From 02b95807e410c2700e26ccdded8d65a7b15bb0a3 Mon Sep 17 00:00:00 2001 From: "LEGOLAS\\lenz" <lenz@irmb.tu-bs.de> Date: Tue, 6 Nov 2018 17:56:25 +0100 Subject: [PATCH] cleans up the project and deletes not used code, also cleans up the include Paths --- CMakeLists.txt | 75 +- .../Input}/ConfigInput/ConfigInput.cpp | 0 .../Input}/ConfigInput/ConfigInput.h | 0 .../Input/ConfigInput}/package.include | 0 .../utilities/input => Core/Input}/Input.cpp | 0 .../utilities/input => Core/Input}/Input.h | 0 .../Input}/JsonInput/JsonInput.cpp | 0 .../Input}/JsonInput/JsonInput.h | 0 .../Input/JsonInput}/package.include | 0 .../Connectors => Core/Input}/package.include | 0 .../logger => Core/Logger}/Logger.cpp | 0 .../utilities/logger => Core/Logger}/Logger.h | 0 .../Logger}/implementations/LoggerImp.cpp | 0 .../Logger}/implementations/LoggerImp.h | 0 .../Logger}/implementations/LoggerTest.cpp | 0 .../Logger/implementations}/package.include | 0 .../FETOL => Core/Logger}/package.include | 0 .../StringUtilities}/StringUtil.cpp | 0 .../StringUtilities}/StringUtil.h | 0 .../StringUtilities}/package.include | 0 .../Core}/buildInfo.h | 2 + src/GridGenerator/geometries/Arrow/Arrow.h | 1 + .../geometries/Arrow/ArrowImp.cpp | 2 - src/GridGenerator/geometries/Arrow/ArrowImp.h | 4 +- .../geometries/Arrow/ArrowMocks.h | 40 - .../geometries/Arrow/ArrowTest.cpp | 4 - .../geometries/BoundingBox/BoundingBox.h | 6 +- .../geometries/Conglomerate/Conglomerate.cu | 2 - .../geometries/Conglomerate/Conglomerate.h | 7 +- .../Conglomerate/ConglomerateTest.cpp | 142 -- src/GridGenerator/geometries/Cuboid/Cuboid.cu | 2 +- src/GridGenerator/geometries/Cuboid/Cuboid.h | 5 +- .../geometries/Cuboid/CuboidTest.cpp | 71 - src/GridGenerator/geometries/ObjectMocks.h | 75 - .../geometries/ObjectPrototypeFactory.h | 64 - src/GridGenerator/geometries/Sphere/Sphere.h | 6 +- .../geometries/Sphere/SphereMocks.h | 58 - .../geometries/Triangle/Triangle.cu | 3 +- .../geometries/Triangle/Triangle.h | 7 +- .../geometries/Triangle/TriangleException.h | 1 + .../geometries/Triangle/TriangleTest.cpp | 190 -- .../TriangularMesh/TriangularMesh.cu | 15 +- .../TriangularMesh/TriangularMesh.h | 11 +- .../TriangularMesh/TriangularMeshStrategy.cpp | 13 +- .../TriangularMesh/TriangularMeshStrategy.h | 4 +- .../TriangularMesh/TriangularMeshTest.cpp | 10 - .../TriangleNeighborFinderTest.cpp | 52 - .../triangleRefinement/TriangleRefinement.h | 6 +- .../TriangleRefinementTest.cpp | 117 - src/GridGenerator/geometries/Vertex/Vertex.cu | 3 +- src/GridGenerator/geometries/Vertex/Vertex.h | 5 +- .../geometries/Vertex/VertexTest.cpp | 154 -- .../VerticalCylinder/VerticalCylinder.h | 6 +- src/GridGenerator/global.h | 11 +- .../BoundaryConditions/BoundaryCondition.cpp | 4 +- .../BoundaryConditions/BoundaryCondition.h | 4 +- .../grid/BoundaryConditions/Side.cpp | 8 +- .../grid/BoundaryConditions/Side.h | 5 +- src/GridGenerator/grid/Cell.h | 3 +- src/GridGenerator/grid/Field.cu | 5 +- src/GridGenerator/grid/Field.h | 2 +- src/GridGenerator/grid/Grid.h | 7 +- .../grid/GridBuilder/GridBuilder.h | 4 +- .../grid/GridBuilder/LevelGridBuilder.cpp | 42 +- .../grid/GridBuilder/LevelGridBuilder.h | 7 +- .../grid/GridBuilder/LevelGridBuilderTest.cpp | 15 - .../grid/GridBuilder/MultipleGridBuilder.cpp | 13 +- .../grid/GridBuilder/MultipleGridBuilder.h | 9 +- .../GridBuilder/MultipleGridBuilderTest.cpp | 120 - .../grid/GridBuilder/ParallelGridBuilder.cpp | 541 ----- .../grid/GridBuilder/ParallelGridBuilder.h | 100 - src/GridGenerator/grid/GridFactory.cpp | 23 - src/GridGenerator/grid/GridFactory.h | 37 +- src/GridGenerator/grid/GridImp.cu | 32 +- src/GridGenerator/grid/GridImp.h | 12 +- src/GridGenerator/grid/GridInterface.cu | 9 +- src/GridGenerator/grid/GridInterface.h | 6 +- src/GridGenerator/grid/GridInterfaceTest.cpp | 5 - src/GridGenerator/grid/GridMocks.h | 190 -- .../GridCpuStrategy/GridCpuStrategy.cpp | 12 +- .../GridCpuStrategy/GridCpuStrategy.h | 7 +- .../GridCpuStrategy/GridCpuStrategyTest.cpp | 328 --- .../GridGpuStrategy/GridGpuStrategy.cpp | 22 +- .../GridGpuStrategy/GridGpuStrategy.h | 3 +- .../GridGpuStrategy/GridGpuStrategyTest.cpp | 367 --- .../grid/GridStrategy/GridStrategy.h | 7 +- .../grid/GridStrategy/GridStrategyMocks.h | 49 - src/GridGenerator/grid/GridTest.cpp | 274 --- .../grid/distributions/Distribution.cpp | 15 +- .../grid/distributions/Distribution.h | 4 +- .../grid/kernel/runGridKernelGPU.cu | 11 +- .../io/GridVTKWriter/GridVTKWriter.cpp | 12 +- .../io/GridVTKWriter/GridVTKWriter.h | 3 +- src/GridGenerator/io/QLineWriter.cpp | 11 +- src/GridGenerator/io/QLineWriter.h | 2 +- .../io/STLReaderWriter/STLReader.cpp | 8 +- .../io/STLReaderWriter/STLReader.h | 4 +- .../io/STLReaderWriter/STLWriter.cpp | 8 +- .../io/STLReaderWriter/STLWriter.h | 4 +- .../SimulationFileNames.h | 2 +- .../SimulationFileTest.cpp | 153 -- .../SimulationFileWriter.cpp | 20 +- .../SimulationFileWriter.h | 7 +- .../utilities/cuda/LaunchParameter.cu | 2 - .../utilities/cuda/LaunchParameter.cuh | 10 +- .../utilities/cuda/LaunchParameterTest.cpp | 57 - .../utilities/cuda/cudaDefines.h | 2 +- .../utilities/cuda/cudaKernelCall.h | 8 +- src/GridGenerator/utilities/math/Math.h | 8 +- src/GridGenerator/utilities/math/MathTest.cpp | 107 - .../transformator/ArrowTransformator.cpp | 3 +- .../transformator/ArrowTransformator.h | 2 +- .../utilities/transformator/Transformator.cpp | 2 +- .../utilities/transformator/Transformator.h | 2 +- .../transformator/TransformatorImp.cpp | 12 +- .../transformator/TransformatorImp.h | 10 +- .../transformator/TransformatorMocks.h | 50 - .../transformator/TransformatorTest.cpp | 195 -- .../BoundaryConditions/BCAdapter.h | 100 - .../BoundaryConditions/BCAlgorithm.cpp | 70 - .../BoundaryConditions/BCAlgorithm.h | 69 - .../BoundaryConditions/BCArray3D.cpp | 203 -- .../BoundaryConditions/BCArray3D.h | 206 -- .../BoundaryConditions/BCArray3DTest.cpp | 25 - .../BoundaryConditions/BCFunction.cpp | 5 - .../BoundaryConditions/BCFunction.h | 117 - .../BoundaryConditions/BCProcessor.cpp | 69 - .../BoundaryConditions/BCProcessor.h | 46 - .../BoundaryConditions/BoundaryConditions.cpp | 4 - .../BoundaryConditions/BoundaryConditions.h | 306 --- .../BoundaryConditions/CMakePackage.txt | 2 - .../BoundaryConditions/DensityBCAdapter.cpp | 157 -- .../BoundaryConditions/DensityBCAdapter.h | 81 - .../EqDensityBCAlgorithm.cpp | 60 - .../BoundaryConditions/EqDensityBCAlgorithm.h | 27 - .../HighViscosityNoSlipBCAlgorithm.cpp | 47 - .../HighViscosityNoSlipBCAlgorithm.h | 29 - .../BoundaryConditions/NoSlipBCAdapter.cpp | 1 - .../BoundaryConditions/NoSlipBCAdapter.h | 52 - .../BoundaryConditions/NoSlipBCAlgorithm.cpp | 47 - .../BoundaryConditions/NoSlipBCAlgorithm.h | 27 - .../NonEqDensityBCAlgorithm.cpp | 61 - .../NonEqDensityBCAlgorithm.h | 27 - .../NonReflectingOutflowBCAlgorithm.cpp | 188 -- .../NonReflectingOutflowBCAlgorithm.h | 28 - .../BoundaryConditions/SlipBCAdapter.cpp | 35 - .../BoundaryConditions/SlipBCAdapter.h | 94 - .../BoundaryConditions/SlipBCAlgorithm.cpp | 88 - .../BoundaryConditions/SlipBCAlgorithm.h | 27 - .../ThinWallBCProcessor.cpp | 43 - .../BoundaryConditions/ThinWallBCProcessor.h | 33 - .../ThinWallNoSlipBCAlgorithm.cpp | 66 - .../ThinWallNoSlipBCAlgorithm.h | 34 - .../BoundaryConditions/VelocityBCAdapter.cpp | 306 --- .../BoundaryConditions/VelocityBCAdapter.h | 156 -- .../VelocityBCAlgorithm.cpp | 50 - .../BoundaryConditions/VelocityBCAlgorithm.h | 30 - .../VelocityWithDensityBCAlgorithm.cpp | 84 - .../VelocityWithDensityBCAlgorithm.h | 33 - .../CoProcessors/AdjustForcingCoProcessor.cpp | 173 -- .../CoProcessors/AdjustForcingCoProcessor.h | 61 - .../CoProcessors/AverageValuesCoProcessor.cpp | 573 ----- .../CoProcessors/AverageValuesCoProcessor.h | 97 - .../CoProcessors/CMakePackage.txt | 2 - .../CalculateForcesCoProcessor.cpp | 112 - .../CoProcessors/CalculateForcesCoProcessor.h | 65 - .../CoProcessors/CoProcessor.cpp | 31 - src/VirtualFluids/CoProcessors/CoProcessor.h | 45 - .../DecreaseViscosityCoProcessor.cpp | 83 - .../DecreaseViscosityCoProcessor.h | 51 - .../CoProcessors/EmergencyExitCoProcessor.cpp | 75 - .../CoProcessors/EmergencyExitCoProcessor.h | 46 - .../CoProcessors/ForceCalculator.cpp | 138 -- .../CoProcessors/ForceCalculator.h | 44 - .../InSituCatalystCoProcessor.cpp | 349 --- .../CoProcessors/InSituCatalystCoProcessor.h | 54 - .../CoProcessors/InSituVTKCoProcessor.cpp | 294 --- .../CoProcessors/InSituVTKCoProcessor.h | 52 - .../CoProcessors/IntegrateValuesHelper.cpp | 559 ----- .../CoProcessors/IntegrateValuesHelper.h | 123 - .../LineTimeSeriesCoProcessor.cpp | 247 -- .../CoProcessors/LineTimeSeriesCoProcessor.h | 58 - .../MPIIORestart11CoProcessor.cpp | 1414 ------------ .../CoProcessors/MPIIORestart11CoProcessor.h | 196 -- .../CoProcessors/MPIIORestart1CoProcessor.cpp | 1381 ----------- .../CoProcessors/MPIIORestart1CoProcessor.h | 189 -- .../MPIIORestart21CoProcessor.cpp | 1231 ---------- .../CoProcessors/MPIIORestart21CoProcessor.h | 188 -- .../CoProcessors/MPIIORestart2CoProcessor.cpp | 1285 ----------- .../CoProcessors/MPIIORestart2CoProcessor.h | 181 -- .../CoProcessors/NUPSCounterCoProcessor.cpp | 77 - .../CoProcessors/NUPSCounterCoProcessor.h | 42 - .../PressureCoefficientCoProcessor.cpp | 223 -- .../PressureCoefficientCoProcessor.h | 55 - .../PressureDifferenceCoProcessor.cpp | 102 - .../PressureDifferenceCoProcessor.h | 44 - .../CoProcessors/QCriterionCoProcessor.cpp | 389 ---- .../CoProcessors/QCriterionCoProcessor.h | 69 - .../CoProcessors/RestartCoProcessor.cpp | 380 --- .../CoProcessors/RestartCoProcessor.h | 63 - .../CoProcessors/ShearStressCoProcessor.cpp | 701 ------ .../CoProcessors/ShearStressCoProcessor.h | 87 - .../TimeAveragedValuesCoProcessor.cpp | 757 ------ .../TimeAveragedValuesCoProcessor.h | 142 -- .../TimeDependentBCCoProcessor.cpp | 31 - .../CoProcessors/TimeDependentBCCoProcessor.h | 34 - .../CoProcessors/TimeseriesCoProcessor.cpp | 87 - .../CoProcessors/TimeseriesCoProcessor.h | 51 - .../TurbulenceIntensityCoProcessor.cpp | 268 --- .../TurbulenceIntensityCoProcessor.h | 45 - .../CoProcessors/WriteBlocksCoProcessor.cpp | 153 -- .../CoProcessors/WriteBlocksCoProcessor.h | 41 - .../WriteBoundaryConditionsCoProcessor.cpp | 241 -- .../WriteBoundaryConditionsCoProcessor.h | 66 - .../WriteMacroscopicQuantitiesCoProcessor.cpp | 258 --- .../WriteMacroscopicQuantitiesCoProcessor.h | 73 - .../CoProcessors/WriteObjectsCoProcessor.cpp | 52 - .../CoProcessors/WriteObjectsCoProcessor.h | 45 - .../Connectors/Block3DConnector.h | 101 - .../Connectors/Block3DConnectorFactory.cpp | 50 - .../Connectors/Block3DConnectorFactory.h | 41 - src/VirtualFluids/Connectors/CMakePackage.txt | 2 - .../CoarseToFineBlock3DConnector.cpp | 135 -- .../Connectors/CoarseToFineBlock3DConnector.h | 105 - .../CoarseToFineNodeSetBlock3DConnector.cpp | 1384 ----------- .../CoarseToFineNodeSetBlock3DConnector.h | 103 - .../Connectors/ConnectorFactory.h | 40 - .../D3Q27ETCFOffVectorConnector.cpp | 1 - .../Connectors/D3Q27ETCFOffVectorConnector.h | 1940 ---------------- .../D3Q27ETFCOffVectorConnector.cpp | 3 - .../Connectors/D3Q27ETFCOffVectorConnector.h | 1437 ------------ .../Connectors/D3Q27ETFullDirectConnector.cpp | 210 -- .../Connectors/D3Q27ETFullDirectConnector.h | 83 - .../Connectors/D3Q27ETFullVectorConnector.cpp | 468 ---- .../Connectors/D3Q27ETFullVectorConnector.h | 118 - .../Connectors/D3Q27ETOffConnectorFactory.cpp | 38 - .../Connectors/D3Q27ETOffConnectorFactory.h | 34 - .../FineToCoarseBlock3DConnector.cpp | 77 - .../Connectors/FineToCoarseBlock3DConnector.h | 95 - .../FineToCoarseNodeSetBlock3DConnector.cpp | 1235 ---------- .../FineToCoarseNodeSetBlock3DConnector.h | 78 - .../Connectors/LocalBlock3DConnector.h | 59 - .../Connectors/RemoteBlock3DConnector.cpp | 64 - .../Connectors/RemoteBlock3DConnector.h | 72 - .../Connectors/TransmitterType.h | 16 - src/VirtualFluids/Data/CMakePackage.txt | 2 - src/VirtualFluids/Data/D3Q27EsoTwist3DSoA.cpp | 594 ----- src/VirtualFluids/Data/D3Q27EsoTwist3DSoA.h | 91 - .../Data/D3Q27EsoTwist3DSplittedVector.cpp | 653 ------ .../Data/D3Q27EsoTwist3DSplittedVector.h | 86 - .../Data/D3Q27EsoTwist3DSplittedVectorEx.cpp | 13 - .../Data/D3Q27EsoTwist3DSplittedVectorEx.h | 15 - src/VirtualFluids/Data/DataSet3D.h | 155 -- src/VirtualFluids/Data/DistributionArray3D.h | 37 - src/VirtualFluids/Data/EsoTwist3D.h | 61 - .../Data/EsoTwistD3Q27SparseData.cpp | 628 ----- .../Data/EsoTwistD3Q27SparseData.h | 105 - .../Data/EsoTwistD3Q27System.cpp | 92 - src/VirtualFluids/Data/EsoTwistD3Q27System.h | 108 - src/VirtualFluids/Data/SparseMatrix3D.cpp | 39 - src/VirtualFluids/Data/SparseMatrix3D.h | 29 - src/VirtualFluids/Data/SparseMatrix4D.cpp | 42 - src/VirtualFluids/Data/SparseMatrix4D.h | 27 - src/VirtualFluids/Data/VoidData3D.h | 46 - src/VirtualFluids/FETOL/CMakePackage.txt | 2 - src/VirtualFluids/FETOL/FETOLCalculator.cpp | 384 ---- src/VirtualFluids/FETOL/FETOLCalculator.h | 39 - src/VirtualFluids/FETOL/FETOLCommunicator.cpp | 260 --- src/VirtualFluids/FETOL/FETOLCommunicator.h | 56 - .../FETOL/FETOLSetConnectorsBlockVisitor.cpp | 289 --- .../FETOL/FETOLSetConnectorsBlockVisitor.h | 41 - .../FETOL/FETOLTransmitterBondPool.h | 510 ----- src/VirtualFluids/Geometry/VoxelMatrix.h | 57 - src/VirtualFluids/Grid/Block3D.cpp | 494 ---- src/VirtualFluids/Grid/Block3D.h | 160 -- .../BoostSerializationClassExportHelper.h | 79 - src/VirtualFluids/Grid/CMakePackage.txt | 2 - src/VirtualFluids/Grid/CalculationManager.cpp | 156 -- src/VirtualFluids/Grid/CalculationManager.h | 51 - src/VirtualFluids/Grid/Calculator.cpp | 613 ----- src/VirtualFluids/Grid/Calculator.h | 93 - src/VirtualFluids/Grid/CalculatorFactory.h | 33 - .../Grid/ConcreteCalculatorFactory.h | 55 - src/VirtualFluids/Grid/Grid3D.cpp | 2027 ----------------- src/VirtualFluids/Grid/Grid3D.h | 283 --- src/VirtualFluids/Grid/Grid3DSystem.cpp | 48 - src/VirtualFluids/Grid/Grid3DSystem.h | 158 -- src/VirtualFluids/Grid/Grid3DTest.cpp | 30 - src/VirtualFluids/Grid/MPICalculator.cpp | 372 --- src/VirtualFluids/Grid/MPICalculator.h | 49 - .../Grid/PrePostBcCalculator.cpp | 197 -- src/VirtualFluids/Grid/PrePostBcCalculator.h | 33 - src/VirtualFluids/Grid/package.include | 0 .../Interactors/CMakePackage.txt | 2 - .../Interactors/D3Q27Interactor.cpp | 782 ------- .../Interactors/D3Q27Interactor.h | 106 - .../D3Q27TriFaceMeshInteractor.cpp | 1837 --------------- .../Interactors/D3Q27TriFaceMeshInteractor.h | 118 - .../Interactors/Interactor3D.cpp | 288 --- src/VirtualFluids/Interactors/Interactor3D.h | 119 - .../Interactors/InteractorsHelper.cpp | 85 - .../Interactors/InteractorsHelper.h | 38 - src/VirtualFluids/Interactors/package.include | 0 .../LBM/CompressibleCumulant2LBMKernel.cpp | 1083 --------- .../LBM/CompressibleCumulant2LBMKernel.h | 72 - .../LBM/CompressibleCumulantLBMKernel.cpp | 1057 --------- .../LBM/CompressibleCumulantLBMKernel.h | 72 - ...mpressibleOffsetInterpolationProcessor.cpp | 722 ------ ...CompressibleOffsetInterpolationProcessor.h | 77 - ...bleOffsetMomentsInterpolationProcessor.cpp | 1278 ----------- ...sibleOffsetMomentsInterpolationProcessor.h | 82 - src/VirtualFluids/LBM/D3Q27System.cpp | 195 -- src/VirtualFluids/LBM/D3Q27System.h | 745 ------ src/VirtualFluids/LBM/D3Q27SystemTest.cpp | 14 - src/VirtualFluids/LBM/ICell.h | 33 - src/VirtualFluids/LBM/ILBMKernel.h | 34 - .../LBM/IncompressibleCumulantLBMKernel.cpp | 919 -------- .../LBM/IncompressibleCumulantLBMKernel.h | 69 - ...ssibleCumulantWithSpongeLayerLBMKernel.cpp | 1021 --------- ...ressibleCumulantWithSpongeLayerLBMKernel.h | 67 - ...mpressibleOffsetInterpolationProcessor.cpp | 794 ------- ...compressibleOffsetInterpolationProcessor.h | 77 - .../LBM/InitDensityLBMKernel.cpp | 1080 --------- src/VirtualFluids/LBM/InitDensityLBMKernel.h | 33 - src/VirtualFluids/LBM/InterpolationHelper.cpp | 39 - src/VirtualFluids/LBM/InterpolationHelper.h | 25 - .../LBM/InterpolationProcessor.cpp | 314 --- .../LBM/InterpolationProcessor.h | 70 - src/VirtualFluids/LBM/LBMKernel.cpp | 215 -- src/VirtualFluids/LBM/LBMKernel.h | 126 - src/VirtualFluids/LBM/LBMKernelTest.cpp | 12 - src/VirtualFluids/LBM/LBMSystem.cpp | 6 - src/VirtualFluids/LBM/LBMSystem.h | 83 - src/VirtualFluids/LBM/LBMSystems.h | 372 --- src/VirtualFluids/LBM/LBMUnitConverter.h | 215 -- src/VirtualFluids/LBM/VoidLBMKernel.cpp | 49 - src/VirtualFluids/LBM/VoidLBMKernel.h | 28 - src/VirtualFluids/LBM/package.include | 0 .../Parallel/BlocksDistributor.cpp | 7 - .../Parallel/BlocksDistributor.h | 26 - src/VirtualFluids/Parallel/CMakePackage.txt | 2 - src/VirtualFluids/Parallel/Communicator.cpp | 12 - src/VirtualFluids/Parallel/Communicator.h | 58 - src/VirtualFluids/Parallel/LoadBalancer.cpp | 507 ----- src/VirtualFluids/Parallel/LoadBalancer.h | 104 - .../Parallel/MPICommunicator.cpp | 227 -- src/VirtualFluids/Parallel/MPICommunicator.h | 183 -- .../Parallel/MetisPartitioner.cpp | 71 - src/VirtualFluids/Parallel/MetisPartitioner.h | 61 - .../Parallel/NullCommunicator.cpp | 74 - src/VirtualFluids/Parallel/NullCommunicator.h | 33 - .../Parallel/PriorityQueueDecompositor.cpp | 2 - .../Parallel/PriorityQueueDecompositor.h | 68 - .../Parallel/SimpleGeometricPartitioner.h | 97 - src/VirtualFluids/Parallel/Synchronizer.h | 67 - .../Parallel/ZoltanPartitioner.cpp | 203 -- .../Parallel/ZoltanPartitioner.h | 74 - src/VirtualFluids/Parallel/package.include | 0 src/VirtualFluids/Utilities/CMakePackage.txt | 2 - .../Utilities/ChangeRandomQs.hpp | 51 - .../Utilities/ConfigFileReader.cpp | 195 -- .../Utilities/ConfigFileReader.h | 31 - .../Utilities/ConfigurationFile.hpp | 258 --- src/VirtualFluids/Utilities/MathUtil.hpp | 97 - src/VirtualFluids/Utilities/MemoryUtil.h | 121 - src/VirtualFluids/Utilities/StringUtil.hpp | 305 --- .../Utilities/VoxelMatrixUtil.hpp | 50 - src/VirtualFluids/Utilities/package.include | 0 src/VirtualFluids/VirtualFluids.h | 310 --- src/VirtualFluids/Visitors/Block3DVisitor.h | 59 - .../BoundaryConditionsBlockVisitor.cpp | 98 - .../Visitors/BoundaryConditionsBlockVisitor.h | 27 - src/VirtualFluids/Visitors/CMakePackage.txt | 2 - .../ChangeBoundaryDensityBlockVisitor.cpp | 62 - .../ChangeBoundaryDensityBlockVisitor.h | 24 - .../Visitors/CheckRatioBlockVisitor.cpp | 75 - .../Visitors/CheckRatioBlockVisitor.h | 33 - ...rsenCrossAndInsideGbObjectBlockVisitor.cpp | 41 - ...oarsenCrossAndInsideGbObjectBlockVisitor.h | 33 - .../Visitors/ConnectorBlockVisitor.cpp | 472 ---- .../Visitors/ConnectorBlockVisitor.h | 41 - .../Visitors/CreateTransmittersHelper.cpp | 161 -- .../Visitors/CreateTransmittersHelper.h | 38 - .../Visitors/GenBlocksGridVisitor.cpp | 70 - .../Visitors/GenBlocksGridVisitor.h | 28 - src/VirtualFluids/Visitors/Grid3DVisitor.h | 20 - .../InitDistributionsBlockVisitor.cpp | 316 --- .../Visitors/InitDistributionsBlockVisitor.h | 86 - .../InitDistributionsFromFileBlockVisitor.cpp | 258 --- .../InitDistributionsFromFileBlockVisitor.h | 28 - ...tributionsWithInterpolationGridVisitor.cpp | 610 ----- ...istributionsWithInterpolationGridVisitor.h | 34 - .../Visitors/MetisPartitioningGridVisitor.cpp | 305 --- .../Visitors/MetisPartitioningGridVisitor.h | 70 - .../Visitors/OverlapBlockVisitor.cpp | 60 - .../Visitors/OverlapBlockVisitor.h | 31 - .../PQueuePartitioningGridVisitor.cpp | 54 - .../Visitors/PQueuePartitioningGridVisitor.h | 27 - .../Visitors/RatioBlockVisitor.cpp | 129 -- .../Visitors/RatioBlockVisitor.h | 49 - .../Visitors/RatioSmoothBlockVisitor.cpp | 145 -- .../Visitors/RatioSmoothBlockVisitor.h | 49 - .../Visitors/RefineAroundGbObjectHelper.cpp | 55 - .../Visitors/RefineAroundGbObjectHelper.h | 34 - ...fineCrossAndInsideGbObjectBlockVisitor.cpp | 43 - ...RefineCrossAndInsideGbObjectBlockVisitor.h | 33 - .../RefineCrossAndInsideGbObjectHelper.cpp | 78 - .../RefineCrossAndInsideGbObjectHelper.h | 36 - .../Visitors/RefineInterGbObjectsVisitor.cpp | 68 - .../Visitors/RefineInterGbObjectsVisitor.h | 27 - .../Visitors/RenumberBlockVisitor.cpp | 22 - .../Visitors/RenumberBlockVisitor.h | 32 - .../Visitors/SetConnectorsBlockVisitor.cpp | 486 ---- .../Visitors/SetConnectorsBlockVisitor.h | 42 - .../Visitors/SetForcingBlockVisitor.cpp | 70 - .../Visitors/SetForcingBlockVisitor.h | 39 - .../SetInterpolationDirsBlockVisitor.cpp | 162 -- .../SetInterpolationDirsBlockVisitor.h | 27 - .../Visitors/SetKernelBlockVisitor.cpp | 90 - .../Visitors/SetKernelBlockVisitor.h | 36 - .../Visitors/SetSolidBlockVisitor.cpp | 33 - .../Visitors/SetSolidBlockVisitor.h | 30 - .../Visitors/SetSpongeLayerBlockVisitor.cpp | 31 - .../Visitors/SetSpongeLayerBlockVisitor.h | 28 - .../SetUndefinedNodesBlockVisitor.cpp | 678 ------ .../Visitors/SetUndefinedNodesBlockVisitor.h | 24 - .../Visitors/SpongeLayerBlockVisitor.cpp | 44 - .../Visitors/SpongeLayerBlockVisitor.h | 25 - .../Visitors/ViscosityBlockVisitor.cpp | 22 - .../Visitors/ViscosityBlockVisitor.h | 25 - .../ZoltanPartitioningGridVisitor.cpp | 144 -- .../Visitors/ZoltanPartitioningGridVisitor.h | 38 - src/VirtualFluids/Visitors/package.include | 0 src/VirtualFluids/package.include | 0 .../basics/writer/WbWriterVtkXmlBinary.cpp | 2 +- .../utilities/StringUtil/StringUtilTest.cpp | 116 - .../utilities/StringUtil/package.include | 0 .../input/ConfigInput/ConfigInputTest.cpp | 144 -- .../input/ConfigInput/package.include | 0 .../input/JsonInput/JsonInputTest.cpp | 117 - .../utilities/input/JsonInput/package.include | 0 .../utilities/input/package.include | 0 .../logger/implementations/package.include | 0 .../utilities/logger/package.include | 0 .../Calculation/ForceCalculations.cpp | 2 +- .../Calculation/ForceCalculations.h | 2 +- .../GridReaderGenerator/GridGenerator.h | 2 +- src/VirtualFluids_GPU/Init/InitLattice.h | 2 +- .../Input/PositionReader.cpp | 2 +- .../Input/VtkGeometryReader.cpp | 2 +- src/VirtualFluids_GPU/Input/kFullReader.cpp | 2 +- src/VirtualFluids_GPU/LBM/LB.h | 2 +- src/VirtualFluids_GPU/LBM/Simulation.h | 4 +- src/VirtualFluids_GPU/Output/FileWriter.cpp | 2 +- src/VirtualFluids_GPU/Parameter/Parameter.h | 2 +- src/core/A.cpp | 7 - src/core/A.h | 24 - src/core/Timer/Timer.cpp | 2 - src/core/Timer/Timer.h | 5 +- src/dem_coupling/DemCalculator.cpp | 84 - src/dem_coupling/DemCalculator.h | 28 - src/dem_coupling/DemCalculatorFactory.h | 45 - src/dem_coupling/DemCoProcessor.cpp | 165 -- src/dem_coupling/DemCoProcessor.h | 68 - src/dem_coupling/MovableObjectInteractor.cpp | 138 -- src/dem_coupling/MovableObjectInteractor.h | 68 - src/dem_coupling/dem_coupling_EXPORT.h | 42 - src/dem_coupling/package.include | 0 .../PhysicsEngineGeometryAdapter.h | 45 - .../PhysicsEngineMaterialAdapter.h | 33 - .../PhysicsEngineSolverAdapter.h | 29 - .../DummyPhysicsEngineGeometryAdapter.cpp | 79 - .../dummy/DummyPhysicsEngineGeometryAdapter.h | 45 - .../DummyPhysicsEngineMaterialAdapter.cpp | 1 - .../dummy/DummyPhysicsEngineMaterialAdapter.h | 23 - .../dummy/DummyPhysicsEngineSolverAdapter.cpp | 13 - .../dummy/DummyPhysicsEngineSolverAdapter.h | 28 - .../dummy/package.include | 0 .../physicsEngineAdapter/package.include | 0 .../physicsEngineAdapter/pe/PeAdapter.h | 28 - .../physicsEngineAdapter/pe/PeAdapterTest.cpp | 28 - .../pe/PePhysicsEngineGeometryAdapter.cpp | 103 - .../pe/PePhysicsEngineGeometryAdapter.h | 56 - .../pe/PePhysicsEngineMaterialAdapter.cpp | 10 - .../pe/PePhysicsEngineMaterialAdapter.h | 26 - .../pe/PePhysicsEngineSolverAdapter.cpp | 123 - .../pe/PePhysicsEngineSolverAdapter.h | 93 - .../physicsEngineAdapter/pe/package.include | 0 .../EquilibriumReconstructor.cpp | 56 - .../reconstructor/EquilibriumReconstructor.h | 30 - .../ExtrapolationReconstructor.cpp | 120 - .../ExtrapolationReconstructor.h | 43 - .../reconstructor/Reconstructor.h | 27 - .../reconstructor/VelocityBcReconstructor.cpp | 102 - .../reconstructor/VelocityBcReconstructor.h | 28 - .../reconstructor/package.include | 0 targets/apps/HULC/main.cpp | 84 +- .../libs/GridGenerator/3rdPartyLinking.cmake | 4 +- targets/libs/GridGenerator/CMakeLists.txt | 7 +- .../libs/VirtualFluids/3rdPartyLinking.cmake | 8 - targets/libs/VirtualFluids/CMakeLists.txt | 18 - targets/libs/VirtualFluids/CMakePackage.cmake | 8 - targets/libs/VirtualFluids/includes.cmake | 24 - .../libs/VirtualFluidsBasics/CMakeLists.txt | 8 +- .../libs/VirtualFluidsBasics/buildInfo.cmake | 16 - .../buildInfoInput/buildInfo.in.cpp | 12 - .../libs/VirtualFluidsBasics/package.include | 0 targets/libs/VirtualFluids_GPU/CMakeLists.txt | 10 +- targets/libs/core/3rdPartyLinking.cmake | 6 + targets/libs/core/CMakeLists.txt | 2 + targets/libs/core/buildInfo.cmake | 7 +- targets/libs/core/buildInfo.h | 25 - .../libs/core/buildInfoInput/buildInfo.in.cpp | 16 +- .../libs/dem_coupling/3rdPartyLinking.cmake | 8 - targets/libs/dem_coupling/CMakeLists.txt | 15 - targets/libs/dem_coupling/CMakePackage.cmake | 8 - .../GridGeneratorTest/3rdPartyLinking.cmake | 8 - .../tests/GridGeneratorTest/CMakeLists.txt | 14 - .../GridGeneratorTest/CMakePackage.cmake | 8 - targets/tests/GridGeneratorTest/main.cpp | 20 - .../tests/GridGeneratorTest/package.include | 0 .../3rdPartyLinking.cmake | 2 - .../VirtualFluidsBasicsTest/CMakeLists.txt | 14 - .../CMakePackage.cmake | 8 - .../tests/VirtualFluidsBasicsTest/main.cpp | 7 - .../VirtualFluidsBasicsTest/package.include | 0 .../VirtualFluidsTest/3rdPartyLinking.cmake | 4 - .../tests/VirtualFluidsTest/CMakeLists.txt | 14 - .../VirtualFluidsTest/CMakePackage.cmake | 8 - targets/tests/VirtualFluidsTest/main.cpp | 7 - .../tests/VirtualFluidsTest/package.include | 0 .../3rdPartyLinking.cmake | 6 - .../VirtualFluids_GPUTest/CMakeLists.txt | 14 - .../VirtualFluids_GPUTest/CMakePackage.cmake | 8 - targets/tests/VirtualFluids_GPUTest/main.cpp | 15 - .../VirtualFluids_GPUTest/package.include | 0 targets/tests/coreTest/3rdPartyLinking.cmake | 2 - targets/tests/coreTest/CMakeLists.txt | 14 - targets/tests/coreTest/CMakePackage.cmake | 8 - targets/tests/coreTest/main.cpp | 7 - targets/tests/coreTest/package.include | 0 541 files changed, 337 insertions(+), 64840 deletions(-) rename src/{VirtualFluidsBasics/utilities/input => Core/Input}/ConfigInput/ConfigInput.cpp (100%) rename src/{VirtualFluidsBasics/utilities/input => Core/Input}/ConfigInput/ConfigInput.h (100%) rename src/{VirtualFluids/BoundaryConditions => Core/Input/ConfigInput}/package.include (100%) rename src/{VirtualFluidsBasics/utilities/input => Core/Input}/Input.cpp (100%) rename src/{VirtualFluidsBasics/utilities/input => Core/Input}/Input.h (100%) rename src/{VirtualFluidsBasics/utilities/input => Core/Input}/JsonInput/JsonInput.cpp (100%) rename src/{VirtualFluidsBasics/utilities/input => Core/Input}/JsonInput/JsonInput.h (100%) rename src/{VirtualFluids/CoProcessors => Core/Input/JsonInput}/package.include (100%) rename src/{VirtualFluids/Connectors => Core/Input}/package.include (100%) rename src/{VirtualFluidsBasics/utilities/logger => Core/Logger}/Logger.cpp (100%) rename src/{VirtualFluidsBasics/utilities/logger => Core/Logger}/Logger.h (100%) rename src/{VirtualFluidsBasics/utilities/logger => Core/Logger}/implementations/LoggerImp.cpp (100%) rename src/{VirtualFluidsBasics/utilities/logger => Core/Logger}/implementations/LoggerImp.h (100%) rename src/{VirtualFluidsBasics/utilities/logger => Core/Logger}/implementations/LoggerTest.cpp (100%) rename src/{VirtualFluids/Data => Core/Logger/implementations}/package.include (100%) rename src/{VirtualFluids/FETOL => Core/Logger}/package.include (100%) rename src/{VirtualFluidsBasics/utilities/StringUtil => Core/StringUtilities}/StringUtil.cpp (100%) rename src/{VirtualFluidsBasics/utilities/StringUtil => Core/StringUtilities}/StringUtil.h (100%) rename src/{VirtualFluids/Geometry => Core/StringUtilities}/package.include (100%) rename {targets/libs/VirtualFluidsBasics => src/Core}/buildInfo.h (94%) delete mode 100644 src/GridGenerator/geometries/Arrow/ArrowMocks.h delete mode 100644 src/GridGenerator/geometries/Arrow/ArrowTest.cpp delete mode 100644 src/GridGenerator/geometries/Conglomerate/ConglomerateTest.cpp delete mode 100644 src/GridGenerator/geometries/Cuboid/CuboidTest.cpp delete mode 100644 src/GridGenerator/geometries/ObjectMocks.h delete mode 100644 src/GridGenerator/geometries/ObjectPrototypeFactory.h delete mode 100644 src/GridGenerator/geometries/Sphere/SphereMocks.h delete mode 100644 src/GridGenerator/geometries/Triangle/TriangleTest.cpp delete mode 100644 src/GridGenerator/geometries/TriangularMesh/TriangularMeshTest.cpp delete mode 100644 src/GridGenerator/geometries/TriangularMesh/triangleNeighborFinder/TriangleNeighborFinderTest.cpp delete mode 100644 src/GridGenerator/geometries/TriangularMesh/triangleRefinement/TriangleRefinementTest.cpp delete mode 100644 src/GridGenerator/geometries/Vertex/VertexTest.cpp delete mode 100644 src/GridGenerator/grid/GridBuilder/LevelGridBuilderTest.cpp delete mode 100644 src/GridGenerator/grid/GridBuilder/MultipleGridBuilderTest.cpp delete mode 100644 src/GridGenerator/grid/GridBuilder/ParallelGridBuilder.cpp delete mode 100644 src/GridGenerator/grid/GridBuilder/ParallelGridBuilder.h delete mode 100644 src/GridGenerator/grid/GridInterfaceTest.cpp delete mode 100644 src/GridGenerator/grid/GridMocks.h delete mode 100644 src/GridGenerator/grid/GridStrategy/GridCpuStrategy/GridCpuStrategyTest.cpp delete mode 100644 src/GridGenerator/grid/GridStrategy/GridGpuStrategy/GridGpuStrategyTest.cpp delete mode 100644 src/GridGenerator/grid/GridStrategy/GridStrategyMocks.h delete mode 100644 src/GridGenerator/grid/GridTest.cpp delete mode 100644 src/GridGenerator/io/SimulationFileWriter/SimulationFileTest.cpp delete mode 100644 src/GridGenerator/utilities/cuda/LaunchParameterTest.cpp delete mode 100644 src/GridGenerator/utilities/math/MathTest.cpp delete mode 100644 src/GridGenerator/utilities/transformator/TransformatorMocks.h delete mode 100644 src/GridGenerator/utilities/transformator/TransformatorTest.cpp delete mode 100644 src/VirtualFluids/BoundaryConditions/BCAdapter.h delete mode 100644 src/VirtualFluids/BoundaryConditions/BCAlgorithm.cpp delete mode 100644 src/VirtualFluids/BoundaryConditions/BCAlgorithm.h delete mode 100644 src/VirtualFluids/BoundaryConditions/BCArray3D.cpp delete mode 100644 src/VirtualFluids/BoundaryConditions/BCArray3D.h delete mode 100644 src/VirtualFluids/BoundaryConditions/BCArray3DTest.cpp delete mode 100644 src/VirtualFluids/BoundaryConditions/BCFunction.cpp delete mode 100644 src/VirtualFluids/BoundaryConditions/BCFunction.h delete mode 100644 src/VirtualFluids/BoundaryConditions/BCProcessor.cpp delete mode 100644 src/VirtualFluids/BoundaryConditions/BCProcessor.h delete mode 100644 src/VirtualFluids/BoundaryConditions/BoundaryConditions.cpp delete mode 100644 src/VirtualFluids/BoundaryConditions/BoundaryConditions.h delete mode 100644 src/VirtualFluids/BoundaryConditions/CMakePackage.txt delete mode 100644 src/VirtualFluids/BoundaryConditions/DensityBCAdapter.cpp delete mode 100644 src/VirtualFluids/BoundaryConditions/DensityBCAdapter.h delete mode 100644 src/VirtualFluids/BoundaryConditions/EqDensityBCAlgorithm.cpp delete mode 100644 src/VirtualFluids/BoundaryConditions/EqDensityBCAlgorithm.h delete mode 100644 src/VirtualFluids/BoundaryConditions/HighViscosityNoSlipBCAlgorithm.cpp delete mode 100644 src/VirtualFluids/BoundaryConditions/HighViscosityNoSlipBCAlgorithm.h delete mode 100644 src/VirtualFluids/BoundaryConditions/NoSlipBCAdapter.cpp delete mode 100644 src/VirtualFluids/BoundaryConditions/NoSlipBCAdapter.h delete mode 100644 src/VirtualFluids/BoundaryConditions/NoSlipBCAlgorithm.cpp delete mode 100644 src/VirtualFluids/BoundaryConditions/NoSlipBCAlgorithm.h delete mode 100644 src/VirtualFluids/BoundaryConditions/NonEqDensityBCAlgorithm.cpp delete mode 100644 src/VirtualFluids/BoundaryConditions/NonEqDensityBCAlgorithm.h delete mode 100644 src/VirtualFluids/BoundaryConditions/NonReflectingOutflowBCAlgorithm.cpp delete mode 100644 src/VirtualFluids/BoundaryConditions/NonReflectingOutflowBCAlgorithm.h delete mode 100644 src/VirtualFluids/BoundaryConditions/SlipBCAdapter.cpp delete mode 100644 src/VirtualFluids/BoundaryConditions/SlipBCAdapter.h delete mode 100644 src/VirtualFluids/BoundaryConditions/SlipBCAlgorithm.cpp delete mode 100644 src/VirtualFluids/BoundaryConditions/SlipBCAlgorithm.h delete mode 100644 src/VirtualFluids/BoundaryConditions/ThinWallBCProcessor.cpp delete mode 100644 src/VirtualFluids/BoundaryConditions/ThinWallBCProcessor.h delete mode 100644 src/VirtualFluids/BoundaryConditions/ThinWallNoSlipBCAlgorithm.cpp delete mode 100644 src/VirtualFluids/BoundaryConditions/ThinWallNoSlipBCAlgorithm.h delete mode 100644 src/VirtualFluids/BoundaryConditions/VelocityBCAdapter.cpp delete mode 100644 src/VirtualFluids/BoundaryConditions/VelocityBCAdapter.h delete mode 100644 src/VirtualFluids/BoundaryConditions/VelocityBCAlgorithm.cpp delete mode 100644 src/VirtualFluids/BoundaryConditions/VelocityBCAlgorithm.h delete mode 100644 src/VirtualFluids/BoundaryConditions/VelocityWithDensityBCAlgorithm.cpp delete mode 100644 src/VirtualFluids/BoundaryConditions/VelocityWithDensityBCAlgorithm.h delete mode 100644 src/VirtualFluids/CoProcessors/AdjustForcingCoProcessor.cpp delete mode 100644 src/VirtualFluids/CoProcessors/AdjustForcingCoProcessor.h delete mode 100644 src/VirtualFluids/CoProcessors/AverageValuesCoProcessor.cpp delete mode 100644 src/VirtualFluids/CoProcessors/AverageValuesCoProcessor.h delete mode 100644 src/VirtualFluids/CoProcessors/CMakePackage.txt delete mode 100644 src/VirtualFluids/CoProcessors/CalculateForcesCoProcessor.cpp delete mode 100644 src/VirtualFluids/CoProcessors/CalculateForcesCoProcessor.h delete mode 100644 src/VirtualFluids/CoProcessors/CoProcessor.cpp delete mode 100644 src/VirtualFluids/CoProcessors/CoProcessor.h delete mode 100644 src/VirtualFluids/CoProcessors/DecreaseViscosityCoProcessor.cpp delete mode 100644 src/VirtualFluids/CoProcessors/DecreaseViscosityCoProcessor.h delete mode 100644 src/VirtualFluids/CoProcessors/EmergencyExitCoProcessor.cpp delete mode 100644 src/VirtualFluids/CoProcessors/EmergencyExitCoProcessor.h delete mode 100644 src/VirtualFluids/CoProcessors/ForceCalculator.cpp delete mode 100644 src/VirtualFluids/CoProcessors/ForceCalculator.h delete mode 100644 src/VirtualFluids/CoProcessors/InSituCatalystCoProcessor.cpp delete mode 100644 src/VirtualFluids/CoProcessors/InSituCatalystCoProcessor.h delete mode 100644 src/VirtualFluids/CoProcessors/InSituVTKCoProcessor.cpp delete mode 100644 src/VirtualFluids/CoProcessors/InSituVTKCoProcessor.h delete mode 100644 src/VirtualFluids/CoProcessors/IntegrateValuesHelper.cpp delete mode 100644 src/VirtualFluids/CoProcessors/IntegrateValuesHelper.h delete mode 100644 src/VirtualFluids/CoProcessors/LineTimeSeriesCoProcessor.cpp delete mode 100644 src/VirtualFluids/CoProcessors/LineTimeSeriesCoProcessor.h delete mode 100644 src/VirtualFluids/CoProcessors/MPIIORestart11CoProcessor.cpp delete mode 100644 src/VirtualFluids/CoProcessors/MPIIORestart11CoProcessor.h delete mode 100644 src/VirtualFluids/CoProcessors/MPIIORestart1CoProcessor.cpp delete mode 100644 src/VirtualFluids/CoProcessors/MPIIORestart1CoProcessor.h delete mode 100644 src/VirtualFluids/CoProcessors/MPIIORestart21CoProcessor.cpp delete mode 100644 src/VirtualFluids/CoProcessors/MPIIORestart21CoProcessor.h delete mode 100644 src/VirtualFluids/CoProcessors/MPIIORestart2CoProcessor.cpp delete mode 100644 src/VirtualFluids/CoProcessors/MPIIORestart2CoProcessor.h delete mode 100644 src/VirtualFluids/CoProcessors/NUPSCounterCoProcessor.cpp delete mode 100644 src/VirtualFluids/CoProcessors/NUPSCounterCoProcessor.h delete mode 100644 src/VirtualFluids/CoProcessors/PressureCoefficientCoProcessor.cpp delete mode 100644 src/VirtualFluids/CoProcessors/PressureCoefficientCoProcessor.h delete mode 100644 src/VirtualFluids/CoProcessors/PressureDifferenceCoProcessor.cpp delete mode 100644 src/VirtualFluids/CoProcessors/PressureDifferenceCoProcessor.h delete mode 100644 src/VirtualFluids/CoProcessors/QCriterionCoProcessor.cpp delete mode 100644 src/VirtualFluids/CoProcessors/QCriterionCoProcessor.h delete mode 100644 src/VirtualFluids/CoProcessors/RestartCoProcessor.cpp delete mode 100644 src/VirtualFluids/CoProcessors/RestartCoProcessor.h delete mode 100644 src/VirtualFluids/CoProcessors/ShearStressCoProcessor.cpp delete mode 100644 src/VirtualFluids/CoProcessors/ShearStressCoProcessor.h delete mode 100644 src/VirtualFluids/CoProcessors/TimeAveragedValuesCoProcessor.cpp delete mode 100644 src/VirtualFluids/CoProcessors/TimeAveragedValuesCoProcessor.h delete mode 100644 src/VirtualFluids/CoProcessors/TimeDependentBCCoProcessor.cpp delete mode 100644 src/VirtualFluids/CoProcessors/TimeDependentBCCoProcessor.h delete mode 100644 src/VirtualFluids/CoProcessors/TimeseriesCoProcessor.cpp delete mode 100644 src/VirtualFluids/CoProcessors/TimeseriesCoProcessor.h delete mode 100644 src/VirtualFluids/CoProcessors/TurbulenceIntensityCoProcessor.cpp delete mode 100644 src/VirtualFluids/CoProcessors/TurbulenceIntensityCoProcessor.h delete mode 100644 src/VirtualFluids/CoProcessors/WriteBlocksCoProcessor.cpp delete mode 100644 src/VirtualFluids/CoProcessors/WriteBlocksCoProcessor.h delete mode 100644 src/VirtualFluids/CoProcessors/WriteBoundaryConditionsCoProcessor.cpp delete mode 100644 src/VirtualFluids/CoProcessors/WriteBoundaryConditionsCoProcessor.h delete mode 100644 src/VirtualFluids/CoProcessors/WriteMacroscopicQuantitiesCoProcessor.cpp delete mode 100644 src/VirtualFluids/CoProcessors/WriteMacroscopicQuantitiesCoProcessor.h delete mode 100644 src/VirtualFluids/CoProcessors/WriteObjectsCoProcessor.cpp delete mode 100644 src/VirtualFluids/CoProcessors/WriteObjectsCoProcessor.h delete mode 100644 src/VirtualFluids/Connectors/Block3DConnector.h delete mode 100644 src/VirtualFluids/Connectors/Block3DConnectorFactory.cpp delete mode 100644 src/VirtualFluids/Connectors/Block3DConnectorFactory.h delete mode 100644 src/VirtualFluids/Connectors/CMakePackage.txt delete mode 100644 src/VirtualFluids/Connectors/CoarseToFineBlock3DConnector.cpp delete mode 100644 src/VirtualFluids/Connectors/CoarseToFineBlock3DConnector.h delete mode 100644 src/VirtualFluids/Connectors/CoarseToFineNodeSetBlock3DConnector.cpp delete mode 100644 src/VirtualFluids/Connectors/CoarseToFineNodeSetBlock3DConnector.h delete mode 100644 src/VirtualFluids/Connectors/ConnectorFactory.h delete mode 100644 src/VirtualFluids/Connectors/D3Q27ETCFOffVectorConnector.cpp delete mode 100644 src/VirtualFluids/Connectors/D3Q27ETCFOffVectorConnector.h delete mode 100644 src/VirtualFluids/Connectors/D3Q27ETFCOffVectorConnector.cpp delete mode 100644 src/VirtualFluids/Connectors/D3Q27ETFCOffVectorConnector.h delete mode 100644 src/VirtualFluids/Connectors/D3Q27ETFullDirectConnector.cpp delete mode 100644 src/VirtualFluids/Connectors/D3Q27ETFullDirectConnector.h delete mode 100644 src/VirtualFluids/Connectors/D3Q27ETFullVectorConnector.cpp delete mode 100644 src/VirtualFluids/Connectors/D3Q27ETFullVectorConnector.h delete mode 100644 src/VirtualFluids/Connectors/D3Q27ETOffConnectorFactory.cpp delete mode 100644 src/VirtualFluids/Connectors/D3Q27ETOffConnectorFactory.h delete mode 100644 src/VirtualFluids/Connectors/FineToCoarseBlock3DConnector.cpp delete mode 100644 src/VirtualFluids/Connectors/FineToCoarseBlock3DConnector.h delete mode 100644 src/VirtualFluids/Connectors/FineToCoarseNodeSetBlock3DConnector.cpp delete mode 100644 src/VirtualFluids/Connectors/FineToCoarseNodeSetBlock3DConnector.h delete mode 100644 src/VirtualFluids/Connectors/LocalBlock3DConnector.h delete mode 100644 src/VirtualFluids/Connectors/RemoteBlock3DConnector.cpp delete mode 100644 src/VirtualFluids/Connectors/RemoteBlock3DConnector.h delete mode 100644 src/VirtualFluids/Connectors/TransmitterType.h delete mode 100644 src/VirtualFluids/Data/CMakePackage.txt delete mode 100644 src/VirtualFluids/Data/D3Q27EsoTwist3DSoA.cpp delete mode 100644 src/VirtualFluids/Data/D3Q27EsoTwist3DSoA.h delete mode 100644 src/VirtualFluids/Data/D3Q27EsoTwist3DSplittedVector.cpp delete mode 100644 src/VirtualFluids/Data/D3Q27EsoTwist3DSplittedVector.h delete mode 100644 src/VirtualFluids/Data/D3Q27EsoTwist3DSplittedVectorEx.cpp delete mode 100644 src/VirtualFluids/Data/D3Q27EsoTwist3DSplittedVectorEx.h delete mode 100644 src/VirtualFluids/Data/DataSet3D.h delete mode 100644 src/VirtualFluids/Data/DistributionArray3D.h delete mode 100644 src/VirtualFluids/Data/EsoTwist3D.h delete mode 100644 src/VirtualFluids/Data/EsoTwistD3Q27SparseData.cpp delete mode 100644 src/VirtualFluids/Data/EsoTwistD3Q27SparseData.h delete mode 100644 src/VirtualFluids/Data/EsoTwistD3Q27System.cpp delete mode 100644 src/VirtualFluids/Data/EsoTwistD3Q27System.h delete mode 100644 src/VirtualFluids/Data/SparseMatrix3D.cpp delete mode 100644 src/VirtualFluids/Data/SparseMatrix3D.h delete mode 100644 src/VirtualFluids/Data/SparseMatrix4D.cpp delete mode 100644 src/VirtualFluids/Data/SparseMatrix4D.h delete mode 100644 src/VirtualFluids/Data/VoidData3D.h delete mode 100644 src/VirtualFluids/FETOL/CMakePackage.txt delete mode 100644 src/VirtualFluids/FETOL/FETOLCalculator.cpp delete mode 100644 src/VirtualFluids/FETOL/FETOLCalculator.h delete mode 100644 src/VirtualFluids/FETOL/FETOLCommunicator.cpp delete mode 100644 src/VirtualFluids/FETOL/FETOLCommunicator.h delete mode 100644 src/VirtualFluids/FETOL/FETOLSetConnectorsBlockVisitor.cpp delete mode 100644 src/VirtualFluids/FETOL/FETOLSetConnectorsBlockVisitor.h delete mode 100644 src/VirtualFluids/FETOL/FETOLTransmitterBondPool.h delete mode 100644 src/VirtualFluids/Geometry/VoxelMatrix.h delete mode 100644 src/VirtualFluids/Grid/Block3D.cpp delete mode 100644 src/VirtualFluids/Grid/Block3D.h delete mode 100644 src/VirtualFluids/Grid/BoostSerializationClassExportHelper.h delete mode 100644 src/VirtualFluids/Grid/CMakePackage.txt delete mode 100644 src/VirtualFluids/Grid/CalculationManager.cpp delete mode 100644 src/VirtualFluids/Grid/CalculationManager.h delete mode 100644 src/VirtualFluids/Grid/Calculator.cpp delete mode 100644 src/VirtualFluids/Grid/Calculator.h delete mode 100644 src/VirtualFluids/Grid/CalculatorFactory.h delete mode 100644 src/VirtualFluids/Grid/ConcreteCalculatorFactory.h delete mode 100644 src/VirtualFluids/Grid/Grid3D.cpp delete mode 100644 src/VirtualFluids/Grid/Grid3D.h delete mode 100644 src/VirtualFluids/Grid/Grid3DSystem.cpp delete mode 100644 src/VirtualFluids/Grid/Grid3DSystem.h delete mode 100644 src/VirtualFluids/Grid/Grid3DTest.cpp delete mode 100644 src/VirtualFluids/Grid/MPICalculator.cpp delete mode 100644 src/VirtualFluids/Grid/MPICalculator.h delete mode 100644 src/VirtualFluids/Grid/PrePostBcCalculator.cpp delete mode 100644 src/VirtualFluids/Grid/PrePostBcCalculator.h delete mode 100644 src/VirtualFluids/Grid/package.include delete mode 100644 src/VirtualFluids/Interactors/CMakePackage.txt delete mode 100644 src/VirtualFluids/Interactors/D3Q27Interactor.cpp delete mode 100644 src/VirtualFluids/Interactors/D3Q27Interactor.h delete mode 100644 src/VirtualFluids/Interactors/D3Q27TriFaceMeshInteractor.cpp delete mode 100644 src/VirtualFluids/Interactors/D3Q27TriFaceMeshInteractor.h delete mode 100644 src/VirtualFluids/Interactors/Interactor3D.cpp delete mode 100644 src/VirtualFluids/Interactors/Interactor3D.h delete mode 100644 src/VirtualFluids/Interactors/InteractorsHelper.cpp delete mode 100644 src/VirtualFluids/Interactors/InteractorsHelper.h delete mode 100644 src/VirtualFluids/Interactors/package.include delete mode 100644 src/VirtualFluids/LBM/CompressibleCumulant2LBMKernel.cpp delete mode 100644 src/VirtualFluids/LBM/CompressibleCumulant2LBMKernel.h delete mode 100644 src/VirtualFluids/LBM/CompressibleCumulantLBMKernel.cpp delete mode 100644 src/VirtualFluids/LBM/CompressibleCumulantLBMKernel.h delete mode 100644 src/VirtualFluids/LBM/CompressibleOffsetInterpolationProcessor.cpp delete mode 100644 src/VirtualFluids/LBM/CompressibleOffsetInterpolationProcessor.h delete mode 100644 src/VirtualFluids/LBM/CompressibleOffsetMomentsInterpolationProcessor.cpp delete mode 100644 src/VirtualFluids/LBM/CompressibleOffsetMomentsInterpolationProcessor.h delete mode 100644 src/VirtualFluids/LBM/D3Q27System.cpp delete mode 100644 src/VirtualFluids/LBM/D3Q27System.h delete mode 100644 src/VirtualFluids/LBM/D3Q27SystemTest.cpp delete mode 100644 src/VirtualFluids/LBM/ICell.h delete mode 100644 src/VirtualFluids/LBM/ILBMKernel.h delete mode 100644 src/VirtualFluids/LBM/IncompressibleCumulantLBMKernel.cpp delete mode 100644 src/VirtualFluids/LBM/IncompressibleCumulantLBMKernel.h delete mode 100644 src/VirtualFluids/LBM/IncompressibleCumulantWithSpongeLayerLBMKernel.cpp delete mode 100644 src/VirtualFluids/LBM/IncompressibleCumulantWithSpongeLayerLBMKernel.h delete mode 100644 src/VirtualFluids/LBM/IncompressibleOffsetInterpolationProcessor.cpp delete mode 100644 src/VirtualFluids/LBM/IncompressibleOffsetInterpolationProcessor.h delete mode 100644 src/VirtualFluids/LBM/InitDensityLBMKernel.cpp delete mode 100644 src/VirtualFluids/LBM/InitDensityLBMKernel.h delete mode 100644 src/VirtualFluids/LBM/InterpolationHelper.cpp delete mode 100644 src/VirtualFluids/LBM/InterpolationHelper.h delete mode 100644 src/VirtualFluids/LBM/InterpolationProcessor.cpp delete mode 100644 src/VirtualFluids/LBM/InterpolationProcessor.h delete mode 100644 src/VirtualFluids/LBM/LBMKernel.cpp delete mode 100644 src/VirtualFluids/LBM/LBMKernel.h delete mode 100644 src/VirtualFluids/LBM/LBMKernelTest.cpp delete mode 100644 src/VirtualFluids/LBM/LBMSystem.cpp delete mode 100644 src/VirtualFluids/LBM/LBMSystem.h delete mode 100644 src/VirtualFluids/LBM/LBMSystems.h delete mode 100644 src/VirtualFluids/LBM/LBMUnitConverter.h delete mode 100644 src/VirtualFluids/LBM/VoidLBMKernel.cpp delete mode 100644 src/VirtualFluids/LBM/VoidLBMKernel.h delete mode 100644 src/VirtualFluids/LBM/package.include delete mode 100644 src/VirtualFluids/Parallel/BlocksDistributor.cpp delete mode 100644 src/VirtualFluids/Parallel/BlocksDistributor.h delete mode 100644 src/VirtualFluids/Parallel/CMakePackage.txt delete mode 100644 src/VirtualFluids/Parallel/Communicator.cpp delete mode 100644 src/VirtualFluids/Parallel/Communicator.h delete mode 100644 src/VirtualFluids/Parallel/LoadBalancer.cpp delete mode 100644 src/VirtualFluids/Parallel/LoadBalancer.h delete mode 100644 src/VirtualFluids/Parallel/MPICommunicator.cpp delete mode 100644 src/VirtualFluids/Parallel/MPICommunicator.h delete mode 100644 src/VirtualFluids/Parallel/MetisPartitioner.cpp delete mode 100644 src/VirtualFluids/Parallel/MetisPartitioner.h delete mode 100644 src/VirtualFluids/Parallel/NullCommunicator.cpp delete mode 100644 src/VirtualFluids/Parallel/NullCommunicator.h delete mode 100644 src/VirtualFluids/Parallel/PriorityQueueDecompositor.cpp delete mode 100644 src/VirtualFluids/Parallel/PriorityQueueDecompositor.h delete mode 100644 src/VirtualFluids/Parallel/SimpleGeometricPartitioner.h delete mode 100644 src/VirtualFluids/Parallel/Synchronizer.h delete mode 100644 src/VirtualFluids/Parallel/ZoltanPartitioner.cpp delete mode 100644 src/VirtualFluids/Parallel/ZoltanPartitioner.h delete mode 100644 src/VirtualFluids/Parallel/package.include delete mode 100644 src/VirtualFluids/Utilities/CMakePackage.txt delete mode 100644 src/VirtualFluids/Utilities/ChangeRandomQs.hpp delete mode 100644 src/VirtualFluids/Utilities/ConfigFileReader.cpp delete mode 100644 src/VirtualFluids/Utilities/ConfigFileReader.h delete mode 100644 src/VirtualFluids/Utilities/ConfigurationFile.hpp delete mode 100644 src/VirtualFluids/Utilities/MathUtil.hpp delete mode 100644 src/VirtualFluids/Utilities/MemoryUtil.h delete mode 100644 src/VirtualFluids/Utilities/StringUtil.hpp delete mode 100644 src/VirtualFluids/Utilities/VoxelMatrixUtil.hpp delete mode 100644 src/VirtualFluids/Utilities/package.include delete mode 100644 src/VirtualFluids/VirtualFluids.h delete mode 100644 src/VirtualFluids/Visitors/Block3DVisitor.h delete mode 100644 src/VirtualFluids/Visitors/BoundaryConditionsBlockVisitor.cpp delete mode 100644 src/VirtualFluids/Visitors/BoundaryConditionsBlockVisitor.h delete mode 100644 src/VirtualFluids/Visitors/CMakePackage.txt delete mode 100644 src/VirtualFluids/Visitors/ChangeBoundaryDensityBlockVisitor.cpp delete mode 100644 src/VirtualFluids/Visitors/ChangeBoundaryDensityBlockVisitor.h delete mode 100644 src/VirtualFluids/Visitors/CheckRatioBlockVisitor.cpp delete mode 100644 src/VirtualFluids/Visitors/CheckRatioBlockVisitor.h delete mode 100644 src/VirtualFluids/Visitors/CoarsenCrossAndInsideGbObjectBlockVisitor.cpp delete mode 100644 src/VirtualFluids/Visitors/CoarsenCrossAndInsideGbObjectBlockVisitor.h delete mode 100644 src/VirtualFluids/Visitors/ConnectorBlockVisitor.cpp delete mode 100644 src/VirtualFluids/Visitors/ConnectorBlockVisitor.h delete mode 100644 src/VirtualFluids/Visitors/CreateTransmittersHelper.cpp delete mode 100644 src/VirtualFluids/Visitors/CreateTransmittersHelper.h delete mode 100644 src/VirtualFluids/Visitors/GenBlocksGridVisitor.cpp delete mode 100644 src/VirtualFluids/Visitors/GenBlocksGridVisitor.h delete mode 100644 src/VirtualFluids/Visitors/Grid3DVisitor.h delete mode 100644 src/VirtualFluids/Visitors/InitDistributionsBlockVisitor.cpp delete mode 100644 src/VirtualFluids/Visitors/InitDistributionsBlockVisitor.h delete mode 100644 src/VirtualFluids/Visitors/InitDistributionsFromFileBlockVisitor.cpp delete mode 100644 src/VirtualFluids/Visitors/InitDistributionsFromFileBlockVisitor.h delete mode 100644 src/VirtualFluids/Visitors/InitDistributionsWithInterpolationGridVisitor.cpp delete mode 100644 src/VirtualFluids/Visitors/InitDistributionsWithInterpolationGridVisitor.h delete mode 100644 src/VirtualFluids/Visitors/MetisPartitioningGridVisitor.cpp delete mode 100644 src/VirtualFluids/Visitors/MetisPartitioningGridVisitor.h delete mode 100644 src/VirtualFluids/Visitors/OverlapBlockVisitor.cpp delete mode 100644 src/VirtualFluids/Visitors/OverlapBlockVisitor.h delete mode 100644 src/VirtualFluids/Visitors/PQueuePartitioningGridVisitor.cpp delete mode 100644 src/VirtualFluids/Visitors/PQueuePartitioningGridVisitor.h delete mode 100644 src/VirtualFluids/Visitors/RatioBlockVisitor.cpp delete mode 100644 src/VirtualFluids/Visitors/RatioBlockVisitor.h delete mode 100644 src/VirtualFluids/Visitors/RatioSmoothBlockVisitor.cpp delete mode 100644 src/VirtualFluids/Visitors/RatioSmoothBlockVisitor.h delete mode 100644 src/VirtualFluids/Visitors/RefineAroundGbObjectHelper.cpp delete mode 100644 src/VirtualFluids/Visitors/RefineAroundGbObjectHelper.h delete mode 100644 src/VirtualFluids/Visitors/RefineCrossAndInsideGbObjectBlockVisitor.cpp delete mode 100644 src/VirtualFluids/Visitors/RefineCrossAndInsideGbObjectBlockVisitor.h delete mode 100644 src/VirtualFluids/Visitors/RefineCrossAndInsideGbObjectHelper.cpp delete mode 100644 src/VirtualFluids/Visitors/RefineCrossAndInsideGbObjectHelper.h delete mode 100644 src/VirtualFluids/Visitors/RefineInterGbObjectsVisitor.cpp delete mode 100644 src/VirtualFluids/Visitors/RefineInterGbObjectsVisitor.h delete mode 100644 src/VirtualFluids/Visitors/RenumberBlockVisitor.cpp delete mode 100644 src/VirtualFluids/Visitors/RenumberBlockVisitor.h delete mode 100644 src/VirtualFluids/Visitors/SetConnectorsBlockVisitor.cpp delete mode 100644 src/VirtualFluids/Visitors/SetConnectorsBlockVisitor.h delete mode 100644 src/VirtualFluids/Visitors/SetForcingBlockVisitor.cpp delete mode 100644 src/VirtualFluids/Visitors/SetForcingBlockVisitor.h delete mode 100644 src/VirtualFluids/Visitors/SetInterpolationDirsBlockVisitor.cpp delete mode 100644 src/VirtualFluids/Visitors/SetInterpolationDirsBlockVisitor.h delete mode 100644 src/VirtualFluids/Visitors/SetKernelBlockVisitor.cpp delete mode 100644 src/VirtualFluids/Visitors/SetKernelBlockVisitor.h delete mode 100644 src/VirtualFluids/Visitors/SetSolidBlockVisitor.cpp delete mode 100644 src/VirtualFluids/Visitors/SetSolidBlockVisitor.h delete mode 100644 src/VirtualFluids/Visitors/SetSpongeLayerBlockVisitor.cpp delete mode 100644 src/VirtualFluids/Visitors/SetSpongeLayerBlockVisitor.h delete mode 100644 src/VirtualFluids/Visitors/SetUndefinedNodesBlockVisitor.cpp delete mode 100644 src/VirtualFluids/Visitors/SetUndefinedNodesBlockVisitor.h delete mode 100644 src/VirtualFluids/Visitors/SpongeLayerBlockVisitor.cpp delete mode 100644 src/VirtualFluids/Visitors/SpongeLayerBlockVisitor.h delete mode 100644 src/VirtualFluids/Visitors/ViscosityBlockVisitor.cpp delete mode 100644 src/VirtualFluids/Visitors/ViscosityBlockVisitor.h delete mode 100644 src/VirtualFluids/Visitors/ZoltanPartitioningGridVisitor.cpp delete mode 100644 src/VirtualFluids/Visitors/ZoltanPartitioningGridVisitor.h delete mode 100644 src/VirtualFluids/Visitors/package.include delete mode 100644 src/VirtualFluids/package.include delete mode 100644 src/VirtualFluidsBasics/utilities/StringUtil/StringUtilTest.cpp delete mode 100644 src/VirtualFluidsBasics/utilities/StringUtil/package.include delete mode 100644 src/VirtualFluidsBasics/utilities/input/ConfigInput/ConfigInputTest.cpp delete mode 100644 src/VirtualFluidsBasics/utilities/input/ConfigInput/package.include delete mode 100644 src/VirtualFluidsBasics/utilities/input/JsonInput/JsonInputTest.cpp delete mode 100644 src/VirtualFluidsBasics/utilities/input/JsonInput/package.include delete mode 100644 src/VirtualFluidsBasics/utilities/input/package.include delete mode 100644 src/VirtualFluidsBasics/utilities/logger/implementations/package.include delete mode 100644 src/VirtualFluidsBasics/utilities/logger/package.include delete mode 100644 src/core/A.cpp delete mode 100644 src/core/A.h delete mode 100644 src/dem_coupling/DemCalculator.cpp delete mode 100644 src/dem_coupling/DemCalculator.h delete mode 100644 src/dem_coupling/DemCalculatorFactory.h delete mode 100644 src/dem_coupling/DemCoProcessor.cpp delete mode 100644 src/dem_coupling/DemCoProcessor.h delete mode 100644 src/dem_coupling/MovableObjectInteractor.cpp delete mode 100644 src/dem_coupling/MovableObjectInteractor.h delete mode 100644 src/dem_coupling/dem_coupling_EXPORT.h delete mode 100644 src/dem_coupling/package.include delete mode 100644 src/dem_coupling/physicsEngineAdapter/PhysicsEngineGeometryAdapter.h delete mode 100644 src/dem_coupling/physicsEngineAdapter/PhysicsEngineMaterialAdapter.h delete mode 100644 src/dem_coupling/physicsEngineAdapter/PhysicsEngineSolverAdapter.h delete mode 100644 src/dem_coupling/physicsEngineAdapter/dummy/DummyPhysicsEngineGeometryAdapter.cpp delete mode 100644 src/dem_coupling/physicsEngineAdapter/dummy/DummyPhysicsEngineGeometryAdapter.h delete mode 100644 src/dem_coupling/physicsEngineAdapter/dummy/DummyPhysicsEngineMaterialAdapter.cpp delete mode 100644 src/dem_coupling/physicsEngineAdapter/dummy/DummyPhysicsEngineMaterialAdapter.h delete mode 100644 src/dem_coupling/physicsEngineAdapter/dummy/DummyPhysicsEngineSolverAdapter.cpp delete mode 100644 src/dem_coupling/physicsEngineAdapter/dummy/DummyPhysicsEngineSolverAdapter.h delete mode 100644 src/dem_coupling/physicsEngineAdapter/dummy/package.include delete mode 100644 src/dem_coupling/physicsEngineAdapter/package.include delete mode 100644 src/dem_coupling/physicsEngineAdapter/pe/PeAdapter.h delete mode 100644 src/dem_coupling/physicsEngineAdapter/pe/PeAdapterTest.cpp delete mode 100644 src/dem_coupling/physicsEngineAdapter/pe/PePhysicsEngineGeometryAdapter.cpp delete mode 100644 src/dem_coupling/physicsEngineAdapter/pe/PePhysicsEngineGeometryAdapter.h delete mode 100644 src/dem_coupling/physicsEngineAdapter/pe/PePhysicsEngineMaterialAdapter.cpp delete mode 100644 src/dem_coupling/physicsEngineAdapter/pe/PePhysicsEngineMaterialAdapter.h delete mode 100644 src/dem_coupling/physicsEngineAdapter/pe/PePhysicsEngineSolverAdapter.cpp delete mode 100644 src/dem_coupling/physicsEngineAdapter/pe/PePhysicsEngineSolverAdapter.h delete mode 100644 src/dem_coupling/physicsEngineAdapter/pe/package.include delete mode 100644 src/dem_coupling/reconstructor/EquilibriumReconstructor.cpp delete mode 100644 src/dem_coupling/reconstructor/EquilibriumReconstructor.h delete mode 100644 src/dem_coupling/reconstructor/ExtrapolationReconstructor.cpp delete mode 100644 src/dem_coupling/reconstructor/ExtrapolationReconstructor.h delete mode 100644 src/dem_coupling/reconstructor/Reconstructor.h delete mode 100644 src/dem_coupling/reconstructor/VelocityBcReconstructor.cpp delete mode 100644 src/dem_coupling/reconstructor/VelocityBcReconstructor.h delete mode 100644 src/dem_coupling/reconstructor/package.include delete mode 100644 targets/libs/VirtualFluids/3rdPartyLinking.cmake delete mode 100644 targets/libs/VirtualFluids/CMakeLists.txt delete mode 100644 targets/libs/VirtualFluids/CMakePackage.cmake delete mode 100644 targets/libs/VirtualFluids/includes.cmake delete mode 100644 targets/libs/VirtualFluidsBasics/buildInfo.cmake delete mode 100644 targets/libs/VirtualFluidsBasics/buildInfoInput/buildInfo.in.cpp delete mode 100644 targets/libs/VirtualFluidsBasics/package.include delete mode 100644 targets/libs/core/buildInfo.h delete mode 100644 targets/libs/dem_coupling/3rdPartyLinking.cmake delete mode 100644 targets/libs/dem_coupling/CMakeLists.txt delete mode 100644 targets/libs/dem_coupling/CMakePackage.cmake delete mode 100644 targets/tests/GridGeneratorTest/3rdPartyLinking.cmake delete mode 100644 targets/tests/GridGeneratorTest/CMakeLists.txt delete mode 100644 targets/tests/GridGeneratorTest/CMakePackage.cmake delete mode 100644 targets/tests/GridGeneratorTest/main.cpp delete mode 100644 targets/tests/GridGeneratorTest/package.include delete mode 100644 targets/tests/VirtualFluidsBasicsTest/3rdPartyLinking.cmake delete mode 100644 targets/tests/VirtualFluidsBasicsTest/CMakeLists.txt delete mode 100644 targets/tests/VirtualFluidsBasicsTest/CMakePackage.cmake delete mode 100644 targets/tests/VirtualFluidsBasicsTest/main.cpp delete mode 100644 targets/tests/VirtualFluidsBasicsTest/package.include delete mode 100644 targets/tests/VirtualFluidsTest/3rdPartyLinking.cmake delete mode 100644 targets/tests/VirtualFluidsTest/CMakeLists.txt delete mode 100644 targets/tests/VirtualFluidsTest/CMakePackage.cmake delete mode 100644 targets/tests/VirtualFluidsTest/main.cpp delete mode 100644 targets/tests/VirtualFluidsTest/package.include delete mode 100644 targets/tests/VirtualFluids_GPUTest/3rdPartyLinking.cmake delete mode 100644 targets/tests/VirtualFluids_GPUTest/CMakeLists.txt delete mode 100644 targets/tests/VirtualFluids_GPUTest/CMakePackage.cmake delete mode 100644 targets/tests/VirtualFluids_GPUTest/main.cpp delete mode 100644 targets/tests/VirtualFluids_GPUTest/package.include delete mode 100644 targets/tests/coreTest/3rdPartyLinking.cmake delete mode 100644 targets/tests/coreTest/CMakeLists.txt delete mode 100644 targets/tests/coreTest/CMakePackage.cmake delete mode 100644 targets/tests/coreTest/main.cpp delete mode 100644 targets/tests/coreTest/package.include diff --git a/CMakeLists.txt b/CMakeLists.txt index 8969f5c2e..b53cf9781 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -68,15 +68,14 @@ ENDIF(MSVC) ############################################################# ### OPTIONS ### ############################################################# -option(BUILD_SHARED_LIBS "Build shared libraries" ON) -option(HULC.BUILD_VirtualFluids "Builds virtual Fluids" OFF) -option(HULC.BUILD_dem_coupling "Builds dem coupling " OFF) -option(HULC.BUILD_GPU_CODE "Build gpu VirtualFluids" ON) -option(HULC.BUILD_JSONCPP "Builds json cpp " ON) -option(HULC.BUILD_TESTS "Build tests" OFF) -option(HULC.BUILD_NUMERIC_TESTS "Build numeric tests" OFF) +option(BUILD_SHARED_LIBS "Build shared libraries" ON ) +option(HULC.BUILD_GPU_CODE "Build gpu VirtualFluids" ON ) +option(HULC.BUILD_JSONCPP "Builds json cpp " ON ) +option(HULC.BUILD_NUMERIC_TESTS "Build numeric tests" OFF) -option(VF_DOUBLE_ACCURACY "Build shared libraries" OFF) +option(VF_DOUBLE_ACCURACY "Build shared libraries" OFF) + +############################################################# if(HULC.BUILD_GPU_CODE) #SET(CMAKE_CUDA_COMPILER $ENV{CUDA_PATH_V9_0}/bin/nvcc.exe) @@ -84,6 +83,8 @@ if(HULC.BUILD_GPU_CODE) endif() sharedLibs() +############################################################# + include(${CMAKE_SOURCE_DIR}/${cmakeMacroPath}/general/FindCompiler.cmake) configure_file(src/VirtualFluidsDefinitions.in.h VirtualFluidsDefinitions.h) if(MSVC) @@ -92,36 +93,6 @@ ELSE(MSVC) SET( CMAKE_CXX_FLAGS "-include ${CMAKE_BINARY_DIR}/VirtualFluidsDefinitions.h ${CMAKE_CXX_FLAGS}" ) ENDIF(MSVC) -############################################################# -### Virtual Fluids ### -############################################################# -IF (HULC.BUILD_VirtualFluids) - add_definitions(-DVF_METIS) - add_definitions(-DVF_MPI) - - add_subdirectory(3rdParty/MuParser) - add_subdirectory(targets/libs/VirtualFluids) -ELSE() - MESSAGE( STATUS "exclude Virtual Fluids." ) -ENDIF() - - -############################################################# -### dem_coupling ### -############################################################# -IF (HULC.BUILD_dem_coupling AND HULC.BUILD_VirtualFluids) - link_directories("${PE_BINARY_DIR}/src/pe" "${PE_BINARY_DIR}/src/core" "${PE_BINARY_DIR}/src/blockforest" "${PE_BINARY_DIR}/src/domain_decomposition" ) -IF(MSVC) - SET( CMAKE_CXX_FLAGS "/FI ${PE_BINARY_DIR}/src/pe/extern/libccd/ccd/config.h ${CMAKE_CXX_FLAGS}" ) -ELSE(MSVC) - SET( CMAKE_CXX_FLAGS "-include ${PE_BINARY_DIR}/src/pe/extern/libccd/ccd/config.h ${CMAKE_CXX_FLAGS}" ) -ENDIF(MSVC) - - add_subdirectory(targets/libs/dem_coupling) -ELSE() - MESSAGE(STATUS "exclude dem-coupling." ) -ENDIF() - ############################################################# ### Virtual Fluids GPU ### ############################################################# @@ -148,33 +119,7 @@ ENDIF() add_subdirectory(targets/apps/HULC) add_subdirectory(targets/libs/VirtualFluidsBasics) -add_subdirectory(targets/libs/core) - -if(HULC.BUILD_GPU_CODE OR HULC.BUILD_VirtualFluids) - add_subdirectory(3rdParty/metis/metis-5.1.0) -endif() - - -if(HULC.BUILD_TESTS) - if(VF_DOUBLE_ACCURACY) - add_definitions("-DRealEq=testing::DoubleEq") - else() - add_definitions("-DRealEq=testing::FloatEq") - endif() - - add_subdirectory(3rdParty/googletest) - if (HULC.BUILD_GPU_CODE) - add_subdirectory(targets/tests/GridGeneratorTest) - add_subdirectory(targets/tests/VirtualFluids_GPUTest) - endif() - - if (HULC.BUILD_VirtualFluids) - add_subdirectory(targets/tests/VirtualFluidsTest) - endif() - - add_subdirectory(targets/tests/coreTest) - add_subdirectory(targets/tests/VirtualFluidsBasicsTest) -endif() +add_subdirectory(targets/libs/Core) if(HULC.BUILD_NUMERIC_TESTS) add_subdirectory(3rdParty/fftw/fftw-3.3.7) diff --git a/src/VirtualFluidsBasics/utilities/input/ConfigInput/ConfigInput.cpp b/src/Core/Input/ConfigInput/ConfigInput.cpp similarity index 100% rename from src/VirtualFluidsBasics/utilities/input/ConfigInput/ConfigInput.cpp rename to src/Core/Input/ConfigInput/ConfigInput.cpp diff --git a/src/VirtualFluidsBasics/utilities/input/ConfigInput/ConfigInput.h b/src/Core/Input/ConfigInput/ConfigInput.h similarity index 100% rename from src/VirtualFluidsBasics/utilities/input/ConfigInput/ConfigInput.h rename to src/Core/Input/ConfigInput/ConfigInput.h diff --git a/src/VirtualFluids/BoundaryConditions/package.include b/src/Core/Input/ConfigInput/package.include similarity index 100% rename from src/VirtualFluids/BoundaryConditions/package.include rename to src/Core/Input/ConfigInput/package.include diff --git a/src/VirtualFluidsBasics/utilities/input/Input.cpp b/src/Core/Input/Input.cpp similarity index 100% rename from src/VirtualFluidsBasics/utilities/input/Input.cpp rename to src/Core/Input/Input.cpp diff --git a/src/VirtualFluidsBasics/utilities/input/Input.h b/src/Core/Input/Input.h similarity index 100% rename from src/VirtualFluidsBasics/utilities/input/Input.h rename to src/Core/Input/Input.h diff --git a/src/VirtualFluidsBasics/utilities/input/JsonInput/JsonInput.cpp b/src/Core/Input/JsonInput/JsonInput.cpp similarity index 100% rename from src/VirtualFluidsBasics/utilities/input/JsonInput/JsonInput.cpp rename to src/Core/Input/JsonInput/JsonInput.cpp diff --git a/src/VirtualFluidsBasics/utilities/input/JsonInput/JsonInput.h b/src/Core/Input/JsonInput/JsonInput.h similarity index 100% rename from src/VirtualFluidsBasics/utilities/input/JsonInput/JsonInput.h rename to src/Core/Input/JsonInput/JsonInput.h diff --git a/src/VirtualFluids/CoProcessors/package.include b/src/Core/Input/JsonInput/package.include similarity index 100% rename from src/VirtualFluids/CoProcessors/package.include rename to src/Core/Input/JsonInput/package.include diff --git a/src/VirtualFluids/Connectors/package.include b/src/Core/Input/package.include similarity index 100% rename from src/VirtualFluids/Connectors/package.include rename to src/Core/Input/package.include diff --git a/src/VirtualFluidsBasics/utilities/logger/Logger.cpp b/src/Core/Logger/Logger.cpp similarity index 100% rename from src/VirtualFluidsBasics/utilities/logger/Logger.cpp rename to src/Core/Logger/Logger.cpp diff --git a/src/VirtualFluidsBasics/utilities/logger/Logger.h b/src/Core/Logger/Logger.h similarity index 100% rename from src/VirtualFluidsBasics/utilities/logger/Logger.h rename to src/Core/Logger/Logger.h diff --git a/src/VirtualFluidsBasics/utilities/logger/implementations/LoggerImp.cpp b/src/Core/Logger/implementations/LoggerImp.cpp similarity index 100% rename from src/VirtualFluidsBasics/utilities/logger/implementations/LoggerImp.cpp rename to src/Core/Logger/implementations/LoggerImp.cpp diff --git a/src/VirtualFluidsBasics/utilities/logger/implementations/LoggerImp.h b/src/Core/Logger/implementations/LoggerImp.h similarity index 100% rename from src/VirtualFluidsBasics/utilities/logger/implementations/LoggerImp.h rename to src/Core/Logger/implementations/LoggerImp.h diff --git a/src/VirtualFluidsBasics/utilities/logger/implementations/LoggerTest.cpp b/src/Core/Logger/implementations/LoggerTest.cpp similarity index 100% rename from src/VirtualFluidsBasics/utilities/logger/implementations/LoggerTest.cpp rename to src/Core/Logger/implementations/LoggerTest.cpp diff --git a/src/VirtualFluids/Data/package.include b/src/Core/Logger/implementations/package.include similarity index 100% rename from src/VirtualFluids/Data/package.include rename to src/Core/Logger/implementations/package.include diff --git a/src/VirtualFluids/FETOL/package.include b/src/Core/Logger/package.include similarity index 100% rename from src/VirtualFluids/FETOL/package.include rename to src/Core/Logger/package.include diff --git a/src/VirtualFluidsBasics/utilities/StringUtil/StringUtil.cpp b/src/Core/StringUtilities/StringUtil.cpp similarity index 100% rename from src/VirtualFluidsBasics/utilities/StringUtil/StringUtil.cpp rename to src/Core/StringUtilities/StringUtil.cpp diff --git a/src/VirtualFluidsBasics/utilities/StringUtil/StringUtil.h b/src/Core/StringUtilities/StringUtil.h similarity index 100% rename from src/VirtualFluidsBasics/utilities/StringUtil/StringUtil.h rename to src/Core/StringUtilities/StringUtil.h diff --git a/src/VirtualFluids/Geometry/package.include b/src/Core/StringUtilities/package.include similarity index 100% rename from src/VirtualFluids/Geometry/package.include rename to src/Core/StringUtilities/package.include diff --git a/targets/libs/VirtualFluidsBasics/buildInfo.h b/src/Core/buildInfo.h similarity index 94% rename from targets/libs/VirtualFluidsBasics/buildInfo.h rename to src/Core/buildInfo.h index 269fe1fab..36e4f000c 100644 --- a/targets/libs/VirtualFluidsBasics/buildInfo.h +++ b/src/Core/buildInfo.h @@ -1,6 +1,8 @@ #ifndef buildInfo_H #define buildInfo_H +#include "VirtualFluidsDefinitions.h" + namespace buildInfo { const char * gitCommitHash(); diff --git a/src/GridGenerator/geometries/Arrow/Arrow.h b/src/GridGenerator/geometries/Arrow/Arrow.h index 8bf3c9c49..dfd006042 100644 --- a/src/GridGenerator/geometries/Arrow/Arrow.h +++ b/src/GridGenerator/geometries/Arrow/Arrow.h @@ -2,6 +2,7 @@ #define Arrow_H #include <memory> + struct Vertex; class Arrow diff --git a/src/GridGenerator/geometries/Arrow/ArrowImp.cpp b/src/GridGenerator/geometries/Arrow/ArrowImp.cpp index c205ec9f5..28176b4f5 100644 --- a/src/GridGenerator/geometries/Arrow/ArrowImp.cpp +++ b/src/GridGenerator/geometries/Arrow/ArrowImp.cpp @@ -2,8 +2,6 @@ #include "../Vertex/Vertex.h" - - std::shared_ptr<Arrow> ArrowImp::make(const Vertex &start, const Vertex &end) { return std::shared_ptr<ArrowImp>(new ArrowImp(start, end)); diff --git a/src/GridGenerator/geometries/Arrow/ArrowImp.h b/src/GridGenerator/geometries/Arrow/ArrowImp.h index 641e158d5..950dbfd9f 100644 --- a/src/GridGenerator/geometries/Arrow/ArrowImp.h +++ b/src/GridGenerator/geometries/Arrow/ArrowImp.h @@ -1,10 +1,10 @@ #ifndef ArrowImp_H #define ArrowImp_H -#include "GridGenerator/global.h" +#include <memory> +#include "GridGenerator/global.h" -#include <memory> #include "Arrow.h" struct Vertex; diff --git a/src/GridGenerator/geometries/Arrow/ArrowMocks.h b/src/GridGenerator/geometries/Arrow/ArrowMocks.h deleted file mode 100644 index a53f076b6..000000000 --- a/src/GridGenerator/geometries/Arrow/ArrowMocks.h +++ /dev/null @@ -1,40 +0,0 @@ -#ifndef ArrowMocks_H -#define ArrowMocks_H - -#include "GridGenerator/global.h" -#include <memory> - -#include "Arrow.h" -#include "../Vertex/Vertex.h" - -class ArrowStub : public Arrow -{ -public: - virtual ~ArrowStub() {} - static std::shared_ptr<Arrow> make(std::shared_ptr<Vertex> start, std::shared_ptr<Vertex> end) - { - return std::shared_ptr<Arrow>(new ArrowStub(start, end)); - } - - std::shared_ptr<Vertex> getStart() const { return this->start; } - std::shared_ptr<Vertex> getEnd() const { return this->end; }; - - - virtual void print() const override - { - throw std::logic_error("The method or operation is not implemented."); - } - -private: - ArrowStub(std::shared_ptr<Vertex> start, std::shared_ptr<Vertex> end) : start(start), end(end) {} - - std::shared_ptr<Vertex> start; - std::shared_ptr<Vertex> end; -}; - - - - - - -#endif diff --git a/src/GridGenerator/geometries/Arrow/ArrowTest.cpp b/src/GridGenerator/geometries/Arrow/ArrowTest.cpp deleted file mode 100644 index 501490ab7..000000000 --- a/src/GridGenerator/geometries/Arrow/ArrowTest.cpp +++ /dev/null @@ -1,4 +0,0 @@ -#include "gmock/gmock.h" -#include "Arrow.h" - -using namespace testing; diff --git a/src/GridGenerator/geometries/BoundingBox/BoundingBox.h b/src/GridGenerator/geometries/BoundingBox/BoundingBox.h index 2cf105ebf..1094ed43c 100644 --- a/src/GridGenerator/geometries/BoundingBox/BoundingBox.h +++ b/src/GridGenerator/geometries/BoundingBox/BoundingBox.h @@ -1,10 +1,10 @@ #ifndef BoundingBox_h #define BoundingBox_h -#include "GridGenerator/global.h" - #include <vector> -#include "cuda_runtime.h" +#include <cuda_runtime.h> + +#include "global.h" struct Vertex; struct Triangle; diff --git a/src/GridGenerator/geometries/Conglomerate/Conglomerate.cu b/src/GridGenerator/geometries/Conglomerate/Conglomerate.cu index a2432eda8..b87eba98c 100644 --- a/src/GridGenerator/geometries/Conglomerate/Conglomerate.cu +++ b/src/GridGenerator/geometries/Conglomerate/Conglomerate.cu @@ -1,7 +1,5 @@ #include "Conglomerate.h" -#include <utilities/logger/Logger.h> - Conglomerate::Conglomerate() { addObjects = new Object*[MAX_NUMBER_OF_OBJECTS]; diff --git a/src/GridGenerator/geometries/Conglomerate/Conglomerate.h b/src/GridGenerator/geometries/Conglomerate/Conglomerate.h index c08e1492e..0089d3686 100644 --- a/src/GridGenerator/geometries/Conglomerate/Conglomerate.h +++ b/src/GridGenerator/geometries/Conglomerate/Conglomerate.h @@ -7,12 +7,9 @@ #ifndef CONGLOMERATE_H #define CONGLOMERATE_H - -#include "../Object.h" -#include <VirtualFluidsDefinitions.h> -#include <core/DataTypes.h> #include "global.h" -#include "geometries/ObjectMocks.h" + +#include "geometries/Object.h" #define MAX_NUMBER_OF_OBJECTS 20 diff --git a/src/GridGenerator/geometries/Conglomerate/ConglomerateTest.cpp b/src/GridGenerator/geometries/Conglomerate/ConglomerateTest.cpp deleted file mode 100644 index 8053de0b7..000000000 --- a/src/GridGenerator/geometries/Conglomerate/ConglomerateTest.cpp +++ /dev/null @@ -1,142 +0,0 @@ -#include "gmock/gmock.h" - - -#include "Conglomerate.h" -#include "../ObjectMocks.h" - -using namespace testing; - -TEST(ConglomerateTest, addTwoObjectsToConglomerate_ShouldReturnMinimumMaximum) -{ - auto objectStub1 = new ObjectStub(); - auto objectStub2 = new ObjectStub(); - objectStub1->setX1Minimum(0.0); - objectStub2->setX1Minimum(-2.0); - objectStub1->setX2Minimum(2.0); - objectStub2->setX2Minimum(4.0); - objectStub1->setX3Minimum(100.0); - objectStub2->setX3Minimum(-100.0); - - objectStub1->setX1Maximum(0.0); - objectStub2->setX1Maximum(-2.0); - objectStub1->setX2Maximum(-5.0); - objectStub2->setX2Maximum(-2.0); - objectStub1->setX3Maximum(0.0); - objectStub2->setX3Maximum(33.0); - - - SPtr<Conglomerate> conglomerate = Conglomerate::makeShared(); - conglomerate->add(objectStub1); - conglomerate->add(objectStub2); - - - const real expectedMinX1 = -2.0; - const real expectedMinX2 = 2.0; - const real expectedMinX3 = -100.0; - const real actualMinX1 = conglomerate->getX1Minimum(); - const real actualMinX2 = conglomerate->getX2Minimum(); - const real actualMinX3 = conglomerate->getX3Minimum(); - EXPECT_THAT(actualMinX1, RealEq(expectedMinX1)); - EXPECT_THAT(actualMinX2, RealEq(expectedMinX2)); - EXPECT_THAT(actualMinX3, RealEq(expectedMinX3)); - - const real expectedMaxX1 = 0.0; - const real expectedMaxX2 = -2.0; - const real expectedMaxX3 = 33.0; - const real actualMaxX1 = conglomerate->getX1Maximum(); - const real actualMaxX2 = conglomerate->getX2Maximum(); - const real actualMaxX3 = conglomerate->getX3Maximum(); - EXPECT_THAT(actualMaxX1, RealEq(expectedMaxX1)); - EXPECT_THAT(actualMaxX2, RealEq(expectedMaxX2)); - EXPECT_THAT(actualMaxX3, RealEq(expectedMaxX3)); -} - -TEST(ConglomerateTest, getCenterFromConglomerate) -{ - auto objectStub1 = new ObjectStub(); - auto objectStub2 = new ObjectStub(); - objectStub1->setX1Minimum(0.0); - objectStub2->setX1Minimum(-2.0); - objectStub1->setX2Minimum(2.0); - objectStub2->setX2Minimum(4.0); - objectStub1->setX3Minimum(100.0); - objectStub2->setX3Minimum(-100.0); - - objectStub1->setX1Maximum(0.0); - objectStub2->setX1Maximum(-2.0); - objectStub1->setX2Maximum(12.0); - objectStub2->setX2Maximum(10.0); - objectStub1->setX3Maximum(0.0); - objectStub2->setX3Maximum(100.0); - - - SPtr<Conglomerate> conglomerate = Conglomerate::makeShared(); - conglomerate->add(objectStub1); - conglomerate->add(objectStub2); - - - const real expectedCenterX1 = -1.0; - const real expectedCenterX2 = 7.0; - const real expectedCenterX3 = 0.0; - const real actualCenterX1 = conglomerate->getX1Centroid(); - const real actualCenterX2 = conglomerate->getX2Centroid(); - const real actualCenterX3 = conglomerate->getX3Centroid(); - EXPECT_THAT(actualCenterX1, RealEq(expectedCenterX1)); - EXPECT_THAT(actualCenterX2, RealEq(expectedCenterX2)); - EXPECT_THAT(actualCenterX3, RealEq(expectedCenterX3)); -} - - -TEST(ConglomerateTest, getPointInObject_ShouldReturnTrueIfOnePointIsInObject) -{ - auto objectStub1 = new ObjectStub(); - auto objectStub2 = new ObjectStub(); - objectStub1->setIsInObject(false); - objectStub2->setIsInObject(true); - - - SPtr<Conglomerate> conglomerate = Conglomerate::makeShared(); - conglomerate->add(objectStub1); - conglomerate->add(objectStub2); - - - const bool expectedIsInObject = true; - const bool actualIsInObject = conglomerate->isPointInObject(0,0,0,0,0); - EXPECT_THAT(actualIsInObject, Eq(expectedIsInObject)); -} - -TEST(ConglomerateTest, getPointInObject_ShouldReturnTrueIfOnePointIsInBothObject) -{ - auto objectStub1 = new ObjectStub(); - auto objectStub2 = new ObjectStub(); - objectStub1->setIsInObject(true); - objectStub2->setIsInObject(true); - - - SPtr<Conglomerate> conglomerate = Conglomerate::makeShared(); - conglomerate->add(objectStub1); - conglomerate->add(objectStub2); - - - const bool expectedIsInObject = true; - const bool actualIsInObject = conglomerate->isPointInObject(0, 0, 0, 0, 0); - EXPECT_THAT(actualIsInObject, Eq(expectedIsInObject)); -} - -TEST(ConglomerateTest, addAndSubtractTwoObjects_PointIsInBothObjects_ShouldNotBeInConglomerate) -{ - auto objectStub1 = new ObjectStub(); - auto objectStub2 = new ObjectStub(); - objectStub1->setIsInObject(true); - objectStub2->setIsInObject(true); - - - SPtr<Conglomerate> conglomerate = Conglomerate::makeShared(); - conglomerate->add(objectStub1); - conglomerate->subtract(objectStub2); - - - const bool expectedIsInObject = false; - const bool actualIsInObject = conglomerate->isPointInObject(0, 0, 0, 0, 0); - EXPECT_THAT(actualIsInObject, Eq(expectedIsInObject)); -} \ No newline at end of file diff --git a/src/GridGenerator/geometries/Cuboid/Cuboid.cu b/src/GridGenerator/geometries/Cuboid/Cuboid.cu index 23eae87d1..af7cb42c2 100644 --- a/src/GridGenerator/geometries/Cuboid/Cuboid.cu +++ b/src/GridGenerator/geometries/Cuboid/Cuboid.cu @@ -1,6 +1,6 @@ #include "Cuboid.h" -#include "utilities/math/Math.h" +#include "utilities/math/Math.h" Cuboid::Cuboid(const double& x1a,const double& x2a, const double& x3a, const double& x1b,const double& x2b, const double& x3b) : minX1(x1a), minX2(x2a), minX3(x3a), maxX1(x1b), maxX2(x2b), maxX3(x3b) diff --git a/src/GridGenerator/geometries/Cuboid/Cuboid.h b/src/GridGenerator/geometries/Cuboid/Cuboid.h index f4728b6e0..8d5922bd9 100644 --- a/src/GridGenerator/geometries/Cuboid/Cuboid.h +++ b/src/GridGenerator/geometries/Cuboid/Cuboid.h @@ -7,10 +7,9 @@ #ifndef CUBOID_H #define CUBOID_H +#include "global.h" -#include "../Object.h" -#include <VirtualFluidsDefinitions.h> -#include <core/DataTypes.h> +#include "geometries/Object.h" class VF_PUBLIC Cuboid : public Object { diff --git a/src/GridGenerator/geometries/Cuboid/CuboidTest.cpp b/src/GridGenerator/geometries/Cuboid/CuboidTest.cpp deleted file mode 100644 index 02ade47bd..000000000 --- a/src/GridGenerator/geometries/Cuboid/CuboidTest.cpp +++ /dev/null @@ -1,71 +0,0 @@ -#include "gmock/gmock.h" - - -#include "Cuboid.h" - - -using namespace testing; - -TEST(CuboidTest, createCuboid_shouldReturnCenter) -{ - Cuboid sut(1, 3, 5, 10, 11, 12); - - const double centerX1 = sut.getX1Centroid(); - const double centerX2 = sut.getX2Centroid(); - const double centerX3 = sut.getX3Centroid(); - - EXPECT_THAT(centerX1, DoubleEq(5.5)); - EXPECT_THAT(centerX2, DoubleEq(7.0)); - EXPECT_THAT(centerX3, DoubleEq(8.5)); -} - -TEST(CuboidTest, createCuboid_shouldReturnMinimum) -{ - Cuboid sut(1, 3, 5, 10, 11, 3); - - const double minX1 = sut.getX1Minimum(); - const double minX2 = sut.getX2Minimum(); - const double minX3 = sut.getX3Minimum(); - - EXPECT_THAT(minX1, DoubleEq(1)); - EXPECT_THAT(minX2, DoubleEq(3)); - EXPECT_THAT(minX3, DoubleEq(3)); -} - -TEST(CuboidTest, createCuboid_shouldReturnMaximum) -{ - Cuboid sut(1, 3, 5, 10, 11, 3); - - const double maxX1 = sut.getX1Maximum(); - const double maxX2 = sut.getX2Maximum(); - const double maxX3 = sut.getX3Maximum(); - - EXPECT_THAT(maxX1, DoubleEq(10)); - EXPECT_THAT(maxX2, DoubleEq(11)); - EXPECT_THAT(maxX3, DoubleEq(5)); -} - - -TEST(CuboidTest, checkIfPointIsInsideOfCuboid) -{ - Cuboid sut(1, 3, 5, 10, 11, 12); - - const double minOffset = 0; - const double maxOffset = 0; - - EXPECT_TRUE(sut.isPointInObject(2, 4, 6, minOffset, maxOffset)); - EXPECT_FALSE(sut.isPointInObject(1, 4, 6, minOffset, maxOffset)); - EXPECT_FALSE(sut.isPointInObject(2, 11, 6, minOffset, maxOffset)); - EXPECT_FALSE(sut.isPointInObject(2, 4, 12, minOffset, maxOffset)); -} - -TEST(CuboidTest, checkIfPointIsInsideOfCuboid_withOffset) -{ - Cuboid sut(1, 3, 5, 10, 11, 12); - - const double minOffset = 2; - const double maxOffset = 1; - - EXPECT_FALSE(sut.isPointInObject(3, 5, 7, minOffset, maxOffset)); - EXPECT_FALSE(sut.isPointInObject(9, 10, 11, minOffset, maxOffset)); -} diff --git a/src/GridGenerator/geometries/ObjectMocks.h b/src/GridGenerator/geometries/ObjectMocks.h deleted file mode 100644 index bcfdf2f38..000000000 --- a/src/GridGenerator/geometries/ObjectMocks.h +++ /dev/null @@ -1,75 +0,0 @@ -#ifndef OBJECT_MOCKS_H -#define OBJECT_MOCKS_H - -#include "GridGenerator/global.h" - -#include "geometries/Object.h" - -class ObjectDummy : public Object -{ -public: - HOSTDEVICE virtual ~ObjectDummy() {} - - static SPtr<ObjectDummy> makeShared() - { - return SPtr<ObjectDummy>(new ObjectDummy()); - } - - HOSTDEVICE virtual Object* clone() const override { return nullptr; } - virtual double getX1Centroid() override { return 0.0; } - virtual double getX1Minimum() override { return 0.0; } - virtual double getX1Maximum() override { return 0.0; } - virtual double getX2Centroid() override { return 0.0; } - virtual double getX2Minimum() override { return 0.0; } - virtual double getX2Maximum() override { return 0.0; } - virtual double getX3Centroid() override { return 0.0; } - virtual double getX3Minimum() override { return 0.0; } - virtual double getX3Maximum() override { return 0.0; } - virtual void scale(double delta) override {} - HOSTDEVICE virtual bool isPointInObject(const double& x1, const double& x2, const double& x3, const double& minOffset, const double& maxOffset) override { return false; } -}; - - -class ObjectStub : public ObjectDummy -{ -public: - HOSTDEVICE virtual ~ObjectStub() {} - - static SPtr<ObjectStub> makeShared() - { - return SPtr<ObjectStub>(new ObjectStub()); - } - - double getX1Minimum() override { return this->minX1; } - double getX2Minimum() override { return this->minX2; } - double getX3Minimum() override { return this->minX3; } - double getX1Maximum() override { return this->maxX1; } - double getX2Maximum() override { return this->maxX2; } - double getX3Maximum() override { return this->maxX3; } - - void setX1Minimum(double minX1) { this->minX1 = minX1; } - void setX2Minimum(double minX2) { this->minX2 = minX2; } - void setX3Minimum(double minX3) { this->minX3 = minX3; } - void setX1Maximum(double maxX1) { this->maxX1 = maxX1; } - void setX2Maximum(double maxX2) { this->maxX2 = maxX2; } - void setX3Maximum(double maxX3) { this->maxX3 = maxX3; } - - void setIsInObject(bool isInObject) { this->isInObject = isInObject; } - - virtual double getX1Centroid() override { return (maxX1 + minX1) * 0.5; } - virtual double getX2Centroid() override { return (maxX2 + minX2) * 0.5; } - virtual double getX3Centroid() override { return (maxX3 + minX3) * 0.5; } - - HOSTDEVICE virtual bool isPointInObject(const double& x1, const double& x2, const double& x3, const double& minOffset, const double& maxOffset) override { return isInObject; } - - - -protected: - double minX1, minX2, minX3, maxX1, maxX2, maxX3; - bool isInObject; -}; - - - - -#endif diff --git a/src/GridGenerator/geometries/ObjectPrototypeFactory.h b/src/GridGenerator/geometries/ObjectPrototypeFactory.h deleted file mode 100644 index 8de60352a..000000000 --- a/src/GridGenerator/geometries/ObjectPrototypeFactory.h +++ /dev/null @@ -1,64 +0,0 @@ -// _ ___ __ __________ _ __ -// | | / (_)____/ /___ ______ _/ / ____/ /_ __(_)___/ /____ -// | | / / / ___/ __/ / / / __ `/ / /_ / / / / / / __ / ___/ -// | |/ / / / / /_/ /_/ / /_/ / / __/ / / /_/ / / /_/ (__ ) -// |___/_/_/ \__/\__,_/\__,_/_/_/ /_/\__,_/_/\__,_/____/ -// -#ifndef OBJECT_PROTOTYPE_FACTORY_H -#define OBJECT_PROTOTYPE_FACTORY_H - -#include "PointerDefinitions.h" - -#include "Sphere/Sphere.h" -#include "Cuboid/Cuboid.h" - -enum class ObjectType -{ - Cuboid -}; - - -class AbstractFactory -{ -public: - virtual Object* make(ObjectType type) = 0; -}; - -class VF_PUBLIC ObjectPrototypeFactory : public AbstractFactory -{ -public: - ~ObjectPrototypeFactory() = default; - static SPtr<ObjectPrototypeFactory> make() - { - return SPtr<ObjectPrototypeFactory>(new ObjectPrototypeFactory()); - } - - Object* make(ObjectType type) - { - switch (type) - { - case ObjectType::Cuboid: - return cuboid.clone(); - //case ObjectType::Sphere: - // return sphere.clone(); - } - } - - void setCuboid(Cuboid cuboid) - { - this->cuboid = cuboid; - } - - -private: - ObjectPrototypeFactory() = default; - ObjectPrototypeFactory(const ObjectPrototypeFactory& a) = default; - - - Cuboid cuboid; -}; - - - - -#endif diff --git a/src/GridGenerator/geometries/Sphere/Sphere.h b/src/GridGenerator/geometries/Sphere/Sphere.h index 20d772ebc..7ca12037a 100644 --- a/src/GridGenerator/geometries/Sphere/Sphere.h +++ b/src/GridGenerator/geometries/Sphere/Sphere.h @@ -7,11 +7,9 @@ #ifndef SPHERE_H #define SPHERE_H +#include "global.h" -#include "../Object.h" -#include <VirtualFluidsDefinitions.h> -#include <core/DataTypes.h> -#include <core/PointerDefinitions.h> +#include "geometries/Object.h" class VF_PUBLIC Sphere : public Object { diff --git a/src/GridGenerator/geometries/Sphere/SphereMocks.h b/src/GridGenerator/geometries/Sphere/SphereMocks.h deleted file mode 100644 index f054a86cf..000000000 --- a/src/GridGenerator/geometries/Sphere/SphereMocks.h +++ /dev/null @@ -1,58 +0,0 @@ -// _ ___ __ __________ _ __ -// | | / (_)____/ /___ ______ _/ / ____/ /_ __(_)___/ /____ -// | | / / / ___/ __/ / / / __ `/ / /_ / / / / / / __ / ___/ -// | |/ / / / / /_/ /_/ / /_/ / / __/ / / /_/ / / /_/ (__ ) -// |___/_/_/ \__/\__,_/\__,_/_/_/ /_/\__,_/_/\__,_/____/ -// -#ifndef SPHERE_MOCKS_H -#define SPHERE_MOCKS_H - - -#include "../Object.h" -#include <VirtualFluidsDefinitions.h> -#include <core/DataTypes.h> -#include "core/PointerDefinitions.h" - -class SphereDummy : public Object -{ -public: - double getX1Centroid() override { return 0.0; } - double getX1Minimum() override { return 0.0; } - double getX1Maximum() override { return 0.0; } - double getX2Centroid() override { return 0.0; } - double getX2Minimum() override { return 0.0; } - double getX2Maximum() override { return 0.0; } - double getX3Centroid() override { return 0.0; } - double getX3Minimum() override { return 0.0; } - double getX3Maximum() override { return 0.0; } - bool isPointInObject(const double& x1, const double& x2, const double& x3, const double& minOffset, - const double& maxOffset) override {} - bool isOnBoundary(const double& x1, const double& x2, const double& x3, const double& minOffset, - const double& maxOffset) override {} -}; - -class SphereStub : public SphereDummy -{ -private: - SphereStub(double centerX, double centerY, double centerZ, double radius) - : x(centerX), y(centerY), z(centerZ), radius(radius) {} -public: - SPtr<SphereStub> makeShared(double centerX, double centerY, double centerZ, double radius) { - return SPtr<SphereStub>(new SphereStub(centerX, centerY, centerZ, radius)); - } - - double getX1Minimum() override { return 0.0; } - double getX1Maximum() override { return 0.0; } - double getX2Minimum() override { return 0.0; } - double getX2Maximum() override { return 0.0; } - double getX3Minimum() override { return 0.0; } - double getX3Maximum() override { return 0.0; } - -private: - double x, y, z; - double radius; -}; - - - -#endif diff --git a/src/GridGenerator/geometries/Triangle/Triangle.cu b/src/GridGenerator/geometries/Triangle/Triangle.cu index 3cd7118a3..565167d96 100644 --- a/src/GridGenerator/geometries/Triangle/Triangle.cu +++ b/src/GridGenerator/geometries/Triangle/Triangle.cu @@ -1,7 +1,8 @@ #include "Triangle.h" -#include <GridGenerator/utilities/math/Math.h> #include "TriangleException.h" +#include "utilities/math/Math.h" + #include "grid/NodeValues.h" HOSTDEVICE Triangle::Triangle(Vertex &v1, Vertex &v2, Vertex &v3, Vertex &normal) : v1(v1), v2(v2), v3(v3), normal(normal), patchIndex(INVALID_INDEX) {} diff --git a/src/GridGenerator/geometries/Triangle/Triangle.h b/src/GridGenerator/geometries/Triangle/Triangle.h index 4e67d94c4..36c8b192b 100644 --- a/src/GridGenerator/geometries/Triangle/Triangle.h +++ b/src/GridGenerator/geometries/Triangle/Triangle.h @@ -1,15 +1,14 @@ #ifndef Triangle_h #define Triangle_h -#include "GridGenerator/global.h" +#include <memory> -#include "../Vertex/Vertex.h" +#include "global.h" -#include <memory> +#include "geometries/Vertex/Vertex.h" class TriangleMemento; - struct VF_PUBLIC Triangle { Vertex v1, v2, v3, normal; diff --git a/src/GridGenerator/geometries/Triangle/TriangleException.h b/src/GridGenerator/geometries/Triangle/TriangleException.h index bbc870781..962a471b3 100644 --- a/src/GridGenerator/geometries/Triangle/TriangleException.h +++ b/src/GridGenerator/geometries/Triangle/TriangleException.h @@ -1,5 +1,6 @@ #ifndef meshGenExcpetion_h #define meshGenExcpetion_h + #include <exception> #include <iostream> #include <string> diff --git a/src/GridGenerator/geometries/Triangle/TriangleTest.cpp b/src/GridGenerator/geometries/Triangle/TriangleTest.cpp deleted file mode 100644 index 3452d8963..000000000 --- a/src/GridGenerator/geometries/Triangle/TriangleTest.cpp +++ /dev/null @@ -1,190 +0,0 @@ -#include "gmock/gmock.h" -#include <GridGenerator/utilities/Transformator/Transformator.h> -#include "TriangleException.h" - -#include "Triangle.h" - - -using namespace testing; - -TEST(TriangleTest, callingStandardConstructor_createsCorrectTriangle) -{ - Triangle t; - - bool isV1Null = (t.v1 == Vertex(0, 0, 0)); - bool isV2Null = (t.v2 == Vertex(0, 0, 0)); - bool isV3Null = (t.v3 == Vertex(0, 0, 0)); - bool isNormalNull = (t.normal == Vertex(0, 0, 0)); - - EXPECT_TRUE(isV1Null); - EXPECT_TRUE(isV2Null); - EXPECT_TRUE(isV3Null); - EXPECT_TRUE(isNormalNull); -} - -TEST(TriangleTest, changeTriangleWithSetMethod) -{ - Triangle t; - - real v1x = 3.0f; - real v1y = 3.0f; - real v1z = 3.0f; - - real v2x = 1.0f; - real v2y = 1.0f; - real v2z = 3.0f; - - real v3x = -1.0f; - real v3y = 1.0f; - real v3z = 3.0f; - - t.set(Vertex(v1x,v1y,v1z), Vertex(v2x, v2y, v2z), Vertex(v3x, v3y, v3z)); - - - bool isV1Set = (t.v1 == Vertex(v1x, v1y, v1z)); - bool isV2Set = (t.v2 == Vertex(v2x, v2y, v2z)); - bool isV3Set = (t.v3 == Vertex(v3x, v3y, v3z)); - bool isNormalSet = (t.normal == Vertex(0, 0, -1.0)); - - EXPECT_TRUE(isV1Set); - EXPECT_TRUE(isV2Set); - EXPECT_TRUE(isV3Set); - EXPECT_TRUE(isNormalSet); -} - - -TEST(TriangleTest, getClosestPointsOnEdgesFromTriangle) -{ - Triangle t = Triangle(Vertex(0, 0, 0), Vertex(10, 0, 0), Vertex(0, 10, 0), Vertex(0, 0, 1)); - Vertex P4 = Vertex(0, 1, 5); - - Vertex p[3]; - t.getClosestPointsOnEdges(p, P4); - - bool isP1OnEdge = (p[0] == Vertex(0,0,0)); - bool isP2OnEdge = (p[1] == Vertex(4.5,5.5,0.0)); - bool isP3OnEdge = (p[2] == Vertex(0.0,1.0,0.0)); - - EXPECT_TRUE(isP1OnEdge); - EXPECT_TRUE(isP2OnEdge); - EXPECT_TRUE(isP3OnEdge); -} - -//TEST(TriangleTest, PointIsNotWithinTriangle) -//{ -// Triangle t = Triangle(Vertex(0, 0, 0), Vertex(10, 0, 0), Vertex(0, 10, 0), Vertex(0, 0, 1)); -// Vertex P4 = Vertex(1, 1, -2); -// -// EXPECT_FALSE(t.isNotNextToFace(P4)); -//} - -TEST(TriangleTest, calculatePerpendicularPoint) -{ - Triangle t = Triangle(Vertex(0, 0, 0), Vertex(10, 0, 0), Vertex(0, 10, 0), Vertex(0, 0, 1)); - Vertex P4 = Vertex(8, 5, -3); - - Vertex distPbances = t.getPerpedicularPointFrom(P4); - - bool isVertexEqual = distPbances == Vertex(8.0, 5.0, 0.0); - EXPECT_TRUE(isVertexEqual); -} - -TEST(TriangleTest, pointintersectTriangle_directionIntoTriangle_ExpectReturn1) -{ - Vertex normal = Vertex(-1.0f, 0.0f, 0.0f); - Triangle t = Triangle(Vertex(3.5, 0, 0), Vertex(3.5, 0, 9), Vertex(3.5, 9, 9), normal); - Vertex v = Vertex(3, 5, 5); - Vertex direction = Vertex(1.0f, 0, 0); - Vertex intersect; - - real q; - int err = t.getTriangleIntersection(v, direction, intersect, q); - ASSERT_THAT(err, Eq(0)); -} - - -TEST(TriangleTest, pointintersectTriangle_directionAgainstTriangle_ExpectReturn0) -{ - Vertex normal = Vertex(-1.0f, 0.0f, 0.0f); - Triangle t = Triangle(Vertex(3.5, 0, 0), Vertex(3.5, 0, 9), Vertex(3.5, 9, 9), normal); - Vertex v = Vertex(3, 5, 5); - Vertex direction = Vertex(-1.0f, 0, 0); - Vertex intersect; - - real q; - int err = t.getTriangleIntersection(v, direction, intersect, q); - ASSERT_THAT(err, Eq(1)); -} - - -TEST(TriangleTest, getHalfAngleBetweenTwoEqualTriangles_ExpectNullAngle) -{ - Triangle t1 = Triangle(Vertex(0, 0, 0), Vertex(10, 0, 0), Vertex(0, 10, 0), Vertex(0, 0, 1)); - Triangle t2 = Triangle(Vertex(0, 0, 0), Vertex(10, 0, 0), Vertex(0, 10, 0), Vertex(0, 0, 1)); - - real alpha = t1.getHalfAngleBetweenToAdjacentTriangle(t2); - ASSERT_THAT(alpha, RealEq(0.0)); -} - -TEST(TriangleTest, checkSTLwith90degreeOutpointingNormal) -{ - Triangle t1 = Triangle(Vertex(40.0f, 20.0f, 20.0f), Vertex(40.0f, 20.0f, 0.0f), Vertex(60.0f, 20.0f, 20.0f)); - Triangle t2 = Triangle(Vertex(60.0f, 20.0f, 20.0f), Vertex(40.0f, 40.0f, 20.0f), Vertex(40.0f, 20.0f, 20.0f)); - - real alpha = t1.getHalfAngleBetweenToAdjacentTriangle(t2); - ASSERT_THAT(alpha, RealEq(90.0 / 2.0)); -} - -TEST(TriangleTest, checkSTLwith90degreeInpointingNormal) -{ - Triangle t1 = Triangle(Vertex(40.0f, 20.0f, 20.0f), Vertex(40.0f, 20.0f, 40.0f), Vertex(60.0f, 20.0f, 20.0f)); - Triangle t2 = Triangle(Vertex(60.0f, 20.0f, 20.0f), Vertex(40.0f, 40.0f, 20.0f), Vertex(40.0f, 20.0f, 20.0f)); - - real alpha = t1.getHalfAngleBetweenToAdjacentTriangle(t2); - ASSERT_THAT(alpha, RealEq(270.0 / 2.0)); -} - -TEST(TriangleTest, checkSTLwith180degreeOutpointingNormal) -{ - Triangle t1 = Triangle(Vertex(40.0f, 20.0f, 20.0f), Vertex(40.0f, 0.0f, 20.0f), Vertex(60.0f, 20.0f, 20.0f)); - Triangle t2 = Triangle(Vertex(60.0f, 20.0f, 20.0f), Vertex(40.0f, 40.0f, 20.0f), Vertex(40.0f, 20.0f, 20.0f)); - - real alpha = t1.getHalfAngleBetweenToAdjacentTriangle(t2); - ASSERT_THAT(alpha, RealEq(180.0 / 2.0)); -} - -TEST(TriangleTest, checkSTLwithSmallDegreeOutpointingNormal) -{ - Triangle t2 = Triangle(Vertex(40.0f, 40.0f, 18.0f), Vertex(60.0f, 20.0f, 20.0f), Vertex(40.0f, 20.0f, 20.0f)); - Triangle t1 = Triangle(Vertex(60.0f, 20.0f, 20.0f), Vertex(40.0f, 40.0f, 20.0f), Vertex(40.0f, 20.0f, 20.0f)); - - real alpha = t1.getHalfAngleBetweenToAdjacentTriangle(t2); - ASSERT_TRUE(alpha < 30.0); -} - -TEST(TriangleTest, checkSTLwithBigDegreeInpointingNormal) -{ - Triangle t1 = Triangle(Vertex(40.0f, 40.0f, 20.0f), Vertex(60.0f, 20.0f, 20.0f), Vertex(40.0f, 20.0f, 20.0f)); - Triangle t2 = Triangle(Vertex(60.0f, 20.0f, 20.0f), Vertex(40.0f, 40.0f, 18.0f), Vertex(40.0f, 20.0f, 20.0f)); - - real alpha = t1.getHalfAngleBetweenToAdjacentTriangle(t2); - ASSERT_TRUE(alpha > 330.0 / 2); -} - -TEST(TriangleTest, getCommonEdgesFromTheSameTriangle_ExpectThreeEdges) -{ - Triangle t1 = Triangle(Vertex(0.0f, 0.0f, 0.0f), Vertex(10.0f, 0.0f, 0.0f), Vertex(0.0f, 10.0f, 0.0f)); - Triangle t2 = Triangle(Vertex(0.0f, 0.0f, 0.0f), Vertex(10.0f, 0.0f, 0.0f), Vertex(0.0f, 10.0f, 0.0f)); - int num = t1.getNumberOfCommonEdge(t2); - ASSERT_THAT(num, Eq(3)); -} - -TEST(TriangleTest, getCommonEdgeFromDifferentTriangles_ShouldReturnMinusOne) -{ - Triangle t1 = Triangle(Vertex(0.0f, 0.0f, 0.0f), Vertex(10.0f, 0.0f, 0.0f), Vertex(0.0f, 10.0f, 0.0f)); - Triangle t2 = Triangle(Vertex(10.0f, 100.0f, 100.0f), Vertex(102.0f, 122.0f, 100.0f), Vertex(3000.0f, 1000.0f, 100.0f)); - - - int num = t1.getCommonEdge(t2); - ASSERT_THAT(num, -1); -} diff --git a/src/GridGenerator/geometries/TriangularMesh/TriangularMesh.cu b/src/GridGenerator/geometries/TriangularMesh/TriangularMesh.cu index e8fafa769..429cd0b44 100644 --- a/src/GridGenerator/geometries/TriangularMesh/TriangularMesh.cu +++ b/src/GridGenerator/geometries/TriangularMesh/TriangularMesh.cu @@ -1,21 +1,20 @@ #include "TriangularMesh.h" -#include "io/STLReaderWriter/STLReader.h" -#include "utilities/transformator/TransformatorImp.h" -#include "triangleNeighborFinder/TriangleNeighborFinder.h" +#include "Core/Timer/Timer.h" +#include "VirtualFluidsBasics/numerics/geometry3d/GbTriFaceMesh3D.h" -#include "VirtualFluidsBasics/utilities/logger/Logger.h" - -#include "Timer/Timer.h" +#include "geometries/TriangularMesh/triangleNeighborFinder/TriangleNeighborFinder.h" +#include "geometries/TriangularMesh/TriangularMeshStrategy.h" -#include "numerics/geometry3d/GbTriFaceMesh3D.h" #include "io/STLReaderWriter/STLWriter.h" +#include "io/STLReaderWriter/STLReader.h" #include "grid/GridImp.h" -#include "geometries/TriangularMesh/TriangularMeshStrategy.h" #include "grid/NodeValues.h" +#include "utilities/transformator/TransformatorImp.h" + TriangularMesh* TriangularMesh::make(const std::string& fileName, const std::vector<uint> ignorePatches) { diff --git a/src/GridGenerator/geometries/TriangularMesh/TriangularMesh.h b/src/GridGenerator/geometries/TriangularMesh/TriangularMesh.h index ede26f964..db96292fa 100644 --- a/src/GridGenerator/geometries/TriangularMesh/TriangularMesh.h +++ b/src/GridGenerator/geometries/TriangularMesh/TriangularMesh.h @@ -1,19 +1,18 @@ #ifndef Geometry_h #define Geometry_h -#include "GridGenerator/global.h" - - #include <stdio.h> #include <cuda_runtime.h> #include <vector> #include <string> #include <memory> -#include "../Triangle/Triangle.h" -#include "../BoundingBox/BoundingBox.h" +#include "global.h" + +#include "geometries/Triangle/Triangle.h" +#include "geometries/BoundingBox/BoundingBox.h" -#include "../Object.h" +#include "geometries/Object.h" class GeometryMemento; class GbTriFaceMesh3D; diff --git a/src/GridGenerator/geometries/TriangularMesh/TriangularMeshStrategy.cpp b/src/GridGenerator/geometries/TriangularMesh/TriangularMeshStrategy.cpp index 92ee068d5..1b3ae3da9 100644 --- a/src/GridGenerator/geometries/TriangularMesh/TriangularMeshStrategy.cpp +++ b/src/GridGenerator/geometries/TriangularMesh/TriangularMeshStrategy.cpp @@ -1,15 +1,14 @@ #include "TriangularMeshStrategy.h" -#include "utilities/logger/Logger.h" +#include "Core/Timer/Timer.h" -#include "../Triangle/Triangle.h" -#include "TriangularMesh.h" -#include "grid/GridImp.h" +#include "VirtualFluidsBasics/numerics/geometry3d/GbTriFaceMesh3D.h" -#include "numerics/geometry3d/GbTriFaceMesh3D.h" -#include "grid/NodeValues.h" +#include "geometries/Triangle/Triangle.h" +#include "geometries/TriangularMesh/TriangularMesh.h" -#include "core/Timer/Timer.h" +#include "grid/GridImp.h" +#include "grid/NodeValues.h" void TriangularMeshDiscretizationStrategy::removeOddBoundaryCellNodes(GridImp* grid) { diff --git a/src/GridGenerator/geometries/TriangularMesh/TriangularMeshStrategy.h b/src/GridGenerator/geometries/TriangularMesh/TriangularMeshStrategy.h index 9bb555bfa..cd5edbce9 100644 --- a/src/GridGenerator/geometries/TriangularMesh/TriangularMeshStrategy.h +++ b/src/GridGenerator/geometries/TriangularMesh/TriangularMeshStrategy.h @@ -1,9 +1,7 @@ #ifndef TriangularMeshStrategy_H #define TriangularMeshStrategy_H -#include "GridGenerator/global.h" - -#include "VirtualFluidsDefinitions.h" +#include "global.h" class GridImp; class TriangularMesh; diff --git a/src/GridGenerator/geometries/TriangularMesh/TriangularMeshTest.cpp b/src/GridGenerator/geometries/TriangularMesh/TriangularMeshTest.cpp deleted file mode 100644 index e3c87f632..000000000 --- a/src/GridGenerator/geometries/TriangularMesh/TriangularMeshTest.cpp +++ /dev/null @@ -1,10 +0,0 @@ -#include "gmock/gmock.h" -#include "TriangularMesh.h" - -using namespace testing; - -class GeometryTest : public Test { -public: - void SetUp() { - } -}; diff --git a/src/GridGenerator/geometries/TriangularMesh/triangleNeighborFinder/TriangleNeighborFinderTest.cpp b/src/GridGenerator/geometries/TriangularMesh/triangleNeighborFinder/TriangleNeighborFinderTest.cpp deleted file mode 100644 index e800b9130..000000000 --- a/src/GridGenerator/geometries/TriangularMesh/triangleNeighborFinder/TriangleNeighborFinderTest.cpp +++ /dev/null @@ -1,52 +0,0 @@ -#include <vector> -#include <memory> - -#include "gmock/gmock.h" - -#include <GridGenerator/geometries/Triangle/Triangle.h> -#include "TriangleNeighborFinder.h" -#include <GridGenerator/utilities/Transformator/Transformator.h> - -using namespace testing; - - -class TriangleNeighborFinderTest : public Test { -public: - std::shared_ptr<TriangleNeighborFinder> finder; - std::vector<Triangle> triangles; - IntegerPtr2D indices; - - void SetUp() { - triangles.push_back(Triangle(Vertex((real)0, (real)1, (real)1), Vertex((real)0, (real)1, (real)0), Vertex((real)0, (real)0, (real)1))); - triangles.push_back(Triangle(Vertex((real)0, (real)1, (real)0), Vertex((real)0, (real)0, (real)0), Vertex((real)0, (real)0, (real)1))); - triangles.push_back(Triangle(Vertex((real)1, (real)1, (real)1), Vertex((real)1, (real)1, (real)0), Vertex((real)0, (real)1, (real)1))); - triangles.push_back(Triangle(Vertex((real)1, (real)1, (real)0), Vertex((real)0, (real)1, (real)0), Vertex((real)0, (real)1, (real)1))); - triangles.push_back(Triangle(Vertex((real)1, (real)0, (real)1), Vertex((real)1, (real)0, (real)0), Vertex((real)1, (real)1, (real)1))); - triangles.push_back(Triangle(Vertex((real)1, (real)0, (real)0), Vertex((real)1, (real)1, (real)0), Vertex((real)1, (real)1, (real)1))); - triangles.push_back(Triangle(Vertex((real)0, (real)0, (real)1), Vertex((real)0, (real)0, (real)0), Vertex((real)1, (real)0, (real)1))); - triangles.push_back(Triangle(Vertex((real)0, (real)0, (real)0), Vertex((real)1, (real)0, (real)0), Vertex((real)1, (real)0, (real)1))); - triangles.push_back(Triangle(Vertex((real)1, (real)1, (real)1), Vertex((real)0, (real)1, (real)1), Vertex((real)1, (real)0, (real)1))); - triangles.push_back(Triangle(Vertex((real)0, (real)1, (real)1), Vertex((real)0, (real)0, (real)1), Vertex((real)1, (real)0, (real)1))); - triangles.push_back(Triangle(Vertex((real)0, (real)1, (real)0), Vertex((real)1, (real)1, (real)0), Vertex((real)0, (real)0, (real)0))); - triangles.push_back(Triangle(Vertex((real)1, (real)1, (real)0), Vertex((real)1, (real)0, (real)0), Vertex((real)0, (real)0, (real)0))); - - finder = std::make_shared<TriangleNeighborFinder>(&triangles[0], (int)triangles.size()); - indices.size = (int) triangles.size(); - indices.DIM = DIMENSION; - indices.ptr = new int[indices.DIM * triangles.size()]; - } - - void TearDown() { - delete[] indices.ptr; - } -}; - -TEST_F(TriangleNeighborFinderTest, getNeighboursFromTriangle) { - unsigned int triangleID = 0; - finder->fillWithNeighborIndices(&indices, &triangles[0]); - - EXPECT_THAT(indices.ptr[triangleID * indices.DIM + 0], Eq(3)); - EXPECT_THAT(indices.ptr[triangleID * indices.DIM + 1], Eq(1)); - EXPECT_THAT(indices.ptr[triangleID * indices.DIM + 2], Eq(9)); -} - diff --git a/src/GridGenerator/geometries/TriangularMesh/triangleRefinement/TriangleRefinement.h b/src/GridGenerator/geometries/TriangularMesh/triangleRefinement/TriangleRefinement.h index 41581b3d8..a158169c0 100644 --- a/src/GridGenerator/geometries/TriangularMesh/triangleRefinement/TriangleRefinement.h +++ b/src/GridGenerator/geometries/TriangularMesh/triangleRefinement/TriangleRefinement.h @@ -1,11 +1,11 @@ #ifndef TriangleRefinement_h #define TriangleRefinement_h - #include <vector> -#include "GridGenerator/global.h" -#include "../triangleNeighborFinder/TriangleNeighborFinder.h" +#include "global.h" + +#include "geometries/TriangularMesh/triangleNeighborFinder/TriangleNeighborFinder.h" struct Triangle; struct Vertex; diff --git a/src/GridGenerator/geometries/TriangularMesh/triangleRefinement/TriangleRefinementTest.cpp b/src/GridGenerator/geometries/TriangularMesh/triangleRefinement/TriangleRefinementTest.cpp deleted file mode 100644 index 688ff037e..000000000 --- a/src/GridGenerator/geometries/TriangularMesh/triangleRefinement/TriangleRefinementTest.cpp +++ /dev/null @@ -1,117 +0,0 @@ -#include <vector> -#include <memory> - -#include "gmock/gmock.h" -#include <GridGenerator/geometries/Vertex/Vertex.h> -#include <GridGenerator/geometries/Triangle/Triangle.h> -#include "TriangleRefinement.h" -#include <GridGenerator/geometries/TriangularMesh/triangleNeighborFinder/TriangleNeighborFinder.h> -#include <GridGenerator/io/GridVTKWriter/GridVTKWriter.h> -#include <GridGenerator/utilities/Transformator/Transformator.h> - -using namespace testing; - - - -class TriangleRefinementTest : public Test { -public: - std::shared_ptr<TriangleRefinement> refiner; - std::vector<Triangle> triangles; - - void SetUp() { - triangles.push_back(Triangle(Vertex((real)0, (real)1, (real)1), Vertex((real)0, (real)1, (real)0), Vertex((real)0, (real)0, (real)1))); - triangles.push_back(Triangle(Vertex((real)0, (real)1, (real)0), Vertex((real)0, (real)0, (real)0), Vertex((real)0, (real)0, (real)1))); - triangles.push_back(Triangle(Vertex((real)1, (real)1, (real)1),Vertex((real)1, (real)1, (real)0),Vertex((real)0, (real)1, (real)1))); - triangles.push_back(Triangle(Vertex((real)1, (real)1, (real)0),Vertex((real)0, (real)1, (real)0),Vertex((real)0, (real)1, (real)1))); - triangles.push_back(Triangle(Vertex((real)1, (real)0, (real)1),Vertex((real)1, (real)0, (real)0),Vertex((real)1, (real)1, (real)1))); - triangles.push_back(Triangle(Vertex((real)1, (real)0, (real)0),Vertex((real)1, (real)1, (real)0),Vertex((real)1, (real)1, (real)1))); - triangles.push_back(Triangle(Vertex((real)0, (real)0, (real)1),Vertex((real)0, (real)0, (real)0),Vertex((real)1, (real)0, (real)1))); - triangles.push_back(Triangle(Vertex((real)0, (real)0, (real)0),Vertex((real)1, (real)0, (real)0),Vertex((real)1, (real)0, (real)1))); - triangles.push_back(Triangle(Vertex((real)1, (real)1, (real)1),Vertex((real)0, (real)1, (real)1),Vertex((real)1, (real)0, (real)1))); - triangles.push_back(Triangle(Vertex((real)0, (real)1, (real)1),Vertex((real)0, (real)0, (real)1),Vertex((real)1, (real)0, (real)1))); - triangles.push_back(Triangle(Vertex((real)0, (real)1, (real)0),Vertex((real)1, (real)1, (real)0),Vertex((real)0, (real)0, (real)0))); - triangles.push_back(Triangle(Vertex((real)1, (real)1, (real)0),Vertex((real)1, (real)0, (real)0),Vertex((real)0, (real)0, (real)0))); - - refiner = std::make_shared<TriangleRefinement>(&triangles); - } -}; - -TEST_F(TriangleRefinementTest, refineOneTriangle_shouldCreateTwoMoreTriangle) { - int oldSize = (int)triangles.size(); - refiner->refine(0); - - ASSERT_THAT(triangles.size(), Eq(oldSize + 2)); -} - - -TEST_F(TriangleRefinementTest, refineOneTriangle_triangleShouldBeDeleteAfterRefine) { - int refine = 0; - Triangle oldTriangle = triangles[refine]; - refiner->refine(refine); - - ASSERT_FALSE(oldTriangle.getNumberOfCommonEdge(triangles[refine]) == 3); -} - -TEST_F(TriangleRefinementTest, refineOneTriangle_newTrianglesAtTheEndMustHaveTwoCommonEdgesWithOld) { - int refine = 0; - Triangle oldTriangle = triangles[refine]; - refiner->refine(refine); - - Triangle firstNewTriangle = triangles[triangles.size() - 3]; - Triangle secondNewTriangle = triangles[triangles.size() - 4]; - EXPECT_THAT(oldTriangle.getNumberOfCommonEdge(firstNewTriangle), Eq(2)); - EXPECT_THAT(oldTriangle.getNumberOfCommonEdge(secondNewTriangle), Eq(2)); -} - -TEST_F(TriangleRefinementTest, refineQuadar_shouldDoubleTheTriangles_PlusTwoCauseOfFirstLoop) { - int oldSize = (int)triangles.size(); - refiner->refineUntilMinDistance(1); - - ASSERT_THAT(triangles.size(), Eq(oldSize * 2 + 2)); -} - - -TEST_F(TriangleRefinementTest, getHalfVertex){ - Vertex v1(10.0, 5.0, -2.0); - Vertex v2(5.0, 0.0, 10); - - Vertex half = TriangleRefinement::getHalfVertex(v1, v2); - - - EXPECT_THAT((double)half.x, DoubleEq(7.5)); - EXPECT_THAT((double)half.y, DoubleEq(2.5)); - EXPECT_THAT((double)half.z, DoubleEq(4)); -} - - -TEST_F(TriangleRefinementTest, getLongestDistance){ - - Triangle t = Triangle(Vertex(0, 0, 0), Vertex(10, 0, 0), Vertex(1, 1, 0), Vertex(0, 0, 0)); - - real d = TriangleRefinement::getLongestEdgeDistance(t); - ASSERT_THAT((double)d, DoubleEq(10.0)); -} - -TEST_F(TriangleRefinementTest, getLongestDistanceEdge_ExpectEdgeZero){ - - Triangle t = Triangle(Vertex(0, 0, 0), Vertex(10, 0, 0), Vertex(4, 4, 0), Vertex(0, 0, 0)); - - int edge = TriangleRefinement::getEdgeWithLongestDistance(t); - ASSERT_THAT(edge, Eq(0)); -} - -TEST_F(TriangleRefinementTest, getLongestDistanceEdge_ExpectEdgeOne){ - - Triangle t = Triangle(Vertex(4, 4, 0), Vertex(10, 0, 0), Vertex(0, 0, 0), Vertex(0, 0, 0)); - - int edge = TriangleRefinement::getEdgeWithLongestDistance(t); - ASSERT_THAT(edge, Eq(1)); -} - -TEST_F(TriangleRefinementTest, getLongestDistanceEdge_ExpectEdgeTwo){ - - Triangle t = Triangle(Vertex(0, 0, 0), Vertex(4, 4, 0), Vertex(10, 0, 0), Vertex(0, 0, 0)); - - int edge = TriangleRefinement::getEdgeWithLongestDistance(t); - ASSERT_THAT(edge, Eq(2)); -} diff --git a/src/GridGenerator/geometries/Vertex/Vertex.cu b/src/GridGenerator/geometries/Vertex/Vertex.cu index af382cd8e..878481977 100644 --- a/src/GridGenerator/geometries/Vertex/Vertex.cu +++ b/src/GridGenerator/geometries/Vertex/Vertex.cu @@ -1,7 +1,6 @@ #include "Vertex.h" -#include <GridGenerator/utilities/math/Math.h> - +#include "utilities/math/Math.h" HOSTDEVICE Vertex::Vertex(real x, real y, real z) : x(x), y(y), z(z){} HOSTDEVICE Vertex::Vertex() { x = 0.0f; y = 0.0f; z = 0.0f; } diff --git a/src/GridGenerator/geometries/Vertex/Vertex.h b/src/GridGenerator/geometries/Vertex/Vertex.h index 12e24a18c..51c7bb460 100644 --- a/src/GridGenerator/geometries/Vertex/Vertex.h +++ b/src/GridGenerator/geometries/Vertex/Vertex.h @@ -1,14 +1,13 @@ #ifndef VERTEX_H #define VERTEX_H -#include "GridGenerator/global.h" - - #include <stdio.h> #include <cuda_runtime.h> #include <memory> #include <ostream> +#include "global.h" + class VertexMemento; struct VF_PUBLIC Vertex diff --git a/src/GridGenerator/geometries/Vertex/VertexTest.cpp b/src/GridGenerator/geometries/Vertex/VertexTest.cpp deleted file mode 100644 index 785c6f933..000000000 --- a/src/GridGenerator/geometries/Vertex/VertexTest.cpp +++ /dev/null @@ -1,154 +0,0 @@ -#include "gmock/gmock.h" -#include "Vertex.h" - -using namespace testing; - -class VertexTest : public Test -{ -public: - Vertex vec1; - Vertex vec2; - - void SetUp() - { - vec1.x = vec1.y = vec1.z = 4.0f; - vec2.x = 0.0f; vec2.y = 2.4f; vec2.x = -1.3f; - } -}; - -TEST_F(VertexTest, overloadMinusOperator) -{ - Vertex vec3; - vec3.x = vec2.x - vec1.x; - vec3.y = vec2.y - vec1.y; - vec3.z = vec2.z - vec1.z; - - Vertex v4 = vec2 - vec1; - ASSERT_THAT(v4.x, RealEq(vec3.x)); - ASSERT_THAT(v4.y, RealEq(vec3.y)); - ASSERT_THAT(v4.z, RealEq(vec3.z)); -} - -TEST_F(VertexTest, overloadPlusOperator) -{ - Vertex vec3; - vec3.x = vec2.x + vec1.x; - vec3.y = vec2.y + vec1.y; - vec3.z = vec2.z + vec1.z; - - Vertex v4 = vec2 + vec1; - ASSERT_THAT(v4.x, RealEq(vec3.x)); - ASSERT_THAT(v4.y, RealEq(vec3.y)); - ASSERT_THAT(v4.z, RealEq(vec3.z)); -} - -TEST_F(VertexTest, overloadTimesOperatorWithSkalarProduct) -{ - real skalar = vec1.x * vec2.x + vec1.y * vec2.y + vec1.z * vec2.z; - ASSERT_THAT((vec1 * vec2), RealEq(skalar)); -} - -TEST_F(VertexTest, overloadTimesOperatorWithSkalarMultiplication) -{ - real skalar = 1.0f / 3.0f; - Vertex vec3; - vec3.x = skalar * vec1.x; - vec3.y = skalar * vec1.y; - vec3.z = skalar * vec1.z; - - Vertex v4 = vec1 * skalar; - - ASSERT_THAT(v4.x, RealEq(vec3.x)); - ASSERT_THAT(v4.y, RealEq(vec3.y)); - ASSERT_THAT(v4.z, RealEq(vec3.z)); -} - -TEST_F(VertexTest, getMagnitudeFromVector) -{ - Vertex v; - v.x = 4.0; - v.y = 3.0; - v.z = -1.0; - - const real expected = real(std::sqrt(16.0 + 9.0 + 1.0)); - ASSERT_THAT(v.getMagnitude(), RealEq(expected)); -} - -TEST_F(VertexTest, compareTwoVectors) -{ - Vertex v; - v.x = vec1.x; - v.y = vec1.y; - v.z = vec1.z; - ASSERT_THAT(v.isEqual(vec1), Eq(1)); -} - -TEST_F(VertexTest, checkEuclideanDistance) -{ - Vertex v = Vertex(3, 3, 3); - - ASSERT_FLOAT_EQ(v.getEuclideanDistanceTo(vec1), (float)sqrt(3)); -} - -TEST_F(VertexTest, checkEuclideanDistanceWithNullVector_ExpectNull) -{ - Vertex v1 = Vertex(0.0, 0.0, 0.0); - Vertex v2 = Vertex(0.0, 0.0, 0.0); - - ASSERT_THAT(v1.getEuclideanDistanceTo(v2), RealEq(0.0)); -} - -TEST(VertexAngleTest, checkInnerAngleBetweenToVectors_ExpectRightAngle) -{ - Vertex v1 = Vertex(1.0, 4.0, -2.0); - Vertex v2 = Vertex(-3.0, 3.0, 1); - - ASSERT_THAT((int)floor(v1.getInnerAngle(v2)), Eq(69)); -} - -TEST(VertexAngleTest, checkInnerAngleBetweenSameVectors_ExpectNull) -{ - Vertex v1 = Vertex(1.0, 4.0, -2.0); - Vertex v2 = Vertex(1.0, 4.0, -2.0); - - ASSERT_THAT((int)floor(v1.getInnerAngle(v2)), Eq(0.0)); -} - -TEST(VertexAngleTest, checkInnerAngleBetweenNullVectors_ExpectNull) -{ - Vertex v1 = Vertex(0.0, 0.0, 0.0); - Vertex v2 = Vertex(0.0, 0.0, 0.0); - - ASSERT_THAT((int)floor(v1.getInnerAngle(v2)), Eq(0.0)); -} - - -TEST(VertexAngleTest, checkInnerAngleBetweenSecondNullVectors_ExpectNull) -{ - Vertex v1 = Vertex(1.0, 0.0, 0.0); - Vertex v2 = Vertex(0.0, 0.0, 0.0); - - ASSERT_THAT((int)floor(v1.getInnerAngle(v2)), Eq(0.0)); -} - -TEST(VertexAngleTest, checkInnerAngleBetweenFirstNullVectors_ExpectNull) -{ - Vertex v1 = Vertex(0.0, 0.0, 0.0); - Vertex v2 = Vertex(2.0, 0.0, 0.0); - - ASSERT_THAT((int)floor(v1.getInnerAngle(v2)), Eq(0.0)); -} - - -TEST_F(VertexTest, crossProductBetweenTwoVectors) -{ - Vertex v1 = Vertex(-5.0, -5.0, 0.0); - Vertex v2 = Vertex(5.0, 0.0, 10); - - Vertex crossProd = Vertex(-50.0, 50.0, 25.0); - Vertex testCrossProduct = v1.crossProduct(v2); - - EXPECT_THAT(testCrossProduct.x, RealEq(crossProd.x)); - EXPECT_THAT(testCrossProduct.y, RealEq(crossProd.y)); - EXPECT_THAT(testCrossProduct.z, RealEq(crossProd.z)); -} diff --git a/src/GridGenerator/geometries/VerticalCylinder/VerticalCylinder.h b/src/GridGenerator/geometries/VerticalCylinder/VerticalCylinder.h index 98f18f08f..0bf95520e 100644 --- a/src/GridGenerator/geometries/VerticalCylinder/VerticalCylinder.h +++ b/src/GridGenerator/geometries/VerticalCylinder/VerticalCylinder.h @@ -7,11 +7,9 @@ #ifndef VERTICAL_CYLINDER_H #define VERTICAL_CYLINDER_H +#include "global.h" -#include "../Object.h" -#include <VirtualFluidsDefinitions.h> -#include <core/DataTypes.h> -#include <core/PointerDefinitions.h> +#include "geometries/Object.h" class VF_PUBLIC VerticalCylinder : public Object { diff --git a/src/GridGenerator/global.h b/src/GridGenerator/global.h index cd48f5e06..b6c93da2c 100644 --- a/src/GridGenerator/global.h +++ b/src/GridGenerator/global.h @@ -7,10 +7,13 @@ #define DIMENSION 3 #define MASTERRANK 0 - -#include <GridGenerator/utilities/cuda/cudaDefines.h> #include "VirtualFluidsDefinitions.h" -#include "core/PointerDefinitions.h" -#include "core/DataTypes.h" + +#include "Core/PointerDefinitions.h" +#include "Core/DataTypes.h" + +#include "Core/Logger/Logger.h" + +#include "utilities/cuda/cudaDefines.h" #endif diff --git a/src/GridGenerator/grid/BoundaryConditions/BoundaryCondition.cpp b/src/GridGenerator/grid/BoundaryConditions/BoundaryCondition.cpp index e5d5ca0ac..a969246fe 100644 --- a/src/GridGenerator/grid/BoundaryConditions/BoundaryCondition.cpp +++ b/src/GridGenerator/grid/BoundaryConditions/BoundaryCondition.cpp @@ -2,8 +2,8 @@ #include <cmath> -#include "Side.h" -#include "../Grid.h" +#include "grid/BoundaryConditions/Side.h" +#include "grid/Grid.h" bool BoundaryCondition::isSide( SideType side ) const { diff --git a/src/GridGenerator/grid/BoundaryConditions/BoundaryCondition.h b/src/GridGenerator/grid/BoundaryConditions/BoundaryCondition.h index cf589540e..9c60ace72 100644 --- a/src/GridGenerator/grid/BoundaryConditions/BoundaryCondition.h +++ b/src/GridGenerator/grid/BoundaryConditions/BoundaryCondition.h @@ -3,8 +3,8 @@ #include <vector> -#include <core/PointerDefinitions.h> -#include <core/DataTypes.h> +#include "global.h" + #include "grid/NodeValues.h" class Grid; diff --git a/src/GridGenerator/grid/BoundaryConditions/Side.cpp b/src/GridGenerator/grid/BoundaryConditions/Side.cpp index 9955efbd0..7f8fe8fd5 100644 --- a/src/GridGenerator/grid/BoundaryConditions/Side.cpp +++ b/src/GridGenerator/grid/BoundaryConditions/Side.cpp @@ -1,10 +1,10 @@ #include "Side.h" -#include "../Grid.h" -#include "../NodeValues.h" -#include <GridGenerator/utilities/math/Math.h> +#include "grid/BoundaryConditions/BoundaryCondition.h" +#include "grid/Grid.h" +#include "grid/NodeValues.h" -#include "BoundaryCondition.h" +#include "utilities/math/Math.h" void Side::addIndices(SPtr<Grid> grid, SPtr<BoundaryCondition> boundaryCondition, std::string coord, real constant, real startInner, real endInner, real startOuter, real endOuter) diff --git a/src/GridGenerator/grid/BoundaryConditions/Side.h b/src/GridGenerator/grid/BoundaryConditions/Side.h index d7190ea5c..717b965d0 100644 --- a/src/GridGenerator/grid/BoundaryConditions/Side.h +++ b/src/GridGenerator/grid/BoundaryConditions/Side.h @@ -4,10 +4,7 @@ #include <string> #include <vector> -#include <VirtualFluidsDefinitions.h> - -#include <core/PointerDefinitions.h> -#include <core/DataTypes.h> +#include "global.h" #define X_INDEX 0 #define Y_INDEX 1 diff --git a/src/GridGenerator/grid/Cell.h b/src/GridGenerator/grid/Cell.h index 53aad7918..845e02eaa 100644 --- a/src/GridGenerator/grid/Cell.h +++ b/src/GridGenerator/grid/Cell.h @@ -1,7 +1,8 @@ #ifndef CELL_H #define CELL_H -#include "core/DataTypes.h" +#include "global.h" + #include "utilities/cuda/cudaDefines.h" struct Point diff --git a/src/GridGenerator/grid/Field.cu b/src/GridGenerator/grid/Field.cu index 3f1265446..b3ae961aa 100644 --- a/src/GridGenerator/grid/Field.cu +++ b/src/GridGenerator/grid/Field.cu @@ -1,8 +1,7 @@ #include "Field.h" -#include <GridGenerator/grid/NodeValues.h> -#include <GridGenerator/grid/GridStrategy/GridStrategy.h> - +#include "grid/NodeValues.h" +#include "grid/GridStrategy/GridStrategy.h" HOST Field::Field(SPtr<GridStrategy> gridStrategy, uint size) : gridStrategy(gridStrategy), size(size) { diff --git a/src/GridGenerator/grid/Field.h b/src/GridGenerator/grid/Field.h index d991c4dad..2bc891ba7 100644 --- a/src/GridGenerator/grid/Field.h +++ b/src/GridGenerator/grid/Field.h @@ -1,7 +1,7 @@ #ifndef FIELD_H #define FIELD_H -#include "GridGenerator/global.h" +#include "global.h" struct Vertex; class GridStrategy; diff --git a/src/GridGenerator/grid/Grid.h b/src/GridGenerator/grid/Grid.h index a4cc4ae78..c4101ebbd 100644 --- a/src/GridGenerator/grid/Grid.h +++ b/src/GridGenerator/grid/Grid.h @@ -1,13 +1,14 @@ #ifndef GRID_H #define GRID_H -#include "GridGenerator/global.h" +#include "Core/LbmOrGks.h" -#include "core/LbmOrGks.h" +#include "global.h" -#include "Cell.h" #include "geometries/Vertex/Vertex.h" +#include "grid/Cell.h" + class TriangularMesh; struct Vertex; struct Triangle; diff --git a/src/GridGenerator/grid/GridBuilder/GridBuilder.h b/src/GridGenerator/grid/GridBuilder/GridBuilder.h index 3867f3173..8307d2d7f 100644 --- a/src/GridGenerator/grid/GridBuilder/GridBuilder.h +++ b/src/GridGenerator/grid/GridBuilder/GridBuilder.h @@ -1,13 +1,11 @@ #ifndef GridBuilder_H #define GridBuilder_H -#include "GridGenerator/global.h" - - #include <vector> #include <string> #include <memory> +#include "GridGenerator/global.h" #define GEOMQS 6 #define INLETQS 0 diff --git a/src/GridGenerator/grid/GridBuilder/LevelGridBuilder.cpp b/src/GridGenerator/grid/GridBuilder/LevelGridBuilder.cpp index dad73cb98..e3a7cf3cb 100644 --- a/src/GridGenerator/grid/GridBuilder/LevelGridBuilder.cpp +++ b/src/GridGenerator/grid/GridBuilder/LevelGridBuilder.cpp @@ -2,39 +2,31 @@ #include <stdio.h> #include <iostream> -#include <GridGenerator/grid/GridStrategy/GridGpuStrategy/GridGpuStrategy.h> -#include <GridGenerator/grid/GridStrategy/GridCpuStrategy/GridCpuStrategy.h> -#include <GridGenerator/grid/partition/Partition.h> -#include <GridGenerator/geometries/Triangle/Triangle.h> -#include <GridGenerator/geometries/BoundingBox/BoundingBox.h> -#include <GridGenerator/geometries/TriangularMesh/TriangularMesh.h> - - -#include <GridGenerator/io/GridVTKWriter/GridVTKWriter.h> -#include <GridGenerator/io/SimulationFileWriter/SimulationFileWriter.h> -#include <GridGenerator/io/VTKWriterWrapper/UnstructuredGridWrapper.h> -#include <GridGenerator/io/VTKWriterWrapper/PolyDataWriterWrapper.h> - -#include <GridGenerator/grid/NodeValues.h> - -#include <GridGenerator/geometries/Arrow/ArrowImp.h> -#include <GridGenerator/utilities/transformator/ArrowTransformator.h> - -#include <utilities/logger/Logger.h> - -#include <GridGenerator/grid/GridFactory.h> -#include "grid/GridInterface.h" -#include "grid/Grid.h" +#include "geometries/Arrow/ArrowImp.h" +#include "geometries/Triangle/Triangle.h" +#include "geometries/BoundingBox/BoundingBox.h" +#include "geometries/TriangularMesh/TriangularMesh.h" #include "grid/BoundaryConditions/BoundaryCondition.h" #include "grid/BoundaryConditions/Side.h" +#include "grid/GridStrategy/GridGpuStrategy/GridGpuStrategy.h" +#include "grid/GridStrategy/GridCpuStrategy/GridCpuStrategy.h" +#include "grid/partition/Partition.h" +#include "grid/NodeValues.h" +#include "grid/GridFactory.h" +#include "grid/GridInterface.h" +#include "grid/Grid.h" -#include <GridGenerator/io/QLineWriter.h> +#include "io/GridVTKWriter/GridVTKWriter.h" +#include "io/SimulationFileWriter/SimulationFileWriter.h" +#include "io/VTKWriterWrapper/UnstructuredGridWrapper.h" +#include "io/VTKWriterWrapper/PolyDataWriterWrapper.h" +#include "io/QLineWriter.h" +#include "utilities/transformator/ArrowTransformator.h" #include "utilities/communication.h" - #define GEOFLUID 19 #define GEOSOLID 16 diff --git a/src/GridGenerator/grid/GridBuilder/LevelGridBuilder.h b/src/GridGenerator/grid/GridBuilder/LevelGridBuilder.h index 0dcf16345..787161759 100644 --- a/src/GridGenerator/grid/GridBuilder/LevelGridBuilder.h +++ b/src/GridGenerator/grid/GridBuilder/LevelGridBuilder.h @@ -1,17 +1,16 @@ #ifndef LEVEL_GRID_BUILDER_H #define LEVEL_GRID_BUILDER_H -#include "GridGenerator/global.h" - #include <vector> #include <string> #include <memory> #include <array> -#include "GridBuilder.h" -#include "grid/GridInterface.h" +#include "global.h" +#include "grid/GridBuilder/GridBuilder.h" #include "grid/Grid.h" +#include "grid/GridInterface.h" #include "grid/NodeValues.h" struct Vertex; diff --git a/src/GridGenerator/grid/GridBuilder/LevelGridBuilderTest.cpp b/src/GridGenerator/grid/GridBuilder/LevelGridBuilderTest.cpp deleted file mode 100644 index 811882ba2..000000000 --- a/src/GridGenerator/grid/GridBuilder/LevelGridBuilderTest.cpp +++ /dev/null @@ -1,15 +0,0 @@ -#include "gmock/gmock.h" - -//#include "LevelGridBuilder.h" -//#include "../Grid.cuh" - -//TEST(LevelGridBuilderTest, addTwoGridsWithStartCoordinates_shouldMakeTheFistGridToLevel1) -//{ -// auto gridBuilder = LevelGridBuilder::makeShared("cpu", "D3Q27"); -// gridBuilder->addGrid(12.0, 12.0, 12.0, 14.0, 14.0, 14.0, false, false, false); -// gridBuilder->addGrid(10.0, 10.0, 10.0, 20.0, 20.0, 20.0, true, true, true); -// -// gridBuilder->generateGrids(); -// -// EXPECT_THAT(gridBuilder->getGrid(1)->startX, RealEq(12.25)); -//} diff --git a/src/GridGenerator/grid/GridBuilder/MultipleGridBuilder.cpp b/src/GridGenerator/grid/GridBuilder/MultipleGridBuilder.cpp index 8dc882f4f..432f0b236 100644 --- a/src/GridGenerator/grid/GridBuilder/MultipleGridBuilder.cpp +++ b/src/GridGenerator/grid/GridBuilder/MultipleGridBuilder.cpp @@ -6,15 +6,16 @@ #include <cmath> #include "utilities/math/Math.h" -#include "../Grid.h" -#include "../GridFactory.h" -#include <VirtualFluidsBasics/utilities/logger/Logger.h> +#include "geometries/BoundingBox/BoundingBox.h" + +#include "grid/BoundaryConditions/BoundaryCondition.h" +#include "grid/BoundaryConditions/Side.h" +#include "grid/Grid.h" +#include "grid/GridFactory.h" + #include "io/STLReaderWriter/STLWriter.h" #include "io/GridVTKWriter/GridVTKWriter.h" -#include <grid/BoundaryConditions/BoundaryCondition.h> -#include <grid/BoundaryConditions/Side.h> -#include "geometries/BoundingBox/BoundingBox.h" MultipleGridBuilder::MultipleGridBuilder(SPtr<GridFactory> gridFactory, Device device, const std::string &d3qxx) : LevelGridBuilder(device, d3qxx), gridFactory(gridFactory), solidObject(nullptr), numberOfLayersFine(12), numberOfLayersBetweenLevels(8), subDomainBox(nullptr) diff --git a/src/GridGenerator/grid/GridBuilder/MultipleGridBuilder.h b/src/GridGenerator/grid/GridBuilder/MultipleGridBuilder.h index 3bd71331f..7b1629458 100644 --- a/src/GridGenerator/grid/GridBuilder/MultipleGridBuilder.h +++ b/src/GridGenerator/grid/GridBuilder/MultipleGridBuilder.h @@ -1,16 +1,15 @@ #ifndef MULTIPLE_GRID_BUILDER_H #define MULTIPLE_GRID_BUILDER_H -#include "GridGenerator/global.h" - #include <vector> #include <array> -#include "core/LbmOrGks.h" +#include "Core/LbmOrGks.h" -#include "LevelGridBuilder.h" +#include "global.h" -#include "../GridFactory.h" +#include "grid/GridBuilder/LevelGridBuilder.h" +#include "grid/GridFactory.h" class Object; class BoundingBox; diff --git a/src/GridGenerator/grid/GridBuilder/MultipleGridBuilderTest.cpp b/src/GridGenerator/grid/GridBuilder/MultipleGridBuilderTest.cpp deleted file mode 100644 index 67bc2059f..000000000 --- a/src/GridGenerator/grid/GridBuilder/MultipleGridBuilderTest.cpp +++ /dev/null @@ -1,120 +0,0 @@ -#include "gmock/gmock.h" - -#include "MultipleGridBuilder.h" -#include "../GridMocks.h" -#include "../GridStrategy/GridStrategyMocks.h" -#include "../GridFactory.h" - -class MultipleGridBuilderAddGridTest : public testing::Test -{ - virtual void SetUp() override - { - gridFactory = GridFactory::make(); - gridFactory->setGridStrategy(SPtr<GridStrategy>(new GridStrategyDummy())); - gridBuilder = MultipleGridBuilder::makeShared(gridFactory); - } -public: - SPtr<MultipleGridBuilder> gridBuilder; - -private: - SPtr<GridFactory> gridFactory; -}; - -TEST_F(MultipleGridBuilderAddGridTest, addOneGrid_numberOfLevelsShouldBeOne) -{ - gridBuilder->addCoarseGrid(0.0, 0.0, 0.0, 10.0, 10.0, 10.0, 1.0); - - ASSERT_THAT(gridBuilder->getNumberOfLevels(), testing::Eq(1)); -} - -TEST_F(MultipleGridBuilderAddGridTest, addTwoGridsWhereSecondGridIsBigger_GridShouldNotAdded) -{ - gridBuilder->addCoarseGrid(0.0, 0.0, 0.0, 10.0, 10.0, 10.0, 1.0); - gridBuilder->addGrid(new Cuboid(0.0, 0.0, 0.0, 20.0, 20.0, 20.0)); - ASSERT_THAT(gridBuilder->getNumberOfLevels(), testing::Eq(1)); -} - -TEST_F(MultipleGridBuilderAddGridTest, givenCoarseGrid_addAdditionalGrid_shouldCalculateDelta) -{ - const real delta = 2.0; - gridBuilder->addCoarseGrid(0.0, 0.0, 0.0, 10.0, 10.0, 10.0, delta); - - gridBuilder->addGrid(new Cuboid(4.0, 4.0, 4.0, 6.0, 6.0, 6.0)); - - ASSERT_THAT(gridBuilder->getDelta(1), RealEq(delta * 0.5)); -} - -TEST_F(MultipleGridBuilderAddGridTest, addGridWithoutCoarseGrid_shouldNotbeAdded) -{ - gridBuilder->addGrid(new Cuboid(0.0, 0.0, 0.0, 20.0, 20.0, 20.0)); - - ASSERT_THAT(gridBuilder->getNumberOfLevels(), testing::Eq(0)); -} - -TEST_F(MultipleGridBuilderAddGridTest, getInvalidLevel_shouldThrowException) -{ - ASSERT_THROW(gridBuilder->getDelta(0), std::exception); -} - -TEST_F(MultipleGridBuilderAddGridTest, addGridWithoutCoarseGrid_ShouldNotAddingAGrid) -{ - gridBuilder->addGrid(new Cuboid(0, 0, 0, 0, 0, 0), 0); - - ASSERT_THAT(gridBuilder->getNumberOfLevels(), testing::Eq(0)); -} - - -TEST_F(MultipleGridBuilderAddGridTest, addGridWithFloatingStartPoints_ShouldCreatedStaggeredCoordinatesToCoarseGrid) -{ - gridBuilder->addCoarseGrid(0.0, 0.0, 0.0, 15.0, 15.0, 15.0, 1); - - gridBuilder->addGrid(new Cuboid(1.76, 1.76, 1.76, 10.51, 10.51, 10.51)); - - - EXPECT_THAT(gridBuilder->getStartX(1), RealEq(1.75)); - EXPECT_THAT(gridBuilder->getStartY(1), RealEq(1.75)); - EXPECT_THAT(gridBuilder->getStartZ(1), RealEq(1.75)); - - EXPECT_THAT(gridBuilder->getEndX(1), RealEq(10.75)); - EXPECT_THAT(gridBuilder->getEndY(1), RealEq(10.75)); - EXPECT_THAT(gridBuilder->getEndZ(1), RealEq(10.75)); -} - - - -TEST(MultipleGridBuilderTest, everyExceptTheFinestGrid_shouldHaveAGridInterface) -{ - auto gridFactory = GridFactory::make(); - gridFactory->setGridStrategy(SPtr<GridStrategy>(new GridStrategyDummy())); - gridFactory->setGridType(TestDouble::SPY); - auto gridBuilder = MultipleGridBuilder::makeShared(gridFactory); - gridBuilder->addCoarseGrid(0.0, 0.0, 0.0, 15.0, 15.0, 15.0, 1.0); - gridBuilder->addGrid(new Cuboid(7.0, 7.0, 7.0, 10.0, 10.0, 10.0), 2); - - gridBuilder->buildGrids(LBM); - - auto grid0 = std::dynamic_pointer_cast<GridSpy>(gridBuilder->getGrid(0)); - auto grid1 = std::dynamic_pointer_cast<GridSpy>(gridBuilder->getGrid(1)); - EXPECT_TRUE(grid0->hasGridInterface()); - EXPECT_TRUE(grid1->hasGridInterface()); -} - - -TEST(MultipleGridBuilderTest, afterCreatingGridInterface_FineGridsShouldNotBeHavePeriodicBoundarys) -{ - auto gridFactory = GridFactory::make(); - gridFactory->setGridStrategy(SPtr<GridStrategy>(new GridStrategyDummy())); - gridFactory->setGridType(TestDouble::SPY); - - auto gridBuilder = MultipleGridBuilder::makeShared(gridFactory); - gridBuilder->addCoarseGrid(0.0, 0.0, 0.0, 15.0, 15.0, 15.0, 1.0); - gridBuilder->addGrid(new Cuboid(7.0, 7.0, 7.0, 10.0, 10.0, 10.0), 2); - - gridBuilder->buildGrids(LBM); - - auto grid1 = std::dynamic_pointer_cast<GridSpy>(gridBuilder->getGrid(1)); - auto grid2 = std::dynamic_pointer_cast<GridSpy>(gridBuilder->getGrid(2)); - - EXPECT_TRUE(grid1->hasNoPeriodicityBoundaries()); - EXPECT_TRUE(grid2->hasNoPeriodicityBoundaries()); -} diff --git a/src/GridGenerator/grid/GridBuilder/ParallelGridBuilder.cpp b/src/GridGenerator/grid/GridBuilder/ParallelGridBuilder.cpp deleted file mode 100644 index d8e43b2ef..000000000 --- a/src/GridGenerator/grid/GridBuilder/ParallelGridBuilder.cpp +++ /dev/null @@ -1,541 +0,0 @@ -//#include "ParallelGridBuilder.h" -// -//#include "mpi.h" -// -//#include <stdio.h> -//#include <iostream> -//#include <GridGenerator/grid/Grid.cuh> -//#include <GridGenerator/grid/GridWrapper/GridWrapperCPU/GridWrapperCPU.h> -//#include <GridGenerator/grid/GridWrapper/GridWrapperGPU/GridWrapperGPU.h> -//#include <GridGenerator/grid/partition/Partition.h> -// -//#include <GridGenerator/geometries/Triangle/Triangle.h> -//#include <GridGenerator/geometries/BoundingBox/BoundingBox.h> -//#include <GridGenerator/geometries/TriangularMesh/TriangularMesh.h> -// -//#include <GridGenerator/utilities/Transformator/Transformator.h> -// -//#include <GridGenerator/io/GridVTKWriter/GridVTKWriter.h> -//#include <GridGenerator/io/SimulationFileWriter/SimulationFileWriter.h> -//#include <GridGenerator/io/VTKWriterWrapper/UnstructuredGridWrapper.h> -//#include <GridGenerator/io/VTKWriterWrapper/PolyDataWriterWrapper.h> -// -//#include <GridGenerator/grid/NodeValues.h> -// -//#include <GridGenerator/geometries/Arrow/ArrowImp.h> -//#include <GridGenerator/utilities/Transformator/ArrowTransformator.h> -// -//#include <utilities/logger/Logger.h> -// -// -//#include <utilities/StringUtil/StringUtil.h> -// -//#include <GridGenerator/geometries/Geometry/Serialization/GeometryMemento.h> -// -//#include <boost/archive/text_iarchive.hpp> -//#include <boost/archive/text_oarchive.hpp> -// -//#include <boost/archive/binary_iarchive.hpp> -//#include <boost/archive/binary_oarchive.hpp> -// -//void serialize(const GeometryMemento &memento, const std::string &filename) -//{ -// std::ofstream ofs(filename, std::ios::binary); -// boost::archive::binary_oarchive oa(ofs); -// oa << memento; -//} -//void deserialize(GeometryMemento &memento, const std::string &filename) -//{ -// std::ifstream ifs(filename, std::ios::binary); -// boost::archive::binary_iarchive ia(ifs); -// ia >> memento; -//} -// -//#define GEOFLUID 19 -//#define GEOSOLID 16 -// -// -//ParallelGridBuilder::ParallelGridBuilder(GenerationDevice device) : device(device) -//{ -// this->Qs.resize(QFILES); -// this->channelBoundaryConditions.resize(6); -// channelBoundaryConditions[0] = "periodic"; -// channelBoundaryConditions[1] = "periodic"; -// channelBoundaryConditions[2] = "periodic"; -// channelBoundaryConditions[3] = "periodic"; -// channelBoundaryConditions[4] = "periodic"; -// channelBoundaryConditions[5] = "periodic"; -//} -// -// -//ParallelGridBuilder::~ParallelGridBuilder() -//{ -// -//} -// -//void ParallelGridBuilder::meshGeometry(std::string input, int level) -//{ -// checkLevel(level); -// -// for (int i = 0; i < rankTasks.size(); i += 2) -// { -// int levelTask = rankTasks[i]; -// -// int index = rankTasks[i + 1]; -// -// if (levelTask == level) -// { -// Geometry* geometry; -// if (StringUtil::endsWith(input, ".stl") || StringUtil::endsWith(input, ".STL")) -// { -// geometry = new Geometry(input, boxes[level][index], transformators[level].get()); -// printf("Serialize State\n"); -// GeometryMemento memento = geometry->getState(); -// serialize(memento, input + "state"); -// } -// else { -// *logging::out << logging::Logger::INTERMEDIATE << "start reading memento ...\n"; -// -// clock_t begin = clock(); -// geometry = new Geometry(); -// GeometryMemento memento; -// deserialize(memento, input); -// geometry->setState(memento); -// clock_t end = clock(); -// -// real time = real(end - begin) / CLOCKS_PER_SEC; -// *logging::out << logging::Logger::INTERMEDIATE << "time reading memento: " << SSTR(time) << "s\n"; -// } -// -// if (geometry->size > 0) -// this->gridKernels[level][index]->meshGrid(*geometry); -// //this->gridKernels[level][index]->copyDataFromGPU(); -// delete geometry; -// } -// } -//} -// -//void ParallelGridBuilder::deleteSolidNodes() -//{ -// this->gridKernels[0][0]->deleteSolidNodes(); -// this->gridKernels[0][0]->copyDataFromGPU(); -//} -// -//void ParallelGridBuilder::flood(Vertex &startFlood, int level) -//{ -// checkLevel(level); -// this->gridKernels[level][0]->floodFill(startFlood); -//} -// -//void ParallelGridBuilder::createBoundaryConditions() -//{ -// this->createBCVectors(); -//} -// -// -//unsigned int ParallelGridBuilder::getNumberOfNodes(unsigned int level) const -//{ -// return (unsigned int) this->gridKernels[level][0]->grid.reducedSize; -//} -// -//std::vector<std::vector<std::vector<real> > > ParallelGridBuilder::getQsValues() const -//{ -// return this->Qs; -//} -// -//int ParallelGridBuilder::getBoundaryConditionSize(int rb) const -//{ -// return (int)Qs[rb].size(); -//} -// -//std::vector<std::string> ParallelGridBuilder::getTypeOfBoundaryConditions() const -//{ -// return this->channelBoundaryConditions; -//} -// -//void ParallelGridBuilder::writeGridToVTK(std::string output, int level) -//{ -// checkLevel(level); -// int rank; -// MPI_Comm_rank(MPI_COMM_WORLD, &rank); -// -// for (int i = 0; i < rankTasks.size(); i += 2) -// { -// int levelTask = rankTasks[i]; -// int index = rankTasks[i + 1]; -// -// if (levelTask == level) { -// std::stringstream ss; -// ss << output << rank; -// GridVTKWriter::writeGridToVTK(this->gridKernels[level][index]->grid, ss.str(), this->transformators[level], true); -// } -// } -//} -// -// -//void ParallelGridBuilder::writeSimulationFiles(std::string output, BoundingBox &nodesDelete, bool writeFilesBinary, int level) -//{ -// //checkLevel(level); -// //UnstructuredParallelGridBuilder builder; -// //builder.buildUnstructuredGrid(this->gridKernels[level]->grid, nodesDelete); -// -// //std::vector<Node> coords = builder.getCoordsVec(); -// //std::vector<std::vector<std::vector<real> > > qs = builder.getQsValues(); -// //SimulationFileWriter::writeSimulationFiles(output, coords, qs, writeFilesBinary, this->gridKernels[level]->grid, this->transformators[level]); -//} -// -//std::shared_ptr<GridWrapper> ParallelGridBuilder::getGridWrapper(int level, int box) -//{ -// return this->gridKernels[level][box]; -//} -// -//void ParallelGridBuilder::checkLevel(int level) -//{ -// if (level >= boxes.size()) { std::cout << "wrong level input... return to caller\n"; return; } -//} -// -// -//void ParallelGridBuilder::addGrid(real length, real width, real high, real delta, std::string distribution, std::shared_ptr<Transformator> trans) -//{ -// this->transformators.push_back(trans); -// -// int rank; -// MPI_Comm_rank(MPI_COMM_WORLD, &rank); -// -// this->setCudaDevice(rank); -// this->setNumberOfNodes(length, width, high, delta); -// this->rebuildBoxes(); -// -// if (rank == 0) -// this->sendTasks(); -// else -// this->receiveTasks(); -// -// this->createGridKernels(distribution); -//} -// -//void ParallelGridBuilder::createGridKernels(std::string distribution) -//{ -// for (int i = 0; i < rankTasks.size(); i += 2) -// { -// int level = rankTasks[i]; -// int index = rankTasks[i + 1]; -// -// switch (this->device) -// { -// case GenerationDevice::CPU: -// this->gridKernels[level][index] = std::shared_ptr<GridWrapperCPU>(new GridWrapperCPU(this->boxes[level][index], distribution)); -// break; -// case GenerationDevice::GPU: -// this->gridKernels[level][index] = std::shared_ptr<GridWrapperGPU>(new GridWrapperGPU(this->boxes[level][index], distribution)); -// break; -// } -// } -//} -// -// -//void ParallelGridBuilder::setNumberOfNodes(real length, real width, real high, real delta) -//{ -// int nx = (int)(length / delta); -// int ny = (int)(width / delta); -// int nz = (int)(high / delta); -// -// std::vector<int> dim = { nx,ny,nz }; -// this->gridDimensions.push_back(dim); -// -// this->printMasterInformation(nx, ny, nz); -//} -// -//void ParallelGridBuilder::printMasterInformation(int nx, int ny, int nz) -//{ -// *logging::out << "global field dimension : " << SSTR(nx) << ", " << SSTR(ny) << ", " << SSTR(nz) << "\n"; -// *logging::out << "global field size : " << SSTR(nx * ny * nz) << "\n"; -// *logging::out << "------------------------------------------- \n"; -//} -// -//void ParallelGridBuilder::setCudaDevice(int rank) -//{ -// int countDevices; -// cudaGetDeviceCount(&countDevices); -//#ifdef __unix__ -// char hostname[1024]; -// hostname[1023] = '\0'; -// gethostname(hostname, 1023); -// -// std::string hostnameStr(hostname); -// int device = rank % 4; -// cudaSetDevice(device); -// logging::Logger::getInstance()->logTerminal("Hostname: " + hostnameStr + ", device: " + SSTR(device) + "/" + SSTR(countDevices) + "\n"); -//#else -// cudaSetDevice(1); -//#endif -//} -// -//void ParallelGridBuilder::rebuildBoxes() -//{ -// int numProcess; -// MPI_Comm_size(MPI_COMM_WORLD, &numProcess); -// int actualLevelSize = (int)this->boxes.size() + 1; -// this->boxes.resize(actualLevelSize); -// this->gridKernels.resize(actualLevelSize); -// -// //for each level rebuild boxes -// for (int i = 0; i < actualLevelSize; i++) { -// this->boxes[i] = Partition::getProcessBoxes(numProcess / actualLevelSize, gridDimensions[i][0], gridDimensions[i][1], gridDimensions[i][2]); -// this->gridKernels[i].resize(this->boxes[i].size()); -// } -//} -// -//void ParallelGridBuilder::sendTasks() -//{ -// int numProcess; -// MPI_Comm_size(MPI_COMM_WORLD, &numProcess); -// std::vector<std::vector<int> >tasks = Partition::partitionBoxes(this->boxes, numProcess, transformators); -// -// rankTasks.resize(tasks[0].size()); -// for (int i = 0; i < rankTasks.size(); i++) { -// rankTasks[i] = tasks[0][i]; -// } -// -// for (int i = 1; i < numProcess; i++) { -// int numOfBoxes = (int)tasks[i].size(); -// MPI_Send(&numOfBoxes, 1, MPI_INT, i, 0, MPI_COMM_WORLD); -// MPI_Send(&tasks[i][0], numOfBoxes, MPI_INT, i, 1, MPI_COMM_WORLD); -// } -//} -// -//void ParallelGridBuilder::receiveTasks() -//{ -// int numOfBoxes; -// MPI_Status status; -// MPI_Recv(&numOfBoxes, 1, MPI_INT, 0, 0, MPI_COMM_WORLD, &status); -// rankTasks.resize(numOfBoxes); -// -// int *boxNumbers = new int[numOfBoxes]; -// MPI_Recv(boxNumbers, numOfBoxes, MPI_INT, 0, 1, MPI_COMM_WORLD, &status); -// -// for (int i = 0; i < numOfBoxes; i++) { -// rankTasks[i] = boxNumbers[i]; -// } -// delete[] boxNumbers; -//} -// -//void ParallelGridBuilder::writeBoxes(std::string name) -//{ -// //int rank; -// //MPI_Comm_rank(MPI_COMM_WORLD, &rank); -// -// //UnstructuredGridWrapper writer; -// //for (int i = 0; i < rankTasks.size(); i += 2) { -// // int level = rankTasks[i]; -// // int index = rankTasks[i + 1]; -// // BoundingBox box = boxes[level][index]; -// // transformators[level]->transformGridToWorld(box); -// // writer.addBoundingBox(box, rank); -// //} -// //writer.writeUnstructuredGridToFile(name); -//} -// -// -//void ParallelGridBuilder::getDimensions(int &nx, int &ny, int &nz, const int level) const -//{ -// nx = this->gridKernels[level][0]->grid.nx; -// ny = this->gridKernels[level][0]->grid.ny; -// nz = this->gridKernels[level][0]->grid.nz; -//} -// -//void ParallelGridBuilder::getNodeValues(real *xCoords, real *yCoords, real *zCoords, unsigned int *neighborX, unsigned int *neighborY, unsigned int *neighborZ, unsigned int *geo, const int level) const -//{ -// xCoords[0] = 0; -// yCoords[0] = 0; -// zCoords[0] = 0; -// neighborX[0] = 0; -// neighborY[0] = 0; -// neighborZ[0] = 0; -// geo[0] = GEOSOLID; -// -// Grid grid = this->gridKernels[level][0]->grid; -// -// for (int i = 0; i < grid.reducedSize; i++) -// { -// real x, y, z; -// grid.transIndexToCoords(grid.matrixIndex[i], x, y, z); -// -// xCoords[i + 1] = x; -// yCoords[i + 1] = y; -// zCoords[i + 1] = z; -// neighborX[i + 1] = (unsigned int)(grid.neighborIndexX[grid.matrixIndex[i]] + 1); -// neighborY[i + 1] = (unsigned int)(grid.neighborIndexY[grid.matrixIndex[i]] + 1); -// neighborZ[i + 1] = (unsigned int)(grid.neighborIndexZ[grid.matrixIndex[i]] + 1); -// geo[i + 1] = (unsigned int)grid.isSolid(grid.matrixIndex[i]) ? GEOSOLID : GEOFLUID; -// } -//} -// -//void ParallelGridBuilder::setQs(real** q27, int* k, int channelSide, unsigned int level) const -//{ -// for (int index = 0; index < Qs[channelSide].size(); index++) { -// k[index] = (int)Qs[channelSide][index][0]; -// for (int column = 1; column < Qs[channelSide][index].size(); column++) { -// q27[column - 1][index] = Qs[channelSide][index][column]; -// -// } -// } -//} -// -//void ParallelGridBuilder::setOutflowValues(real* RhoBC, int* kN, int channelSide, int level) const -//{ -// for (int index = 0; index < Qs[channelSide].size(); index++) { -// RhoBC[index] = 0.0; -// kN[index] = 0; -// } -//} -// -//void ParallelGridBuilder::setVelocityValues(real* vx, real* vy, real* vz, int channelSide, int level) const -//{ -// for (int index = 0; index < Qs[channelSide].size(); index++) { -// vx[index] = 0.0; -// vy[index] = 0.0; -// vz[index] = 0.0; -// } -//} -// -//void ParallelGridBuilder::setPressValues(real* RhoBC, int* kN, int channelSide, int level) const -//{ -// for (int index = 0; index < Qs[channelSide].size(); index++) { -// RhoBC[index] = 0.0; -// kN[index] = 0; -// } -//} -// -// -///*#################################################################################*/ -///*---------------------------------private methods---------------------------------*/ -///*---------------------------------------------------------------------------------*/ -//void ParallelGridBuilder::createBCVectors() -//{ -// Grid grid = this->gridKernels[0][0]->grid; -// for (int i = 0; i < grid.reducedSize; i++) -// { -// real x, y, z; -// grid.transIndexToCoords(grid.matrixIndex[i], x, y, z); -// -// if (grid.field[grid.matrixIndex[i]] == Q) /*addShortQsToVector(i);*/ addQsToVector(i); -// if (x == 0 && y < grid.ny - 1 && z < grid.nz - 1) fillRBForNode(x, y, z, i, 0, -1, INLETQS); -// if (x == grid.nx - 2 && y < grid.ny - 1 && z < grid.nz - 1) fillRBForNode(x, y, z, i, 0, 1, OUTLETQS); -// -// if (z == grid.nz - 2 && x < grid.nx - 1 && y < grid.ny - 1) fillRBForNode(x, y, z, i, 2, 1, TOPQS); -// if (z == 0 && x < grid.nx - 1 && y < grid.ny - 1) fillRBForNode(x, y, z, i, 2, -1, BOTTOMQS); -// -// if (y == 0 && x < grid.nx - 1 && z < grid.nz - 1) fillRBForNode(x, y, z, i, 1, -1, FRONTQS); -// if (y == grid.ny - 2 && x < grid.nx - 1 && z < grid.nz - 1) fillRBForNode(x, y, z, i, 1, 1, BACKQS); -// } -//} -// -//void ParallelGridBuilder::addShortQsToVector(int index) -//{ -// uint32_t qKey = 0; -// std::vector<real> qNode; -// -// Grid grid = this->gridKernels[0][0]->grid; -// for (int i = grid.d.dir_end; i >= 0; i--) -// { -// int qIndex = i * grid.size + grid.matrixIndex[index]; -// real q = grid.d.f[qIndex]; -// if (q > 0) { -// //printf("Q%d (old:%d, new:%d), : %2.8f \n", i, coordsVec[index].matrixIndex, index, grid.d.f[i * grid.size + coordsVec[index].matrixIndex]); -// qKey += (uint32_t)pow(2, 26 - i); -// qNode.push_back(q); -// } -// } -// if (qKey > 0) { -// real transportKey = *((real*)&qKey); -// qNode.push_back(transportKey); -// qNode.push_back((real)index); -// Qs[GEOMQS].push_back(qNode); -// } -// qNode.clear(); -//} -// -//void ParallelGridBuilder::addQsToVector(int index) -//{ -// std::vector<real> qNode; -// qNode.push_back((real)index); -// -// Grid grid = this->gridKernels[0][0]->grid; -// for (int i = grid.d.dir_end; i >= 0; i--) -// { -// int qIndex = i * grid.size + grid.matrixIndex[index]; -// real q = grid.d.f[qIndex]; -// if (q > 0) -// qNode.push_back(q); -// else -// qNode.push_back(-1); -// } -// Qs[GEOMQS].push_back(qNode); -// qNode.clear(); -//} -// -//void ParallelGridBuilder::fillRBForNode(int x, int y, int z, int index, int direction, int directionSign, int rb) -//{ -// uint32_t qKey = 0; -// std::vector<real> qNode; -// -// Grid grid = this->gridKernels[0][0]->grid; -// for (int i = grid.d.dir_end; i >= 0; i--) -// { -// if (grid.d.dirs[i * DIMENSION + direction] != directionSign) -// continue; -// -// qKey += (uint32_t)pow(2, 26 - i); -// qNode.push_back(0.5f); -// } -// if (qKey > 0) { -// real transportKey = *((real*)&qKey); -// qNode.push_back(transportKey); -// qNode.push_back((real)index); -// Qs[rb].push_back(qNode); -// } -// qNode.clear(); -//} -// -//void ParallelGridBuilder::writeArrows(std::string fileName, std::shared_ptr<ArrowTransformator> trans) const -//{ -// Grid grid = this->gridKernels[0][0]->grid; -// //std::shared_ptr<PolyDataWriterWrapper> writer = std::shared_ptr<PolyDataWriterWrapper>(new PolyDataWriterWrapper()); -// for (int index = 0; index < Qs[GEOMQS].size(); index++) -// { -// Vertex startNode = getVertex(getMatrixIndex(index)); -// //for (int qi = grid.d.dir_start; qi <= grid.d.dir_end; qi++) -// //writeArrow(index, qi, startNode, trans, writer); -// } -// //writer->writePolyDataToFile(fileName); -//} -// -//void ParallelGridBuilder::writeArrow(const int i, const int qi, const Vertex& startNode, std::shared_ptr<const ArrowTransformator> trans/*, std::shared_ptr<PolyDataWriterWrapper> writer*/) const -//{ -// Grid grid = this->gridKernels[0][0]->grid; -// real qval = Qs[GEOMQS][i][qi + 1]; -// if (qval > 0.0f) -// { -// int qReverse = grid.d.dir_end - qi; -// Vertex dir((real)grid.d.dirs[qReverse * DIMENSION + 0], (real)grid.d.dirs[qReverse* DIMENSION + 1], (real)grid.d.dirs[qReverse * DIMENSION + 2]); -// Vertex nodeOnGeometry(startNode + (dir * qval)); -// std::shared_ptr<Arrow> arrow = ArrowImp::make(startNode, nodeOnGeometry); -// trans->transformGridToWorld(arrow); -// //writer->addVectorArrow(arrow); -// } -//} -// -//Vertex ParallelGridBuilder::getVertex(int matrixIndex) const -//{ -// real x, y, z; -// this->gridKernels[0][0]->grid.transIndexToCoords(matrixIndex, x, y, z); -// return Vertex((real)x, (real)y, (real)z); -//} -// -//int ParallelGridBuilder::getMatrixIndex(int i) const -//{ -// int index = (int)Qs[GEOMQS][i][0]; -// return this->gridKernels[0][0]->grid.matrixIndex[index]; -//} -// diff --git a/src/GridGenerator/grid/GridBuilder/ParallelGridBuilder.h b/src/GridGenerator/grid/GridBuilder/ParallelGridBuilder.h deleted file mode 100644 index 49ed3243d..000000000 --- a/src/GridGenerator/grid/GridBuilder/ParallelGridBuilder.h +++ /dev/null @@ -1,100 +0,0 @@ -//#ifndef PARALLEL_GRID_BUILDER_H -//#define PARALLEL_GRID_BUILDER_H -// -//#include "GridGenerator/global.h" -// -// -//#include <vector> -//#include <string> -//#include <memory> -// -//#include "GridBuilder.h" -// -//struct Vertex; -//class GridWrapper; -//class Transformator; -//class ArrowTransformator; -//class PolyDataWriterWrapper; -// -//template <typename T> -//class BoundingBox; -// -// -//class ParallelGridBuilder : public GridBuilder -//{ -//public: -// -// VF_PUBLIC ParallelGridBuilder(GenerationDevice device); -// -// VF_PUBLIC virtual ~ParallelGridBuilder(); -// -// VF_PUBLIC virtual void addGrid(real length, real width, real high, real delta, std::string distribution, std::shared_ptr<Transformator> trans); -// -// VF_PUBLIC virtual void meshGeometry(std::string input, int level); -// VF_PUBLIC virtual void deleteSolidNodes(); -// -// VF_PUBLIC virtual void flood(Vertex &startFlood, int level); -// -// VF_PUBLIC virtual void writeGridToVTK(std::string output, int level); -// VF_PUBLIC virtual void writeSimulationFiles(std::string output, BoundingBox &nodesDelete, bool writeFilesBinary, int level); -// -// VF_PUBLIC virtual std::shared_ptr<GridWrapper> getGridWrapper(int level, int box); -// -// VF_PUBLIC virtual void createBoundaryConditions(); -// -// VF_PUBLIC virtual unsigned int getNumberOfNodes(unsigned int level) const;; -// VF_PUBLIC virtual std::vector<std::vector<std::vector<real> > > getQsValues() const; -// -// VF_PUBLIC virtual int getBoundaryConditionSize(int rb) const; -// VF_PUBLIC virtual std::vector<std::string> getTypeOfBoundaryConditions() const; -// -// VF_PUBLIC virtual void getNodeValues(real *xCoords, real *yCoords, real *zCoords, unsigned int *nx, unsigned int *ny, unsigned int *nz, unsigned int *geo, const int level) const; -// VF_PUBLIC virtual void getDimensions(int &nx, int &ny, int &nz, const int level) const; -// -// VF_PUBLIC virtual void setQs(real** q27, int* k, int channelSide, unsigned int level) const; -// VF_PUBLIC virtual void setOutflowValues(real* RhoBC, int* kN, int channelSide, int level) const; -// VF_PUBLIC virtual void setVelocityValues(real* vx, real* vy, real* vz, int channelSide, int level) const; -// VF_PUBLIC virtual void setPressValues(real* RhoBC, int* kN, int channelSide, int level) const; -// -// VF_PUBLIC void writeArrows(std::string fileName, std::shared_ptr<ArrowTransformator> trans) const; -// -//protected: -// GenerationDevice device; -// -// std::vector<std::vector<std::shared_ptr<GridWrapper> > >gridKernels; -// std::vector<std::shared_ptr<Transformator>> transformators; -// std::vector<std::vector<BoundingBox> > boxes; -// std::vector<int> rankTasks; -// std::vector<std::vector<int> > gridDimensions; -// -// -// std::vector<std::vector<std::vector<real> > > Qs; -// std::vector<std::string> channelBoundaryConditions; -// -// void checkLevel(int level); -// -//protected: -// virtual void createGridKernels(std::string distribution); -// -// void setNumberOfNodes(real length, real width, real high, real delta); -// void printMasterInformation(int nx, int ny, int nz); -// void setCudaDevice(int rank); -// void rebuildBoxes(); -// void sendTasks(); -// void receiveTasks(); -// void writeBoxes(std::string name); -// -//protected: -// void createBCVectors(); -// void addShortQsToVector(int index); -// void addQsToVector(int index); -// void fillRBForNode(int x, int y, int z, int index, int direction, int directionSign, int rb); -// -// int getMatrixIndex(const int i) const; -// Vertex getVertex(const int matrixIndex) const; -// void writeArrow(const int i, const int qi, const Vertex& startNode, std::shared_ptr<const ArrowTransformator> trans/*, std::shared_ptr<PolyDataWriterWrapper> writer*/) const; -// -//}; -// -//#endif -// diff --git a/src/GridGenerator/grid/GridFactory.cpp b/src/GridGenerator/grid/GridFactory.cpp index 76faf0a14..3e2297c21 100644 --- a/src/GridGenerator/grid/GridFactory.cpp +++ b/src/GridGenerator/grid/GridFactory.cpp @@ -1,27 +1,4 @@ #include "GridFactory.h" -#include <iostream> -#include "grid/GridStrategy/GridCpuStrategy/GridCpuStrategy.h" -#include "grid/GridStrategy/GridGpuStrategy/GridGpuStrategy.h" -#include "distributions/Distribution.h" - -//SPtr<Grid> GridFactory::makeGrid(real startX, real startY, real startZ, real endX, real endY, real endZ, real delta, -// const std::string& device, const std::string& d3Qxx) -//{ -// SPtr<GridStrategy> gridStrategy; -// if (device == "gpu") -// gridStrategy = SPtr<GridStrategy>(new GridGpuStrategy()); -// else if (device == "cpu") -// gridStrategy = SPtr<GridStrategy>(new GridCpuStrategy()); -// else -// { -// std::cout << "Cannot identify device: " << device << ". cpu is chosen!\n"; -// gridStrategy = SPtr<GridStrategy>(new GridGpuStrategy()); -// } -// -// Distribution distribution = DistributionHelper::getDistribution(d3Qxx); -// -// return Grid::makeShared(startX, startY, startZ, endX, endY, endZ, delta, gridStrategy, distribution); -//} diff --git a/src/GridGenerator/grid/GridFactory.h b/src/GridGenerator/grid/GridFactory.h index b1e3b830a..13e7d72f4 100644 --- a/src/GridGenerator/grid/GridFactory.h +++ b/src/GridGenerator/grid/GridFactory.h @@ -1,18 +1,17 @@ #ifndef GRID_FACTORY_H #define GRID_FACTORY_H -#include <VirtualFluidsDefinitions.h> -#include <core/PointerDefinitions.h> +#include "global.h" -#include "grid/GridStrategy/GridCpuStrategy/GridCpuStrategy.h" -#include "grid/GridStrategy/GridGpuStrategy/GridGpuStrategy.h" -#include "distributions/Distribution.h" -#include "GridImp.h" -#include "grid/GridMocks.h" #include "geometries/Cuboid/Cuboid.h" #include "geometries/Sphere/Sphere.h" #include "geometries/TriangularMesh/TriangularMeshStrategy.h" +#include "grid/GridStrategy/GridCpuStrategy/GridCpuStrategy.h" +#include "grid/GridStrategy/GridGpuStrategy/GridGpuStrategy.h" +#include "grid/distributions/Distribution.h" +#include "grid/GridImp.h" + enum class Device { CPU, GPU @@ -23,12 +22,6 @@ enum class TriangularMeshDiscretizationMethod RAYCASTING, POINT_IN_OBJECT, POINT_UNDER_TRIANGLE }; -enum class TestDouble -{ - PRODUCTIONCLASS, STUB, SPY -}; - - class VF_PUBLIC GridFactory { public: @@ -40,7 +33,6 @@ public: private: GridFactory() { - gridType = TestDouble::PRODUCTIONCLASS; gridStrategy = SPtr<GridStrategy>(new GridCpuStrategy()); triangularMeshDiscretizationStrategy = new RayCastingDiscretizationStrategy(); } @@ -52,16 +44,7 @@ public: SPtr<GridImp> grid; - switch (gridType) - { - case TestDouble::PRODUCTIONCLASS: - grid = GridImp::makeShared(gridShape, startX, startY, startZ, endX, endY, endZ, delta, gridStrategy, distribution, level); - break; - case TestDouble::STUB: - return GridStub::makeShared(gridShape, startX, startY, startZ, endX, endY, endZ, delta, gridStrategy, distribution, level); - case TestDouble::SPY: - return GridSpy::makeShared(gridShape, startX, startY, startZ, endX, endY, endZ, delta, gridStrategy, distribution, level); - } + grid = GridImp::makeShared(gridShape, startX, startY, startZ, endX, endY, endZ, delta, gridStrategy, distribution, level); grid->setTriangularMeshDiscretizationStrategy(this->triangularMeshDiscretizationStrategy); @@ -85,11 +68,6 @@ public: this->gridStrategy = gridStrategy; } - void setGridType(TestDouble gridType) - { - this->gridType = gridType; - } - void setTriangularMeshDiscretizationMethod(TriangularMeshDiscretizationMethod triangularMeshDiscretizationMethod) { switch (triangularMeshDiscretizationMethod) @@ -109,7 +87,6 @@ public: private: TriangularMeshDiscretizationStrategy* triangularMeshDiscretizationStrategy; SPtr<GridStrategy> gridStrategy; - TestDouble gridType; }; diff --git a/src/GridGenerator/grid/GridImp.cu b/src/GridGenerator/grid/GridImp.cu index d6df05944..5b3a06c8b 100644 --- a/src/GridGenerator/grid/GridImp.cu +++ b/src/GridGenerator/grid/GridImp.cu @@ -1,36 +1,30 @@ #include "GridImp.h" -#include "GridGenerator/global.h" #include <stdio.h> #include <time.h> #include <iostream> #include <omp.h> - #include <sstream> -#include <GridGenerator/utilities/math/Math.h> -#include "distributions/Distribution.h" - -#include <GridGenerator/geometries/Vertex/Vertex.h> -#include <GridGenerator/geometries/Triangle/Triangle.h> -#include <GridGenerator/geometries/TriangularMesh/TriangularMesh.h> -#include <GridGenerator/geometries/TriangularMesh/TriangularMeshStrategy.h> - -#include <GridGenerator/geometries/BoundingBox/BoundingBox.h> - -#include <GridGenerator/grid/NodeValues.h> -#include <GridGenerator/grid/distributions/Distribution.h> - -#include <GridGenerator/grid/GridStrategy/GridStrategy.h> -#include <utilities/logger/Logger.h> -#include "GridInterface.h" +#include "global.h" #include "geometries/Object.h" -#include "Field.h" +#include "geometries/Vertex/Vertex.h" +#include "geometries/Triangle/Triangle.h" +#include "geometries/TriangularMesh/TriangularMesh.h" +#include "geometries/TriangularMesh/TriangularMeshStrategy.h" +#include "geometries/BoundingBox/BoundingBox.h" + +#include "grid/GridStrategy/GridStrategy.h" +#include "grid/distributions/Distribution.h" +#include "grid/Field.h" +#include "grid/GridInterface.h" +#include "grid/NodeValues.h" #include "io/GridVTKWriter/GridVTKWriter.h" #include "utilities/communication.h" +#include "utilities/math/Math.h" CONSTANT int DIRECTIONS[DIR_END_MAX][DIMENSION]; diff --git a/src/GridGenerator/grid/GridImp.h b/src/GridGenerator/grid/GridImp.h index 8a78aeaf3..27d141710 100644 --- a/src/GridGenerator/grid/GridImp.h +++ b/src/GridGenerator/grid/GridImp.h @@ -3,14 +3,14 @@ #include <array> -#include "GridGenerator/global.h" -#include "distributions/Distribution.h" +#include "Core/LbmOrGks.h" -#include "core/LbmOrGks.h" +#include "global.h" -#include "Grid.h" -#include "Cell.h" -#include "Field.h" +#include "grid/distributions/Distribution.h" +#include "grid/Grid.h" +#include "grid/Cell.h" +#include "grid/Field.h" class TriangularMesh; struct Vertex; diff --git a/src/GridGenerator/grid/GridInterface.cu b/src/GridGenerator/grid/GridInterface.cu index e0041c400..a890753f3 100644 --- a/src/GridGenerator/grid/GridInterface.cu +++ b/src/GridGenerator/grid/GridInterface.cu @@ -1,10 +1,9 @@ #include "GridInterface.h" -#include "GridImp.h" -#include "Field.h" -#include "NodeValues.h" - -#include "distributions/D3Q27.h" +#include "grid/distributions/D3Q27.h" +#include "grid/GridImp.h" +#include "grid/Field.h" +#include "grid/NodeValues.h" GridInterface::GridInterface() { diff --git a/src/GridGenerator/grid/GridInterface.h b/src/GridGenerator/grid/GridInterface.h index 8dfd294f6..e0909b34a 100644 --- a/src/GridGenerator/grid/GridInterface.h +++ b/src/GridGenerator/grid/GridInterface.h @@ -1,11 +1,7 @@ #ifndef GRID_INTERFACE_H #define GRID_INTERFACE_H -#include "core/DataTypes.h" -#include "VirtualFluidsDefinitions.h" -#include "utilities/cuda/cudaDefines.h" - -#include "core/PointerDefinitions.h" +#include "global.h" class GridImp; diff --git a/src/GridGenerator/grid/GridInterfaceTest.cpp b/src/GridGenerator/grid/GridInterfaceTest.cpp deleted file mode 100644 index a709cbec6..000000000 --- a/src/GridGenerator/grid/GridInterfaceTest.cpp +++ /dev/null @@ -1,5 +0,0 @@ -#include "gmock/gmock.h" - -//#include "GridInterface.cuh" - - diff --git a/src/GridGenerator/grid/GridMocks.h b/src/GridGenerator/grid/GridMocks.h deleted file mode 100644 index 0ab49bcfa..000000000 --- a/src/GridGenerator/grid/GridMocks.h +++ /dev/null @@ -1,190 +0,0 @@ -#ifndef GRID_MOCKS_H -#define GRID_MOCKS_H - -#include "GridGenerator/global.h" -#include "GridStrategy/GridStrategyMocks.h" -#include "distributions/Distribution.h" -#include <geometries/Vertex/Vertex.h> - -#include "Grid.h" -#include "geometries/Object.h" - -class GridDummy : public Grid -{ -public: - virtual ~GridDummy() {} - - static SPtr<GridDummy> makeShared() - { - return SPtr<GridDummy>(new GridDummy()); - } - - virtual real getDelta() const - { - return 0.0; - } - - virtual const Object* getObject() const { return nullptr; } - - virtual uint getSparseSize() const override { return 0; } - virtual uint getSize() const override { return 0; } - virtual real getStartX() const override { return 0.0; } - virtual real getStartY() const override { return 0.0; } - virtual real getStartZ() const override { return 0.0; } - virtual real getEndX() const override { return 0.0; } - virtual real getEndY() const override { return 0.0; } - virtual real getEndZ() const override { return 0.0; } - virtual uint getNumberOfNodesX() const override { return 0; } - virtual uint getNumberOfNodesY() const override { return 0; } - virtual uint getNumberOfNodesZ() const override { return 0; } - virtual uint getNumberOfNodesCF() const override { return 0; } - virtual uint getNumberOfNodesFC() const override { return 0; } - virtual int getSparseIndex(uint matrixIndex) const override { return 0; } - virtual char getFieldEntry(uint matrixIndex) const override { return 0; } - virtual void getGridInterfaceIndices(uint* iCellCfc, uint* iCellCff, uint* iCellFcc, uint* iCellFcf) const override {} - virtual uint* getCF_coarse() const override { return 0; } - virtual uint* getCF_fine() const override { return 0; } - virtual uint* getCF_offset() const override { return 0; } - virtual uint* getFC_coarse() const override { return 0; } - virtual uint* getFC_fine() const override { return 0; } - virtual uint* getFC_offset() const override { return 0; } - virtual real* getDistribution() const override { return nullptr; } - virtual int* getDirection() const override { return nullptr; } - virtual int getStartDirection() const override { return 0; } - virtual int getEndDirection() const override { return 0; } - virtual void getNodeValues(real* xCoords, real* yCoords, real* zCoords, - uint* neighborX, uint* neighborY, uint* neighborZ, uint* neighborNegative, - uint* geo) const override {} - virtual SPtr<GridStrategy> getGridStrategy() const override { return nullptr; } - virtual void transIndexToCoords(uint index, real& x, real& y, real& z) const override {} - virtual void setPeriodicity(bool periodicityX, bool periodicityY, bool periodicityZ) override {} - virtual void freeMemory() override {} - - virtual void findGridInterface(SPtr<Grid> grid, LbmOrGks lbmOrGks) override {} - - virtual void repairGridInterfaceOnMultiGPU(SPtr<Grid> fineGrid) override {} - - virtual void limitToSubDomain(SPtr<BoundingBox> subDomainBox) override {} - - virtual void enableFindSolidBoundaryNodes() override {} - virtual void enableComputeQs() override {} - - virtual void mesh(TriangularMesh& geometry) override {} - virtual void closeNeedleCells() override {} - virtual void closeNeedleCellsThinWall() override {} - void findQs(Object* object) override {} - - virtual uint transCoordToIndex(const real& x, const real& y, const real& z) const override { return 0; } - virtual int* getNeighborsX() const override { return nullptr; } - virtual int* getNeighborsY() const override { return nullptr; } - virtual int* getNeighborsZ() const override { return nullptr; } - virtual int* getNeighborsNegative() const override { return nullptr; } - virtual void inital(const SPtr<Grid> fineGrid, uint numberOfLayers) override {}; - virtual void setOddStart( bool xOddStart, bool yOddStart, bool zOddStart ) {}; - virtual bool nodeInCellIs(Cell& cell, char type) const override { return false; } - virtual void findSparseIndices(SPtr<Grid> fineGrid) override {} - virtual Vertex getMinimumOnNode(Vertex exact) const override { return Vertex(0, 0, 0); } - virtual Vertex getMaximumOnNode(Vertex exact) const override { return Vertex(0, 0, 0); } - virtual void mesh(Object* object) override {} - void setPeriodicityX(bool periodicity) override {} - void setPeriodicityY(bool periodicity) override {} - void setPeriodicityZ(bool periodicity) override {} - bool getPeriodicityX() override {return false;} - bool getPeriodicityY() override {return false;} - bool getPeriodicityZ() override {return false;} - void setFieldEntry(uint matrixIndex, char type) override {} - real getFirstFluidNode(real coords[3], int direction, real startCoord) const override { return 0.0; } - real getLastFluidNode(real coords[3], int direction, real startCoord) const override { return 0.0; } - - uint getNumberOfSolidBoundaryNodes() const override { return 0; } - void setNumberOfSolidBoundaryNodes(uint numberOfSolidBoundaryNodes) override {} - - real getQValue(const uint index, const uint dir) const override { return 0.0; } - uint getQPatch(const uint index) const override { return 0.0; } - - void setInnerRegionFromFinerGrid( bool innerRegionFromFinerGrid ) override {} - - void setNumberOfLayers( uint numberOfLayers ) override {} - - void findCommunicationIndices(int direction, SPtr<BoundingBox> subDomainBox) override {} - - uint getNumberOfSendNodes(int direction) override { return INVALID_INDEX; } - uint getNumberOfReceiveNodes(int direction) override { return INVALID_INDEX; } - - uint getSendIndex(int direction, uint index) override { return INVALID_INDEX; } - uint getReceiveIndex(int direction, uint index) override { return INVALID_INDEX; } - -}; - -class GridStub : public GridDummy -{ -protected: - GridStub(Object* gridShape, real startX, real startY, real startZ, real endX, real endY, real endZ, real delta, uint level) : startX(startX), startY(startY), startZ(startZ), endX(endX), endY(endY), endZ(endZ), delta(delta), level(level) {} - -public: - static SPtr<GridStub> makeShared(Object* gridShape, real startX, real startY, real startZ, real endX, real endY, real endZ, real delta, SPtr<GridStrategy> gridStrategy, Distribution d, uint level) - { - return SPtr<GridStub>(new GridStub(gridShape, startX, startY, startZ, endX, endY, endZ, delta, level)); - } - - virtual real getDelta() const override { return delta; } - - virtual real getStartX() const override { return startX; } - virtual real getStartY() const override { return startY; } - virtual real getStartZ() const override { return startZ; } - virtual real getEndX() const override { return endX; } - virtual real getEndY() const override { return endY; } - virtual real getEndZ() const override { return endZ; } - - -private: - real startX, startY, startZ; - real endX, endY, endZ; - - real delta; - - uint level; -}; - - -class GridSpy : public GridStub -{ -protected: - GridSpy(Object* gridShape, real startX, real startY, real startZ, real endX, real endY, real endZ, real delta, uint level) : GridStub(gridShape, startX, startY, startZ, endX, endY, endZ, delta, level) {} - -public: - static SPtr<GridSpy> makeShared(Object* gridShape, real startX, real startY, real startZ, real endX, real endY, real endZ, real delta, SPtr<GridStrategy> gridStrategy, Distribution d, uint level) - { - return SPtr<GridSpy>(new GridSpy(gridShape, startX, startY, startZ, endX, endY, endZ, delta, level)); - } - - bool hasGridInterface() const - { - return _hasGridInterface; - } - - bool hasNoPeriodicityBoundaries() const - { - return !(periodicityX && periodicityY && periodicityZ); - } - - virtual void setPeriodicity(bool periodicityX, bool periodicityY, bool periodicityZ) override - { - this->periodicityX = periodicityX; - this->periodicityY = periodicityY; - this->periodicityZ = periodicityZ; - } - - virtual void findGridInterface(SPtr<Grid> grid, LbmOrGks lbmOrGks) override - { - _hasGridInterface = true; - } - -private: - bool _hasGridInterface = false; - bool periodicityX; - bool periodicityY; - bool periodicityZ; -}; - -#endif diff --git a/src/GridGenerator/grid/GridStrategy/GridCpuStrategy/GridCpuStrategy.cpp b/src/GridGenerator/grid/GridStrategy/GridCpuStrategy/GridCpuStrategy.cpp index 928489d74..ea45a3ac4 100644 --- a/src/GridGenerator/grid/GridStrategy/GridCpuStrategy/GridCpuStrategy.cpp +++ b/src/GridGenerator/grid/GridStrategy/GridCpuStrategy/GridCpuStrategy.cpp @@ -1,4 +1,3 @@ - #include "GridCpuStrategy.h" #include <time.h> @@ -7,15 +6,12 @@ #include <vector> #include <iostream> -#include <GridGenerator/grid/distributions/Distribution.h> -#include <GridGenerator/grid/GridImp.h> - -#include <GridGenerator/geometries/TriangularMesh/TriangularMesh.h> - -#include <utilities/logger/Logger.h> -#include "grid/NodeValues.h" +#include "geometries/TriangularMesh/TriangularMesh.h" +#include "grid/distributions/Distribution.h" #include "grid/GridInterface.h" +#include "grid/GridImp.h" +#include "grid/NodeValues.h" void GridCpuStrategy::allocateGridMemory(SPtr<GridImp> grid) { diff --git a/src/GridGenerator/grid/GridStrategy/GridCpuStrategy/GridCpuStrategy.h b/src/GridGenerator/grid/GridStrategy/GridCpuStrategy/GridCpuStrategy.h index a59aa021d..cabbc67e3 100644 --- a/src/GridGenerator/grid/GridStrategy/GridCpuStrategy/GridCpuStrategy.h +++ b/src/GridGenerator/grid/GridStrategy/GridCpuStrategy/GridCpuStrategy.h @@ -1,12 +1,9 @@ #ifndef GRID_CPU_STRATEGY_H #define GRID_CPU_STRATEGY_H -#include "GridGenerator/global.h" - -#include "../GridStrategy.h" - -#include "core/PointerDefinitions.h" +#include "global.h" +#include "grid/GridStrategy/GridStrategy.h" class GridImp; class TriangularMesh; diff --git a/src/GridGenerator/grid/GridStrategy/GridCpuStrategy/GridCpuStrategyTest.cpp b/src/GridGenerator/grid/GridStrategy/GridCpuStrategy/GridCpuStrategyTest.cpp deleted file mode 100644 index 09ee08568..000000000 --- a/src/GridGenerator/grid/GridStrategy/GridCpuStrategy/GridCpuStrategyTest.cpp +++ /dev/null @@ -1,328 +0,0 @@ -//#include "gmock/gmock.h" -// -//#include "GridKernelCPU.h" -//#include "GridKernelGPU.h" -// -//#include <string> -// -//#include <stl/Triangle.h> -//#include <stl/BoundingBox.h> -// -//#include <grid/kernel/runGridKernelGPU.cuh> -//#include <grid/distributions/D3Q7.h> -//#include <utilities/Transformator.h> -//#include <utilities/io/STLReaderWriter.h> -//#include <utilities/io/GridVTKWriter.h> -// -// -//#include <grid/distributions/Distribution.h> -//#include <grid/partition/Partition.h> -// -//using namespace testing; -// -//void verifyGrid(Grid &grid, int min, int max, int expectedNode) -//{ -// int x, z, y; -// // -x +x -// for (y = min; y <= max; y++) -// { -// for (z = min; z <= max; z++) -// { -// x = min; -// EXPECT_THAT(grid.getFieldEntry(Vertex((real)x, (real)y, (real)z)), Eq(expectedNode)); -// x = max; -// EXPECT_THAT(grid.getFieldEntry(Vertex((real)x, (real)y, (real)z)), Eq(expectedNode)); -// } -// } -// -// // -y +y -// for (x = min; x <= max; x++) -// { -// for (z = min; z <= max; z++) -// { -// y = min; -// EXPECT_THAT(grid.getFieldEntry(Vertex((real)x, (real)y, (real)z)), Eq(expectedNode)); -// y = max; -// EXPECT_THAT(grid.getFieldEntry(Vertex((real)x, (real)y, (real)z)), Eq(expectedNode)); -// } -// } -// -// // -z +z -// for (x = min; x <= max; x++) -// { -// for (y = min; y <= max; y++) -// { -// z = min; -// EXPECT_THAT(grid.getFieldEntry(Vertex((real)x, (real)y, (real)z)), Eq(expectedNode)); -// z = max; -// EXPECT_THAT(grid.getFieldEntry(Vertex((real)x, (real)y, (real)z)), Eq(expectedNode)); -// } -// } -//} -// -//void resetGridNodes(Grid &grid, int min, int max, int newNode) -//{ -// int x, z, y; -// // -x +x -// for (y = min; y <= max; y++) -// { -// for (z = min; z <= max; z++) -// { -// x = min; -// grid.setFieldEntry(Vertex((real)x, (real)y, (real)z), newNode); -// x = max; -// grid.setFieldEntry(Vertex((real)x, (real)y, (real)z), newNode); -// } -// } -// -// // -y +y -// for (x = min; x <= max; x++) -// { -// for (z = min; z <= max; z++) -// { -// y = min; -// grid.setFieldEntry(Vertex((real)x, (real)y, (real)z), newNode); -// y = max; -// grid.setFieldEntry(Vertex((real)x, (real)y, (real)z), newNode); -// } -// } -// -// // -z +z -// for (x = min; x <= max; x++) -// { -// for (y = min; y <= max; y++) -// { -// z = min; -// grid.setFieldEntry(Vertex((real)x, (real)y, (real)z), newNode); -// z = max; -// grid.setFieldEntry(Vertex((real)x, (real)y, (real)z), newNode); -// } -// } -//} -// -//void verifyInitalClearGridField(Grid &grid) -//{ -// unsigned int x, y, z; -// for (unsigned int i = 0; i < grid.size; i += 10) -// { -// grid.transIndexToCoords(i, x, y, z); -// if ((x == grid.nx - 1) || (y == grid.ny - 1) || (z == grid.nz - 1)) -// EXPECT_THAT(grid.field[i], Eq(1)); -// else -// EXPECT_THAT(grid.field[i], Eq(0)); -// } -//} -// -// -//class GridKernelCubeIsExactlyOnNodesTest : public Test { -//public: -// GridKernelCPU* gridCPU; -// std::vector<Triangle> triangles; -// -// void SetUp() { -// real length = 30.0f; -// real width = 30.0f; -// real high = 30.0f; -// real delta = 1.0f; -// Transformator trans(delta, Vertex(0.0f, 0.0f, 0.0f)); -// std::string path = PATH_TO_DATA; -// std::string test = TESTSUITE; -// std::string input = path + test + "STL/GridKernelCPUTest/" + "cube_ascii.stl"; -// -// int nx = (int)(length / delta); -// int ny = (int)(width / delta); -// int nz = (int)(high / delta); -// triangles = STLReaderWriter::readSTL(input, trans); -// -// std::vector<BoundingBox> boxes = Partition::getProcessBoxes(1, nx, nx, nz); -// gridCPU = new GridKernelCPU(boxes[0], "D3Q27", trans); -// -// } -// void TearDown() { -// delete gridCPU; -// } -//}; -// -//TEST_F(GridKernelCubeIsExactlyOnNodesTest, theInitalField_ShouldHaveZerosOnEveryEntry) { -// verifyInitalClearGridField(gridCPU->grid); -//} -// -//TEST_F(GridKernelCubeIsExactlyOnNodesTest, meshCubeToGrid_expectSolidAndQRows_WallIsExactlyOnNodes) { -// gridCPU->meshGrid(&triangles[0], (int)triangles.size()); -// -// int min = 5; -// int max = 25; -// int expectedQ = 6; -// int expectedSolid = 1; -// int fluidNode = 0; -// -// verifyGrid(gridCPU->grid, min - 1, max + 1, expectedQ); -// resetGridNodes(gridCPU->grid, min - 1, max + 1, fluidNode); -// -// verifyGrid(gridCPU->grid, min, max, expectedSolid); -// resetGridNodes(gridCPU->grid, min, max, fluidNode); -// -// verifyGrid(gridCPU->grid, min + 1, max - 1, expectedSolid); -// resetGridNodes(gridCPU->grid, min + 1, max - 1, fluidNode); -// -// verifyInitalClearGridField(gridCPU->grid); -// -// /*std::vector<std::vector<real> > qs_ausgeduennt = DistributionHelper::getQsWithoutRowsWithOnlyZeroValues(*(gridCPU->grid), gridCPU->d); -// DistributionHelper::printQs(qs_ausgeduennt, 2);*/ -//} -// -// -//class GridKernelCubeIsBetweenNodesTest : public Test { -//public: -// GridKernelCPU* gridCPU; -// std::vector<Triangle> triangles; -// -// void SetUp() { -// real length = 30.0f; -// real width = 30.0f; -// real high = 30.0f; -// real delta = 1.0f; -// Transformator trans; -// std::string path = PATH_TO_DATA; -// std::string test = TESTSUITE; -// std::string input = path + test + "STL/GridKernelCPUTest/" + "cubeBetweenNode_ascii.stl"; -// -// trans = Transformator(delta, Vertex(0.0f, 0.0f, 0.0f)); -// int nx = (int)(length / delta); -// int ny = (int)(width / delta); -// int nz = (int)(high / delta); -// triangles = STLReaderWriter::readSTL(input, trans); -// std::vector<BoundingBox> boxes = Partition::getProcessBoxes(1, nx, nx, nz); -// -// gridCPU = new GridKernelCPU(boxes[0], "D3Q7", trans); -// } -// -// void TearDown() { -// delete gridCPU; -// } -// -// -//}; -// -//TEST_F(GridKernelCubeIsBetweenNodesTest, meshCubeToGrid_expectSolidAndQRows_WallIsBetweenTwoNode) { -// gridCPU->meshGrid(&triangles[0], (int)triangles.size()); -// -// int min = 6; -// int max = 25; -// int expectedQ = 6; -// int expectedSolid = 1; -// int fluidNode = 0; -// -// verifyGrid(gridCPU->grid, min - 1, max + 1, expectedQ); -// resetGridNodes(gridCPU->grid, min - 1, max + 1, fluidNode); -// -// verifyGrid(gridCPU->grid, min, max, expectedSolid); -// resetGridNodes(gridCPU->grid, min, max, fluidNode); -// -// verifyInitalClearGridField(gridCPU->grid); -//} -// -// -//TEST_F(GridKernelCubeIsBetweenNodesTest, calculateQ_validateAllQs_shouldBe_0_5_D3Q7){ -// gridCPU->meshGrid(&triangles[0], (int)triangles.size()); -// -// std::vector<std::vector<real> > qs_ausgeduennt = DistributionHelper::getQsWithoutRowsWithOnlyZeroValues(gridCPU->grid, gridCPU->grid.d); -// -// for (int node = 0; node < qs_ausgeduennt.size(); node++) { -// for (int dir = DIR_7_START; dir < DIR_7_END; dir++) { -// real q = qs_ausgeduennt[node][dir+1]; -// if (q != 0.0f){ -// EXPECT_THAT(q, DoubleEq(0.5)); -// } -// } -// } -// //gridCPU->writeArrows("arrowsTest"); -// //GridVTKWriter::writeGridToVTK(grid, path + "cubeTestWall.vtk", trans, true); -// //DistributionHelper::printQs(qs_ausgeduennt, 2); -//} -// -// -//class GridKernelCubeIsBetweenNodesD3Q27Test : public Test { -//public: -// GridKernelCPU* gridCPU; -// std::vector<Triangle> triangles; -// -// void SetUp() { -// real length = 30.0f; -// real width = 30.0f; -// real high = 30.0f; -// real delta = 1.0f; -// Transformator trans; -// std::string path = PATH_TO_DATA; -// std::string test = TESTSUITE; -// std::string input = path + test + "STL/GridKernelCPUTest/" + "cubeBetweenNode_ascii.stl"; -// -// trans = Transformator(delta, Vertex(0.0f, 0.0f, 0.0f)); -// int nx = (int)(length / delta); -// int ny = (int)(width / delta); -// int nz = (int)(high / delta); -// triangles = STLReaderWriter::readSTL(input, trans); -// std::vector<BoundingBox> boxes = Partition::getProcessBoxes(1, nx, nx, nz); -// -// gridCPU = new GridKernelCPU(boxes[0], "D3Q27", trans); -// } -// -// void TearDown() { -// delete gridCPU; -// } -// -//}; -// -//TEST_F(GridKernelCubeIsBetweenNodesD3Q27Test, calculateQ_validateAllQs_shouldBe_0_5_D3Q27){ -// gridCPU->meshGrid(&triangles[0], (int)triangles.size()); -// -// std::vector<std::vector<real> > qs_ausgeduennt = DistributionHelper::getQsWithoutRowsWithOnlyZeroValues(gridCPU->grid, gridCPU->grid.d); -// -// for (int node = 0; node < qs_ausgeduennt.size(); node++) { -// for (int dir = DIR_7_START; dir < DIR_7_END; dir++) { -// real q = qs_ausgeduennt[node][dir + 1]; -// if (q != 0.0f){ -// EXPECT_THAT(q, DoubleEq(0.5)); -// } -// } -// } -// //gridCPU->writeArrows("arrowsTestQ27", Transformator(delta, getVertex(0.0f, 0.0f, 0.0f))); -// //GridVTKWriter::writeGridToVTK(grid, path + "cubeTestWall.vtk", trans, true); -// //printQs(qs_ausgeduennt, 2); -// -//} -// -// -// -//TEST_F(GridKernelCubeIsBetweenNodesTest, calculateQ_checkifQIsInFSolidNode_whenTriangleIsStraight_forD3Q7){ -// //GridkernelCPU kernel(&grid); -// -// //Vertex p1 = getVertex(3.5, 2, 2); -// //Vertex p2 = getVertex(3.5, 2, 9); -// //Vertex p3 = getVertex(5.5, 9, 9); -// -// //Vertex edge1, edge2, normal; -// //edge1 = minus(p2, p1); -// //edge2 = minus(p3, p2); -// //normal = crossProduct(edge1, edge2); -// -// //Triangle t = Triangle(p1,p2,p3,normal); -// -// //kernel.meshGrid(&t, 1); -// //GridVTKWriter::writeGridToVTK(grid, "firstd3Q7test.vtk", Transformator(), true); -// ////writeArrowsToFile(); -// -// //UnstructuredGridWriter writer; -// //real v1_arr[3], v2_arr[3], v3_arr[3]; -// //convertVertexToArray(t.v1, v1_arr); convertVertexToArray(t.v2, v2_arr); convertVertexToArray(t.v3, v3_arr); -// //writer.addTriangle(v1_arr, v2_arr, v3_arr); -// //writer.writeUnstructuredGridToFile("triangleTest.vtu"); -// -// -// -// //VertexInteger v = getVertexInt(3, 5, 5); -// //Distributions7 d; -// //int dirs = 7; -// //d.f[0] = new real[grid.size * dirs]; -// ////calculateQs(grid, v, t, d.f[0]); -//} diff --git a/src/GridGenerator/grid/GridStrategy/GridGpuStrategy/GridGpuStrategy.cpp b/src/GridGenerator/grid/GridStrategy/GridGpuStrategy/GridGpuStrategy.cpp index 5c0c0a978..f9ab568cf 100644 --- a/src/GridGenerator/grid/GridStrategy/GridGpuStrategy/GridGpuStrategy.cpp +++ b/src/GridGenerator/grid/GridStrategy/GridGpuStrategy/GridGpuStrategy.cpp @@ -1,23 +1,17 @@ #include "GridGpuStrategy.h" -#include "time.h" -#include "GridGenerator/global.h" +#include "Core/Timer/Timer.h" -#include <GridGenerator/utilities/cuda/CudaErrorCheck.cu> -#include <GridGenerator/utilities/cuda/LaunchParameter.cuh> +#include "geometries/BoundingBox/BoundingBox.h" +#include "geometries/TriangularMesh/TriangularMesh.h" -#include <GridGenerator/geometries/BoundingBox/BoundingBox.h> -#include <GridGenerator/geometries/TriangularMesh/TriangularMesh.h> - -#include <GridGenerator/grid/kernel/runGridKernelGPU.cuh> -#include <GridGenerator/grid/GridImp.h> - -#include <grid/distributions/Distribution.h> - -#include <utilities/logger/Logger.h> -//#include <helper_cuda.h> +#include "grid/kernel/runGridKernelGPU.cuh" +#include "grid/distributions/Distribution.h" +#include "grid/GridImp.h" #include "grid/GridInterface.h" +#include "utilities/cuda/CudaErrorCheck.cu" +#include "utilities/cuda/LaunchParameter.cuh" void GridGpuStrategy::allocateGridMemory(SPtr<GridImp> grid) { diff --git a/src/GridGenerator/grid/GridStrategy/GridGpuStrategy/GridGpuStrategy.h b/src/GridGenerator/grid/GridStrategy/GridGpuStrategy/GridGpuStrategy.h index 99a79603b..a0031eafe 100644 --- a/src/GridGenerator/grid/GridStrategy/GridGpuStrategy/GridGpuStrategy.h +++ b/src/GridGenerator/grid/GridStrategy/GridGpuStrategy/GridGpuStrategy.h @@ -1,10 +1,9 @@ #ifndef GRID_GPU_STRATEGY_H #define GRID_GPU_STRATEGY_H -#include <VirtualFluidsDefinitions.h> #include "global.h" -#include "../GridStrategy.h" +#include "grid/GridStrategy/GridStrategy.h" class BoundingBox; class TriangularMesh; diff --git a/src/GridGenerator/grid/GridStrategy/GridGpuStrategy/GridGpuStrategyTest.cpp b/src/GridGenerator/grid/GridStrategy/GridGpuStrategy/GridGpuStrategyTest.cpp deleted file mode 100644 index 747378c3a..000000000 --- a/src/GridGenerator/grid/GridStrategy/GridGpuStrategy/GridGpuStrategyTest.cpp +++ /dev/null @@ -1,367 +0,0 @@ -//#include "gmock/gmock.h" -//#include "GridKernelCPU.h" -//#include "GridKernelGPU.h" -// -//#include <string> -// -//#include <stl/Triangle.h> -//#include <stl/BoundingBox.h> -// -//#include <grid/kernel/runGridKernelGPU.cuh> -//#include <grid/distributions/D3Q7.h> -//#include <utilities/Transformator.h> -//#include <utilities/io/STLReaderWriter.h> -//#include <utilities/io/GridVTKWriter.h> -// -// -//#include <grid/distributions/Distribution.h> -//#include <grid/partition/Partition.h> -// -//using namespace testing; -// -// -//#ifndef __unix__ -// -//void verifyGridGPU(Grid &grid, int min, int max, int expectedNode) -//{ -// int x, z, y; -// // -x +x -// for (y = min; y <= max; y++) -// { -// for (z = min; z <= max; z++) -// { -// x = min; -// EXPECT_THAT(grid.getFieldEntry(Vertex((real)x, (real)y, (real)z)), Eq(expectedNode)); -// x = max; -// EXPECT_THAT(grid.getFieldEntry(Vertex((real)x, (real)y, (real)z)), Eq(expectedNode)); -// } -// } -// -// // -y +y -// for (x = min; x <= max; x++) -// { -// for (z = min; z <= max; z++) -// { -// y = min; -// EXPECT_THAT(grid.getFieldEntry(Vertex((real)x, (real)y, (real)z)), Eq(expectedNode)); -// y = max; -// EXPECT_THAT(grid.getFieldEntry(Vertex((real)x, (real)y, (real)z)), Eq(expectedNode)); -// } -// } -// -// // -z +z -// for (x = min; x <= max; x++) -// { -// for (y = min; y <= max; y++) -// { -// z = min; -// EXPECT_THAT(grid.getFieldEntry(Vertex((real)x, (real)y, (real)z)), Eq(expectedNode)); -// z = max; -// EXPECT_THAT(grid.getFieldEntry(Vertex((real)x, (real)y, (real)z)), Eq(expectedNode)); -// } -// } -//} -// -//void resetGridNodesGPU(Grid &grid, int min, int max, int newNode) -//{ -// int x, z, y; -// // -x +x -// for (y = min; y <= max; y++) -// { -// for (z = min; z <= max; z++) -// { -// x = min; -// grid.setFieldEntry(Vertex((real)x, (real)y, (real)z), newNode); -// x = max; -// grid.setFieldEntry(Vertex((real)x, (real)y, (real)z), newNode); -// } -// } -// -// // -y +y -// for (x = min; x <= max; x++) -// { -// for (z = min; z <= max; z++) -// { -// y = min; -// grid.setFieldEntry(Vertex((real)x, (real)y, (real)z), newNode); -// y = max; -// grid.setFieldEntry(Vertex((real)x, (real)y, (real)z), newNode); -// } -// } -// -// // -z +z -// for (x = min; x <= max; x++) -// { -// for (y = min; y <= max; y++) -// { -// z = min; -// grid.setFieldEntry(Vertex((real)x, (real)y, (real)z), newNode); -// z = max; -// grid.setFieldEntry(Vertex((real)x, (real)y, (real)z), newNode); -// } -// } -//} -// -//void verifyInitalClearGridFieldGPU(Grid &grid) -//{ -// unsigned int x, y, z; -// for (unsigned int i = 0; i < grid.size; i += 10) -// { -// grid.transIndexToCoords(i, x, y, z); -// if ((x == grid.nx - 1) || (y == grid.ny - 1) || (z == grid.nz - 1)) -// EXPECT_THAT(grid.field[i], Eq(0)); -// else -// EXPECT_THAT(grid.field[i], Eq(0)); -// } -//} -// -// -// -//class GridKernelCubeIsExactlyOnNodesGPUTest : public Test { -//public: -// GridKernelGPU* gridGPU; -// std::vector<Triangle> triangles; -// -// void SetUp() { -// real length = 30.0f; -// real width = 30.0f; -// real high = 30.0f; -// real delta = 1.0f; -// Transformator trans(delta, Vertex(0.0f, 0.0f, 0.0f)); -// std::string path = PATH_TO_DATA; -// std::string test = TESTSUITE; -// std::string input = path + test + "STL/GridKernelCPUTest/" + "cube_ascii.stl"; -// -// int nx = (int)(length / delta); -// int ny = (int)(width / delta); -// int nz = (int)(high / delta); -// triangles = STLReaderWriter::readSTL(input, trans); -// std::vector<BoundingBox> boxes = Partition::getProcessBoxes(1, nx, nx, nz); -// -// gridGPU = new GridKernelGPU(boxes[0], "D3Q27", Transformator()); -// -// } -// void TearDown() { -// delete gridGPU; -// } -//}; -// -// -//TEST_F(GridKernelCubeIsExactlyOnNodesGPUTest, meshCubeToGrid_expectSolidAndQRows_WallIsExactlyOnNodes_onGPU) { -// gridGPU->meshGrid(&triangles[0], (int)triangles.size()); -// gridGPU->copyDataFromGPU(); -// -// std::string path = PATH_TO_DATA; -// GridVTKWriter::writeGridToVTK(gridGPU->grid, path + "VTK_OUTPUT/testcube" , Transformator(1.0f, Vertex(0.0f, 0.0f, 0.0f)), false); -// -// int min = 5; -// int max = 25; -// int expectedQ = 6; -// int expectedSolid = 1; -// int fluidNode = 0; -// -// verifyGridGPU(gridGPU->grid, min - 1, max + 1, expectedQ); -// resetGridNodesGPU(gridGPU->grid, min - 1, max + 1, fluidNode); -// -// verifyGridGPU(gridGPU->grid, min, max, expectedSolid); -// resetGridNodesGPU(gridGPU->grid, min, max, fluidNode); -// -// verifyGridGPU(gridGPU->grid, min + 1, max - 1, expectedSolid); -// resetGridNodesGPU(gridGPU->grid, min + 1, max - 1, fluidNode); -// -// verifyInitalClearGridFieldGPU(gridGPU->grid); -// -//} -// -// -//class GridKernelCubeIsBetweenNodesGPUTest : public Test { -//public: -// GridKernelGPU* gridGPU; -// std::vector<Triangle> triangles; -// -// void SetUp() { -// real length = 30.0f; -// real width = 30.0f; -// real high = 30.0f; -// real delta = 1.0f; -// Transformator trans; -// std::string path = PATH_TO_DATA; -// std::string test = TESTSUITE; -// std::string input = path + test + "STL/GridKernelCPUTest/" + "cubeBetweenNode_ascii.stl"; -// -// trans = Transformator(delta, Vertex(0.0f, 0.0f, 0.0f)); -// int nx = (int)(length / delta); -// int ny = (int)(width / delta); -// int nz = (int)(high / delta); -// triangles = STLReaderWriter::readSTL(input, trans); -// std::vector<BoundingBox> boxes = Partition::getProcessBoxes(1, nx, nx, nz); -// -// gridGPU = new GridKernelGPU(boxes[0], "D3Q7", Transformator()); -// } -// -// void TearDown() { -// delete gridGPU; -// } -// -// -//}; -// -// -//TEST_F(GridKernelCubeIsBetweenNodesGPUTest, meshCubeToGrid_expectSolidAndQRows_WallIsBetweenTwoNode_onGPU) { -// gridGPU->meshGrid(&triangles[0], (int)triangles.size()); -// gridGPU->copyDataFromGPU(); -// -// int min = 6; -// int max = 25; -// int expectedQ = 6; -// int expectedSolid = 1; -// int fluidNode = 0; -// -// verifyGridGPU(gridGPU->grid, min - 1, max + 1, expectedQ); -// resetGridNodesGPU(gridGPU->grid, min - 1, max + 1, fluidNode); -// -// verifyGridGPU(gridGPU->grid, min, max, expectedSolid); -// resetGridNodesGPU(gridGPU->grid, min, max, fluidNode); -// -// verifyInitalClearGridFieldGPU(gridGPU->grid); -//} -// -// -//TEST_F(GridKernelCubeIsBetweenNodesGPUTest, calculateQ_validateAllQs_shouldBe_0_5_onGPU_D3Q7){ -// gridGPU->meshGrid(&triangles[0], (int)triangles.size()); -// gridGPU->copyDataFromGPU(); -// -// std::vector<std::vector<real> > qs_ausgeduennt = DistributionHelper::getQsWithoutRowsWithOnlyZeroValues(gridGPU->grid, gridGPU->grid.d); -// -// for (int node = 0; node < qs_ausgeduennt.size(); node++) { -// for (int dir = DIR_7_START; dir < DIR_7_END; dir++) { -// real q = qs_ausgeduennt[node][dir + 1]; -// if (q != 0.0f){ -// EXPECT_THAT(q, DoubleEq(0.5)); -// } -// } -// } -//} -// -//class GridKernelCubeIsBetweenNodesD3Q27GPUTest : public Test { -//public: -// GridKernelGPU* gridGPU; -// std::vector<Triangle> triangles; -// -// void SetUp() { -// real length = 30.0f; -// real width = 30.0f; -// real high = 30.0f; -// real delta = 1.0f; -// Transformator trans; -// std::string path = PATH_TO_DATA; -// std::string test = TESTSUITE; -// std::string input = path + test + "STL/GridKernelCPUTest/" + "cubeBetweenNode_ascii.stl"; -// -// trans = Transformator(delta, Vertex(0.0f, 0.0f, 0.0f)); -// int nx = (int)(length / delta); -// int ny = (int)(width / delta); -// int nz = (int)(high / delta); -// triangles = STLReaderWriter::readSTL(input, trans); -// std::vector<BoundingBox> boxes = Partition::getProcessBoxes(1, nx, nx, nz); -// gridGPU = new GridKernelGPU(boxes[0], "D3Q27", Transformator()); -// } -// -// void TearDown() { -// delete gridGPU; -// } -// -//}; -// -// -//TEST_F(GridKernelCubeIsBetweenNodesD3Q27GPUTest, calculateQ_validateAllQs_shouldBe_0_5_onGPU_D3Q27) { -// gridGPU->meshGrid(&triangles[0], (int)triangles.size()); -// gridGPU->copyDataFromGPU(); -// -// std::vector<std::vector<real> > qs_ausgeduennt = DistributionHelper::getQsWithoutRowsWithOnlyZeroValues(gridGPU->grid, gridGPU->grid.d); -// -// for (int node = 0; node < qs_ausgeduennt.size(); node++) { -// for (int dir = DIR_7_START; dir < DIR_7_END; dir++) { -// real q = qs_ausgeduennt[node][dir + 1]; -// if (q != 0.0f){ -// EXPECT_THAT(q, DoubleEq(0.5)); -// } -// } -// } -//} -// -// -//class GridKernelTest : public Test { -//public: -// real length; -// real width; -// real high; -// real delta; -// unsigned int nx; -// unsigned int ny; -// unsigned int nz; -// Grid grid; -// Distribution d; -// void SetUp() { -// length = 10; -// width = 5; -// high = 4; -// delta = 0.1f; -// nx = (unsigned int)(length / delta); -// ny = (unsigned int)(width / delta); -// nz = (unsigned int)(high / delta); -// d = DistributionHelper::getDistribution7(); -// grid = Grid(NULL, 0, 0, 0, nx, ny, nz, d); -// } -//}; -// -// -// -//TEST_F(GridKernelTest, transCoordToIndexAndIndexToCoordinates) { -// int x = nx / 2; -// int y = ny - 1; -// int z = nz - 1; -// unsigned int index = grid.transCoordToIndex(Vertex((real)x, (real)y, (real)z)); -// -// unsigned int newX, newY, newZ; -// grid.transIndexToCoords(index, newX, newY, newZ); -// -// EXPECT_THAT(x, Eq(newX)); -// EXPECT_THAT(y, Eq(newY)); -// EXPECT_THAT(z, Eq(newZ)); -//} -// -//TEST_F(GridKernelTest, ifAllBetaAreSmallerThenAlpha_ItShouldreturnTrue) { -// -// real alphaAngles[3]; -// real betaAngles[3]; -// alphaAngles[0] = 94.4f; -// alphaAngles[1] = 92.4f; -// alphaAngles[2] = 91.5f; -// -// betaAngles[0] = 0.0f; -// betaAngles[1] = 0.0f; -// betaAngles[2] = 0.0f; -// -// Grid grid; -// ASSERT_TRUE(grid.isBetaSmallerThanAlpha(alphaAngles, betaAngles)); -//} -// -//TEST_F(GridKernelTest, ifOneBetaIsBiggerThenAlpha_ItShouldreturnFalse) { -// -// real alphaAngles[3]; -// real betaAngles[3]; -// -// alphaAngles[0] = 94.4f; -// alphaAngles[1] = 92.4f; -// alphaAngles[2] = 91.5f; -// -// betaAngles[0] = 100.0f; -// betaAngles[1] = 0.0f; -// betaAngles[2] = 0.0f; -// -// Grid grid; -// ASSERT_FALSE(grid.isBetaSmallerThanAlpha(alphaAngles, betaAngles)); -//} -// -//#endif diff --git a/src/GridGenerator/grid/GridStrategy/GridStrategy.h b/src/GridGenerator/grid/GridStrategy/GridStrategy.h index 15b1d8476..bc861f8c9 100644 --- a/src/GridGenerator/grid/GridStrategy/GridStrategy.h +++ b/src/GridGenerator/grid/GridStrategy/GridStrategy.h @@ -1,9 +1,10 @@ #ifndef GRID_STRATEGY_H #define GRID_STRATEGY_H -#include <VirtualFluidsDefinitions.h> -#include "core/PointerDefinitions.h" -#include "core/LbmOrGks.h" +#include "Core/LbmOrGks.h" + +#include "global.h" + #include "grid/Field.h" struct Vertex; diff --git a/src/GridGenerator/grid/GridStrategy/GridStrategyMocks.h b/src/GridGenerator/grid/GridStrategy/GridStrategyMocks.h deleted file mode 100644 index 39aa538ab..000000000 --- a/src/GridGenerator/grid/GridStrategy/GridStrategyMocks.h +++ /dev/null @@ -1,49 +0,0 @@ -#ifndef GRID_STRATEGYMOCKS_H -#define GRID_STRATEGYMOCKS_H - -#include <VirtualFluidsDefinitions.h> -#include "core/PointerDefinitions.h" - -#include "GridStrategy.h" - -class TriangularMesh; -class GridImp; - -class VF_PUBLIC GridStrategyDummy : public GridStrategy -{ -public: - virtual ~GridStrategyDummy() {} - - virtual void allocateFieldMemory(Field* field) override {} - virtual void freeFieldMemory(Field* field) override {} - - virtual void allocateGridMemory(SPtr<GridImp> grid) override {} - - virtual void allocateQs(SPtr<GridImp> grid) override {} - - virtual void initalNodesToOutOfGrid(SPtr<GridImp> grid) override {} - void fixOddCells(SPtr<GridImp> grid) override{} - virtual void findInnerNodes(SPtr<GridImp> grid) override {} - void addOverlap(SPtr<GridImp> grid) override {} - - void fixRefinementIntoWall(SPtr<GridImp> grid) override {} - virtual void findStopperNodes(SPtr<GridImp> grid) override {} - void findBoundarySolidNodes(SPtr<GridImp> grid) override {} - void findEndOfGridStopperNodes(SPtr<GridImp> grid) override {} - void findSolidStopperNodes(SPtr<GridImp> grid) override {} - - virtual void mesh(SPtr<GridImp> grid, TriangularMesh &geom) override {} - - virtual uint closeNeedleCells(SPtr<GridImp> grid) override {return 0;}; - virtual uint closeNeedleCellsThinWall(SPtr<GridImp> grid) override {return 0;}; - - void findQs(SPtr<GridImp> grid, TriangularMesh& geom) override {}; - - virtual void findGridInterface(SPtr<GridImp> grid, SPtr<GridImp> finerGrid, LbmOrGks lbmOrGks) override {} - - virtual void findSparseIndices(SPtr<GridImp> coarseGrid, SPtr<GridImp> fineGrid) override {} - - virtual void freeMemory(SPtr<GridImp> grid) override {} -}; - -#endif diff --git a/src/GridGenerator/grid/GridTest.cpp b/src/GridGenerator/grid/GridTest.cpp deleted file mode 100644 index b2bc13553..000000000 --- a/src/GridGenerator/grid/GridTest.cpp +++ /dev/null @@ -1,274 +0,0 @@ -#include "gmock/gmock.h" -#include "GridImp.h" - -#include <vector> -#include <GridGenerator/geometries/Vertex/Vertex.h> -#include <GridGenerator/geometries/Triangle/Triangle.h> -#include <GridGenerator/geometries/BoundingBox/BoundingBox.h> -#include "GridStrategy/GridCpuStrategy/GridCpuStrategy.h" -#include "GridStrategy/GridStrategyMocks.h" - - -TEST(GridTest, getMinimumOnNode) -{ - auto gridStrategyDummy = SPtr<GridStrategy>(new GridStrategyDummy); - - const real startX = 0.0; - const real startY = 0.75; - const real startZ = 1.75; - const real delta = 0.5; - const auto sut = GridImp::makeShared(NULL, startX, startY, startZ, 10, 10, 10, delta, gridStrategyDummy, Distribution(), 0); - - const real exactX = 0.4; - const real exactY = 0.8; - const real exactZ = 2.3; - const Vertex actual = sut->getMinimumOnNode(Vertex(exactX, exactY, exactZ)); - - const real expectedX = 0.0; - const real expectedY = 0.75; - const real expectedZ = 2.25; - const Vertex expected = Vertex(expectedX, expectedY, expectedZ); - - EXPECT_TRUE(actual == expected); -} - -TEST(GridTest, getMaximumOnNode) -{ - auto gridStrategyDummy = SPtr<GridStrategy>(new GridStrategyDummy); - - const real startX = 0.0; - const real startY = 0.75; - const real startZ = 0.75; - const real delta = 0.5; - const auto sut = GridImp::makeShared(NULL, startX, startY, startZ, 10, 10, 10, delta, gridStrategyDummy, Distribution(), 0); - - const real exactX = 0.4; - const real exactY = 0.8; - const real exactZ = 1.3; - const Vertex actual = sut->getMaximumOnNode(Vertex(exactX, exactY, exactZ)); - - const real expectedX = 0.5; - const real expectedY = 1.25; - const real expectedZ = 1.75; - const Vertex expected = Vertex(expectedX, expectedY, expectedZ); - - EXPECT_TRUE(actual == expected); -} - -TEST(GridTest, getBoundingBoxOnNodes) -{ - auto gridStrategyDummy = SPtr<GridStrategy>(new GridStrategyDummy); - - const real startX = -1.0; - const real startY = -1.0; - const real startZ = -1.0; - const real delta = 0.25; - const auto sut = GridImp::makeShared(NULL, startX, startY, startZ, 10, 10, 10, delta, gridStrategyDummy, Distribution(), 0); - - Triangle t = Triangle(Vertex(0,0,0), Vertex(1,0,0), Vertex(1,1,0), Vertex(0.0f, 0.0f, 0.0f)); - - const auto actual = sut->getBoundingBoxOnNodes(t); - - EXPECT_THAT(actual.maxX, RealEq(1.25)); -} - - - - -//std::vector<Vertex> getPointsInBoundingBox(Triangle t, real delta) -//{ -// int x, y, z; -// BoundingBox box = BoundingBox::makeNodeBox(t); -// -// std::vector<Vertex> points; -// -// for (x = box.minX; x <= box.maxX; x++) { -// for (y = box.minY; y <= box.maxY; y++) { -// for (z = box.minZ; z <= box.maxZ; z++) { -// points.push_back(Vertex((real)x, (real)y, (real)z)); -// } -// } -// } -// -// return points; -//} -// -// -//TEST(GridTest, transIndexToCoordsAndCoordToIndex) -//{ -// Grid grid(nullptr, 0, 0, 0, 10, 10, 10, Distribution()); -// -// int index = 756; -// real x, y, z; -// grid.transIndexToCoords(index, x, y, z); -// -// real expectedX = 6; -// real expectedY = 5; -// real expectedZ = 7; -// -// EXPECT_THAT(x, expectedX); -// EXPECT_THAT(y, expectedY); -// EXPECT_THAT(z, expectedZ); -// -// unsigned int newIndex = grid.transCoordToIndex(expectedX, expectedY, expectedZ); -// -// EXPECT_THAT(newIndex, index); -//} -// -// -//TEST(GridTest, checkIfPointIsOutOfRange) -//{ -// Grid grid(nullptr, 5, 5, 5, 10, 10, 10, Distribution()); -// EXPECT_TRUE(grid.isOutOfRange(Vertex(0, 0, 0))); -//} -// -//TEST(GridTest, checkIfPointIsNotOutOfRange) -//{ -// Grid grid(nullptr, 5, 5, 5, 10, 10, 10, Distribution()); -// EXPECT_FALSE(grid.isOutOfRange(Vertex(8, 8, 5))); -//} - - - -#include <GridGenerator/grid/distributions/Distribution.h> -#include <GridGenerator/grid/NodeValues.h> - -// -//class GridStopperTest : public testing::Test -//{ -//public: -// Grid grid; -// -// void SetUp() -// { -// int nx = 2; -// int ny = 2; -// int nz = 2; -// int size = nx*ny*nz; -// -// char *field = new char[size](); -// grid = Grid(field, 0, 0, 0, nx, ny, nz, DistributionHelper::getDistribution27()); -// } -//}; -// -//TEST_F(GridStopperTest, testIfNodeIsStopper_IfeveryNodeBeforeIsSolid_ItShouldNotBeAStopperNode) -//{ -// grid.field[grid.transCoordToIndex(1, 1, 1)] = SOLID; // node -// -// grid.field[grid.transCoordToIndex(0, 1, 1)] = SOLID; // -x -// grid.field[grid.transCoordToIndex(1, 0, 1)] = SOLID; // -y -// grid.field[grid.transCoordToIndex(1, 1, 0)] = SOLID; // -z -// grid.field[grid.transCoordToIndex(0, 0, 0)] = SOLID; // -xyz -// grid.field[grid.transCoordToIndex(0, 0, 1)] = SOLID; // -xy -// grid.field[grid.transCoordToIndex(1, 0, 0)] = SOLID; // -yz -// grid.field[grid.transCoordToIndex(0, 1, 0)] = SOLID; // -xz -// -// ASSERT_FALSE(grid.isStopper(grid.transCoordToIndex(1, 1, 1))); -//} -// -//TEST_F(GridStopperTest, testIfNodeIsStopper_IfMinusXisFluid_ItShouldBeAStopperNode) -//{ -// grid.field[grid.transCoordToIndex(1, 1, 1)] = SOLID; // node -// -// grid.field[grid.transCoordToIndex(0, 1, 1)] = FLUID; // -x -// grid.field[grid.transCoordToIndex(1, 0, 1)] = SOLID; // -y -// grid.field[grid.transCoordToIndex(1, 1, 0)] = SOLID; // -z -// grid.field[grid.transCoordToIndex(0, 0, 0)] = SOLID; // -xyz -// grid.field[grid.transCoordToIndex(0, 0, 1)] = SOLID; // -xy -// grid.field[grid.transCoordToIndex(1, 0, 0)] = SOLID; // -yz -// grid.field[grid.transCoordToIndex(0, 1, 0)] = SOLID; // -xz -// -// ASSERT_TRUE(grid.isStopper(grid.transCoordToIndex(1, 1, 1))); -//} -// -// -//TEST_F(GridStopperTest, testIfNodeIsStopper_IfMinusYisFluid_ItShouldBeAStopperNode) -//{ -// grid.field[grid.transCoordToIndex(1, 1, 1)] = SOLID; // node -// -// grid.field[grid.transCoordToIndex(0, 1, 1)] = SOLID; // -x -// grid.field[grid.transCoordToIndex(1, 0, 1)] = FLUID; // -y -// grid.field[grid.transCoordToIndex(1, 1, 0)] = SOLID; // -z -// grid.field[grid.transCoordToIndex(0, 0, 0)] = SOLID; // -xyz -// grid.field[grid.transCoordToIndex(0, 0, 1)] = SOLID; // -xy -// grid.field[grid.transCoordToIndex(1, 0, 0)] = SOLID; // -yz -// grid.field[grid.transCoordToIndex(0, 1, 0)] = SOLID; // -xz -// -// ASSERT_TRUE(grid.isStopper(grid.transCoordToIndex(1, 1, 1))); -//} -// -// -//TEST_F(GridStopperTest, testIfNodeIsStopper_IfMinusZisFluid_ItShouldBeAStopperNode) -//{ -// grid.field[grid.transCoordToIndex(1, 1, 1)] = SOLID; // node -// -// grid.field[grid.transCoordToIndex(0, 1, 1)] = SOLID; // -x -// grid.field[grid.transCoordToIndex(1, 0, 1)] = SOLID; // -y -// grid.field[grid.transCoordToIndex(1, 1, 0)] = FLUID; // -z -// grid.field[grid.transCoordToIndex(0, 0, 0)] = SOLID; // -xyz -// grid.field[grid.transCoordToIndex(0, 0, 1)] = SOLID; // -xy -// grid.field[grid.transCoordToIndex(1, 0, 0)] = SOLID; // -yz -// grid.field[grid.transCoordToIndex(0, 1, 0)] = SOLID; // -xz -// -// ASSERT_TRUE(grid.isStopper(grid.transCoordToIndex(1, 1, 1))); -//} -// -//TEST_F(GridStopperTest, testIfNodeIsStopper_IfMinusXYZisFluid_ItShouldBeAStopperNode) -//{ -// grid.field[grid.transCoordToIndex(1, 1, 1)] = SOLID; // node -// -// grid.field[grid.transCoordToIndex(0, 1, 1)] = SOLID; // -x -// grid.field[grid.transCoordToIndex(1, 0, 1)] = SOLID; // -y -// grid.field[grid.transCoordToIndex(1, 1, 0)] = SOLID; // -z -// grid.field[grid.transCoordToIndex(0, 0, 0)] = FLUID; // -xyz -// grid.field[grid.transCoordToIndex(0, 0, 1)] = SOLID; // -xy -// grid.field[grid.transCoordToIndex(1, 0, 0)] = SOLID; // -yz -// grid.field[grid.transCoordToIndex(0, 1, 0)] = SOLID; // -xz -// -// ASSERT_TRUE(grid.isStopper(grid.transCoordToIndex(1, 1, 1))); -//} -// -//TEST_F(GridStopperTest, testIfNodeIsStopper_IfMinusXYisFluid_ItShouldBeAStopperNode) -//{ -// grid.field[grid.transCoordToIndex(1, 1, 1)] = SOLID; // node -// -// grid.field[grid.transCoordToIndex(0, 1, 1)] = SOLID; // -x -// grid.field[grid.transCoordToIndex(1, 0, 1)] = SOLID; // -y -// grid.field[grid.transCoordToIndex(1, 1, 0)] = SOLID; // -z -// grid.field[grid.transCoordToIndex(0, 0, 0)] = SOLID; // -xyz -// grid.field[grid.transCoordToIndex(0, 0, 1)] = FLUID; // -xy -// grid.field[grid.transCoordToIndex(1, 0, 0)] = SOLID; // -yz -// grid.field[grid.transCoordToIndex(0, 1, 0)] = SOLID; // -xz -// -// ASSERT_TRUE(grid.isStopper(grid.transCoordToIndex(1, 1, 1))); -//} -// -//TEST_F(GridStopperTest, testIfNodeIsStopper_IfMinusYZisFluid_ItShouldBeAStopperNode) -//{ -// grid.field[grid.transCoordToIndex(1, 1, 1)] = SOLID; // node -// -// grid.field[grid.transCoordToIndex(0, 1, 1)] = SOLID; // -x -// grid.field[grid.transCoordToIndex(1, 0, 1)] = SOLID; // -y -// grid.field[grid.transCoordToIndex(1, 1, 0)] = SOLID; // -z -// grid.field[grid.transCoordToIndex(0, 0, 0)] = SOLID; // -xyz -// grid.field[grid.transCoordToIndex(0, 0, 1)] = SOLID; // -xy -// grid.field[grid.transCoordToIndex(1, 0, 0)] = FLUID; // -yz -// grid.field[grid.transCoordToIndex(0, 1, 0)] = SOLID; // -xz -// -// ASSERT_TRUE(grid.isStopper(grid.transCoordToIndex(1, 1, 1))); -//} -// -//TEST_F(GridStopperTest, testIfNodeIsStopper_IfMinusXZisFluid_ItShouldBeAStopperNode) -//{ -// grid.field[grid.transCoordToIndex(1, 1, 1)] = SOLID; // node -// -// grid.field[grid.transCoordToIndex(0, 1, 1)] = SOLID; // -x -// grid.field[grid.transCoordToIndex(1, 0, 1)] = SOLID; // -y -// grid.field[grid.transCoordToIndex(1, 1, 0)] = SOLID; // -z -// grid.field[grid.transCoordToIndex(0, 0, 0)] = SOLID; // -xyz -// grid.field[grid.transCoordToIndex(0, 0, 1)] = SOLID; // -xy -// grid.field[grid.transCoordToIndex(1, 0, 0)] = SOLID; // -yz -// grid.field[grid.transCoordToIndex(0, 1, 0)] = FLUID; // -xz -// -// ASSERT_TRUE(grid.isStopper(grid.transCoordToIndex(1, 1, 1))); -//} diff --git a/src/GridGenerator/grid/distributions/Distribution.cpp b/src/GridGenerator/grid/distributions/Distribution.cpp index b805e4b5e..3373db7ce 100644 --- a/src/GridGenerator/grid/distributions/Distribution.cpp +++ b/src/GridGenerator/grid/distributions/Distribution.cpp @@ -1,14 +1,13 @@ #include "Distribution.h" - -#include "D3Q7.h" -#include "D3Q13.h" -#include "D3Q19.h" -#include "D3Q27.h" -#include <stdio.h> -#include <GridGenerator/grid/Grid.h> +#include <stdio.h> + +#include "grid/distributions/D3Q7.h" +#include "grid/distributions/D3Q13.h" +#include "grid/distributions/D3Q19.h" +#include "grid/distributions/D3Q27.h" -#include <GridGenerator/geometries/Vertex/Vertex.h> +#include "grid/Grid.h" Distribution DistributionHelper::getDistribution7() { diff --git a/src/GridGenerator/grid/distributions/Distribution.h b/src/GridGenerator/grid/distributions/Distribution.h index 0585faa4e..f7aadd65f 100644 --- a/src/GridGenerator/grid/distributions/Distribution.h +++ b/src/GridGenerator/grid/distributions/Distribution.h @@ -1,11 +1,11 @@ #ifndef Distribution_H #define Distribution_H -#include "GridGenerator/global.h" - #include <vector> #include <string> +#include "global.h" + #define DIR_END_MAX 27 diff --git a/src/GridGenerator/grid/kernel/runGridKernelGPU.cu b/src/GridGenerator/grid/kernel/runGridKernelGPU.cu index fce27d3ca..7aa6d4ebb 100644 --- a/src/GridGenerator/grid/kernel/runGridKernelGPU.cu +++ b/src/GridGenerator/grid/kernel/runGridKernelGPU.cu @@ -1,11 +1,10 @@ #include "runGridKernelGPU.cuh" -#include <GridGenerator/utilities/cuda/cudaDefines.h> -#include <GridGenerator/utilities/cuda/cudaKernelCall.h> -#include <GridGenerator/utilities/cuda/LaunchParameter.cuh> - -#include <GridGenerator/grid/GridImp.h> -#include <GridGenerator/geometries/TriangularMesh/TriangularMesh.h> +#include "utilities/cuda/cudaDefines.h" +#include "utilities/cuda/cudaKernelCall.h" +#include "utilities/cuda/LaunchParameter.cuh" +#include "grid/GridImp.h" +#include "geometries/TriangularMesh/TriangularMesh.h" GLOBAL void initalField(GridImp grid); GLOBAL void runMeshing(GridImp grid, const TriangularMesh geom); diff --git a/src/GridGenerator/io/GridVTKWriter/GridVTKWriter.cpp b/src/GridGenerator/io/GridVTKWriter/GridVTKWriter.cpp index 87628f1b0..9ea43fd9f 100644 --- a/src/GridGenerator/io/GridVTKWriter/GridVTKWriter.cpp +++ b/src/GridGenerator/io/GridVTKWriter/GridVTKWriter.cpp @@ -1,15 +1,17 @@ #define _CRT_SECURE_NO_DEPRECATE #include "GridVTKWriter.h" + #include <iostream> #include <fstream> #include <sstream> #include <memory> -#include <utilities/logger/Logger.h> -#include <GridGenerator/grid/Grid.h> -#include <GridGenerator/geometries/Vertex/Vertex.h> -#include "basics/writer/WbWriterVtkXmlBinary.h" -#include "basics/container/CbArray3D.h" +#include "VirtualFluidsBasics/basics/writer/WbWriterVtkXmlBinary.h" +#include "VirtualFluidsBasics/basics/container/CbArray3D.h" + +#include "geometries/Vertex/Vertex.h" + +#include "grid/Grid.h" #include "grid/NodeValues.h" #include "grid/Cell.h" diff --git a/src/GridGenerator/io/GridVTKWriter/GridVTKWriter.h b/src/GridGenerator/io/GridVTKWriter/GridVTKWriter.h index dc7f2662c..c55a111c5 100644 --- a/src/GridGenerator/io/GridVTKWriter/GridVTKWriter.h +++ b/src/GridGenerator/io/GridVTKWriter/GridVTKWriter.h @@ -3,8 +3,7 @@ #include <string> -#include <core/PointerDefinitions.h> -#include <VirtualFluidsDefinitions.h> +#include "global.h" enum class WRITING_FORMAT { BINARY, ASCII }; diff --git a/src/GridGenerator/io/QLineWriter.cpp b/src/GridGenerator/io/QLineWriter.cpp index 2616e7315..7f086b272 100644 --- a/src/GridGenerator/io/QLineWriter.cpp +++ b/src/GridGenerator/io/QLineWriter.cpp @@ -3,18 +3,17 @@ #include <vector> #include <string> #include <fstream> -#include <basics/utilities/UbTuple.h> -#include <grid/BoundaryConditions/BoundaryCondition.h> -#include <grid/Grid.h> -#include <geometries/Vertex/Vertex.h> +#include "VirtualFluidsBasics/basics/utilities/UbTuple.h" -#include "VirtualFluidsBasics/utilities/logger/Logger.h" +#include "geometries/Vertex/Vertex.h" + +#include "grid/BoundaryConditions/BoundaryCondition.h" +#include "grid/Grid.h" using namespace std; void writeLines(std::string filename, std::vector<UbTupleFloat3> nodes, std::vector<UbTupleInt2> lines); - void QLineWriter::writeArrows(std::string fileName, SPtr<GeometryBoundaryCondition> geometryBoundaryCondition, SPtr<Grid> grid) { if (geometryBoundaryCondition == nullptr) diff --git a/src/GridGenerator/io/QLineWriter.h b/src/GridGenerator/io/QLineWriter.h index 2f7798174..01596adbd 100644 --- a/src/GridGenerator/io/QLineWriter.h +++ b/src/GridGenerator/io/QLineWriter.h @@ -5,7 +5,7 @@ #include <string> #include <fstream> -#include <core/PointerDefinitions.h> +#include "global.h" class GeometryBoundaryCondition; class Grid; diff --git a/src/GridGenerator/io/STLReaderWriter/STLReader.cpp b/src/GridGenerator/io/STLReaderWriter/STLReader.cpp index 991573048..69cd83961 100644 --- a/src/GridGenerator/io/STLReaderWriter/STLReader.cpp +++ b/src/GridGenerator/io/STLReaderWriter/STLReader.cpp @@ -9,11 +9,9 @@ #include <stdexcept> #include <algorithm> -#include <GridGenerator/geometries/Vertex/Vertex.h> -#include <GridGenerator/geometries/Triangle/Triangle.h> -#include <GridGenerator/geometries/BoundingBox/BoundingBox.h> - -#include <utilities/logger/Logger.h> +#include "geometries/Vertex/Vertex.h" +#include "geometries/Triangle/Triangle.h" +#include "geometries/BoundingBox/BoundingBox.h" std::vector<Triangle> STLReader::readSTL(const std::string& name) diff --git a/src/GridGenerator/io/STLReaderWriter/STLReader.h b/src/GridGenerator/io/STLReaderWriter/STLReader.h index 485a2cf77..ce8411507 100644 --- a/src/GridGenerator/io/STLReaderWriter/STLReader.h +++ b/src/GridGenerator/io/STLReaderWriter/STLReader.h @@ -5,9 +5,7 @@ #include <vector> #include <string> -#include <VirtualFluidsDefinitions.h> - -#include "core/DataTypes.h" +#include "global.h" struct Triangle; struct Vertex; diff --git a/src/GridGenerator/io/STLReaderWriter/STLWriter.cpp b/src/GridGenerator/io/STLReaderWriter/STLWriter.cpp index 94958156b..724ae89b0 100644 --- a/src/GridGenerator/io/STLReaderWriter/STLWriter.cpp +++ b/src/GridGenerator/io/STLReaderWriter/STLWriter.cpp @@ -1,13 +1,11 @@ #define _CRT_SECURE_NO_DEPRECATE #include "STLWriter.h" + #include <fstream> #include <sstream> -#include <GridGenerator/geometries/Vertex/Vertex.h> -#include <GridGenerator/geometries/Triangle/Triangle.h> - -#include <utilities/logger/Logger.h> - +#include "geometries/Vertex/Vertex.h" +#include "geometries/Triangle/Triangle.h" void STLWriter::writeSTL(std::vector<Triangle> &vec, const std::string &name, bool writeBinary) { diff --git a/src/GridGenerator/io/STLReaderWriter/STLWriter.h b/src/GridGenerator/io/STLReaderWriter/STLWriter.h index 5fb5a4d38..174a8e432 100644 --- a/src/GridGenerator/io/STLReaderWriter/STLWriter.h +++ b/src/GridGenerator/io/STLReaderWriter/STLWriter.h @@ -1,14 +1,12 @@ #ifndef STLWriter_H #define STLWriter_H - - #include <vector> #include <string> #include <memory> #include <fstream> -#include <VirtualFluidsDefinitions.h> +#include "global.h" class Transformator; struct Triangle; diff --git a/src/GridGenerator/io/SimulationFileWriter/SimulationFileNames.h b/src/GridGenerator/io/SimulationFileWriter/SimulationFileNames.h index 3507cbc0a..b80e999da 100644 --- a/src/GridGenerator/io/SimulationFileWriter/SimulationFileNames.h +++ b/src/GridGenerator/io/SimulationFileWriter/SimulationFileNames.h @@ -3,7 +3,7 @@ #include <string> -#include <VirtualFluidsDefinitions.h> +#include "global.h" struct VF_PUBLIC simulationFileNames { diff --git a/src/GridGenerator/io/SimulationFileWriter/SimulationFileTest.cpp b/src/GridGenerator/io/SimulationFileWriter/SimulationFileTest.cpp deleted file mode 100644 index d1fa73387..000000000 --- a/src/GridGenerator/io/SimulationFileWriter/SimulationFileTest.cpp +++ /dev/null @@ -1,153 +0,0 @@ -//#include "gmock/gmock.h" -// -//#include <GridGenerator/geometries/Vertex/Vertex.h> -//#include <GridGenerator/geometries/Triangle/Triangle.h> -//#include <GridGenerator/geometries/BoundingBox/BoundingBox.h> -//#include <GridGenerator/geometries/TriangularMesh/TriangularMesh.h> -// -//#include <GridGenerator/grid/kernel/GridKernelCPU.h> -//#include <GridGenerator/grid/partition/Partition.h> -//#include <GridGenerator/utilities/Transformator/Transformator.h> -//#include <GridGenerator/io/STLReaderWriter/STLReaderWriter.h> -//#include "SimulationFileWriter.h" -//#include "UnstructuredGridBuilder.h" -//#include "SimulationFileNames.h" -// -//// -//using namespace testing; -// -//class SimulationFileTest : public Test { -// -//public: -// std::vector<unsigned int> neighborXFoam, neighborYFoam, neighborZFoam, geoFoam; -// std::vector<unsigned int> neighborX, neighborY, neighborZ, geo; -// -// std::vector<real> coordXFoam, coordYFoam, coordZFoam; -// std::vector<real> coordX, coordY, coordZ; -// -// std::vector<std::vector<real> > inletQFoam, outletQFoam; -// std::vector<std::vector<real> > inletQ, outletQ; -// -// void SetUp() { -// real length = 10.0f; -// real width = 10.0f; -// real high = 10.0f; -// real delta = 1.0f; -// -// int nx = (int)(length / delta) + 1; -// int ny = (int)(width / delta) + 1; -// int nz = (int)(high / delta) + 1; -// -// Transformator trans = Transformator(delta, Vertex(0.0f, 0.0f, 0.0f)); -// std::string path = PATH_TO_DATA; -// std::string folder = "TESTSUITE/SIMULATION_FILES/"; -// std::string input = path + folder + "gridcubeSimulation.stl"; -// std::vector<BoundingBox> boxes = Partition::getProcessBoxes(1, nx, ny, nz); -// -// GridKernelCPU gridCPU(boxes[0], "D3Q27", trans, true); -// Geometry geom(input, boxes[0], trans); -// if (geom.size > 0) -// gridCPU.meshGrid(geom); -// -// gridCPU.floodFill(Vertex(5,5,5)); -// -// UnstructuredGridBuilder builder; -// BoundingBox box; -// builder.buildUnstructuredGrid(gridCPU.grid, box); -// -// bool binaer = false; -// Transformator dummy; -// std::vector<Node> coords = builder.getNodes(); -// std::vector<std::vector<std::vector<real> > > qs = builder.getQsValues(); -// SimulationFileWriter::writeSimulationFiles(path + folder + "gridGeneration/", coords, qs, binaer, gridCPU.grid, dummy); -// -// //open OpenFoam files -// CoordNeighborGeoReader cngNXFoam(path + folder + "openFoam/" + simulationFileNames::neighborX, binaer, false); -// CoordNeighborGeoReader cngNYFoam(path + folder + "openFoam/" + simulationFileNames::neighborY, binaer, false); -// CoordNeighborGeoReader cngNZFoam(path + folder + "openFoam/" + simulationFileNames::neighborZ, binaer, false); -// neighborXFoam = cngNXFoam.getNeighbors(0); -// neighborYFoam = cngNYFoam.getNeighbors(0); -// neighborZFoam = cngNZFoam.getNeighbors(0); -// CoordNeighborGeoReader cngXFoam(path + folder + "openFoam/" + simulationFileNames::coordX, binaer, true); -// CoordNeighborGeoReader cngYFoam(path + folder + "openFoam/" + simulationFileNames::coordY, binaer, true); -// CoordNeighborGeoReader cngZFoam(path + folder + "openFoam/" + simulationFileNames::coordZ, binaer, true); -// coordXFoam = cngXFoam.getCoords(0); -// coordYFoam = cngYFoam.getCoords(0); -// coordZFoam = cngZFoam.getCoords(0); -// CoordNeighborGeoReader cngGeoFoam(path + folder + "openFoam/" + simulationFileNames::geoVec, binaer, false); -// geoFoam = cngGeoFoam.getNeighbors(0); -// -// //open grid generation files -// CoordNeighborGeoReader cngNX(path + folder + "gridGeneration/" + simulationFileNames::neighborX, binaer, false); -// CoordNeighborGeoReader cngNY(path + folder + "gridGeneration/" + simulationFileNames::neighborY, binaer, false); -// CoordNeighborGeoReader cngNZ(path + folder + "gridGeneration/" + simulationFileNames::neighborZ, binaer, false); -// neighborX = cngNX.getNeighbors(0); -// neighborY = cngNY.getNeighbors(0); -// neighborZ = cngNZ.getNeighbors(0); -// CoordNeighborGeoReader cngX(path + folder + "gridGeneration/" + simulationFileNames::coordX, binaer, true); -// CoordNeighborGeoReader cngY(path + folder + "gridGeneration/" + simulationFileNames::coordY, binaer, true); -// CoordNeighborGeoReader cngZ(path + folder + "gridGeneration/" + simulationFileNames::coordZ, binaer, true); -// coordX = cngX.getCoords(0); -// coordY = cngY.getCoords(0); -// coordZ = cngZ.getCoords(0); -// CoordNeighborGeoReader cngGeo(path + folder + "gridGeneration/" + simulationFileNames::geoVec, binaer, false); -// geo = cngGeo.getNeighbors(0); -// -// BoundaryQsReader BCInletFoam(path + folder + "openFoam/" + simulationFileNames::inletBoundaryQ, false); -// inletQFoam = BCInletFoam.getQs(0); -// -// BoundaryQsReader BCInlet(path + folder + "gridGeneration/" + simulationFileNames::inletBoundaryQ, false); -// inletQ = BCInlet.getQs(0); -// -// -// BoundaryQsReader BCOutletFoam(path + folder + "openFoam/" + simulationFileNames::outletBoundaryQ, false); -// outletQFoam = BCOutletFoam.getQs(0); -// -// BoundaryQsReader BCOutlet(path + folder + "gridGeneration/" + simulationFileNames::outletBoundaryQ, false); -// outletQ = BCOutlet.getQs(0); -// -// } -// -// void TearDown() { -// } -// -//}; -// -// -//TEST_F(SimulationFileTest, testFileSizeFromOpenFoamWithGridGeneration) -//{ -// bool filesizes = neighborXFoam.size() == neighborX.size() && neighborYFoam.size() == neighborY.size() && neighborZFoam.size() == neighborZ.size() && geoFoam.size() == geo.size(); -// -// EXPECT_TRUE(filesizes); -// -// for (int i = 1; i < neighborXFoam.size(); i++) { -// EXPECT_THAT(coordXFoam[i] - 1.5f, DoubleEq(coordX[i])); -// EXPECT_THAT(coordYFoam[i] - 1.5f, DoubleEq(coordY[i])); -// EXPECT_THAT(coordZFoam[i] - 1.5f, DoubleEq(coordZ[i])); -// -// EXPECT_THAT(neighborXFoam[i], Eq(neighborX[i])); -// EXPECT_THAT(neighborYFoam[i], Eq(neighborY[i])); -// EXPECT_THAT(neighborZFoam[i], Eq(neighborZ[i])); -// EXPECT_THAT(geoFoam[i], Eq(geo[i])); -// } -// -// for (int i = 0; i < inletQFoam.size(); i++) { -// bool size = inletQFoam[i].size() == inletQ[i].size(); -// EXPECT_TRUE(size); -// } -// -// for (int i = 0; i < inletQFoam.size(); i++) { -// for (int j = 0; j < inletQFoam[i].size(); j++) { -// -// EXPECT_THAT(inletQFoam[i][j], DoubleEq(inletQ[i][j])); -// } -// } -// -// for (int i = 0; i < inletQFoam.size(); i++) { -// for (int j = 0; j < inletQFoam[i].size(); j++) { -// -// EXPECT_THAT(outletQFoam[i][j], DoubleEq(outletQ[i][j])); -// } -// } -//} -// diff --git a/src/GridGenerator/io/SimulationFileWriter/SimulationFileWriter.cpp b/src/GridGenerator/io/SimulationFileWriter/SimulationFileWriter.cpp index dd9bb6d6a..7443e3047 100644 --- a/src/GridGenerator/io/SimulationFileWriter/SimulationFileWriter.cpp +++ b/src/GridGenerator/io/SimulationFileWriter/SimulationFileWriter.cpp @@ -5,24 +5,20 @@ #include <iomanip> #include <omp.h> #include <cmath> -#include "stdint.h" +#include <stdint.h> -#include "VirtualFluidsBasics/utilities/logger/Logger.h" +#include "Core/Timer/Timer.h" -#include "SimulationFileNames.h" +#include "grid/NodeValues.h" +#include "grid/Grid.h" +#include "grid/GridBuilder/GridBuilder.h" +#include "grid/BoundaryConditions/Side.h" +#include "grid/BoundaryConditions/BoundaryCondition.h" -#include <GridGenerator/grid/NodeValues.h> -#include <GridGenerator/grid/Grid.h> - -#include <GridGenerator/grid/GridBuilder/GridBuilder.h> - -#include <GridGenerator/grid/BoundaryConditions/Side.h> -#include <GridGenerator/grid/BoundaryConditions/BoundaryCondition.h> +#include "io/SimulationFileWriter/SimulationFileNames.h" #include "utilities/communication.h" -#include "core/Timer/Timer.h" - /*#################################################################################*/ /*---------------------------------public methods----------------------------------*/ /*---------------------------------------------------------------------------------*/ diff --git a/src/GridGenerator/io/SimulationFileWriter/SimulationFileWriter.h b/src/GridGenerator/io/SimulationFileWriter/SimulationFileWriter.h index 2cc974d48..b4edfba92 100644 --- a/src/GridGenerator/io/SimulationFileWriter/SimulationFileWriter.h +++ b/src/GridGenerator/io/SimulationFileWriter/SimulationFileWriter.h @@ -8,10 +8,9 @@ #include <vector> #include <array> -#include <GridGenerator/global.h> -#include <core/PointerDefinitions.h> -#include <core/DataTypes.h> -#include <core/NonCreatable.h> +#include "Core/NonCreatable.h" + +#include "global.h" class UnstructuredGridBuilder; class GridBuilder; diff --git a/src/GridGenerator/utilities/cuda/LaunchParameter.cu b/src/GridGenerator/utilities/cuda/LaunchParameter.cu index 8bd815d55..efe9b0381 100644 --- a/src/GridGenerator/utilities/cuda/LaunchParameter.cu +++ b/src/GridGenerator/utilities/cuda/LaunchParameter.cu @@ -1,6 +1,4 @@ #include "LaunchParameter.cuh" -#include <utilities/logger/Logger.h> -#include "GridGenerator/global.h" #define MAXBLOCKSIZE 65535 diff --git a/src/GridGenerator/utilities/cuda/LaunchParameter.cuh b/src/GridGenerator/utilities/cuda/LaunchParameter.cuh index aa0e5e7ef..cf88e6e3f 100644 --- a/src/GridGenerator/utilities/cuda/LaunchParameter.cuh +++ b/src/GridGenerator/utilities/cuda/LaunchParameter.cuh @@ -1,13 +1,13 @@ #ifndef kernelHelper_CUH #define kernelHelper_CUH -#include "GridGenerator/global.h" - -#include "cuda.h" -#include "cuda_runtime.h" -#include "device_launch_parameters.h" +#include <cuda.h> +#include <cuda_runtime.h> +#include <device_launch_parameters.h> #include <stdio.h> +#include "global.h" + class LaunchParameter { public: diff --git a/src/GridGenerator/utilities/cuda/LaunchParameterTest.cpp b/src/GridGenerator/utilities/cuda/LaunchParameterTest.cpp deleted file mode 100644 index 941994387..000000000 --- a/src/GridGenerator/utilities/cuda/LaunchParameterTest.cpp +++ /dev/null @@ -1,57 +0,0 @@ -#include "LaunchParameter.cuh" - -#include "gmock/gmock.h" - - -using namespace testing; - - -TEST(LaunchParameterTest, get1d1dLaunchParameterWithThreadsEqualToSize) -{ - int threads = 256; - int size = 256; - - LaunchParameter p = LaunchParameter::make_1D1D_launchParameter(size, threads); - - EXPECT_THAT(p.threads.x, Eq(256)); - EXPECT_THAT(p.threads.y, Eq(1)); - EXPECT_THAT(p.threads.z, Eq(1)); - - EXPECT_THAT(p.blocks.x, Eq(1)); - EXPECT_THAT(p.blocks.y, Eq(1)); - EXPECT_THAT(p.blocks.z, Eq(1)); -} - - -TEST(LaunchParameterTest, get1d1dLaunchParameterWithThreadsSmallerThanSize) -{ - int threads = 256; - int size = 257; - - LaunchParameter p = LaunchParameter::make_1D1D_launchParameter(size, threads); - - EXPECT_THAT(p.threads.x, Eq(256)); - EXPECT_THAT(p.threads.y, Eq(1)); - EXPECT_THAT(p.threads.z, Eq(1)); - - EXPECT_THAT(p.blocks.x, Eq(2)); - EXPECT_THAT(p.blocks.y, Eq(1)); - EXPECT_THAT(p.blocks.z, Eq(1)); -} - - -TEST(LaunchParameterTest, get2d1dLaunchParameterWithThreadsSmallerThanSize) -{ - int threads = 256; - int size = 65535 * 257; - - LaunchParameter p = LaunchParameter::make_2D1D_launchParameter(size, threads); - - EXPECT_THAT(p.threads.x, Eq(256)); - EXPECT_THAT(p.threads.y, Eq(1)); - EXPECT_THAT(p.threads.z, Eq(1)); - - EXPECT_THAT(p.blocks.x, Eq(256)); - EXPECT_THAT(p.blocks.y, Eq(256)); - EXPECT_THAT(p.blocks.z, Eq(1)); -} \ No newline at end of file diff --git a/src/GridGenerator/utilities/cuda/cudaDefines.h b/src/GridGenerator/utilities/cuda/cudaDefines.h index 2bb7a070d..101b8418f 100644 --- a/src/GridGenerator/utilities/cuda/cudaDefines.h +++ b/src/GridGenerator/utilities/cuda/cudaDefines.h @@ -1,7 +1,7 @@ #ifndef CUDA_DEFINES_H #define CUDA_DEFINES_H -#include "cuda_runtime.h" +#include <cuda_runtime.h> #include <stdio.h> #define HOST __host__ diff --git a/src/GridGenerator/utilities/cuda/cudaKernelCall.h b/src/GridGenerator/utilities/cuda/cudaKernelCall.h index 6ed18815f..b3334c832 100644 --- a/src/GridGenerator/utilities/cuda/cudaKernelCall.h +++ b/src/GridGenerator/utilities/cuda/cudaKernelCall.h @@ -1,11 +1,9 @@ #ifndef cudaKernelCall_H #define cudaKernelCall_H -#include "cudaDefines.h" - - -#include "CudaErrorCheck.cu" -#include "LaunchParameter.cuh" +#include "utilities/cuda/cudaDefines.h" +#include "utilities/cuda/CudaErrorCheck.cu" +#include "utilities/cuda/LaunchParameter.cuh" template<typename Functor, typename... TArgs> HOST float runKernel(Functor kernel, const LaunchParameter& para, TArgs... args) diff --git a/src/GridGenerator/utilities/math/Math.h b/src/GridGenerator/utilities/math/Math.h index 9992506f1..d4b9823b8 100644 --- a/src/GridGenerator/utilities/math/Math.h +++ b/src/GridGenerator/utilities/math/Math.h @@ -1,9 +1,11 @@ #ifndef CudaMath_H #define CudaMath_H -#include "GridGenerator/global.h" -#include <cuda_runtime.h> -#include "float.h" +#include <float.h> + +#include "global.h" + +#include "utilities/cuda/cudaDefines.h" #define EPSILON FLT_EPSILON diff --git a/src/GridGenerator/utilities/math/MathTest.cpp b/src/GridGenerator/utilities/math/MathTest.cpp deleted file mode 100644 index a1ef077bc..000000000 --- a/src/GridGenerator/utilities/math/MathTest.cpp +++ /dev/null @@ -1,107 +0,0 @@ -#include "gmock/gmock.h" -#include "Math.h" - -using namespace testing; - -class MathTest : public Test { -public: - void SetUp() { - - } -}; - -TEST_F(MathTest, getDecimalPart) { - ASSERT_THAT(vf::Math::getDecimalPart(2.23232), RealEq(0.23232)); -} - -TEST_F(MathTest, compareBigValues) { - ASSERT_TRUE(vf::Math::equal(10000000.0f, 10000001.0f)); - ASSERT_TRUE(vf::Math::equal(10000001.0f, 10000000.0f)); - ASSERT_FALSE(vf::Math::equal(100000.0f, 100001.0f)); - ASSERT_FALSE(vf::Math::equal(100001.0f, 100000.0f)); -} - -TEST_F(MathTest, compareSmallValues) { - ASSERT_TRUE(vf::Math::equal(-10000000.0f, -10000001.0f)); - ASSERT_TRUE(vf::Math::equal(-10000001.0f, -10000000.0f)); - ASSERT_FALSE(vf::Math::equal(-100000.0f, -100001.0f)); - ASSERT_FALSE(vf::Math::equal(-100001.0f, -100000.0f)); -} - -TEST_F(MathTest, compareNumbersAroundOne) { - ASSERT_TRUE(vf::Math::equal(1.0000001f, 1.0000002f)); - ASSERT_TRUE(vf::Math::equal(1.0000002f, 1.0000001f)); - ASSERT_FALSE(vf::Math::equal(1.0002f, 1.0001f)); - ASSERT_FALSE(vf::Math::equal(1.0001f, 1.0002f)); -} - -TEST_F(MathTest, compareNumbersAroundMinusOne) { - ASSERT_TRUE(vf::Math::equal(-1.0000001f, -1.0000002f)); - ASSERT_TRUE(vf::Math::equal(-1.0000002f, -1.0000001f)); - ASSERT_FALSE(vf::Math::equal(-1.0002f, -1.0001f)); - ASSERT_FALSE(vf::Math::equal(-1.0001f, -1.0002f)); -} - -TEST_F(MathTest, compareNumbersBetweenOneAndZero) { - ASSERT_TRUE(vf::Math::equal(0.0000000010000001f, 0.0000000010000002f)); - ASSERT_TRUE(vf::Math::equal(0.0000000010000002f, 0.0000000010000001f)); - ASSERT_FALSE(vf::Math::equal(0.000000000001002f, 0.000000000001001f)); - ASSERT_FALSE(vf::Math::equal(0.000000000001001f, 0.000000000001002f)); -} - -TEST_F(MathTest, compareNumbersBetweenMinusOneAndZero) { - ASSERT_TRUE(vf::Math::equal(-0.0000000010000001f, -0.0000000010000002f)); - ASSERT_TRUE(vf::Math::equal(-0.0000000010000002f, -0.0000000010000001f)); - ASSERT_FALSE(vf::Math::equal(-0.000000000001002f, -0.000000000001001f)); - ASSERT_FALSE(vf::Math::equal(-0.000000000001001f, -0.000000000001002f)); -} - -TEST_F(MathTest, compareNumbersZero) { - ASSERT_TRUE(vf::Math::equal(0.0f, 0.0f)); - ASSERT_TRUE(vf::Math::equal(0.0f, -0.0f)); - ASSERT_TRUE(vf::Math::equal(-0.0f, -0.0f)); - ASSERT_FALSE(vf::Math::equal(0.000000001f, 0.0f)); - ASSERT_FALSE(vf::Math::equal(0.0f, 0.000000001f)); - ASSERT_FALSE(vf::Math::equal(-0.000000001f, 0.0f)); - ASSERT_FALSE(vf::Math::equal(0.0f, -0.000000001f)); - - ASSERT_FALSE(vf::Math::equal(0.0f, 1e-40f, 0.01f)); - ASSERT_FALSE(vf::Math::equal(1e-40f, 0.0f, 0.01f)); -} - -TEST_F(MathTest, compareNumbersExtremeMaxValues) { - ASSERT_TRUE(vf::Math::equal(FLT_MAX, FLT_MAX)); - ASSERT_FALSE(vf::Math::equal(FLT_MAX, -FLT_MAX)); - ASSERT_FALSE(vf::Math::equal(-FLT_MAX, FLT_MAX)); -} - -TEST_F(MathTest, compareNumbersExtremeMinValues) { - ASSERT_TRUE(vf::Math::equal(FLT_MIN, FLT_MIN)); - - ASSERT_FALSE(vf::Math::equal(FLT_MIN, 0.0f)); - ASSERT_FALSE(vf::Math::equal(0.0f, FLT_MIN)); - ASSERT_FALSE(vf::Math::equal(FLT_MIN, 0.0000000000001f)); - ASSERT_FALSE(vf::Math::equal(0.0000000000001f, FLT_MIN)); - - ASSERT_FALSE(vf::Math::equal(FLT_MIN, -FLT_MIN)); - ASSERT_FALSE(vf::Math::equal(-FLT_MIN, FLT_MIN)); -} - -TEST_F(MathTest, compareNumbersNotANumber) { - ASSERT_FALSE(vf::Math::equal(NAN, NAN)); - ASSERT_FALSE(vf::Math::equal(NAN, 0.0f)); - ASSERT_FALSE(vf::Math::equal(0.0f, NAN)); -} - - -TEST_F(MathTest, lessEqual) { - ASSERT_TRUE(vf::Math::lessEqual(10000001.0f, 10000000.0f)); - ASSERT_FALSE(vf::Math::lessEqual(10000001.0f, 1000000.0f)); - ASSERT_TRUE(vf::Math::lessEqual(100000.0f, 100000000.0f)); -} - -TEST_F(MathTest, greaterEqual) { - ASSERT_TRUE(vf::Math::greaterEqual(10000001.0f, 10000000.0f)); - ASSERT_FALSE(vf::Math::greaterEqual(10000.0f, 100000001.0f)); - ASSERT_TRUE(vf::Math::greaterEqual(100000000.0f, 100000.0f)); -} diff --git a/src/GridGenerator/utilities/transformator/ArrowTransformator.cpp b/src/GridGenerator/utilities/transformator/ArrowTransformator.cpp index 6d99ff814..7ec055c59 100644 --- a/src/GridGenerator/utilities/transformator/ArrowTransformator.cpp +++ b/src/GridGenerator/utilities/transformator/ArrowTransformator.cpp @@ -1,7 +1,6 @@ #include "ArrowTransformator.h" -#include "TransformatorImp.h" - +#include "utilities/transformator/TransformatorImp.h" std::shared_ptr<ArrowTransformator> ArrowTransformator::makeTransformator(real delta, real dx, real dy, real dz) { diff --git a/src/GridGenerator/utilities/transformator/ArrowTransformator.h b/src/GridGenerator/utilities/transformator/ArrowTransformator.h index f7efeaefd..deaa4403e 100644 --- a/src/GridGenerator/utilities/transformator/ArrowTransformator.h +++ b/src/GridGenerator/utilities/transformator/ArrowTransformator.h @@ -2,8 +2,8 @@ #define ArrowTransformator_h #include <memory> -#include "GridGenerator/global.h" +#include "global.h" class Arrow; diff --git a/src/GridGenerator/utilities/transformator/Transformator.cpp b/src/GridGenerator/utilities/transformator/Transformator.cpp index 539ec7021..4f59dc648 100644 --- a/src/GridGenerator/utilities/transformator/Transformator.cpp +++ b/src/GridGenerator/utilities/transformator/Transformator.cpp @@ -1,6 +1,6 @@ #include "Transformator.h" -#include "TransformatorImp.h" +#include "utilities/transformator/TransformatorImp.h" std::shared_ptr<Transformator> Transformator::makeTransformator(real delta, real dx, real dy, real dz) { diff --git a/src/GridGenerator/utilities/transformator/Transformator.h b/src/GridGenerator/utilities/transformator/Transformator.h index d965f33f3..3bf5b5b45 100644 --- a/src/GridGenerator/utilities/transformator/Transformator.h +++ b/src/GridGenerator/utilities/transformator/Transformator.h @@ -2,8 +2,8 @@ #define Transformator_h #include <memory> -#include "GridGenerator/global.h" +#include "global.h" class BoundingBox; struct Triangle; diff --git a/src/GridGenerator/utilities/transformator/TransformatorImp.cpp b/src/GridGenerator/utilities/transformator/TransformatorImp.cpp index 2c40f9e27..224dda497 100644 --- a/src/GridGenerator/utilities/transformator/TransformatorImp.cpp +++ b/src/GridGenerator/utilities/transformator/TransformatorImp.cpp @@ -1,10 +1,12 @@ #include "TransformatorImp.h" + #include <memory> -#include <GridGenerator/geometries/BoundingBox/BoundingBox.h> -#include <GridGenerator/geometries/Triangle/Triangle.h> -#include <GridGenerator/geometries/TriangularMesh/TriangularMesh.h> -#include <GridGenerator/geometries/Vertex/Vertex.h> -#include <GridGenerator/geometries/Arrow/Arrow.h> + +#include "geometries/BoundingBox/BoundingBox.h" +#include "geometries/Triangle/Triangle.h" +#include "geometries/TriangularMesh/TriangularMesh.h" +#include "geometries/Vertex/Vertex.h" +#include "geometries/Arrow/Arrow.h" TransformatorImp::TransformatorImp() { diff --git a/src/GridGenerator/utilities/transformator/TransformatorImp.h b/src/GridGenerator/utilities/transformator/TransformatorImp.h index 502492e6d..64a52604b 100644 --- a/src/GridGenerator/utilities/transformator/TransformatorImp.h +++ b/src/GridGenerator/utilities/transformator/TransformatorImp.h @@ -1,19 +1,19 @@ #ifndef TransformatorImp_h #define TransformatorImp_h - -#include "GridGenerator/global.h" #include <exception> #include <sstream> -#include "Transformator.h" -#include "ArrowTransformator.h" + +#include "global.h" + +#include "utilities/transformator/Transformator.h" +#include "utilities/transformator/ArrowTransformator.h" class BoundingBox; struct Triangle; class TriangularMesh; struct Vertex; - class invalidDelta : public std::exception { const char* what() const throw() { diff --git a/src/GridGenerator/utilities/transformator/TransformatorMocks.h b/src/GridGenerator/utilities/transformator/TransformatorMocks.h deleted file mode 100644 index ea6141d9f..000000000 --- a/src/GridGenerator/utilities/transformator/TransformatorMocks.h +++ /dev/null @@ -1,50 +0,0 @@ -#ifndef TransformatorMocks_h -#define TransformatorMocks_h - -#include "gmock/gmock.h" - - -#include "GridGenerator/global.h" - -#include "Transformator.h" - -#include <geometries/Vertex/Vertex.h> -#include <geometries/Triangle/Triangle.h> -#include <geometries/BoundingBox/BoundingBox.h> -#include <geometries/TriangularMesh/TriangularMesh.h> - -class TransformatorStub : public Transformator -{ -public: - TransformatorStub() {} - virtual ~TransformatorStub() {}; - - virtual void transformWorldToView(Triangle &value) const override{} - virtual void transformWorldToView(TriangularMesh &geom) const override {} - virtual void transformWorldToView(Vertex &value) const override {} - - virtual void transformViewToWorld(BoundingBox &box) const override {} - virtual void transformWorldToView(BoundingBox &box) const override {} - - virtual void transformViewToWorld(Vertex &value) const override { v = value; counter++; logString.append("transformViewToWorld "); } - - Vertex getParameterFromTransViewToWorld() { return v; } - std::string getLogString() { return logString; } - -private: - mutable Vertex v; - mutable int counter = 0; - mutable std::string logString; -}; - -class TransformatorSpy : public TransformatorStub -{ -public: - virtual ~TransformatorSpy() {} - MOCK_CONST_METHOD1(transformViewToWorld, void(Vertex& value)); - -}; - - - -#endif diff --git a/src/GridGenerator/utilities/transformator/TransformatorTest.cpp b/src/GridGenerator/utilities/transformator/TransformatorTest.cpp deleted file mode 100644 index 752907876..000000000 --- a/src/GridGenerator/utilities/transformator/TransformatorTest.cpp +++ /dev/null @@ -1,195 +0,0 @@ -#include "TransformatorImp.h" - -#include "gmock/gmock.h" -#include <memory> -using namespace testing; - -#include <GridGenerator/geometries/Vertex/Vertex.h> -#include <GridGenerator/geometries/Triangle/Triangle.h> -#include <GridGenerator/geometries/TriangularMesh/TriangularMesh.h> - -#include <GridGenerator/geometries/Arrow/ArrowMocks.h> - - -class TransformatorTest : public Test -{ -public: - std::shared_ptr<Transformator> sut; - Vertex v; - - real delta; - Vertex translater; - - void SetUp() override - { - delta = 0.01f; - v = Vertex(2.0f, -3.2f, 4.6f); - translater = Vertex(-2.6f, 3434.0f, 0.1f); - } -}; - -void expectEqual(const Vertex& actual, const Vertex& expected) -{ - EXPECT_THAT(actual.x, RealEq(expected.x)); - EXPECT_THAT(actual.y, RealEq(expected.y)); - EXPECT_THAT(actual.z, RealEq(expected.z)); -} - -TEST(TransformatorCopyConstructorTest, copyTransformatorShouldCreateSameTransformator) -{ - real delta = 0.01f; - real dx = 0.1f; - real dy = 0.2f; - real dz = 0.3f; - TransformatorImp trafoToCopy(delta, dx, dy, dz); - - std::shared_ptr<TransformatorImp> sut = std::shared_ptr<TransformatorImp>(new TransformatorImp(trafoToCopy)); - - EXPECT_TRUE(*(sut.get())==trafoToCopy); -} - -TEST_F(TransformatorTest, transformVectorToViewWithStandartConstructor_ExpectnoVectorChange) -{ - sut = std::shared_ptr<Transformator>(new TransformatorImp()); - Vertex expected = Vertex(v); - - sut->transformWorldToGrid(v); - - expectEqual(v, expected); -} - -TEST_F(TransformatorTest, transformVectorToViewWithSmallDelta_ExpectVectorScales) -{ - sut = std::shared_ptr<Transformator>(new TransformatorImp(delta, Vertex())); - Vertex expected = Vertex(v * (1.0f / delta)); - - sut->transformWorldToGrid(v); - - expectEqual(v, expected); -} - -TEST_F(TransformatorTest, transformVectorWithNullDelta_ExpectExcpetion) -{ - real invalidDeltaValue = 0.0f; - ASSERT_THROW(TransformatorImp(invalidDeltaValue, Vertex(0, 0, 0)), invalidDelta); -} - -TEST_F(TransformatorTest, transformVectorWithNegativeDelta_ExpectExcpetion) -{ - real invalidDeltaValue = -1.0f; - ASSERT_THROW(TransformatorImp trafo(invalidDeltaValue, Vertex(0, 0, 0)), invalidDelta); -} - -TEST_F(TransformatorTest, transformVectorToViewWithTranslationsAndSmallDelta) -{ - sut = std::shared_ptr<Transformator>(new TransformatorImp(delta, translater)); - Vertex expected = Vertex((v + translater) * (1.0f / delta)); - - sut->transformWorldToGrid(v); - - expectEqual(v, expected); -} - -TEST_F(TransformatorTest, transformVectorToWorldCoodinatesWithTranslationsAndSmallDelta) -{ - sut = std::shared_ptr<Transformator>(new TransformatorImp(delta, translater)); - Vertex expected = Vertex(v * delta - translater); - - sut->transformGridToWorld(v); - - expectEqual(v, expected); -} - -TEST_F(TransformatorTest, transformTriangleToView) -{ - sut = std::shared_ptr<Transformator>(new TransformatorImp(delta, translater)); - Triangle t(v, v, v); - Vertex expected = Vertex((v + translater) * (1.0f / delta)); - - sut->transformWorldToGrid(t); - - expectEqual(t.v1, expected); - expectEqual(t.v2, expected); - expectEqual(t.v3, expected); -} - -TEST_F(TransformatorTest, transformGeometryToView) -{ - sut = std::shared_ptr<Transformator>(new TransformatorImp(delta, translater)); - TriangularMesh g; - g.triangleVec.push_back(Triangle(v,v,v)); - g.size = 1; - Vertex expected = Vertex((v + translater) * (1.0f / delta)); - - sut->transformWorldToGrid(g); - - expectEqual(g.triangleVec[0].v1, expected); - expectEqual(g.triangleVec[0].v2, expected); - expectEqual(g.triangleVec[0].v3, expected); -} - -TEST(TransformatorTestBoundingBox, transformrealBoundingBoxToView) -{ - real delta = 0.01f; - Vertex translater = Vertex(-2.6f, 3434.0f, 0.1f); - std::shared_ptr<Transformator> sut = std::shared_ptr<Transformator>(new TransformatorImp(delta, translater)); - - BoundingBox box(0, 0, 0, 0, 0, 0); - - sut->transformWorldToGrid(box); - - EXPECT_THAT(box.minX, RealEq(translater.x * (1.0f / delta))); - EXPECT_THAT(box.minY, RealEq(translater.y * (1.0f / delta))); - EXPECT_THAT(box.minZ, RealEq(translater.z * (1.0f / delta))); - - EXPECT_THAT(box.maxX, RealEq(translater.x * (1.0f / delta))); - EXPECT_THAT(box.maxY, RealEq(translater.y * (1.0f / delta))); - EXPECT_THAT(box.maxZ, RealEq(translater.z * (1.0f / delta))); -} - -TEST(TransformatorTestBoundingBox, transformrealBoundingBoxToWorld) -{ - real delta = 0.01f; - Vertex translater = Vertex(-2.6f, 3434.0f, 0.1f); - std::shared_ptr<Transformator> sut = std::shared_ptr<Transformator>(new TransformatorImp(delta, translater)); - - BoundingBox box(0, 0, 0, 0, 0, 0); - - sut->transformGridToWorld(box); - - EXPECT_THAT(box.minX, RealEq(-1.0f * translater.x)); - EXPECT_THAT(box.minY, RealEq(-1.0f * translater.y)); - EXPECT_THAT(box.minZ, RealEq(-1.0f * translater.z)); - - EXPECT_THAT(box.maxX, RealEq(-1.0f * translater.x)); - EXPECT_THAT(box.maxY, RealEq(-1.0f * translater.y)); - EXPECT_THAT(box.maxZ, RealEq(-1.0f * translater.z)); -} - -TEST_F(TransformatorTest, transformArrowToWorld) -{ - delta = 10.0f; - translater = Vertex(0, 0, 0); - std::shared_ptr<ArrowTransformator> sut = std::shared_ptr<ArrowTransformator>(new TransformatorImp(delta, translater)); - - real x1 = 1.23f; - real y1 = 2.23f; - real z1 = 0.023f; - - real x2 = -1.23f; - real y2 = 1.23f; - real z2 = -0.20233f; - auto v1 = std::shared_ptr<Vertex>(new Vertex(x1, y1, z1)); - auto v2 = std::shared_ptr<Vertex>(new Vertex(x2, y2, z2)); - auto arrow = ArrowStub::make(v1, v2); - - sut->transformGridToWorld(arrow); - - EXPECT_THAT(arrow->getStart()->x, RealEq(x1 * delta - translater.x)); - EXPECT_THAT(arrow->getStart()->y, RealEq(y1 * delta - translater.y)); - EXPECT_THAT(arrow->getStart()->z, RealEq(z1 * delta - translater.z)); - - EXPECT_THAT(arrow->getEnd()->x, RealEq(x2 * delta - translater.x)); - EXPECT_THAT(arrow->getEnd()->y, RealEq(y2 * delta - translater.y)); - EXPECT_THAT(arrow->getEnd()->z, RealEq(z2 * delta - translater.z)); -} diff --git a/src/VirtualFluids/BoundaryConditions/BCAdapter.h b/src/VirtualFluids/BoundaryConditions/BCAdapter.h deleted file mode 100644 index 85240febf..000000000 --- a/src/VirtualFluids/BoundaryConditions/BCAdapter.h +++ /dev/null @@ -1,100 +0,0 @@ -// _ ___ __ __________ _ __ -// | | / (_)____/ /___ ______ _/ / ____/ /_ __(_)___/ /____ -// | | / / / ___/ __/ / / / __ `/ / /_ / / / / / / __ / ___/ -// | |/ / / / / /_/ /_/ / /_/ / / __/ / / /_/ / / /_/ (__ ) -// |___/_/_/ \__/\__,_/\__,_/_/_/ /_/\__,_/_/\__,_/____/ -// -#ifndef D3Q27BOUNDARYCONDITIONADAPTER_H -#define D3Q27BOUNDARYCONDITIONADAPTER_H - -#ifdef CAB_RCF - #include <3rdParty/rcf/RcfSerializationIncludes.h> -#endif - -#include <boost/serialization/serialization.hpp> -#include <boost/serialization/base_object.hpp> -#include <boost/serialization/export.hpp> -#include <memory> - -class BCAdapter; -typedef std::shared_ptr<BCAdapter> BCAdapterPtr; - -#include "BoundaryConditions.h" -#include "basics/objects/ObObject.h" -#include "basics/objects/ObObjectCreator.h" -#include "basics/utilities/UbFileOutput.h" -#include "basics/utilities/UbFileInput.h" -#include "basics/utilities/UbAutoRun.hpp" -#include "BCAlgorithm.h" - - -/*=========================================================================*/ -/* D3Q27BoundaryConditionAdapter */ -/* */ -/** -<BR><BR> -@author <A HREF="mailto:muffmolch@gmx.de">S. Freudiger</A> -@version 1.0 - 06.09.06 -*/ - -/* -usage: ... -*/ - -class D3Q27Interactor; - -class BCAdapter -{ -public: - BCAdapter() - : secondaryBcOption(0) - , type(0) - , algorithmType(-1) - { - } - BCAdapter(const short& secondaryBcOption) - : secondaryBcOption(secondaryBcOption) - , type(0) - , algorithmType(-1) - { - } - virtual ~BCAdapter() {} - - //methods - bool isTimeDependent() { return((this->type & TIMEDEPENDENT) == TIMEDEPENDENT); } - - virtual short getSecondaryBcOption() { return this->secondaryBcOption; } - virtual void setSecondaryBcOption(const short& val) { this->secondaryBcOption=val; } - - virtual void init(const D3Q27Interactor* const& interactor, const double& time=0) = 0; - virtual void update(const D3Q27Interactor* const& interactor, const double& time=0) = 0; - - virtual void adaptBC( const D3Q27Interactor& interactor, BoundaryConditionsPtr bc, const double& worldX1, const double& worldX2, const double& worldX3, const double& time=0 ) = 0; - virtual void adaptBCForDirection( const D3Q27Interactor& interactor, BoundaryConditionsPtr bc, const double& worldX1, const double& worldX2, const double& worldX3, const double& q, const int& fdirection, const double& time=0 ) = 0; - - void setBcAlgorithm(BCAlgorithmPtr alg) {algorithmType = alg->getType(); algorithm = alg;} - BCAlgorithmPtr getAlgorithm() {return algorithm;} - char getBcAlgorithmType() {return algorithmType;} - -protected: - short secondaryBcOption; - - char type; - - BCAlgorithmPtr algorithm; - char algorithmType; - - static const char TIMEDEPENDENT = 1<<0;//'1'; - static const char TIMEPERIODIC = 1<<1;//'2'; - -private: - friend class boost::serialization::access; - template<class Archive> - void serialize(Archive & ar, const unsigned int version) - { - ar & secondaryBcOption; - } -}; - - -#endif //D3Q27BOUNDARYCONDITIONADAPTER_H diff --git a/src/VirtualFluids/BoundaryConditions/BCAlgorithm.cpp b/src/VirtualFluids/BoundaryConditions/BCAlgorithm.cpp deleted file mode 100644 index 54894d8f8..000000000 --- a/src/VirtualFluids/BoundaryConditions/BCAlgorithm.cpp +++ /dev/null @@ -1,70 +0,0 @@ -#include "BCAlgorithm.h" - -#include "BoundaryConditions.h" -#include "EsoTwist3D.h" -#include "BCArray3D.h" - - -BCAlgorithm::BCAlgorithm() : compressible(false) -{ - -} -////////////////////////////////////////////////////////////////////////// -void BCAlgorithm::setNodeIndex(int x1, int x2, int x3) -{ - this->x1 = x1; - this->x2 = x2; - this->x3 = x3; -} -////////////////////////////////////////////////////////////////////////// -void BCAlgorithm::setBcPointer(BoundaryConditionsPtr bcPtr) -{ - this->bcPtr = bcPtr; -} -////////////////////////////////////////////////////////////////////////// -void BCAlgorithm::setCompressible(bool c) -{ - compressible = c; - - if (this->compressible) - { - calcFeqsForDirFct = &D3Q27System::getCompFeqForDirection; - calcMacrosFct = &D3Q27System::calcCompMacroscopicValues; - calcFeqFct = &D3Q27System::calcCompFeq; - compressibleFactor = 1.0; - } - else - { - calcFeqsForDirFct = &D3Q27System::getIncompFeqForDirection; - calcMacrosFct = &D3Q27System::calcIncompMacroscopicValues; - calcFeqFct = &D3Q27System::calcIncompFeq; - compressibleFactor = 0.0; - } -} -////////////////////////////////////////////////////////////////////////// -void BCAlgorithm::setCollFactor(LBMReal cf) -{ - collFactor = cf; -} - -////////////////////////////////////////////////////////////////////////// -char BCAlgorithm::getType() -{ - return type; -} -////////////////////////////////////////////////////////////////////////// -bool BCAlgorithm::isPreCollision() -{ - return preCollision; -} -////////////////////////////////////////////////////////////////////////// -BCArray3DPtr BCAlgorithm::getBcArray() -{ - return bcArray; -} -////////////////////////////////////////////////////////////////////////// -void BCAlgorithm::setBcArray(BCArray3DPtr bcarray) -{ - bcArray = bcarray; -} - diff --git a/src/VirtualFluids/BoundaryConditions/BCAlgorithm.h b/src/VirtualFluids/BoundaryConditions/BCAlgorithm.h deleted file mode 100644 index 7781e7ba3..000000000 --- a/src/VirtualFluids/BoundaryConditions/BCAlgorithm.h +++ /dev/null @@ -1,69 +0,0 @@ - -#ifndef BOUNDARYCONDITIONS_H -#define BOUNDARYCONDITIONS_H - -#include <memory> - -#include "D3Q27System.h" - -class DistributionArray3D; -class BCArray3D; -class BoundaryConditions; - -class BCAlgorithm; -typedef std::shared_ptr<BCAlgorithm> BCAlgorithmPtr; - -class BCAlgorithm -{ -public: - static const char VelocityBCAlgorithm = 0; - static const char EqDensityBCAlgorithm = 1; - static const char NonEqDensityBCAlgorithm = 2; - static const char NoSlipBCAlgorithm = 3; - static const char SlipBCAlgorithm = 4; - static const char HighViscosityNoSlipBCAlgorithm = 5; - static const char ThinWallNoSlipBCAlgorithm = 6; - static const char VelocityWithDensityBCAlgorithm = 7; - static const char NonReflectingOutflowBCAlgorithm = 8; - -public: - BCAlgorithm(); - virtual ~BCAlgorithm() {} - - virtual void addDistributions(std::shared_ptr<DistributionArray3D> distributions) = 0; - void setNodeIndex(int x1, int x2, int x3); - void setBcPointer(std::shared_ptr<BoundaryConditions> bcPtr); - void setCompressible(bool c); - void setCollFactor(LBMReal cf); - char getType(); - bool isPreCollision(); - virtual BCAlgorithmPtr clone() = 0; - std::shared_ptr<BCArray3D> getBcArray(); - void setBcArray(std::shared_ptr<BCArray3D> bcarray); - virtual void applyBC() = 0; - -protected: - bool compressible; - char type; - bool preCollision; - - std::shared_ptr<BoundaryConditions> bcPtr; - std::shared_ptr<DistributionArray3D> distributions; - std::shared_ptr<BCArray3D> bcArray; - - LBMReal collFactor; - int x1, x2, x3; - - LBMReal compressibleFactor; - - typedef void(*CalcMacrosFct)(const LBMReal* const& /*f[27]*/, LBMReal& /*rho*/, LBMReal& /*vx1*/, LBMReal& /*vx2*/, LBMReal& /*vx3*/); - typedef LBMReal(*CalcFeqForDirFct)(const int& /*direction*/, const LBMReal& /*(d)rho*/, const LBMReal& /*vx1*/, const LBMReal& /*vx2*/, const LBMReal& /*vx3*/); - typedef void(*CalcFeqFct)(LBMReal* const& /*feq/*[27]*/, const LBMReal& /*rho*/, const LBMReal& /*vx1*/, const LBMReal& /*vx2*/, const LBMReal& /*vx3*/); - - CalcFeqForDirFct calcFeqsForDirFct ; - CalcMacrosFct calcMacrosFct; - CalcFeqFct calcFeqFct; -}; - - -#endif diff --git a/src/VirtualFluids/BoundaryConditions/BCArray3D.cpp b/src/VirtualFluids/BoundaryConditions/BCArray3D.cpp deleted file mode 100644 index 68fbe79f8..000000000 --- a/src/VirtualFluids/BoundaryConditions/BCArray3D.cpp +++ /dev/null @@ -1,203 +0,0 @@ -#include "BCArray3D.h" - - -const int BCArray3D::SOLID = -1; -const int BCArray3D::FLUID = -2; -const int BCArray3D::INTERFACECF = -3; -const int BCArray3D::INTERFACEFC = -4; -const int BCArray3D::UNDEFINED = -5; - -////////////////////////////////////////////////////////////////////////// -BCArray3D::BCArray3D() {} -////////////////////////////////////////////////////////////////////////// -BCArray3D::BCArray3D(std::size_t nx1, std::size_t nx2, std::size_t nx3) -{ - bcindexmatrix.resize(nx1, nx2, nx3, UNDEFINED); -} -////////////////////////////////////////////////////////////////////////// -BCArray3D::BCArray3D(std::size_t nx1, std::size_t nx2, std::size_t nx3, int val) -{ - bcindexmatrix.resize(nx1, nx2, nx3, val); -} -////////////////////////////////////////////////////////////////////////// -BCArray3D::~BCArray3D() {} -////////////////////////////////////////////////////////////////////////// -void BCArray3D::resize(std::size_t nx1, std::size_t nx2, std::size_t nx3) -{ - bcindexmatrix.resize(nx1, nx2, nx3); -} -////////////////////////////////////////////////////////////////////////// -void BCArray3D::resize(std::size_t nx1, std::size_t nx2, std::size_t nx3, int val) -{ - bcindexmatrix.resize(nx1, nx2, nx3, val); -} -////////////////////////////////////////////////////////////////////////// -bool BCArray3D::validIndices(std::size_t x1, std::size_t x2, std::size_t x3) const -{ - if (x1 < 0 || x1 >= this->bcindexmatrix.getNX1()) return false; - if (x2 < 0 || x2 >= this->bcindexmatrix.getNX2()) return false; - if (x3 < 0 || x3 >= this->bcindexmatrix.getNX3()) return false; - return true; -} -////////////////////////////////////////////////////////////////////////// -void BCArray3D::setBC(std::size_t x1, std::size_t x2, std::size_t x3, BoundaryConditionsPtr const& bc) -{ - if (this->hasBC(x1, x2, x3)) - { - if (this->getBC(x1, x2, x3) == bc) return; - else this->deleteBC(x1, x2, x3); - } - - //wenn keine frei gewordene BCs vorhanden - if (indexContainer.empty()) - { - bcvector.push_back(bc); - bcindexmatrix(x1, x2, x3) = (int)bcvector.size() - 1; - } - else - { - int index = indexContainer.back(); - bcindexmatrix(x1, x2, x3) = index; - bcvector[index] = bc; - indexContainer.pop_back(); - } -} -////////////////////////////////////////////////////////////////////////// -void BCArray3D::setSolid(std::size_t x1, std::size_t x2, std::size_t x3) -{ - if (this->hasBC(x1, x2, x3)) this->deleteBC(x1, x2, x3); - bcindexmatrix(x1, x2, x3) = SOLID; -} -////////////////////////////////////////////////////////////////////////// -void BCArray3D::setFluid(std::size_t x1, std::size_t x2, std::size_t x3) -{ - if (this->hasBC(x1, x2, x3)) this->deleteBC(x1, x2, x3); - bcindexmatrix(x1, x2, x3) = FLUID; -} -////////////////////////////////////////////////////////////////////////// -void BCArray3D::setUndefined(std::size_t x1, std::size_t x2, std::size_t x3) -{ - if (this->hasBC(x1, x2, x3)) this->deleteBC(x1, x2, x3); - bcindexmatrix(x1, x2, x3) = UNDEFINED; -} -////////////////////////////////////////////////////////////////////////// -std::size_t BCArray3D::getNumberOfSolidEntries() const -{ - const std::vector<int>& data = bcindexmatrix.getDataVector(); - std::size_t counter = 0; - for (std::size_t i = 0; i < data.size(); i++) - if (data[i] == SOLID) counter++; - return counter; -} -////////////////////////////////////////////////////////////////////////// -std::size_t BCArray3D::getNumberOfFluidEntries() const -{ - const std::vector<int>& data = bcindexmatrix.getDataVector(); - std::size_t counter = 0; - for (std::size_t i = 0; i < data.size(); i++) - { - int tmp = data[i]; - if (tmp == FLUID || tmp >= 0) counter++; - } - return counter; -} -////////////////////////////////////////////////////////////////////////// -std::size_t BCArray3D::getNumberOfFluidWithoutBCEntries() const -{ - const std::vector<int>& data = bcindexmatrix.getDataVector(); - std::size_t counter = 0; - for (std::size_t i = 0; i < data.size(); i++) - if (data[i] == FLUID) counter++; - return counter; -} -////////////////////////////////////////////////////////////////////////// -std::size_t BCArray3D::getNumberOfBCEntries() const -{ - const std::vector<int>& data = bcindexmatrix.getDataVector(); - std::size_t counter = 0; - for (std::size_t i = 0; i < data.size(); i++) - if (data[i] >= 0) counter++; - return counter; -} -////////////////////////////////////////////////////////////////////////// -std::size_t BCArray3D::getNumberOfUndefinedEntries() const -{ - const std::vector<int>& data = bcindexmatrix.getDataVector(); - std::size_t counter = 0; - for (std::size_t i = 0; i < data.size(); i++) - if (data[i] == UNDEFINED) counter++; - return counter; -} -////////////////////////////////////////////////////////////////////////// -std::size_t BCArray3D::getBCVectorSize() const -{ - return this->bcvector.size(); -} -////////////////////////////////////////////////////////////////////////// -std::string BCArray3D::toString() const -{ - std::size_t solidCounter = 0; - std::size_t fluidCounter = 0; - std::size_t bcCounter = 0; - std::size_t undefCounter = 0; - - for (int x1 = 0; x1 < bcindexmatrix.getNX1(); x1++) - { - for (int x2 = 0; x2 < bcindexmatrix.getNX2(); x2++) - { - for (int x3 = 0; x3 < bcindexmatrix.getNX3(); x3++) - { - if (bcindexmatrix(x1, x2, x3) >= 0) bcCounter++; - else if (bcindexmatrix(x1, x2, x3) == FLUID) fluidCounter++; - else if (bcindexmatrix(x1, x2, x3) == SOLID) solidCounter++; - else if (bcindexmatrix(x1, x2, x3) == UNDEFINED) undefCounter++; - else throw UbException(UB_EXARGS, "invalid matrixEntry"); - } - } - } - - std::size_t unrefEntriesInBcVector = 0; - for (std::size_t i = 0; i < bcvector.size(); i++) if (!bcvector[i]) unrefEntriesInBcVector++; - - std::stringstream text; - text << "BCArray<" << typeid(BoundaryConditionsPtr).name() << "," << typeid(int).name() << ">"; - text << "[ entries: " << bcindexmatrix.getNX1() << "x" << bcindexmatrix.getNX2(); - text << "x" << bcindexmatrix.getNX3() << "="; - text << bcindexmatrix.getNX1()*bcindexmatrix.getNX2()*bcindexmatrix.getNX3() << " ]:\n"; - text << " - #fluid entries : " << fluidCounter << std::endl; - text << " - #bc entries : " << bcCounter << std::endl; - text << " - #solid entries : " << solidCounter << std::endl; - text << " - #undef entries : " << undefCounter << std::endl; - text << " - bcvector-entries : " << bcvector.size() << " (empty ones: " << unrefEntriesInBcVector << ")\n"; - text << " - indexContainer-entries: " << indexContainer.size() << std::endl; - - return text.str(); -} -////////////////////////////////////////////////////////////////////////// -std::vector< int >& BCArray3D::getBcindexmatrixDataVector() -{ - return bcindexmatrix.getDataVector(); -} - - -////////////////////////////////////////////////////////////////////////// -void BCArray3D::deleteBCAndSetType(std::size_t x1, std::size_t x2, std::size_t x3, int type) - { - this->deleteBC(x1, x2, x3); - - //matrix neuen Typ zuweisen - bcindexmatrix(x1, x2, x3) = type; - } -////////////////////////////////////////////////////////////////////////// -void BCArray3D::deleteBC(std::size_t x1, std::size_t x2, std::size_t x3) - { - //ueberpruefen, ob ueberhaupt BC vorhanden - int index = bcindexmatrix(x1, x2, x3); - if (index < 0) return; - - //frei gewordenen Index in den Indexcontainer schieben - indexContainer.push_back(index); - - //element "loeschen" - bcvector[index] = BoundaryConditionsPtr(); - } \ No newline at end of file diff --git a/src/VirtualFluids/BoundaryConditions/BCArray3D.h b/src/VirtualFluids/BoundaryConditions/BCArray3D.h deleted file mode 100644 index bfdadf38f..000000000 --- a/src/VirtualFluids/BoundaryConditions/BCArray3D.h +++ /dev/null @@ -1,206 +0,0 @@ -#ifndef BCArray_H -#define BCArray_H - -#include <VirtualFluidsDefinitions.h> - - -#include "BoundaryConditions.h" -#include "basics/container/CbArray3D.h" - -#include <typeinfo> - -#include <boost/serialization/serialization.hpp> -#include <memory> - -class BCArray3D; -typedef std::shared_ptr<BCArray3D> BCArray3DPtr; - -class VF_PUBLIC BCArray3D -{ -public: - ////////////////////////////////////////////////////////////////////////// - BCArray3D(); - ////////////////////////////////////////////////////////////////////////// - BCArray3D(std::size_t nx1, std::size_t nx2, std::size_t nx3); - ////////////////////////////////////////////////////////////////////////// - BCArray3D(std::size_t nx1, std::size_t nx2, std::size_t nx3, int val); - ////////////////////////////////////////////////////////////////////////// - virtual ~BCArray3D(); - ////////////////////////////////////////////////////////////////////////// - inline std::size_t getNX1() const; - ////////////////////////////////////////////////////////////////////////// - inline std::size_t getNX2() const; - ////////////////////////////////////////////////////////////////////////// - inline std::size_t getNX3() const; - ////////////////////////////////////////////////////////////////////////// - void resize(std::size_t nx1, std::size_t nx2, std::size_t nx3); - ////////////////////////////////////////////////////////////////////////// - void resize(std::size_t nx1, std::size_t nx2, std::size_t nx3, int val); - ////////////////////////////////////////////////////////////////////////// - bool validIndices(std::size_t x1, std::size_t x2, std::size_t x3) const; - ////////////////////////////////////////////////////////////////////////// - inline bool hasBC(std::size_t x1, std::size_t x2, std::size_t x3) const; - ////////////////////////////////////////////////////////////////////////// - void setBC(std::size_t x1, std::size_t x2, std::size_t x3, BoundaryConditionsPtr const& bc); - ////////////////////////////////////////////////////////////////////////// - inline int getBCVectorIndex(std::size_t x1, std::size_t x2, std::size_t x3) const; - ////////////////////////////////////////////////////////////////////////// - inline const BoundaryConditionsPtr getBC(std::size_t x1, std::size_t x2, std::size_t x3) const; - ////////////////////////////////////////////////////////////////////////// - inline BoundaryConditionsPtr getBC(std::size_t x1, std::size_t x2, std::size_t x3); - ////////////////////////////////////////////////////////////////////////// - void setSolid(std::size_t x1, std::size_t x2, std::size_t x3); - ////////////////////////////////////////////////////////////////////////// - inline bool isSolid(std::size_t x1, std::size_t x2, std::size_t x3) const; - ////////////////////////////////////////////////////////////////////////// - void setFluid(std::size_t x1, std::size_t x2, std::size_t x3); - ////////////////////////////////////////////////////////////////////////// - //true : FLUID or BC - //false: UNDEFINED or SOLID - inline bool isFluid(std::size_t x1, std::size_t x2, std::size_t x3) const; - ////////////////////////////////////////////////////////////////////////// - inline bool isFluidWithoutBC(std::size_t x1, std::size_t x2, std::size_t x3) const; - ////////////////////////////////////////////////////////////////////////// - inline bool isUndefined(std::size_t x1, std::size_t x2, std::size_t x3) const; - ////////////////////////////////////////////////////////////////////////// - void setUndefined(std::size_t x1, std::size_t x2, std::size_t x3); - ////////////////////////////////////////////////////////////////////////// - inline bool isInterfaceCF(std::size_t x1, std::size_t x2, std::size_t x3) const; - ////////////////////////////////////////////////////////////////////////// - void setInterfaceCF(std::size_t x1, std::size_t x2, std::size_t x3); - ////////////////////////////////////////////////////////////////////////// - inline bool isInterfaceFC(std::size_t x1, std::size_t x2, std::size_t x3) const; - ////////////////////////////////////////////////////////////////////////// - void setInterfaceFC(std::size_t x1, std::size_t x2, std::size_t x3); - ////////////////////////////////////////////////////////////////////////// - std::size_t getNumberOfSolidEntries() const; - ////////////////////////////////////////////////////////////////////////// - std::size_t getNumberOfFluidEntries() const; - ////////////////////////////////////////////////////////////////////////// - std::size_t getNumberOfFluidWithoutBCEntries() const; - ////////////////////////////////////////////////////////////////////////// - std::size_t getNumberOfBCEntries() const; - ////////////////////////////////////////////////////////////////////////// - std::size_t getNumberOfUndefinedEntries() const; - ////////////////////////////////////////////////////////////////////////// - std::size_t getBCVectorSize() const; - ////////////////////////////////////////////////////////////////////////// - std::string toString() const; - ////////////////////////////////////////////////////////////////////////// - std::vector< int >& getBcindexmatrixDataVector(); - ////////////////////////////////////////////////////////////////////////// - bool isInsideOfDomain(const int &x1, const int &x2, const int &x3, const int& ghostLayerWidth) const; - - static const int SOLID; - static const int FLUID; - static const int INTERFACECF; - static const int INTERFACEFC; - static const int UNDEFINED; - -private: - ////////////////////////////////////////////////////////////////////////// - void deleteBCAndSetType(std::size_t x1, std::size_t x2, std::size_t x3, int type); - ////////////////////////////////////////////////////////////////////////// - void deleteBC(std::size_t x1, std::size_t x2, std::size_t x3); - - friend class MPIIORestart1CoProcessor; - friend class MPIIORestart2CoProcessor; - friend class MPIIORestart11CoProcessor; - friend class MPIIORestart21CoProcessor; - - friend class boost::serialization::access; - template<class Archive> - void serialize(Archive & ar, const unsigned int version) - { - ar & bcindexmatrix; - ar & bcvector; - ar & indexContainer; - } -protected: - ////////////////////////////////////////////////////////////////////////// - //-1 solid // -2 fluid -... - CbArray3D<int, IndexerX3X2X1> bcindexmatrix; - std::vector<BoundaryConditionsPtr> bcvector; - std::vector<int> indexContainer; -}; - - -////////////////////////////////////////////////////////////////////////// -inline std::size_t BCArray3D::getNX1() const { return bcindexmatrix.getNX1(); } -////////////////////////////////////////////////////////////////////////// -inline std::size_t BCArray3D::getNX2() const { return bcindexmatrix.getNX2(); } -////////////////////////////////////////////////////////////////////////// -inline std::size_t BCArray3D::getNX3() const { return bcindexmatrix.getNX3(); } -////////////////////////////////////////////////////////////////////////// -inline bool BCArray3D::hasBC(std::size_t x1, std::size_t x2, std::size_t x3) const -{ - return bcindexmatrix(x1, x2, x3) >= 0; -} -////////////////////////////////////////////////////////////////////////// -inline int BCArray3D::getBCVectorIndex(std::size_t x1, std::size_t x2, std::size_t x3) const -{ - return bcindexmatrix(x1, x2, x3); -} -////////////////////////////////////////////////////////////////////////// -inline const BoundaryConditionsPtr BCArray3D::getBC(std::size_t x1, std::size_t x2, std::size_t x3) const -{ - int index = bcindexmatrix(x1, x2, x3); - if (index < 0) return BoundaryConditionsPtr(); //=> NULL Pointer - - return bcvector[index]; -} -////////////////////////////////////////////////////////////////////////// -inline BoundaryConditionsPtr BCArray3D::getBC(std::size_t x1, std::size_t x2, std::size_t x3) -{ - int index = bcindexmatrix(x1, x2, x3); - if (index < 0) return BoundaryConditionsPtr(); //=> NULL Pointer - - return bcvector[index]; -} -////////////////////////////////////////////////////////////////////////// -inline bool BCArray3D::isSolid(std::size_t x1, std::size_t x2, std::size_t x3) const -{ - return bcindexmatrix(x1, x2, x3) == SOLID; -} -////////////////////////////////////////////////////////////////////////// -//true : FLUID or BC -//false: UNDEFINED or SOLID -inline bool BCArray3D::isFluid(std::size_t x1, std::size_t x2, std::size_t x3) const -{ - int tmp = bcindexmatrix(x1, x2, x3); - return (tmp == FLUID || tmp >= 0); -} -////////////////////////////////////////////////////////////////////////// -inline bool BCArray3D::isFluidWithoutBC(std::size_t x1, std::size_t x2, std::size_t x3) const -{ - return bcindexmatrix(x1, x2, x3) == FLUID; -} -////////////////////////////////////////////////////////////////////////// -inline bool BCArray3D::isUndefined(std::size_t x1, std::size_t x2, std::size_t x3) const -{ - return bcindexmatrix(x1, x2, x3) == UNDEFINED; -} -////////////////////////////////////////////////////////////////////////// -inline bool BCArray3D::isInterfaceCF(std::size_t x1, std::size_t x2, std::size_t x3) const -{ - return bcindexmatrix(x1, x2, x3) == INTERFACECF; -} -////////////////////////////////////////////////////////////////////////// -inline bool BCArray3D::isInterfaceFC(std::size_t x1, std::size_t x2, std::size_t x3) const -{ - return bcindexmatrix(x1, x2, x3) == INTERFACEFC; -} -////////////////////////////////////////////////////////////////////////// -inline bool BCArray3D::isInsideOfDomain(const int& x1, const int& x2, const int& x3, const int& ghostLayerWidth) const -{ - const int minX1 = ghostLayerWidth; - const int maxX1 = (int)this->getNX1() - 1 - ghostLayerWidth; - const int minX2 = ghostLayerWidth; - const int maxX2 = (int)this->getNX2() - 1 - ghostLayerWidth; - const int minX3 = ghostLayerWidth; - const int maxX3 = (int)this->getNX3() - 1 - ghostLayerWidth; - - return (!(x1 < minX1 || x1 > maxX1 || x2 < minX2 || x2 > maxX2 || x3 < minX3 || x3 > maxX3)); -} - -#endif diff --git a/src/VirtualFluids/BoundaryConditions/BCArray3DTest.cpp b/src/VirtualFluids/BoundaryConditions/BCArray3DTest.cpp deleted file mode 100644 index cda53a555..000000000 --- a/src/VirtualFluids/BoundaryConditions/BCArray3DTest.cpp +++ /dev/null @@ -1,25 +0,0 @@ -#include "gmock/gmock.h" - -#include "BCArray3D.h" - - - -TEST(BCArray3DTest, checkIfCoordinatesAreInsideOfTheBlock) -{ - const int nx = 10, ny = 10, nz = 10; - BCArray3D sut(nx, ny, nz); - - int ghostLayerWidth = 1; - EXPECT_FALSE(sut.isInsideOfDomain(0, 5, 5, ghostLayerWidth)); - EXPECT_FALSE(sut.isInsideOfDomain(5, 0, 5, ghostLayerWidth)); - EXPECT_FALSE(sut.isInsideOfDomain(0, 5, 0, ghostLayerWidth)); - - EXPECT_TRUE(sut.isInsideOfDomain(1, 1, 1, ghostLayerWidth)); - EXPECT_TRUE(sut.isInsideOfDomain(8, 8, 8, ghostLayerWidth)); - - EXPECT_FALSE(sut.isInsideOfDomain(9, 5, 1, ghostLayerWidth)); - - ghostLayerWidth = 2; - EXPECT_FALSE(sut.isInsideOfDomain(8, 5, 2, ghostLayerWidth)); - EXPECT_TRUE(sut.isInsideOfDomain(7, 2, 2, ghostLayerWidth)); -} diff --git a/src/VirtualFluids/BoundaryConditions/BCFunction.cpp b/src/VirtualFluids/BoundaryConditions/BCFunction.cpp deleted file mode 100644 index 1364ce3dd..000000000 --- a/src/VirtualFluids/BoundaryConditions/BCFunction.cpp +++ /dev/null @@ -1,5 +0,0 @@ -#include "BCFunction.h" - -const double BCFunction::INFTIMEDEPENDENT = -1.0; -const double BCFunction::INFCONST = -10.0; - diff --git a/src/VirtualFluids/BoundaryConditions/BCFunction.h b/src/VirtualFluids/BoundaryConditions/BCFunction.h deleted file mode 100644 index 4c2d9a491..000000000 --- a/src/VirtualFluids/BoundaryConditions/BCFunction.h +++ /dev/null @@ -1,117 +0,0 @@ -// _ ___ __ __________ _ __ -// | | / (_)____/ /___ ______ _/ / ____/ /_ __(_)___/ /____ -// | | / / / ___/ __/ / / / __ `/ / /_ / / / / / / __ / ___/ -// | |/ / / / / /_/ /_/ / /_/ / / __/ / / /_/ / / /_/ (__ ) -// |___/_/_/ \__/\__,_/\__,_/_/_/ /_/\__,_/_/\__,_/____/ -// -#ifndef D3Q27BCFUNCTION_H -#define D3Q27BCFUNCTION_H - -#include <boost/serialization/serialization.hpp> -#include <boost/serialization/split_member.hpp> - -#include <basics/utilities/UbInfinity.h> - -#include <MuParser/include/muParser.h> - - -class BCFunction -{ -public: - static const double INFTIMEDEPENDENT; - static const double INFCONST; - -public: - BCFunction() - : starttime(-Ub::inf ), endtime(-Ub::inf ) - { - - } - BCFunction( const mu::Parser& function, const double& starttime, const double& endtime ) - : function(function), starttime(starttime), endtime(endtime) - { - - } - BCFunction( const std::string& functionstring, const double& starttime, const double& endtime ) - : starttime(starttime), endtime(endtime) - { - this->setFunction(functionstring); - } - BCFunction( const double& velocity, const double& starttime, const double& endtime ) - : starttime(starttime), endtime(endtime) - { - this->setFunction(velocity); - } - - void setFunction(const mu::Parser& function) { this->function = function; } - void setFunction(const std::string& functionstring) { this->function.SetExpr(functionstring); } - void setFunction(const double& constVelocity) { std::stringstream dummy; dummy<<constVelocity; function.SetExpr(dummy.str()); } - void setStartTime(const double& starttime) {this->starttime = starttime; } - void setEndTime(const double& starttime) {this->endtime = endtime; } - - mu::Parser& getFunction() { return function; } - const mu::Parser& getFunction() const { return function; } - const double& getStartTime() const { return starttime; } - const double& getEndTime() const { return endtime; } - - std::string toString() const - { - std::stringstream info; - if (starttime==INFTIMEDEPENDENT) info<<"start=inf. timedep., "; - else if(starttime==INFCONST ) info<<"start=inf. const., "; - else info<<"start="<<starttime<<", "; - if (endtime==INFTIMEDEPENDENT) info<<"end=inf. timedep."<<std::endl; - else if(endtime==INFCONST ) info<<"end=inf. const."<<std::endl; - else info<<"end="<<endtime<<std::endl; - info<<"expr="<<function.GetExpr()<<std::endl; - info<<"with constants: "; - mu::valmap_type cmap = function.GetConst(); - for(mu::valmap_type::const_iterator item = cmap.begin(); item!=cmap.end(); ++item) - info<<item->first<<"="<<item->second<<", "; - return info.str(); - } - /*==========================================================*/ - friend inline std::ostream& operator << (std::ostream& os, const BCFunction& bc) - { - os<<bc.toString(); - return os; - } - -protected: - mu::Parser function; - double starttime; - double endtime; - -private: - friend class boost::serialization::access; - template<class Archive> - void save(Archive & ar, const unsigned int version) const - { - mu::string_type expr = function.GetExpr(); - mu::valmap_type constants = function.GetConst(); - ar & expr; - ar & constants; - - ar & starttime; - ar & endtime; - } - template<class Archive> - void load(Archive & ar, const unsigned int version) - { - mu::string_type expr; - mu::valmap_type constants; - ar & expr; - ar & constants; - function.SetExpr(expr); - for (mu::valmap_type::iterator pos = constants.begin(); pos!=constants.end(); ++pos) - function.DefineConst(pos->first, pos->second); - - function.InitConst(); - - ar & starttime; - ar & endtime; - } - BOOST_SERIALIZATION_SPLIT_MEMBER() -}; - -#endif //D3Q27BCFUNCTION_H diff --git a/src/VirtualFluids/BoundaryConditions/BCProcessor.cpp b/src/VirtualFluids/BoundaryConditions/BCProcessor.cpp deleted file mode 100644 index 464b4e502..000000000 --- a/src/VirtualFluids/BoundaryConditions/BCProcessor.cpp +++ /dev/null @@ -1,69 +0,0 @@ -#include "BCProcessor.h" -#include "D3Q27EsoTwist3DSplittedVector.h" -#include "DataSet3D.h" -#include "ILBMKernel.h" -#include "BCArray3D.h" -#include "BCAlgorithm.h" - -BCProcessor::BCProcessor() -{ - -} -////////////////////////////////////////////////////////////////////////// -BCProcessor::BCProcessor(ILBMKernelPtr kernel) -{ - DistributionArray3DPtr distributions = std::dynamic_pointer_cast<EsoTwist3D>(kernel->getDataSet()->getFdistributions()); - bcArray = BCArray3DPtr(new BCArray3D( distributions->getNX1(), distributions->getNX2(), distributions->getNX3(), BCArray3D::FLUID)); -} -////////////////////////////////////////////////////////////////////////// -BCProcessor::~BCProcessor() -{ - -} -////////////////////////////////////////////////////////////////////////// -BCProcessorPtr BCProcessor::clone(ILBMKernelPtr kernel) -{ - BCProcessorPtr bcProcessor(new BCProcessor(kernel)); - return bcProcessor; -} -////////////////////////////////////////////////////////////////////////// -BCArray3DPtr BCProcessor::getBCArray() -{ - return bcArray; -} -////////////////////////////////////////////////////////////////////////// -void BCProcessor::setBCArray(BCArray3DPtr bcarray) -{ - bcArray = bcarray; -} -////////////////////////////////////////////////////////////////////////// -void BCProcessor::addBC(BCAlgorithmPtr bc) -{ - if (bc->isPreCollision()) - { - preBC.push_back(bc); - } - else - { - postBC.push_back(bc); - } -} -////////////////////////////////////////////////////////////////////////// -void BCProcessor::applyPreCollisionBC() -{ - for(BCAlgorithmPtr bc : preBC) - bc->applyBC(); -} -////////////////////////////////////////////////////////////////////////// -void BCProcessor::applyPostCollisionBC() -{ - for (BCAlgorithmPtr bc : postBC) - bc->applyBC(); -} -////////////////////////////////////////////////////////////////////////// -void BCProcessor::clearBC() -{ - preBC.clear(); - postBC.clear(); -} - diff --git a/src/VirtualFluids/BoundaryConditions/BCProcessor.h b/src/VirtualFluids/BoundaryConditions/BCProcessor.h deleted file mode 100644 index 63c875cf0..000000000 --- a/src/VirtualFluids/BoundaryConditions/BCProcessor.h +++ /dev/null @@ -1,46 +0,0 @@ -#ifndef BC_PROCESSSOR_H -#define BC_PROCESSSOR_H - -#include <memory> -#include <vector> - -#include <boost/serialization/base_object.hpp> - -class BCProcessor; -typedef std::shared_ptr<BCProcessor> BCProcessorPtr; - -class BCArray3D; -class BCAlgorithm; -class ILBMKernel; - -class BCProcessor -{ -public: - BCProcessor(); - BCProcessor(std::shared_ptr<ILBMKernel> kernel); - virtual ~BCProcessor(); - virtual std::shared_ptr<BCArray3D> getBCArray(); - virtual void setBCArray(std::shared_ptr<BCArray3D> bcarray); - virtual BCProcessorPtr clone(std::shared_ptr<ILBMKernel> kernel); - - void addBC(std::shared_ptr<BCAlgorithm> bc); - void applyPreCollisionBC(); - void applyPostCollisionBC(); - void clearBC(); -protected: - std::vector<std::shared_ptr<BCAlgorithm> > preBC; - std::vector<std::shared_ptr<BCAlgorithm> > postBC; - std::shared_ptr<BCArray3D> bcArray; - -private: - friend class boost::serialization::access; - template<class Archive> - void serialize(Archive & ar, const unsigned int version) - { - ar & bcArray; - //ar & preBC; - //ar & postBC; - } -}; - -#endif diff --git a/src/VirtualFluids/BoundaryConditions/BoundaryConditions.cpp b/src/VirtualFluids/BoundaryConditions/BoundaryConditions.cpp deleted file mode 100644 index 4da0ee362..000000000 --- a/src/VirtualFluids/BoundaryConditions/BoundaryConditions.cpp +++ /dev/null @@ -1,4 +0,0 @@ -#include "BoundaryConditions.h" - -const long long BoundaryConditions::maxOptionVal = ( 1<<optionDigits ) - 1; //2^3-1 -> 7 - diff --git a/src/VirtualFluids/BoundaryConditions/BoundaryConditions.h b/src/VirtualFluids/BoundaryConditions/BoundaryConditions.h deleted file mode 100644 index b8d1fd146..000000000 --- a/src/VirtualFluids/BoundaryConditions/BoundaryConditions.h +++ /dev/null @@ -1,306 +0,0 @@ -// _ ___ __ __________ _ __ -// | | / (_)____/ /___ ______ _/ / ____/ /_ __(_)___/ /____ -// | | / / / ___/ __/ / / / __ `/ / /_ / / / / / / __ / ___/ -// | |/ / / / / /_/ /_/ / /_/ / / __/ / / /_/ / / /_/ (__ ) -// |___/_/_/ \__/\__,_/\__,_/_/_/ /_/\__,_/_/\__,_/____/ -// -#ifndef BoundaryConditions_H -#define BoundaryConditions_H - -#include <vector> -#include <string> - -#include "VirtualFluidsBasics/basics/utilities/Vector3D.h" - -#include <basics/utilities/UbException.h> -#include <basics/utilities/UbSystem.h> -#include <basics/utilities/UbTuple.h> -#include "D3Q27System.h" - -#include <boost/serialization/serialization.hpp> - -class BoundaryConditions; -typedef std::shared_ptr<BoundaryConditions> BoundaryConditionsPtr; - -class BoundaryConditions -{ -//public: -// enum BcAlgorithm{VelocityBC, SlipBC, NoSlipBC, ThinWallNoSlipBC, HighViscosityNoSlipBC, EqDensityBC, NonEqDensityBC, NonReflectingVelocityBC, NonReflectingDensityBC}; -public: - BoundaryConditions() - : noslipBoundaryFlags(0) - , slipBoundaryFlags(0) - , velocityBoundaryFlags(0) - , densityBoundaryFlags(0) - , wallModelBoundaryFlags(0) - , bcVelocityX1(0.0f) - , bcVelocityX2(0.0f) - , bcVelocityX3(0.0f) - , bcDensity(0.0f) - , bcLodiDensity(0.0f) - , bcLodiVelocityX1(0.0f) - , bcLodiVelocityX2(0.0f) - , bcLodiVelocityX3(0.0f) - , bcLodiLentgh(0.0f) - , nx1(0.0f) - , nx2(0.0f) - , nx3(0.0f) - , algorithmType(-1) - { - //wenn folgendes nicht geht, dann hat man weiter unten bei der bit-geschichte ein ernstes problem!!! - UB_STATIC_ASSERT( sizeof(long long) >= 8); - //UB_STATIC_ASSERT( sizeof(double) >= 16); - //UB_STATIC_ASSERT( sizeof(long long) == 32); - UB_STATIC_ASSERT( (sizeof(long long)*8) >= (D3Q27System::FENDDIR+1)*BoundaryConditions::optionDigits ); - - for(int fdir=D3Q27System::FSTARTDIR; fdir<=D3Q27System::FENDDIR; fdir++) - q[fdir] = -999.; - } - virtual ~BoundaryConditions() {} - - virtual bool isEmpty() { return (noslipBoundaryFlags&slipBoundaryFlags&velocityBoundaryFlags&densityBoundaryFlags)==0;} - virtual bool hasBoundaryCondition() - { - return ( hasNoSlipBoundary() || hasSlipBoundary() - || hasDensityBoundary() || hasVelocityBoundary() || hasWallModelBoundary() ); - } - - virtual bool hasBoundaryConditionFlag(const int& direction) - { - assert( direction >= D3Q27System::FSTARTDIR && direction <= D3Q27System::FENDDIR ); - - return ( hasNoSlipBoundaryFlag(direction) || hasSlipBoundaryFlag(direction) - || hasDensityBoundaryFlag(direction) || hasVelocityBoundaryFlag(direction) || hasWallModelBoundaryFlag(direction)); - } -protected: - void setFlagBits(long long& flag, const int& direction, const short& secOpt) - { - if( (secOpt+1)>maxOptionVal ) - throw UbException(UB_EXARGS,"error: option > "+UbSystem::toString(maxOptionVal-1)); - - //alle digits an den betreffenden postionen auf "0" - flag &= ~( maxOptionVal<<(direction*optionDigits) ); - //alle digitsan den betreffenden postionen entsprechend der marke setzen - flag |= ((long long)(secOpt+1)<<(direction*optionDigits)); - } -public: - /*===================== NoSlip Boundary ==================================================*/ - void setNoSlipBoundaryFlag(const int& direction, const short& secOpt=0) { this->setFlagBits(noslipBoundaryFlags,direction,secOpt); } - void unsetNoSlipBoundaryFlag(const int& direction) { this->noslipBoundaryFlags &= ~( maxOptionVal<<(direction*optionDigits) ); } - void unsetNoSlipBoundary() { this->noslipBoundaryFlags = 0; } - long long getNoSlipBoundary() { return this->noslipBoundaryFlags; } - bool hasNoSlipBoundary() { return (noslipBoundaryFlags!=0); } - bool hasNoSlipBoundaryFlag(const int& direction) { return ( ( ( noslipBoundaryFlags>>(optionDigits*direction) ) & maxOptionVal ) != 0); } - short getNoSlipSecondaryOption(const int& direction) { return (short)( ( ( noslipBoundaryFlags>>(optionDigits*direction) ) & maxOptionVal ) - 1 ); } - /*===================== WallModel Boundary ==================================================*/ - void setWallModelBoundaryFlag(const int& direction, const short& secOpt=0) { this->setFlagBits(wallModelBoundaryFlags,direction,secOpt); } - void unsetWallModelBoundaryFlag(const int& direction) { this->wallModelBoundaryFlags &= ~( maxOptionVal<<(direction*optionDigits) ); } - void unsetWallModelBoundary() { this->wallModelBoundaryFlags = 0; } - long long getWallModelBoundary() { return this->wallModelBoundaryFlags; } - bool hasWallModelBoundary() { return (wallModelBoundaryFlags!=0); } - bool hasWallModelBoundaryFlag(const int& direction) { return ( ( ( wallModelBoundaryFlags>>(optionDigits*direction) ) & maxOptionVal ) != 0); } - short getWallModelSecondaryOption(const int& direction) { return (short)( ( ( wallModelBoundaryFlags>>(optionDigits*direction) ) & maxOptionVal ) - 1 ); } - /*===================== Slip-Solid Boundary ==================================================*/ - void setSlipBoundaryFlag(const int& direction, const short& secOpt=0) { this->setFlagBits(slipBoundaryFlags,direction,secOpt); } - void unsetSlipBoundaryFlag(const int& direction) { this->slipBoundaryFlags &= ~( maxOptionVal<<(direction*optionDigits) ); } - void unsetSlipBoundary() { this->slipBoundaryFlags = 0; } - long long getSlipBoundary() { return this->slipBoundaryFlags; } - bool hasSlipBoundary() { return (slipBoundaryFlags!=0); } - bool hasSlipBoundaryFlag(const int& direction) { return ( ( ( slipBoundaryFlags>>(optionDigits*direction) ) & maxOptionVal ) != 0); } - short getSlipSecondaryOption(const int& direction) { return (short)( ( ( slipBoundaryFlags>>(optionDigits*direction) ) & maxOptionVal ) - 1 ); } - void setNormalVector(const float& nx1,const float& nx2,const float& nx3) { this->nx1 = nx1; this->nx2 = nx2; this->nx3 = nx3;} - UbTupleFloat3 getNormalVector() { return makeUbTuple(nx1,nx2,nx3); } - - /*============== Velocity Boundary ========================*/ - void setVelocityBoundaryFlag(const int& direction, const short& secOpt=0) { this->setFlagBits(velocityBoundaryFlags,direction,secOpt); } - void unsetVelocityBoundaryFlag(const int& direction) { this->velocityBoundaryFlags &= ~( maxOptionVal<<(direction*optionDigits) ); } - void unsetVelocityBoundary() { this->velocityBoundaryFlags = 0; } - long long getVelocityBoundary() { return this->velocityBoundaryFlags; } - bool hasVelocityBoundary() { return this->velocityBoundaryFlags!=0; } - bool hasVelocityBoundaryFlag(const int& direction) { return ( ( ( velocityBoundaryFlags>>(optionDigits*direction) ) & maxOptionVal ) != 0); } - short getVelocitySecondaryOption(const int& direction) { return (short)( ( ( velocityBoundaryFlags>>(optionDigits*direction) ) & maxOptionVal ) - 1 ); } - - void setBoundaryVelocity(const Vector3D& vx) - { - setBoundaryVelocityX1((float)vx[0]); - setBoundaryVelocityX2((float)vx[1]); - setBoundaryVelocityX3((float)vx[2]); - } - void setBoundaryVelocityX1(const float& vx1) { this->bcVelocityX1 = vx1; } - void setBoundaryVelocityX2(const float& vx2) { this->bcVelocityX2 = vx2; } - void setBoundaryVelocityX3(const float& vx3) { this->bcVelocityX3 = vx3; } - float getBoundaryVelocityX1() { return this->bcVelocityX1; } - float getBoundaryVelocityX2() { return this->bcVelocityX2; } - float getBoundaryVelocityX3() { return this->bcVelocityX3; } - float getBoundaryVelocity(const int& direction) - { - switch(direction) - { - case D3Q27System::E : return (float)( UbMath::c4o9*(+bcVelocityX1) ); //(2/cs^2)(=6)*rho_0(=1 bei inkompr)*wi*u*ei mit cs=1/sqrt(3) - case D3Q27System::W : return (float)( UbMath::c4o9*(-bcVelocityX1) ); //z.B. aus paper manfred MRT LB models in three dimensions (2002) - case D3Q27System::N : return (float)( UbMath::c4o9*(+bcVelocityX2) ); - case D3Q27System::S : return (float)( UbMath::c4o9*(-bcVelocityX2) ); - case D3Q27System::T : return (float)( UbMath::c4o9*(+bcVelocityX3) ); - case D3Q27System::B : return (float)( UbMath::c4o9*(-bcVelocityX3) ); - case D3Q27System::NE: return (float)( UbMath::c1o9*(+bcVelocityX1+bcVelocityX2 ) ); - case D3Q27System::SW: return (float)( UbMath::c1o9*(-bcVelocityX1-bcVelocityX2 ) ); - case D3Q27System::SE: return (float)( UbMath::c1o9*(+bcVelocityX1-bcVelocityX2 ) ); - case D3Q27System::NW: return (float)( UbMath::c1o9*(-bcVelocityX1+bcVelocityX2 ) ); - case D3Q27System::TE: return (float)( UbMath::c1o9*(+bcVelocityX1 +bcVelocityX3) ); - case D3Q27System::BW: return (float)( UbMath::c1o9*(-bcVelocityX1 -bcVelocityX3) ); - case D3Q27System::BE: return (float)( UbMath::c1o9*(+bcVelocityX1 -bcVelocityX3) ); - case D3Q27System::TW: return (float)( UbMath::c1o9*(-bcVelocityX1 +bcVelocityX3) ); - case D3Q27System::TN: return (float)( UbMath::c1o9*( +bcVelocityX2+bcVelocityX3) ); - case D3Q27System::BS: return (float)( UbMath::c1o9*( -bcVelocityX2-bcVelocityX3) ); - case D3Q27System::BN: return (float)( UbMath::c1o9*( +bcVelocityX2-bcVelocityX3) ); - case D3Q27System::TS: return (float)( UbMath::c1o9*( -bcVelocityX2+bcVelocityX3) ); - case D3Q27System::TNE: return (float)( UbMath::c1o36*(+bcVelocityX1+bcVelocityX2+bcVelocityX3) ); - case D3Q27System::BSW: return (float)( UbMath::c1o36*(-bcVelocityX1-bcVelocityX2-bcVelocityX3) ); - case D3Q27System::BNE: return (float)( UbMath::c1o36*(+bcVelocityX1+bcVelocityX2-bcVelocityX3) ); - case D3Q27System::TSW: return (float)( UbMath::c1o36*(-bcVelocityX1-bcVelocityX2+bcVelocityX3) ); - case D3Q27System::TSE: return (float)( UbMath::c1o36*(+bcVelocityX1-bcVelocityX2+bcVelocityX3) ); - case D3Q27System::BNW: return (float)( UbMath::c1o36*(-bcVelocityX1+bcVelocityX2-bcVelocityX3) ); - case D3Q27System::BSE: return (float)( UbMath::c1o36*(+bcVelocityX1-bcVelocityX2-bcVelocityX3) ); - case D3Q27System::TNW: return (float)( UbMath::c1o36*(-bcVelocityX1+bcVelocityX2+bcVelocityX3) ); - default: throw UbException(UB_EXARGS,"unknown error"); - } - } - - /*============== Density Boundary ========================*/ - void setDensityBoundaryFlag(const int& direction, const short& secOpt=0) { this->setFlagBits(densityBoundaryFlags,direction,secOpt); } - void unsetDensityBoundaryFlag(const int& direction) { this->densityBoundaryFlags &= ~( maxOptionVal<<(direction*optionDigits) ); } - void unsetDensityBoundary() { this->densityBoundaryFlags = 0; } - long long getDensityBoundary() { return this->densityBoundaryFlags; } - bool hasDensityBoundary() { return (this->densityBoundaryFlags!=0); } - bool hasDensityBoundaryFlag(const int& direction) { return ( ( ( densityBoundaryFlags>>(optionDigits*direction) ) & maxOptionVal ) != 0); } - short getDensitySecondaryOption(const int& direction) { return (short)( ( ( densityBoundaryFlags>>(optionDigits*direction) ) & maxOptionVal ) - 1 ); } - - void setBoundaryDensity(float density) { this->bcDensity = density; } - float getBoundaryDensity() { return this->bcDensity; } - - //Lodi extension - void setDensityLodiDensity(const float& bcLodiDensity) { this->bcLodiDensity = bcLodiDensity; } - void setDensityLodiVelocityX1(const float& bcLodiVelocityX1) { this->bcLodiVelocityX1 = bcLodiVelocityX1; } - void setDensityLodiVelocityX2(const float& bcLodiVelocityX2) { this->bcLodiVelocityX2 = bcLodiVelocityX2; } - void setDensityLodiVelocityX3(const float& bcLodiVelocityX3) { this->bcLodiVelocityX3 = bcLodiVelocityX3; } - void setDensityLodiLength(const float& bcLodiLentgh) { this->bcLodiLentgh = bcLodiLentgh; } - float getDensityLodiDensity() const { return this->bcLodiDensity; } - float getDensityLodiVelocityX1() const { return this->bcLodiVelocityX1; } - float getDensityLodiVelocityX2() const { return this->bcLodiVelocityX2; } - float getDensityLodiVelocityX3() const { return this->bcLodiVelocityX3; } - float getDensityLodiLength() const { return this->bcLodiLentgh; } - - float& densityLodiDensity() { return this->bcLodiDensity; } - float& densityLodiVelocityX1() { return this->bcLodiVelocityX1; } - float& densityLodiVelocityX2() { return this->bcLodiVelocityX2; } - float& densityLodiVelocityX3() { return this->bcLodiVelocityX3; } - float& densityLodiLentgh() { return this->bcLodiLentgh; } - - const float& densityLodiDensity() const { return this->bcLodiDensity; } - const float& densityLodiVelocityX1() const { return this->bcLodiVelocityX1; } - const float& densityLodiVelocityX2() const { return this->bcLodiVelocityX2; } - const float& densityLodiVelocityX3() const { return this->bcLodiVelocityX3; } - const float& densityLodiLentgh() const { return this->bcLodiLentgh; } - - - /*======================= Qs =============================*/ - void setQ(const float& val, const int& direction) { q[direction] = val; } - float getQ(const int& direction) { return q[direction]; } - - virtual std::vector< std::string > getBCNames() - { - std::vector< std::string > tmp; - tmp.push_back( "NoSlipBC" ); - tmp.push_back( "SlipBC" ); - tmp.push_back( "VelocityBC" ); - tmp.push_back( "DensityBC" ); - return tmp; - } - virtual std::vector< long long > getBCFlags() - { - std::vector< long long > tmp; - tmp.push_back( noslipBoundaryFlags ); - tmp.push_back( slipBoundaryFlags ); - tmp.push_back( velocityBoundaryFlags ); - tmp.push_back( densityBoundaryFlags ); - return tmp; - } - - static bool hasFlagForDirection(const long long& flag, const int& direction) - { - return ( ( ( flag>>(optionDigits*direction) ) & maxOptionVal ) != 0); - } - - void setBcAlgorithmType(char alg) { algorithmType = alg; } - char getBcAlgorithmType() { return algorithmType; } - -public: - static const int optionDigits = 2; //--> 3 bits für secondary Option --> maxOptionVal = 7, da man mit drei Digits max die 7 darstellen kann - static const long long maxOptionVal;// = ( 1<<optionDigits ) - 1; //2^3-1 -> 7 - -protected: - float q[D3Q27System::FENDDIR+1]; - //float q[D3Q27System::STARTF+1]; - - long long noslipBoundaryFlags; - long long slipBoundaryFlags; - long long velocityBoundaryFlags; - long long densityBoundaryFlags; - long long wallModelBoundaryFlags; - - float bcVelocityX1; - float bcVelocityX2; - float bcVelocityX3; - float bcDensity; - - float bcLodiDensity; - float bcLodiVelocityX1; - float bcLodiVelocityX2; - float bcLodiVelocityX3; - float bcLodiLentgh; - - float nx1,nx2,nx3; - - char algorithmType; - -private: - friend class MPIIORestart1CoProcessor; - friend class MPIIORestart2CoProcessor; - friend class MPIIORestart11CoProcessor; - friend class MPIIORestart21CoProcessor; - - - friend class boost::serialization::access; - template<class Archive> - void serialize(Archive & ar, const unsigned int version) - { - ar & q; - - ar & noslipBoundaryFlags; - ar & slipBoundaryFlags; - ar & velocityBoundaryFlags; - ar & densityBoundaryFlags; - - ar & bcVelocityX1; - ar & bcVelocityX2; - ar & bcVelocityX3; - ar & bcDensity; - - ar & bcLodiDensity; - ar & bcLodiVelocityX1; - ar & bcLodiVelocityX2; - ar & bcLodiVelocityX3; - ar & bcLodiLentgh; - - ar & wallModelBoundaryFlags; - - ar & nx1; - ar & nx2; - ar & nx3; - - ar & algorithmType; - } - -}; - -#endif //D3Q27BOUNDARYCONDITION_H diff --git a/src/VirtualFluids/BoundaryConditions/CMakePackage.txt b/src/VirtualFluids/BoundaryConditions/CMakePackage.txt deleted file mode 100644 index e3e3f9a38..000000000 --- a/src/VirtualFluids/BoundaryConditions/CMakePackage.txt +++ /dev/null @@ -1,2 +0,0 @@ -GET_FILENAME_COMPONENT( CURRENT_DIR ${CMAKE_CURRENT_LIST_FILE} PATH) -COLLECT_PACKAGE_DATA_WITH_OPTION(${CURRENT_DIR} ALL_SOURCES) \ No newline at end of file diff --git a/src/VirtualFluids/BoundaryConditions/DensityBCAdapter.cpp b/src/VirtualFluids/BoundaryConditions/DensityBCAdapter.cpp deleted file mode 100644 index 3dc274f0b..000000000 --- a/src/VirtualFluids/BoundaryConditions/DensityBCAdapter.cpp +++ /dev/null @@ -1,157 +0,0 @@ -#include "DensityBCAdapter.h" -#include "basics/utilities/UbLogger.h" -#include "basics/utilities/UbInfinity.h" - -using namespace std; -/*==========================================================*/ -DensityBCAdapter::DensityBCAdapter(const double& dens, const double& startTime, const double& endTime ) -{ - this->densBCs.push_back( BCFunction(dens,startTime,endTime) ); - this->init(); -} -/*==========================================================*/ -DensityBCAdapter::DensityBCAdapter(const BCFunction& densBC ) -{ - this->densBCs.push_back(densBC); - this->init(); -} -/*==========================================================*/ -DensityBCAdapter::DensityBCAdapter(const std::vector< BCFunction >& densBCs) -{ - this->densBCs = densBCs; - this->init(); -} -/*==========================================================*/ -DensityBCAdapter::DensityBCAdapter(const mu::Parser& function, const double& startTime, const double& endTime ) -{ - this->densBCs.push_back(BCFunction(function,startTime,endTime)); - this->init(); -} -/*==========================================================*/ -void DensityBCAdapter::init() -{ - this->timeStep = 0.0; - - this->x1 = 0.0; - this->x2 = 0.0; - this->x3 = 0.0; - - this->tmpDensityFunction = NULL; - - try //initilialization and validation of functions - { - for(size_t pos=0; pos<densBCs.size(); ++pos) - { - if( !( UbMath::equal( BCFunction::INFCONST, densBCs[pos].getEndTime() ) - && UbMath::greaterEqual( this->timeStep, densBCs[pos].getStartTime() ) ) ) - { - this->setTimeDependent(); - } - - densBCs[pos].getFunction().DefineVar("t" , &this->timeStep); - densBCs[pos].getFunction().DefineVar("x1", &this->x1 ); - densBCs[pos].getFunction().DefineVar("x2", &this->x2 ); - densBCs[pos].getFunction().DefineVar("x3", &this->x3 ); - - densBCs[pos].getFunction().Eval(); //<-- validation - } - } - catch(mu::Parser::exception_type& e){ stringstream error; error<<"mu::parser exception occurs, message("<<e.GetMsg()<<"), formula("<<e.GetExpr()+"), token("+e.GetToken()<<")" - <<", pos("<<e.GetPos()<<"), error code("<<e.GetCode(); throw UbException(error.str()); } - catch(...) { throw UbException(UB_EXARGS,"unknown exception" ); } -} -/*==========================================================*/ -void DensityBCAdapter::init(const D3Q27Interactor* const& interactor, const double& time) -{ - this->timeStep = time; - this->tmpDensityFunction = NULL; - double maxEndtime = -Ub::inf; - - //aktuelle Densityfunction bestimmen - for(size_t pos=0; pos<densBCs.size(); ++pos) - { - if( UbMath::equal(densBCs[pos].getEndTime(),BCFunction::INFTIMEDEPENDENT)) maxEndtime=Ub::inf; - maxEndtime = UbMath::max(maxEndtime,densBCs[pos].getStartTime(),densBCs[pos].getEndTime()); //startTime abfragen, da INFCONST=-10 - - if( UbMath::greaterEqual(this->timeStep,densBCs[pos].getStartTime()) ) - { - if( UbMath::lessEqual(this->timeStep,densBCs[pos].getEndTime()) - || UbMath::equal(densBCs[pos].getEndTime(),(double)BCFunction::INFCONST) - || UbMath::equal(densBCs[pos].getEndTime(),(double)BCFunction::INFTIMEDEPENDENT) ) - { - tmpDensityFunction = &densBCs[pos].getFunction(); - break; - } - } - } - - //wenn funktionen zweitlich konstant sind und bis t=unendlich gelten - //kann man zeitabhaengigkeit deaktivieren - if( UbMath::greaterEqual(time,maxEndtime) ) this->unsetTimeDependent(); - - UBLOG(logDEBUG4,"D3Q27DensityBCAdapter::init(time="<<time<<") " - <<", rho= \""<<(tmpDensityFunction ? tmpDensityFunction->GetExpr() : "-") - <<"\", timedependant="<<(this->isTimeDependent() ? "true" : "false") ); -} -/*==========================================================*/ -void DensityBCAdapter::update( const D3Q27Interactor* const& interactor, const double& time ) -{ - this->init(interactor,time); -} -/*==========================================================*/ -void DensityBCAdapter::adaptBCForDirection( const D3Q27Interactor& interactor, BoundaryConditionsPtr bc, const double& worldX1, const double& worldX2, const double& worldX3, const double& q, const int& fdirection, const double& time ) -{ - bc->setDensityBoundaryFlag(D3Q27System::INVDIR[fdirection],secondaryBcOption); - bc->setQ((float)q,fdirection); -} -/*==========================================================*/ -void DensityBCAdapter::adaptBC( const D3Q27Interactor& interactor, BoundaryConditionsPtr bc, const double& worldX1, const double& worldX2, const double& worldX3, const double& time ) -{ - this->setNodeDensity(interactor,bc,worldX1,worldX2,worldX3,time); - bc->setBcAlgorithmType(algorithmType); -} -/*==========================================================*/ -void DensityBCAdapter::setNodeDensity( const D3Q27Interactor& interactor, BoundaryConditionsPtr bc, const double& worldX1, const double& worldX2, const double& worldX3, const double& timestep) -{ - //Geschwindigkeiten setzen - try - { - //PunktKoordinaten bestimmen - this->x1 = worldX1; - this->x2 = worldX2; - this->x3 = worldX3; - this->timeStep = timestep; - - if(tmpDensityFunction) bc->setBoundaryDensity((float)tmpDensityFunction->Eval()); - } - catch(mu::Parser::exception_type& e){ stringstream error; error<<"mu::parser exception occurs, message("<<e.GetMsg()<<"), formula("<<e.GetExpr()+"), token("+e.GetToken()<<")" - <<", pos("<<e.GetPos()<<"), error code("<<e.GetCode(); throw UbException(error.str()); } - catch(...) { throw UbException(UB_EXARGS,"unknown exception" ); } -} -/*==========================================================*/ -double DensityBCAdapter::getDensity(const double& x1, const double& x2, const double& x3, const double& timeStep) -{ - this->x1 = x1; - this->x2 = x2; - this->x3 = x3; - this->timeStep = timeStep; - - if(!tmpDensityFunction) return 0.0; - - return tmpDensityFunction->Eval(); -} -/*==========================================================*/ -string DensityBCAdapter::toString() -{ - stringstream info; - info<<"D3Q27DensityBCAdapter:\n"; - info<<" #dens-functions = "<<(int)densBCs.size()<<endl; - info<<" protected variables: x1, x2, x3, t"<<endl; - - for(size_t i=0; i<densBCs.size(); ++i) - { - info<<"\n dens-function nr."<<i<<":"<<endl; - info<<densBCs[i].toString()<<endl; - } - return info.str(); -} diff --git a/src/VirtualFluids/BoundaryConditions/DensityBCAdapter.h b/src/VirtualFluids/BoundaryConditions/DensityBCAdapter.h deleted file mode 100644 index 0385fe4fc..000000000 --- a/src/VirtualFluids/BoundaryConditions/DensityBCAdapter.h +++ /dev/null @@ -1,81 +0,0 @@ -#ifndef DensityBCAdapter_H -#define DensityBCAdapter_H - -#include <iostream> -#include <string> -#include <sstream> -#include <vector> - -#include "basics/utilities/UbMath.h" -#include "basics/utilities/UbTuple.h" - -#include "BCAdapter.h" -#include "BCFunction.h" - -//* DensityBCAdapter */ -//* */ -//** -//<BR><BR> -//@author <A HREF="mailto:muffmolch@gmx.de">S. Freudiger</A> -//@version 1.0 - 06.09.06 -//*/ -// -//* -//usage: ... -//*/ - - -class DensityBCAdapter : public BCAdapter -{ -public: - //constructors - DensityBCAdapter() { this->init(); } - DensityBCAdapter(const double& dens, const double& startTime=0.0, const double& endTime = BCFunction::INFCONST ); - DensityBCAdapter(const BCFunction& densBC ); - DensityBCAdapter(const std::vector< BCFunction >& densBCs); - DensityBCAdapter(const mu::Parser& function, const double& startTime=0.0, const double& endTime = BCFunction::INFCONST ); - - //------------- implements D3Q27BoundaryConditionAdapter ----- start - std::string toString(); - ObObjectCreator* getCreator(); - - void init(const D3Q27Interactor* const& interactor, const double& time=0); - void update(const D3Q27Interactor* const& interactor, const double& time=0); - - void adaptBCForDirection( const D3Q27Interactor& interactor, BoundaryConditionsPtr bc, const double& worldX1, const double& worldX2, const double& worldX3, const double& q, const int& fdirection, const double& time=0 ); - void adaptBC( const D3Q27Interactor& interactor, BoundaryConditionsPtr bc, const double& worldX1, const double& worldX2, const double& worldX3, const double& time=0 ); - - double getDensity(const double& x1, const double& x2, const double& x3, const double& timeStep); - - //------------- implements D3Q27BoundaryConditionAdapter ----- end - - -protected: - void init(); - - //time dependency wird automatisch ueber D3Q27BCFunction Intervalle ermittelt! - void setTimeDependent() { (this->type |= TIMEDEPENDENT);} - void unsetTimeDependent() { (this->type &= ~TIMEDEPENDENT);} - - void clear() { densBCs.clear(); } - void setNodeDensity(const D3Q27Interactor& interactor, BoundaryConditionsPtr bc, const double& worldX1, const double& worldX2, const double& worldX3, const double& timestep); - -private: - mu::value_type x1, x2, x3; //brauch man nicht serialisieren! - mu::value_type timeStep; //brauch man nicht serialisieren! - - mu::Parser* tmpDensityFunction; //brauch man nicht serialisieren! - - std::vector<BCFunction> densBCs; - -private: - friend class boost::serialization::access; - template<class Archive> - void serialize(Archive & ar, const unsigned int version) - { - ar & boost::serialization::base_object<BCAdapter>(*this); - ar & densBCs; - } -}; - -#endif diff --git a/src/VirtualFluids/BoundaryConditions/EqDensityBCAlgorithm.cpp b/src/VirtualFluids/BoundaryConditions/EqDensityBCAlgorithm.cpp deleted file mode 100644 index 91faa3da0..000000000 --- a/src/VirtualFluids/BoundaryConditions/EqDensityBCAlgorithm.cpp +++ /dev/null @@ -1,60 +0,0 @@ -#include "EqDensityBCAlgorithm.h" -#include "DistributionArray3D.h" -#include "BoundaryConditions.h" - - -EqDensityBCAlgorithm::EqDensityBCAlgorithm() -{ - BCAlgorithm::type = BCAlgorithm::EqDensityBCAlgorithm; - BCAlgorithm::preCollision = false; -} -////////////////////////////////////////////////////////////////////////// -EqDensityBCAlgorithm::~EqDensityBCAlgorithm() -{ -} -////////////////////////////////////////////////////////////////////////// -BCAlgorithmPtr EqDensityBCAlgorithm::clone() -{ - BCAlgorithmPtr bc(new EqDensityBCAlgorithm()); - return bc; -} -////////////////////////////////////////////////////////////////////////// -void EqDensityBCAlgorithm::addDistributions(DistributionArray3DPtr distributions) -{ - this->distributions = distributions; -} -////////////////////////////////////////////////////////////////////////// -void EqDensityBCAlgorithm::applyBC() -{ - LBMReal f[D3Q27System::ENDF+1]; - - distributions->getDistributionInv(f, x1, x2, x3); - int nx1 = x1; - int nx2 = x2; - int nx3 = x3; - int direction = -1; - - //flag points in direction of fluid - if (bcPtr->hasDensityBoundaryFlag(D3Q27System::E)) { nx1 -= 1; direction = D3Q27System::E; } - else if (bcPtr->hasDensityBoundaryFlag(D3Q27System::W)) { nx1 += 1; direction = D3Q27System::W; } - else if (bcPtr->hasDensityBoundaryFlag(D3Q27System::N)) { nx2 -= 1; direction = D3Q27System::N; } - else if (bcPtr->hasDensityBoundaryFlag(D3Q27System::S)) { nx2 += 1; direction = D3Q27System::S; } - else if (bcPtr->hasDensityBoundaryFlag(D3Q27System::T)) { nx3 -= 1; direction = D3Q27System::T; } - else if (bcPtr->hasDensityBoundaryFlag(D3Q27System::B)) { nx3 += 1; direction = D3Q27System::B; } - else UB_THROW(UbException(UB_EXARGS, "Danger...no orthogonal BC-Flag on density boundary...")); - - LBMReal rho, vx1, vx2, vx3; - calcMacrosFct(f, rho, vx1, vx2, vx3); - LBMReal rhoBC = bcPtr->getBoundaryDensity(); - for (int fdir = D3Q27System::STARTF; fdir<=D3Q27System::ENDF; fdir++) - { - if (bcPtr->hasDensityBoundaryFlag(fdir)) - { - //Ehsan: 15.2.2013: - LBMReal ftemp = calcFeqsForDirFct(fdir, rhoBC, vx1, vx2, vx3); - distributions->setDistributionForDirection(ftemp, nx1, nx2, nx3, fdir); - } - } - -} - diff --git a/src/VirtualFluids/BoundaryConditions/EqDensityBCAlgorithm.h b/src/VirtualFluids/BoundaryConditions/EqDensityBCAlgorithm.h deleted file mode 100644 index 2ae0e57e1..000000000 --- a/src/VirtualFluids/BoundaryConditions/EqDensityBCAlgorithm.h +++ /dev/null @@ -1,27 +0,0 @@ -#ifndef EqDensityBCAlgorithm_h__ -#define EqDensityBCAlgorithm_h__ - -#include "BCAlgorithm.h" - -class DistributionArray3D; - -class EqDensityBCAlgorithm; -typedef std::shared_ptr<EqDensityBCAlgorithm> EqDensityBCAlgorithmPtr; - -class EqDensityBCAlgorithm : public BCAlgorithm -{ -public: - EqDensityBCAlgorithm(); - ~EqDensityBCAlgorithm(); - BCAlgorithmPtr clone(); - void addDistributions(std::shared_ptr<DistributionArray3D> distributions); - void applyBC() override; -private: - //friend class boost::serialization::access; - //template<class Archive> - //void serialize(Archive & ar, const unsigned int version) - //{ - // ar & boost::serialization::base_object<BCAlgorithm>(*this); - //} -}; -#endif // EqDensityBCAlgorithm_h__ diff --git a/src/VirtualFluids/BoundaryConditions/HighViscosityNoSlipBCAlgorithm.cpp b/src/VirtualFluids/BoundaryConditions/HighViscosityNoSlipBCAlgorithm.cpp deleted file mode 100644 index 20bb7bf94..000000000 --- a/src/VirtualFluids/BoundaryConditions/HighViscosityNoSlipBCAlgorithm.cpp +++ /dev/null @@ -1,47 +0,0 @@ -#include "HighViscosityNoSlipBCAlgorithm.h" -#include "DistributionArray3D.h" -#include "BoundaryConditions.h" - -HighViscosityNoSlipBCAlgorithm::HighViscosityNoSlipBCAlgorithm() -{ - BCAlgorithm::type = BCAlgorithm::HighViscosityNoSlipBCAlgorithm; - BCAlgorithm::preCollision = true; -} -////////////////////////////////////////////////////////////////////////// -HighViscosityNoSlipBCAlgorithm::~HighViscosityNoSlipBCAlgorithm() -{ -} -////////////////////////////////////////////////////////////////////////// -BCAlgorithmPtr HighViscosityNoSlipBCAlgorithm::clone() -{ - BCAlgorithmPtr bc(new HighViscosityNoSlipBCAlgorithm()); - return bc; -} -////////////////////////////////////////////////////////////////////////// -void HighViscosityNoSlipBCAlgorithm::addDistributions(DistributionArray3DPtr distributions) -{ - this->distributions = distributions; -} -////////////////////////////////////////////////////////////////////////// -void HighViscosityNoSlipBCAlgorithm::applyBC() -{ - LBMReal f[D3Q27System::ENDF+1]; - LBMReal feq[D3Q27System::ENDF+1]; - distributions->getDistribution(f, x1, x2, x3); - LBMReal rho, vx1, vx2, vx3; - calcMacrosFct(f, rho, vx1, vx2, vx3); - calcFeqFct(feq, rho, vx1, vx2, vx3); - - for (int fDir = D3Q27System::FSTARTDIR; fDir<=D3Q27System::FENDDIR; fDir++) - { - if (bcPtr->hasNoSlipBoundaryFlag(fDir)) - { - //quadratic bounce back - const int invDir = D3Q27System::INVDIR[fDir]; - LBMReal q = bcPtr->getQ(invDir); - LBMReal fReturn = (f[invDir]+q*f[fDir]+q*collFactor*(feq[invDir]-f[invDir]+feq[fDir]-f[fDir]))/(1.0+q); - distributions->setDistributionInvForDirection(fReturn, x1+D3Q27System::DX1[invDir], x2+D3Q27System::DX2[invDir], x3+D3Q27System::DX3[invDir], invDir); - } - } -} - diff --git a/src/VirtualFluids/BoundaryConditions/HighViscosityNoSlipBCAlgorithm.h b/src/VirtualFluids/BoundaryConditions/HighViscosityNoSlipBCAlgorithm.h deleted file mode 100644 index 792639c7e..000000000 --- a/src/VirtualFluids/BoundaryConditions/HighViscosityNoSlipBCAlgorithm.h +++ /dev/null @@ -1,29 +0,0 @@ -#ifndef HighViscosityNoSlipBCAlgorithm_h__ -#define HighViscosityNoSlipBCAlgorithm_h__ - -#include "BCAlgorithm.h" - -class DistributionArray3D; - -class HighViscosityNoSlipBCAlgorithm; -typedef std::shared_ptr<HighViscosityNoSlipBCAlgorithm> HighViscosityNoSlipBCAlgorithmPtr; - -class HighViscosityNoSlipBCAlgorithm : public BCAlgorithm -{ -public: - HighViscosityNoSlipBCAlgorithm(); - ~HighViscosityNoSlipBCAlgorithm(); - BCAlgorithmPtr clone(); - void addDistributions(std::shared_ptr<DistributionArray3D> distributions); - - void applyBC() override; -private: - //friend class boost::serialization::access; - //template<class Archive> - //void serialize(Archive & ar, const unsigned int version) - //{ - // ar & boost::serialization::base_object<BCAlgorithm>(*this); - //} -}; -#endif // HighViscosityNoSlipBCAlgorithm_h__ - diff --git a/src/VirtualFluids/BoundaryConditions/NoSlipBCAdapter.cpp b/src/VirtualFluids/BoundaryConditions/NoSlipBCAdapter.cpp deleted file mode 100644 index 119b958fa..000000000 --- a/src/VirtualFluids/BoundaryConditions/NoSlipBCAdapter.cpp +++ /dev/null @@ -1 +0,0 @@ -#include "NoSlipBCAdapter.h" diff --git a/src/VirtualFluids/BoundaryConditions/NoSlipBCAdapter.h b/src/VirtualFluids/BoundaryConditions/NoSlipBCAdapter.h deleted file mode 100644 index 22d8518a0..000000000 --- a/src/VirtualFluids/BoundaryConditions/NoSlipBCAdapter.h +++ /dev/null @@ -1,52 +0,0 @@ -#ifndef NoSlipBCAdapter_H -#define NoSlipBCAdapter_H - -#include "BCAdapter.h" - -/*=========================================================================*/ -/* D3Q27NoSlipBCAdapter */ -/* */ -/** -<BR><BR> -@author <A HREF="mailto:muffmolch@gmx.de">S. Freudiger</A> -@version 1.0 - 06.09.06 -*/ - -/* -usage: ... -*/ - -class NoSlipBCAdapter : public BCAdapter -{ -public: - NoSlipBCAdapter() - : BCAdapter() - { - } - NoSlipBCAdapter(const short& secondaryBcOption) - : BCAdapter(secondaryBcOption) - { - } - - void init(const D3Q27Interactor* const& interactor, const double& time=0) {} - void update(const D3Q27Interactor* const& interactor, const double& time=0) {} - - void adaptBCForDirection( const D3Q27Interactor& interactor, BoundaryConditionsPtr bc, const double& worldX1, const double& worldX2, const double& worldX3, const double& q, const int& fdirection, const double& time=0 ) - { - bc->setNoSlipBoundaryFlag(D3Q27System::INVDIR[fdirection],secondaryBcOption); - bc->setQ((float)q,fdirection); - } - void adaptBC( const D3Q27Interactor& interactor, BoundaryConditionsPtr bc, const double& worldX1, const double& worldX2, const double& worldX3, const double& time=0 ) - { - bc->setBcAlgorithmType(algorithmType); - } - -private: - friend class boost::serialization::access; - template<class Archive> - void serialize(Archive & ar, const unsigned int version) - { - ar & boost::serialization::base_object<BCAdapter>(*this); - } -}; -#endif //NoSlipBCAdapter_H diff --git a/src/VirtualFluids/BoundaryConditions/NoSlipBCAlgorithm.cpp b/src/VirtualFluids/BoundaryConditions/NoSlipBCAlgorithm.cpp deleted file mode 100644 index f1537aea1..000000000 --- a/src/VirtualFluids/BoundaryConditions/NoSlipBCAlgorithm.cpp +++ /dev/null @@ -1,47 +0,0 @@ -#include "NoSlipBCAlgorithm.h" -#include "DistributionArray3D.h" -#include "BoundaryConditions.h" - -NoSlipBCAlgorithm::NoSlipBCAlgorithm() -{ - BCAlgorithm::type = BCAlgorithm::NoSlipBCAlgorithm; - BCAlgorithm::preCollision = false; -} -////////////////////////////////////////////////////////////////////////// -NoSlipBCAlgorithm::~NoSlipBCAlgorithm() -{ - -} -////////////////////////////////////////////////////////////////////////// -BCAlgorithmPtr NoSlipBCAlgorithm::clone() -{ - BCAlgorithmPtr bc(new NoSlipBCAlgorithm()); - return bc; -} -////////////////////////////////////////////////////////////////////////// -void NoSlipBCAlgorithm::addDistributions(DistributionArray3DPtr distributions) -{ - this->distributions = distributions; -} -////////////////////////////////////////////////////////////////////////// -void NoSlipBCAlgorithm::applyBC() -{ - LBMReal f[D3Q27System::ENDF+1]; - LBMReal feq[D3Q27System::ENDF+1]; - distributions->getDistributionInv(f, x1, x2, x3); - LBMReal rho, vx1, vx2, vx3; - calcMacrosFct(f, rho, vx1, vx2, vx3); - calcFeqFct(feq, rho, vx1, vx2, vx3); - - 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-collFactor)+feq[invDir])+((q/(1.0+q))*(f[invDir]+f[fdir])); - distributions->setDistributionForDirection(fReturn, x1+D3Q27System::DX1[invDir], x2+D3Q27System::DX2[invDir], x3+D3Q27System::DX3[invDir], fdir); - } - } -} diff --git a/src/VirtualFluids/BoundaryConditions/NoSlipBCAlgorithm.h b/src/VirtualFluids/BoundaryConditions/NoSlipBCAlgorithm.h deleted file mode 100644 index 862d2972e..000000000 --- a/src/VirtualFluids/BoundaryConditions/NoSlipBCAlgorithm.h +++ /dev/null @@ -1,27 +0,0 @@ -#ifndef NoSlipBCAlgorithm_h__ -#define NoSlipBCAlgorithm_h__ - -#include "BCAlgorithm.h" - -class DistributionArray3D; - -class NoSlipBCAlgorithm; -typedef std::shared_ptr<NoSlipBCAlgorithm> NoSlipBCAlgorithmPtr; - -class NoSlipBCAlgorithm : public BCAlgorithm -{ -public: - NoSlipBCAlgorithm(); - virtual ~NoSlipBCAlgorithm(); - BCAlgorithmPtr clone(); - void addDistributions(std::shared_ptr<DistributionArray3D> distributions); - void applyBC() override; -private: - //friend class boost::serialization::access; - //template<class Archive> - //void serialize(Archive & ar, const unsigned int version) - //{ - // ar & boost::serialization::base_object<BCAlgorithm>(*this); - //} -}; -#endif // NoSlipBCAlgorithm_h__ diff --git a/src/VirtualFluids/BoundaryConditions/NonEqDensityBCAlgorithm.cpp b/src/VirtualFluids/BoundaryConditions/NonEqDensityBCAlgorithm.cpp deleted file mode 100644 index ca27148c7..000000000 --- a/src/VirtualFluids/BoundaryConditions/NonEqDensityBCAlgorithm.cpp +++ /dev/null @@ -1,61 +0,0 @@ -#include "NonEqDensityBCAlgorithm.h" - -#include "DistributionArray3D.h" -#include "BoundaryConditions.h" - -NonEqDensityBCAlgorithm::NonEqDensityBCAlgorithm() -{ - BCAlgorithm::type = BCAlgorithm::NonEqDensityBCAlgorithm; - BCAlgorithm::preCollision = false; -} -////////////////////////////////////////////////////////////////////////// -NonEqDensityBCAlgorithm::~NonEqDensityBCAlgorithm() -{ -} -////////////////////////////////////////////////////////////////////////// -BCAlgorithmPtr NonEqDensityBCAlgorithm::clone() -{ - BCAlgorithmPtr bc(new NonEqDensityBCAlgorithm()); - return bc; -} -////////////////////////////////////////////////////////////////////////// -void NonEqDensityBCAlgorithm::addDistributions(DistributionArray3DPtr distributions) -{ - this->distributions = distributions; -} -////////////////////////////////////////////////////////////////////////// -void NonEqDensityBCAlgorithm::applyBC() -{ - LBMReal f[D3Q27System::ENDF+1]; - distributions->getDistributionInv(f, x1, x2, x3); - int nx1 = x1; - int nx2 = x2; - int nx3 = x3; - int direction = -1; - - //flag points in direction of fluid - if (bcPtr->hasDensityBoundaryFlag(D3Q27System::E)) { nx1 -= 1; direction = D3Q27System::E; } - else if (bcPtr->hasDensityBoundaryFlag(D3Q27System::W)) { nx1 += 1; direction = D3Q27System::W; } - else if (bcPtr->hasDensityBoundaryFlag(D3Q27System::N)) { nx2 -= 1; direction = D3Q27System::N; } - else if (bcPtr->hasDensityBoundaryFlag(D3Q27System::S)) { nx2 += 1; direction = D3Q27System::S; } - else if (bcPtr->hasDensityBoundaryFlag(D3Q27System::T)) { nx3 -= 1; direction = D3Q27System::T; } - else if (bcPtr->hasDensityBoundaryFlag(D3Q27System::B)) { nx3 += 1; direction = D3Q27System::B; } - else UB_THROW(UbException(UB_EXARGS, "Danger...no orthogonal BC-Flag on density boundary...")); - - LBMReal rho, vx1, vx2, vx3; - calcMacrosFct(f, rho, vx1, vx2, vx3); - LBMReal rhoBC = bcPtr->getBoundaryDensity(); - for (int fdir = D3Q27System::STARTF; fdir<=D3Q27System::ENDF; fdir++) - { - if (bcPtr->hasDensityBoundaryFlag(fdir)) - { - // Martins NEQ ADDON - ////original: 15.2.2013: - LBMReal ftemp = calcFeqsForDirFct(fdir, rho, vx1, vx2, vx3); - ftemp = calcFeqsForDirFct(fdir, rhoBC, vx1, vx2, vx3)+f[fdir]-ftemp; - distributions->setDistributionForDirection(ftemp, nx1, nx2, nx3, fdir); - } - } - -} - diff --git a/src/VirtualFluids/BoundaryConditions/NonEqDensityBCAlgorithm.h b/src/VirtualFluids/BoundaryConditions/NonEqDensityBCAlgorithm.h deleted file mode 100644 index b0fb870cc..000000000 --- a/src/VirtualFluids/BoundaryConditions/NonEqDensityBCAlgorithm.h +++ /dev/null @@ -1,27 +0,0 @@ -#ifndef NonEqDensityBCAlgorithm_h__ -#define NonEqDensityBCAlgorithm_h__ - -#include "BCAlgorithm.h" - -class DistributionArray3D; - -class NonEqDensityBCAlgorithm; -typedef std::shared_ptr<NonEqDensityBCAlgorithm> NonEqDensityBCAlgorithmPtr; - -class NonEqDensityBCAlgorithm : public BCAlgorithm -{ -public: - NonEqDensityBCAlgorithm(); - ~NonEqDensityBCAlgorithm(); - BCAlgorithmPtr clone(); - void addDistributions(std::shared_ptr<DistributionArray3D> distributions); - void applyBC() override; -private: - //friend class boost::serialization::access; - //template<class Archive> - //void serialize(Archive & ar, const unsigned int version) - //{ - // ar & boost::serialization::base_object<BCAlgorithm>(*this); - //} -}; -#endif // NonEqDensityBCAlgorithm_h__ diff --git a/src/VirtualFluids/BoundaryConditions/NonReflectingOutflowBCAlgorithm.cpp b/src/VirtualFluids/BoundaryConditions/NonReflectingOutflowBCAlgorithm.cpp deleted file mode 100644 index 1d682393d..000000000 --- a/src/VirtualFluids/BoundaryConditions/NonReflectingOutflowBCAlgorithm.cpp +++ /dev/null @@ -1,188 +0,0 @@ -#include "NonReflectingOutflowBCAlgorithm.h" - -#include "D3Q27System.h" -#include "DistributionArray3D.h" -#include "BoundaryConditions.h" - - -NonReflectingOutflowBCAlgorithm::NonReflectingOutflowBCAlgorithm() -{ - BCAlgorithm::type = BCAlgorithm::NonReflectingOutflowBCAlgorithm; - BCAlgorithm::preCollision = true; - step=0; -} -////////////////////////////////////////////////////////////////////////// -NonReflectingOutflowBCAlgorithm::~NonReflectingOutflowBCAlgorithm() -{ -} -////////////////////////////////////////////////////////////////////////// -BCAlgorithmPtr NonReflectingOutflowBCAlgorithm::clone() -{ - BCAlgorithmPtr bc(new NonReflectingOutflowBCAlgorithm()); - return bc; -} -////////////////////////////////////////////////////////////////////////// -void NonReflectingOutflowBCAlgorithm::addDistributions(DistributionArray3DPtr distributions) -{ - this->distributions = distributions; -} -////////////////////////////////////////////////////////////////////////// -void NonReflectingOutflowBCAlgorithm::applyBC() -{ - using namespace D3Q27System; - LBMReal f[ENDF+1]; - LBMReal ftemp[ENDF+1]; - - int nx1 = x1; - int nx2 = x2; - int nx3 = x3; - int direction = -1; - - //flag points in direction of fluid - if (bcPtr->hasDensityBoundaryFlag(E)) { nx1 += 1; direction = E; } - else if (bcPtr->hasDensityBoundaryFlag(W)) { nx1 -= 1; direction = W; } - else if (bcPtr->hasDensityBoundaryFlag(N)) { nx2 += 1; direction = N; } - else if (bcPtr->hasDensityBoundaryFlag(S)) { nx2 -= 1; direction = S; } - else if (bcPtr->hasDensityBoundaryFlag(T)) { nx3 += 1; direction = T; } - else if (bcPtr->hasDensityBoundaryFlag(B)) { nx3 -= 1; direction = B; } - else UB_THROW(UbException(UB_EXARGS, "Danger...no orthogonal BC-Flag on density boundary...")); - - distributions->getDistribution(f, x1, x2, x3); - distributions->getDistribution(ftemp, nx1, nx2, nx3); - - LBMReal rho, vx1, vx2, vx3; - calcMacrosFct(f, rho, vx1, vx2, vx3); - - switch (direction) - { - case E: - f[E] = ftemp[E] * (one_over_sqrt3 + vx1) + (1.0 - one_over_sqrt3 - vx1)*f[E] ; - f[NE] = ftemp[NE] * (one_over_sqrt3 + vx1) + (1.0 - one_over_sqrt3 - vx1)*f[NE] ; - f[SE] = ftemp[SE] * (one_over_sqrt3 + vx1) + (1.0 - one_over_sqrt3 - vx1)*f[SE] ; - f[TE] = ftemp[TE] * (one_over_sqrt3 + vx1) + (1.0 - one_over_sqrt3 - vx1)*f[TE] ; - f[BE] = ftemp[BE] * (one_over_sqrt3 + vx1) + (1.0 - one_over_sqrt3 - vx1)*f[BE] ; - f[TNE] = ftemp[TNE] * (one_over_sqrt3 + vx1) + (1.0 - one_over_sqrt3 - vx1)*f[TNE] ; - f[TSE] = ftemp[TSE] * (one_over_sqrt3 + vx1) + (1.0 - one_over_sqrt3 - vx1)*f[TSE] ; - f[BNE] = ftemp[BNE] * (one_over_sqrt3 + vx1) + (1.0 - one_over_sqrt3 - vx1)*f[BNE] ; - f[BSE] = ftemp[BSE] * (one_over_sqrt3 + vx1) + (1.0 - one_over_sqrt3 - vx1)*f[BSE] ; - - distributions->setDistributionInvForDirection(f[E], x1+DX1[W], x2+DX2[W], x3+DX3[W], W); - distributions->setDistributionInvForDirection(f[NE], x1+DX1[SW], x2+DX2[SW], x3+DX3[SW], SW); - distributions->setDistributionInvForDirection(f[SE], x1+DX1[NW], x2+DX2[NW], x3+DX3[NW], NW); - distributions->setDistributionInvForDirection(f[TE], x1+DX1[BW], x2+DX2[BW], x3+DX3[BW], BW); - distributions->setDistributionInvForDirection(f[BE], x1+DX1[TW], x2+DX2[TW], x3+DX3[TW], TW); - distributions->setDistributionInvForDirection(f[TNE], x1+DX1[BSW], x2+DX2[BSW], x3+DX3[BSW], BSW); - distributions->setDistributionInvForDirection(f[TSE], x1+DX1[BNW], x2+DX2[BNW], x3+DX3[BNW], BNW); - distributions->setDistributionInvForDirection(f[BNE], x1+DX1[TSW], x2+DX2[TSW], x3+DX3[TSW], TSW); - distributions->setDistributionInvForDirection(f[BSE], x1+DX1[TNW], x2+DX2[TNW], x3+DX3[TNW], TNW); - break; - case W: - f[W] = ftemp[W] * (one_over_sqrt3 - vx1) + (1.0 - one_over_sqrt3 + vx1)*f[W] ; - f[NW] = ftemp[NW] * (one_over_sqrt3 - vx1) + (1.0 - one_over_sqrt3 + vx1)*f[NW] ; - f[SW] = ftemp[SW] * (one_over_sqrt3 - vx1) + (1.0 - one_over_sqrt3 + vx1)*f[SW] ; - f[TW] = ftemp[TW] * (one_over_sqrt3 - vx1) + (1.0 - one_over_sqrt3 + vx1)*f[TW] ; - f[BW] = ftemp[BW] * (one_over_sqrt3 - vx1) + (1.0 - one_over_sqrt3 + vx1)*f[BW] ; - f[TNW] = ftemp[TNW] * (one_over_sqrt3 - vx1) + (1.0 - one_over_sqrt3 + vx1)*f[TNW]; - f[TSW] = ftemp[TSW] * (one_over_sqrt3 - vx1) + (1.0 - one_over_sqrt3 + vx1)*f[TSW]; - f[BNW] = ftemp[BNW] * (one_over_sqrt3 - vx1) + (1.0 - one_over_sqrt3 + vx1)*f[BNW]; - f[BSW] = ftemp[BSW] * (one_over_sqrt3 - vx1) + (1.0 - one_over_sqrt3 + vx1)*f[BSW]; - - distributions->setDistributionInvForDirection(f[W], x1+DX1[E], x2+DX2[E], x3+DX3[E], E); - distributions->setDistributionInvForDirection(f[NW], x1+DX1[SE], x2+DX2[SE], x3+DX3[SE], SE); - distributions->setDistributionInvForDirection(f[SW], x1+DX1[NE], x2+DX2[NE], x3+DX3[NE], NE); - distributions->setDistributionInvForDirection(f[TW], x1+DX1[BE], x2+DX2[BE], x3+DX3[BE], BE); - distributions->setDistributionInvForDirection(f[BW], x1+DX1[TE], x2+DX2[TE], x3+DX3[TE], TE); - distributions->setDistributionInvForDirection(f[TNW], x1+DX1[BSE], x2+DX2[BSE], x3+DX3[BSE], BSE); - distributions->setDistributionInvForDirection(f[TSW], x1+DX1[BNE], x2+DX2[BNE], x3+DX3[BNE], BNE); - distributions->setDistributionInvForDirection(f[BNW], x1+DX1[TSE], x2+DX2[TSE], x3+DX3[TSE], TSE); - distributions->setDistributionInvForDirection(f[BSW], x1+DX1[TNE], x2+DX2[TNE], x3+DX3[TNE], TNE); - break; - case N: - f[N] = ftemp[N] * (one_over_sqrt3 + vx2) + (1.0 - one_over_sqrt3 - vx2)*f[N] ; - f[NE] = ftemp[NE] * (one_over_sqrt3 + vx2) + (1.0 - one_over_sqrt3 - vx2)*f[NE] ; - f[NW] = ftemp[NW] * (one_over_sqrt3 + vx2) + (1.0 - one_over_sqrt3 - vx2)*f[NW] ; - f[TN] = ftemp[TN] * (one_over_sqrt3 + vx2) + (1.0 - one_over_sqrt3 - vx2)*f[TN] ; - f[BN] = ftemp[BN] * (one_over_sqrt3 + vx2) + (1.0 - one_over_sqrt3 - vx2)*f[BN] ; - f[TNE] = ftemp[TNE] * (one_over_sqrt3 + vx2) + (1.0 - one_over_sqrt3 - vx2)*f[TNE] ; - f[TNW] = ftemp[TNW] * (one_over_sqrt3 + vx2) + (1.0 - one_over_sqrt3 - vx2)*f[TNW] ; - f[BNE] = ftemp[BNE] * (one_over_sqrt3 + vx2) + (1.0 - one_over_sqrt3 - vx2)*f[BNE] ; - f[BNW] = ftemp[BNW] * (one_over_sqrt3 + vx2) + (1.0 - one_over_sqrt3 - vx2)*f[BNW] ; - - distributions->setDistributionInvForDirection(f[N], x1+DX1[S], x2+DX2[S], x3+DX3[S], S); - distributions->setDistributionInvForDirection(f[NE], x1+DX1[SW], x2+DX2[SW], x3+DX3[SW], SW); - distributions->setDistributionInvForDirection(f[NW], x1+DX1[SE], x2+DX2[SE], x3+DX3[SE], SE); - distributions->setDistributionInvForDirection(f[TN], x1+DX1[BS], x2+DX2[BS], x3+DX3[BS], BS); - distributions->setDistributionInvForDirection(f[BN], x1+DX1[TS], x2+DX2[TS], x3+DX3[TS], TS); - distributions->setDistributionInvForDirection(f[TNE], x1+DX1[BSW], x2+DX2[BSW], x3+DX3[BSW], BSW); - distributions->setDistributionInvForDirection(f[TNW], x1+DX1[BSE], x2+DX2[BSE], x3+DX3[BSE], BSE); - distributions->setDistributionInvForDirection(f[BNE], x1+DX1[TSW], x2+DX2[TSW], x3+DX3[TSW], TSW); - distributions->setDistributionInvForDirection(f[BNW], x1+DX1[TSE], x2+DX2[TSE], x3+DX3[TSE], TSE); - break; - case S: - f[S] = ftemp[S] * (one_over_sqrt3 - vx2) + (1.0 - one_over_sqrt3 + vx2)*f[S] ; - f[SE] = ftemp[SE] * (one_over_sqrt3 - vx2) + (1.0 - one_over_sqrt3 + vx2)*f[SE] ; - f[SW] = ftemp[SW] * (one_over_sqrt3 - vx2) + (1.0 - one_over_sqrt3 + vx2)*f[SW] ; - f[TS] = ftemp[TS] * (one_over_sqrt3 - vx2) + (1.0 - one_over_sqrt3 + vx2)*f[TS] ; - f[BS] = ftemp[BS] * (one_over_sqrt3 - vx2) + (1.0 - one_over_sqrt3 + vx2)*f[BS] ; - f[TSE] = ftemp[TSE] * (one_over_sqrt3 - vx2) + (1.0 - one_over_sqrt3 + vx2)*f[TSE] ; - f[TSW] = ftemp[TSW] * (one_over_sqrt3 - vx2) + (1.0 - one_over_sqrt3 + vx2)*f[TSW] ; - f[BSE] = ftemp[BSE] * (one_over_sqrt3 - vx2) + (1.0 - one_over_sqrt3 + vx2)*f[BSE] ; - f[BSW] = ftemp[BSW] * (one_over_sqrt3 - vx2) + (1.0 - one_over_sqrt3 + vx2)*f[BSW] ; - - distributions->setDistributionInvForDirection(f[S], x1+DX1[N], x2+DX2[N], x3+DX3[N], N); - distributions->setDistributionInvForDirection(f[SE], x1+DX1[NW], x2+DX2[NW], x3+DX3[NW], NW); - distributions->setDistributionInvForDirection(f[SW], x1+DX1[NE], x2+DX2[NE], x3+DX3[NE], NE); - distributions->setDistributionInvForDirection(f[TS], x1+DX1[BN], x2+DX2[BN], x3+DX3[BN], BN); - distributions->setDistributionInvForDirection(f[BS], x1+DX1[TN], x2+DX2[TN], x3+DX3[TN], TN); - distributions->setDistributionInvForDirection(f[TSE], x1+DX1[BNW], x2+DX2[BNW], x3+DX3[BNW], BNW); - distributions->setDistributionInvForDirection(f[TSW], x1+DX1[BNE], x2+DX2[BNE], x3+DX3[BNE], BNE); - distributions->setDistributionInvForDirection(f[BSE], x1+DX1[TNW], x2+DX2[TNW], x3+DX3[TNW], TNW); - distributions->setDistributionInvForDirection(f[BSW], x1+DX1[TNE], x2+DX2[TNE], x3+DX3[TNE], TNE); - break; - case T: - f[T] = ftemp[T] * (one_over_sqrt3 + vx3) + (1.0 - one_over_sqrt3 - vx3)*f[T] ; - f[TE] = ftemp[TE] * (one_over_sqrt3 + vx3) + (1.0 - one_over_sqrt3 - vx3)*f[TE] ; - f[TW] = ftemp[TW] * (one_over_sqrt3 + vx3) + (1.0 - one_over_sqrt3 - vx3)*f[TW] ; - f[TN] = ftemp[TN] * (one_over_sqrt3 + vx3) + (1.0 - one_over_sqrt3 - vx3)*f[TN] ; - f[TS] = ftemp[TS] * (one_over_sqrt3 + vx3) + (1.0 - one_over_sqrt3 - vx3)*f[TS] ; - f[TNE] = ftemp[TNE] * (one_over_sqrt3 + vx3) + (1.0 - one_over_sqrt3 - vx3)*f[TNE] ; - f[TNW] = ftemp[TNW] * (one_over_sqrt3 + vx3) + (1.0 - one_over_sqrt3 - vx3)*f[TNW] ; - f[TSE] = ftemp[TSE] * (one_over_sqrt3 + vx3) + (1.0 - one_over_sqrt3 - vx3)*f[TSE] ; - f[TSW] = ftemp[TSW] * (one_over_sqrt3 + vx3) + (1.0 - one_over_sqrt3 - vx3)*f[TSW] ; - - distributions->setDistributionInvForDirection(f[T], x1+DX1[B], x2+DX2[B], x3+DX3[B], B); - distributions->setDistributionInvForDirection(f[TE], x1+DX1[BW], x2+DX2[BW], x3+DX3[BW], BW); - distributions->setDistributionInvForDirection(f[TW], x1+DX1[BE], x2+DX2[BE], x3+DX3[BE], BE); - distributions->setDistributionInvForDirection(f[TN], x1+DX1[BS], x2+DX2[BS], x3+DX3[BS], BS); - distributions->setDistributionInvForDirection(f[TS], x1+DX1[BN], x2+DX2[BN], x3+DX3[BN], BN); - distributions->setDistributionInvForDirection(f[TNE], x1+DX1[BSW], x2+DX2[BSW], x3+DX3[BSW], BSW); - distributions->setDistributionInvForDirection(f[TNW], x1+DX1[BSE], x2+DX2[BSE], x3+DX3[BSE], BSE); - distributions->setDistributionInvForDirection(f[TSE], x1+DX1[BNW], x2+DX2[BNW], x3+DX3[BNW], BNW); - distributions->setDistributionInvForDirection(f[TSW], x1+DX1[BNE], x2+DX2[BNE], x3+DX3[BNE], BNE); - break; - case B: - f[B] = ftemp[B] * (one_over_sqrt3 - vx3) + (1.0 - one_over_sqrt3 + vx3)*f[B] ; - f[BE] = ftemp[BE] * (one_over_sqrt3 - vx3) + (1.0 - one_over_sqrt3 + vx3)*f[BE] ; - f[BW] = ftemp[BW] * (one_over_sqrt3 - vx3) + (1.0 - one_over_sqrt3 + vx3)*f[BW] ; - f[BN] = ftemp[BN] * (one_over_sqrt3 - vx3) + (1.0 - one_over_sqrt3 + vx3)*f[BN] ; - f[BS] = ftemp[BS] * (one_over_sqrt3 - vx3) + (1.0 - one_over_sqrt3 + vx3)*f[BS] ; - f[BNE] = ftemp[BNE] * (one_over_sqrt3 - vx3) + (1.0 - one_over_sqrt3 + vx3)*f[BNE] ; - f[BNW] = ftemp[BNW] * (one_over_sqrt3 - vx3) + (1.0 - one_over_sqrt3 + vx3)*f[BNW] ; - f[BSE] = ftemp[BSE] * (one_over_sqrt3 - vx3) + (1.0 - one_over_sqrt3 + vx3)*f[BSE] ; - f[BSW] = ftemp[BSW] * (one_over_sqrt3 - vx3) + (1.0 - one_over_sqrt3 + vx3)*f[BSW] ; - - distributions->setDistributionInvForDirection(f[B], x1+DX1[T], x2+DX2[T], x3+DX3[T], T); - distributions->setDistributionInvForDirection(f[BE], x1+DX1[TW], x2+DX2[TW], x3+DX3[TW], TW); - distributions->setDistributionInvForDirection(f[BW], x1+DX1[TE], x2+DX2[TE], x3+DX3[TE], TE); - distributions->setDistributionInvForDirection(f[BN], x1+DX1[TS], x2+DX2[TS], x3+DX3[TS], TS); - distributions->setDistributionInvForDirection(f[BS], x1+DX1[TN], x2+DX2[TN], x3+DX3[TN], TN); - distributions->setDistributionInvForDirection(f[BNE], x1+DX1[TSW], x2+DX2[TSW], x3+DX3[TSW], TSW); - distributions->setDistributionInvForDirection(f[BNW], x1+DX1[TSE], x2+DX2[TSE], x3+DX3[TSE], TSE); - distributions->setDistributionInvForDirection(f[BSE], x1+DX1[TNW], x2+DX2[TNW], x3+DX3[TNW], TNW); - distributions->setDistributionInvForDirection(f[BSW], x1+DX1[TNE], x2+DX2[TNE], x3+DX3[TNE], TNE); - break; - default: - UB_THROW(UbException(UB_EXARGS, "It isn't implemented non reflecting density boundary for this direction!")); - } -} - diff --git a/src/VirtualFluids/BoundaryConditions/NonReflectingOutflowBCAlgorithm.h b/src/VirtualFluids/BoundaryConditions/NonReflectingOutflowBCAlgorithm.h deleted file mode 100644 index e83592889..000000000 --- a/src/VirtualFluids/BoundaryConditions/NonReflectingOutflowBCAlgorithm.h +++ /dev/null @@ -1,28 +0,0 @@ -#ifndef NonReflectingOutflowBCAlgorithm_h__ -#define NonReflectingOutflowBCAlgorithm_h__ - -#include "BCAlgorithm.h" - -class DistributionArray3D; - -class NonReflectingOutflowBCAlgorithm; -typedef std::shared_ptr<NonReflectingOutflowBCAlgorithm> NonReflectingOutflowBCAlgorithmPtr; - -class NonReflectingOutflowBCAlgorithm : public BCAlgorithm -{ -public: - NonReflectingOutflowBCAlgorithm(); - ~NonReflectingOutflowBCAlgorithm(); - BCAlgorithmPtr clone(); - void addDistributions(std::shared_ptr<DistributionArray3D> distributions); - void applyBC() override; -private: - int step; - //friend class boost::serialization::access; - //template<class Archive> - //void serialize(Archive & ar, const unsigned int version) - //{ - // ar & boost::serialization::base_object<BCAlgorithm>(*this); - //} -}; -#endif // NonReflectingDensityBCAlgorithm_h__ diff --git a/src/VirtualFluids/BoundaryConditions/SlipBCAdapter.cpp b/src/VirtualFluids/BoundaryConditions/SlipBCAdapter.cpp deleted file mode 100644 index 40832d900..000000000 --- a/src/VirtualFluids/BoundaryConditions/SlipBCAdapter.cpp +++ /dev/null @@ -1,35 +0,0 @@ -#include "SlipBCAdapter.h" -#include "D3Q27System.h" -#include "D3Q27Interactor.h" -#include "numerics/geometry3d/GbCuboid3D.h" - - -//*==========================================================*/ -//ObObject* D3Q27SlipBCAdapterCreator::createObObject() -//{ -// return new D3Q27SlipBCAdapter; -//} -//*==========================================================*/ -//ObObjectCreator* D3Q27SlipBCAdapter::getCreator() -//{ -// return D3Q27SlipBCAdapterCreator::getInstance(); -//} -//*==========================================================*/ -void SlipBCAdapter::adaptBC(const D3Q27Interactor& interactor, BoundaryConditionsPtr bc, const double& worldX1, const double& worldX2, const double& worldX3, const double& time) -{ - ////////////////////////////////////////////////////////////////////////// - //>>> nur workaround! -> Hendrick nach normalen berechnung aus qs fragen - - GbCuboid3DPtr geo = std::dynamic_pointer_cast<GbCuboid3D>(interactor.getGbObject3D()); - if(!geo) throw UbException(UB_EXARGS,"derzeit nur fuer Cubes valide"); - - if ( bc->hasSlipBoundaryFlag(D3Q27System::E) ) bc->setNormalVector( 1.0, 0.0, 0.0); - else if( bc->hasSlipBoundaryFlag(D3Q27System::W) ) bc->setNormalVector(-1.0, 0.0, 0.0); - else if( bc->hasSlipBoundaryFlag(D3Q27System::N) ) bc->setNormalVector( 0.0, 1.0, 0.0); - else if( bc->hasSlipBoundaryFlag(D3Q27System::S) ) bc->setNormalVector( 0.0,-1.0, 0.0); - else if( bc->hasSlipBoundaryFlag(D3Q27System::T) ) bc->setNormalVector( 0.0, 0.0, 1.0); - else if( bc->hasSlipBoundaryFlag(D3Q27System::B) ) bc->setNormalVector( 0.0, 0.0,-1.0); - - bc->setBcAlgorithmType(algorithmType); -} - diff --git a/src/VirtualFluids/BoundaryConditions/SlipBCAdapter.h b/src/VirtualFluids/BoundaryConditions/SlipBCAdapter.h deleted file mode 100644 index 6d7fdcea9..000000000 --- a/src/VirtualFluids/BoundaryConditions/SlipBCAdapter.h +++ /dev/null @@ -1,94 +0,0 @@ -// _ ___ __ __________ _ __ -// | | / (_)____/ /___ ______ _/ / ____/ /_ __(_)___/ /____ -// | | / / / ___/ __/ / / / __ `/ / /_ / / / / / / __ / ___/ -// | |/ / / / / /_/ /_/ / /_/ / / __/ / / /_/ / / /_/ (__ ) -// |___/_/_/ \__/\__,_/\__,_/_/_/ /_/\__,_/_/\__,_/____/ -// -#ifndef SlipBCAdapter_H -#define SlipBCAdapter_H - -#ifdef CAB_RCF - #include <3rdParty/rcf/RcfSerializationIncludes.h> -#endif - -#include "BCAdapter.h" - - -/*=======================================================*/ -//D3Q27SlipBCAdapterCreator -//class D3Q27SlipBCAdapterCreator : public ObObjectCreator -//{ -//public: -// static D3Q27SlipBCAdapterCreator* getInstance() -// { -// static D3Q27SlipBCAdapterCreator instance; -// return &instance; -// } -// -// ObObject* createObObject(); -// -// std::string getTypeID() { return "D3Q27SlipBCAdapter";} -// std::string toString() { return "D3Q27SlipBCAdapterCreator"; } -// -//private: -// D3Q27SlipBCAdapterCreator( const D3Q27SlipBCAdapterCreator& ); //no copy allowed -// const D3Q27SlipBCAdapterCreator& operator=( const D3Q27SlipBCAdapterCreator& ); //no copy allowed -// D3Q27SlipBCAdapterCreator() : ObObjectCreator() {} -//}; -// -//#ifndef SWIG -//UB_AUTO_RUN_NAMED( D3Q27BCAdapterFactory::getInstance()->addObObjectCreator(D3Q27SlipBCAdapterCreator::getInstance()), CAB_D3Q27SlipBCAdapterCreator); -//#endif - -/*=========================================================================*/ -/* D3Q27SlipBCAdapter */ -/* */ -/** -<BR><BR> -@author <A HREF="mailto:muffmolch@gmx.de">S. Freudiger</A> -@version 1.0 - 06.09.06 -*/ - -/* -usage: ... -*/ - -class SlipBCAdapter : public BCAdapter -{ -public: - SlipBCAdapter() - : BCAdapter() - { - } - SlipBCAdapter(const short& secondaryBcOption) - : BCAdapter(secondaryBcOption) - { - } - - //------------- implements D3Q27BoundaryConditionAdapter ----- start - ObObjectCreator* getCreator(); - - void init(const D3Q27Interactor* const& interactor, const double& timestep=0) {} - void update(const D3Q27Interactor* const& interactor, const double& timestep=0) {} - - void adaptBCForDirection( const D3Q27Interactor& interactor, BoundaryConditionsPtr bc, const double& worldX1, const double& worldX2, const double& worldX3, const double& q, const int& fdirection, const double& time=0 ) - { - bc->setSlipBoundaryFlag(D3Q27System::INVDIR[fdirection],secondaryBcOption); - bc->setQ((float)q,fdirection); - } - void adaptBC(const D3Q27Interactor& interactor, BoundaryConditionsPtr bc, const double& worldX1, const double& worldX2, const double& worldX3, const double& time=0); - - //------------- implements D3Q27BoundaryConditionAdapter ----- end - -private: - friend class boost::serialization::access; - template<class Archive> - void serialize(Archive & ar, const unsigned int version) - { - ar & boost::serialization::base_object<BCAdapter>(*this); -} - -}; - -#endif - diff --git a/src/VirtualFluids/BoundaryConditions/SlipBCAlgorithm.cpp b/src/VirtualFluids/BoundaryConditions/SlipBCAlgorithm.cpp deleted file mode 100644 index 84eca6852..000000000 --- a/src/VirtualFluids/BoundaryConditions/SlipBCAlgorithm.cpp +++ /dev/null @@ -1,88 +0,0 @@ -#include "SlipBCAlgorithm.h" -#include "DistributionArray3D.h" -#include "BoundaryConditions.h" - -SlipBCAlgorithm::SlipBCAlgorithm() -{ - BCAlgorithm::type = BCAlgorithm::SlipBCAlgorithm; - BCAlgorithm::preCollision = false; -} -////////////////////////////////////////////////////////////////////////// -SlipBCAlgorithm::~SlipBCAlgorithm() -{ - -} -////////////////////////////////////////////////////////////////////////// -BCAlgorithmPtr SlipBCAlgorithm::clone() -{ - BCAlgorithmPtr bc(new SlipBCAlgorithm()); - return bc; -} -////////////////////////////////////////////////////////////////////////// -void SlipBCAlgorithm::addDistributions(DistributionArray3DPtr distributions) -{ - this->distributions = distributions; -} -////////////////////////////////////////////////////////////////////////// -void SlipBCAlgorithm::applyBC() -{ - LBMReal f[D3Q27System::ENDF+1]; - LBMReal feq[D3Q27System::ENDF+1]; - distributions->getDistributionInv(f, x1, x2, x3); - LBMReal rho, vx1, vx2, vx3, drho; - calcMacrosFct(f, drho, vx1, vx2, vx3); - calcFeqFct(feq, drho, vx1, vx2, vx3); - - UbTupleFloat3 normale = bcPtr->getNormalVector(); - LBMReal amp = vx1*val<1>(normale)+vx2*val<2>(normale)+vx3*val<3>(normale); - - vx1 = vx1 - amp * val<1>(normale); //normale zeigt von struktur weg! - vx2 = vx2 - amp * val<2>(normale); //normale zeigt von struktur weg! - vx3 = vx3 - amp * val<3>(normale); //normale zeigt von struktur weg! - - rho = 1.0+drho*compressibleFactor; - - for (int fdir = D3Q27System::FSTARTDIR; fdir<=D3Q27System::FENDDIR; fdir++) - { - if (bcPtr->hasSlipBoundaryFlag(fdir)) - { - //quadratic bounce back - const int invDir = D3Q27System::INVDIR[fdir]; - LBMReal q = bcPtr->getQ(invDir);// m+m q=0 stabiler - //vx3=0; - LBMReal velocity = 0.0; - switch (invDir) - { - case D3Q27System::E: velocity = (UbMath::c4o9*(+vx1)); break; //(2/cs^2)(=6)*rho_0(=1 bei imkompr)*wi*u*ei mit cs=1/sqrt(3) - case D3Q27System::W: velocity = (UbMath::c4o9*(-vx1)); break; //z.B. aus paper manfred MRT LB models in three dimensions (2002) - case D3Q27System::N: velocity = (UbMath::c4o9*(+vx2)); break; - case D3Q27System::S: velocity = (UbMath::c4o9*(-vx2)); break; - case D3Q27System::T: velocity = (UbMath::c4o9*(+vx3)); break; - case D3Q27System::B: velocity = (UbMath::c4o9*(-vx3)); break; - case D3Q27System::NE: velocity = (UbMath::c1o9*(+vx1+vx2)); break; - case D3Q27System::SW: velocity = (UbMath::c1o9*(-vx1-vx2)); break; - case D3Q27System::SE: velocity = (UbMath::c1o9*(+vx1-vx2)); break; - case D3Q27System::NW: velocity = (UbMath::c1o9*(-vx1+vx2)); break; - case D3Q27System::TE: velocity = (UbMath::c1o9*(+vx1 +vx3)); break; - case D3Q27System::BW: velocity = (UbMath::c1o9*(-vx1 -vx3)); break; - case D3Q27System::BE: velocity = (UbMath::c1o9*(+vx1 -vx3)); break; - case D3Q27System::TW: velocity = (UbMath::c1o9*(-vx1 +vx3)); break; - case D3Q27System::TN: velocity = (UbMath::c1o9*(+vx2+vx3)); break; - case D3Q27System::BS: velocity = (UbMath::c1o9*(-vx2-vx3)); break; - case D3Q27System::BN: velocity = (UbMath::c1o9*(+vx2-vx3)); break; - case D3Q27System::TS: velocity = (UbMath::c1o9*(-vx2+vx3)); break; - case D3Q27System::TNE: velocity = (UbMath::c1o36*(+vx1+vx2+vx3)); break; - case D3Q27System::BSW: velocity = (UbMath::c1o36*(-vx1-vx2-vx3)); break; - case D3Q27System::BNE: velocity = (UbMath::c1o36*(+vx1+vx2-vx3)); break; - case D3Q27System::TSW: velocity = (UbMath::c1o36*(-vx1-vx2+vx3)); break; - case D3Q27System::TSE: velocity = (UbMath::c1o36*(+vx1-vx2+vx3)); break; - case D3Q27System::BNW: velocity = (UbMath::c1o36*(-vx1+vx2-vx3)); break; - case D3Q27System::BSE: velocity = (UbMath::c1o36*(+vx1-vx2-vx3)); break; - case D3Q27System::TNW: velocity = (UbMath::c1o36*(-vx1+vx2+vx3)); break; - default: throw UbException(UB_EXARGS, "unknown error"); - } - LBMReal fReturn = ((1.0-q)/(1.0+q))*((f[invDir]-feq[invDir])/(1.0-collFactor)+feq[invDir])+((q*(f[invDir]+f[fdir])-velocity*rho)/(1.0+q)); - distributions->setDistributionForDirection(fReturn, x1+D3Q27System::DX1[invDir], x2+D3Q27System::DX2[invDir], x3+D3Q27System::DX3[invDir], fdir); - } - } -} \ No newline at end of file diff --git a/src/VirtualFluids/BoundaryConditions/SlipBCAlgorithm.h b/src/VirtualFluids/BoundaryConditions/SlipBCAlgorithm.h deleted file mode 100644 index 7cd34f278..000000000 --- a/src/VirtualFluids/BoundaryConditions/SlipBCAlgorithm.h +++ /dev/null @@ -1,27 +0,0 @@ -#ifndef SlipBCAlgorithm_h__ -#define SlipBCAlgorithm_h__ - -#include "BCAlgorithm.h" - -class DistributionArray3D; - -class SlipBCAlgorithm; -typedef std::shared_ptr<SlipBCAlgorithm> SlipBCAlgorithmPtr; - -class SlipBCAlgorithm : public BCAlgorithm -{ -public: - SlipBCAlgorithm(); - virtual ~SlipBCAlgorithm(); - BCAlgorithmPtr clone(); - void addDistributions(std::shared_ptr<DistributionArray3D> distributions); - void applyBC() override; -private: - //friend class boost::serialization::access; - //template<class Archive> - //void serialize(Archive & ar, const unsigned int version) - //{ - // ar & boost::serialization::base_object<BCAlgorithm>(*this); - //} -}; -#endif // SlipBCAlgorithm_h__ diff --git a/src/VirtualFluids/BoundaryConditions/ThinWallBCProcessor.cpp b/src/VirtualFluids/BoundaryConditions/ThinWallBCProcessor.cpp deleted file mode 100644 index d851f2aff..000000000 --- a/src/VirtualFluids/BoundaryConditions/ThinWallBCProcessor.cpp +++ /dev/null @@ -1,43 +0,0 @@ -#include "ThinWallBCProcessor.h" - -#include "ThinWallNoSlipBCAlgorithm.h" - -#include "LBMKernel.h" - -ThinWallBCProcessor::ThinWallBCProcessor() -{ - -} -////////////////////////////////////////////////////////////////////////// -ThinWallBCProcessor::ThinWallBCProcessor(LBMKernelPtr kernel) : BCProcessor(kernel) -{ - -} -////////////////////////////////////////////////////////////////////////// -ThinWallBCProcessor::~ThinWallBCProcessor() -{ - -} -////////////////////////////////////////////////////////////////////////// -BCProcessorPtr ThinWallBCProcessor::clone(LBMKernelPtr kernel) -{ - BCProcessorPtr bcProcessor(new ThinWallBCProcessor(kernel)); - return bcProcessor; -} -////////////////////////////////////////////////////////////////////////// -void ThinWallBCProcessor::applyPostCollisionBC() -{ - BCProcessor::applyPostCollisionBC(); - - for(BCAlgorithmPtr bc : postBC) - { - if (bc->getType() == BCAlgorithm::ThinWallNoSlipBCAlgorithm) - { - std::dynamic_pointer_cast<ThinWallNoSlipBCAlgorithm>(bc)->setPass(2); - bc->applyBC(); - std::dynamic_pointer_cast<ThinWallNoSlipBCAlgorithm>(bc)->setPass(1); - } - } -} - - diff --git a/src/VirtualFluids/BoundaryConditions/ThinWallBCProcessor.h b/src/VirtualFluids/BoundaryConditions/ThinWallBCProcessor.h deleted file mode 100644 index 63797099e..000000000 --- a/src/VirtualFluids/BoundaryConditions/ThinWallBCProcessor.h +++ /dev/null @@ -1,33 +0,0 @@ -#ifndef ThinWallBCProcessor_H -#define ThinWallBCProcessor_H - -#include <memory> - -#include "BCProcessor.h" - -#include <boost/serialization/base_object.hpp> - -class ThinWallBCProcessor; -typedef std::shared_ptr<ThinWallBCProcessor> ThinWallBCProcessorPtr; - -class LBMKernel; - -class ThinWallBCProcessor : public BCProcessor -{ -public: - ThinWallBCProcessor(); - ThinWallBCProcessor(std::shared_ptr<LBMKernel> kernel); - ~ThinWallBCProcessor(); - std::shared_ptr<BCProcessor> clone(std::shared_ptr<LBMKernel> kernel); - void applyPostCollisionBC(); -protected: -private: - friend class boost::serialization::access; - template<class Archive> - void serialize(Archive & ar, const unsigned int version) - { - ar & boost::serialization::base_object<BCProcessor>(*this); - } -}; - -#endif diff --git a/src/VirtualFluids/BoundaryConditions/ThinWallNoSlipBCAlgorithm.cpp b/src/VirtualFluids/BoundaryConditions/ThinWallNoSlipBCAlgorithm.cpp deleted file mode 100644 index d29f56e93..000000000 --- a/src/VirtualFluids/BoundaryConditions/ThinWallNoSlipBCAlgorithm.cpp +++ /dev/null @@ -1,66 +0,0 @@ -#include "ThinWallNoSlipBCAlgorithm.h" - -#include "D3Q27EsoTwist3DSplittedVector.h" -#include "BoundaryConditions.h" - -ThinWallNoSlipBCAlgorithm::ThinWallNoSlipBCAlgorithm() -{ - BCAlgorithm::type = BCAlgorithm::ThinWallNoSlipBCAlgorithm; - BCAlgorithm::preCollision = false; - pass = 1; -} -////////////////////////////////////////////////////////////////////////// -ThinWallNoSlipBCAlgorithm::~ThinWallNoSlipBCAlgorithm() -{ - -} -////////////////////////////////////////////////////////////////////////// -BCAlgorithmPtr ThinWallNoSlipBCAlgorithm::clone() -{ - BCAlgorithmPtr bc(new ThinWallNoSlipBCAlgorithm()); - return bc; -} -////////////////////////////////////////////////////////////////////////// -void ThinWallNoSlipBCAlgorithm::applyBC() -{ - LBMReal f[D3Q27System::ENDF + 1]; - LBMReal feq[D3Q27System::ENDF + 1]; - distributions->getDistributionInv(f, x1, x2, x3); - LBMReal rho, vx1, vx2, vx3; - calcMacrosFct(f, rho, vx1, vx2, vx3); - calcFeqFct(feq, rho, vx1, vx2, vx3); - - LBMReal fReturn; - - for (int fdir = D3Q27System::FSTARTDIR; fdir<=D3Q27System::FENDDIR; fdir++) - { - if (bcPtr->hasNoSlipBoundaryFlag(fdir)) - { - const int invDir = D3Q27System::INVDIR[fdir]; - if (pass == 1) - { - LBMReal q = bcPtr->getQ(invDir); - LBMReal fReturn = ((1.0 - q) / (1.0 + q))*0.5*(f[invDir] - f[fdir] + (f[invDir] + f[fdir] - collFactor*(feq[fdir] + feq[invDir])) / (1.0 - collFactor)); - //distributionsTemp->setDistributionForDirection(fReturn, x1 + D3Q27System::DX1[invDir], x2 + D3Q27System::DX2[invDir], x3 + D3Q27System::DX3[invDir], fdir); - fTemp[fdir] = fReturn; - } - else - { - //quadratic bounce back with for thin walls - //fReturn = distributionsTemp->getDistributionInvForDirection(x1 + D3Q27System::DX1[invDir], x2 + D3Q27System::DX2[invDir], x3 + D3Q27System::DX3[invDir], fdir); - fReturn = fTemp[fdir]; - distributions->setDistributionForDirection(fReturn, x1 + D3Q27System::DX1[invDir], x2 + D3Q27System::DX2[invDir], x3 + D3Q27System::DX3[invDir], fdir); - } - } - } -} -////////////////////////////////////////////////////////////////////////// -void ThinWallNoSlipBCAlgorithm::addDistributions(DistributionArray3DPtr distributions) -{ - this->distributions = distributions; -} -////////////////////////////////////////////////////////////////////////// -void ThinWallNoSlipBCAlgorithm::setPass(int pass) -{ - this->pass = pass; -} diff --git a/src/VirtualFluids/BoundaryConditions/ThinWallNoSlipBCAlgorithm.h b/src/VirtualFluids/BoundaryConditions/ThinWallNoSlipBCAlgorithm.h deleted file mode 100644 index 7f00c20e7..000000000 --- a/src/VirtualFluids/BoundaryConditions/ThinWallNoSlipBCAlgorithm.h +++ /dev/null @@ -1,34 +0,0 @@ -#ifndef ThinWallNoSlipBCAlgorithm_h__ -#define ThinWallNoSlipBCAlgorithm_h__ - -#include "BCAlgorithm.h" - -class DistributionArray3D; - -class ThinWallNoSlipBCAlgorithm; -typedef std::shared_ptr<ThinWallNoSlipBCAlgorithm> ThinWallNoSlipBCAlgorithmPtr; - -class ThinWallNoSlipBCAlgorithm : public BCAlgorithm -{ -public: - ThinWallNoSlipBCAlgorithm(); - virtual ~ThinWallNoSlipBCAlgorithm(); - BCAlgorithmPtr clone(); - void addDistributions(std::shared_ptr<DistributionArray3D> distributions); - void setPass(int pass); - void applyBC() override; - -protected: - std::shared_ptr<DistributionArray3D> distributionsTemp; -private: - int pass; - LBMReal fTemp[D3Q27System::ENDF + 1]; - - //friend class boost::serialization::access; - //template<class Archive> - //void serialize(Archive & ar, const unsigned int version) - //{ - // ar & boost::serialization::base_object<BCAlgorithm>(*this); - //} -}; -#endif // ThinWallNoSlipBCAlgorithm_h__ diff --git a/src/VirtualFluids/BoundaryConditions/VelocityBCAdapter.cpp b/src/VirtualFluids/BoundaryConditions/VelocityBCAdapter.cpp deleted file mode 100644 index 47ace324d..000000000 --- a/src/VirtualFluids/BoundaryConditions/VelocityBCAdapter.cpp +++ /dev/null @@ -1,306 +0,0 @@ -#include "VelocityBCAdapter.h" -#include "basics/utilities/UbLogger.h" -#include "basics/utilities/UbMath.h" -#include "basics/utilities/UbTuple.h" - -using namespace std; - - -VelocityBCAdapter::VelocityBCAdapter(const bool& vx1, const bool& vx2, const bool& vx3, const BCFunction& velVxBC) -{ - if(vx1) this->vx1BCs.push_back(velVxBC); - if(vx2) this->vx2BCs.push_back(velVxBC); - if(vx3) this->vx3BCs.push_back(velVxBC); - this->init(); -} -/*==========================================================*/ -VelocityBCAdapter::VelocityBCAdapter(const bool& vx1, const bool& vx2, const bool& vx3, const mu::Parser& function, 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)); - if(vx3) this->vx3BCs.push_back(BCFunction(function,startTime,endTime)); - this->init(); -} -/*==========================================================*/ -VelocityBCAdapter::VelocityBCAdapter(const bool& vx1, const bool& vx2, const bool& vx3, const mu::Parser& function1, const mu::Parser& function2, const mu::Parser& function3, 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)); - if(vx3) this->vx3BCs.push_back(BCFunction(function3,startTime,endTime)); - this->init(); -} -/*==========================================================*/ -VelocityBCAdapter::VelocityBCAdapter(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)); - if(vx3) this->vx3BCs.push_back(BCFunction(functionstring,startTime,endTime)); - this->init(); -} -/*==========================================================*/ -VelocityBCAdapter::VelocityBCAdapter(const BCFunction& velBC, bool x1Dir, bool x2Dir, bool x3Dir) -{ - if(x1Dir) this->vx1BCs.push_back(velBC); - if(x2Dir) this->vx2BCs.push_back(velBC); - if(x3Dir) this->vx3BCs.push_back(velBC); - this->init(); -} -/*==========================================================*/ -VelocityBCAdapter::VelocityBCAdapter(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); - if( velVx3BC.getEndTime()!=-Ub::inf ) this->vx3BCs.push_back(velVx3BC); - this->init(); -} -/*==========================================================*/ -VelocityBCAdapter::VelocityBCAdapter(const vector< BCFunction >& velVx1BCs, const vector< BCFunction >& velVx2BCs, const vector< BCFunction >& velVx3BCs) -{ - this->vx1BCs = velVx1BCs; - this->vx2BCs = velVx2BCs; - this->vx3BCs = velVx3BCs; - this->init(); -} -/*==========================================================*/ -VelocityBCAdapter::VelocityBCAdapter(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 ) -{ - this->vx1BCs.push_back(BCFunction(vx1,vx1StartTime,vx1EndTime)); - this->vx2BCs.push_back(BCFunction(vx2,vx2StartTime,vx2EndTime)); - this->vx3BCs.push_back(BCFunction(vx3,vx3StartTime,vx3EndTime)); - this->init(); -} -/*==========================================================*/ -VelocityBCAdapter::VelocityBCAdapter(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 ) -{ - if(vx1Function.size()) this->vx1BCs.push_back(BCFunction(vx1Function,vx1StartTime,vx1EndTime)); - if(vx2Function.size()) this->vx2BCs.push_back(BCFunction(vx2Function,vx2StartTime,vx2EndTime)); - if(vx3Function.size()) this->vx3BCs.push_back(BCFunction(vx3Function,vx3StartTime,vx3EndTime)); - this->init(); -} -/*==========================================================*/ -void VelocityBCAdapter::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 ) -{ - this->clear(); - this->vx1BCs.push_back(BCFunction(vx1,vx1StartTime,vx1EndTime)); - this->vx2BCs.push_back(BCFunction(vx2,vx2StartTime,vx2EndTime)); - this->vx3BCs.push_back(BCFunction(vx3,vx3StartTime,vx3EndTime)); - this->init(); -} -/*==========================================================*/ -void VelocityBCAdapter::init() -{ - this->unsetTimeDependent(); - - this->timeStep = 0.0; - - this->x1 = 0.0; - this->x2 = 0.0; - this->x3 = 0.0; - - this->tmpVx1Function = NULL; - this->tmpVx2Function = NULL; - this->tmpVx3Function = NULL; - - try //initilialization and validation of functions - { - this->init(vx1BCs); - this->init(vx2BCs); - this->init(vx3BCs); - } - catch(mu::Parser::exception_type& e){ stringstream error; error<<"mu::parser exception occurs, message("<<e.GetMsg()<<"), formula("<<e.GetExpr()+"), token("+e.GetToken()<<")" - <<", pos("<<e.GetPos()<<"), error code("<<e.GetCode(); throw UbException(error.str()); } - catch(...) { throw UbException(UB_EXARGS,"unknown exception" ); } -} -/*==========================================================*/ -void VelocityBCAdapter::init(std::vector<BCFunction>& vxBCs) -{ - for(size_t pos=0; pos<vxBCs.size(); ++pos) - { - if( !( UbMath::equal( BCFunction::INFCONST, vxBCs[pos].getEndTime() ) - && UbMath::greaterEqual( this->timeStep, vxBCs[pos].getStartTime() ) ) ) - { - this->setTimeDependent(); - } - - vxBCs[pos].getFunction().DefineVar("t" , &this->timeStep); - vxBCs[pos].getFunction().DefineVar("x1", &this->x1 ); - vxBCs[pos].getFunction().DefineVar("x2", &this->x2 ); - vxBCs[pos].getFunction().DefineVar("x3", &this->x3 ); - - vxBCs[pos].getFunction().Eval(); //<-- validation - } -} -/*==========================================================*/ -void VelocityBCAdapter::init(const D3Q27Interactor* const& interactor, const double& time) -{ - this->timeStep = time; - this->tmpVx1Function = this->tmpVx2Function = this->tmpVx3Function = NULL; - - //aktuelle velocityfunction bestimmen - double maxEndtime = -Ub::inf; - - for(size_t pos=0; pos<vx1BCs.size(); ++pos) - { - if( UbMath::equal(vx1BCs[pos].getEndTime(),BCFunction::INFTIMEDEPENDENT) ) maxEndtime=Ub::inf; - maxEndtime = UbMath::max(maxEndtime,vx1BCs[pos].getStartTime(),vx1BCs[pos].getEndTime()); //startTime abfragen, da INFCONST=-10 - - if( UbMath::greaterEqual(this->timeStep,vx1BCs[pos].getStartTime()) ) - { - if( UbMath::lessEqual( this->timeStep , vx1BCs[pos].getEndTime() ) - || UbMath::equal( vx1BCs[pos].getEndTime(), (double)BCFunction::INFCONST ) - || UbMath::equal( vx1BCs[pos].getEndTime(), (double)BCFunction::INFTIMEDEPENDENT) ) - { - tmpVx1Function = &vx1BCs[pos].getFunction(); - break; - } - } - } - for(size_t pos=0; pos<vx2BCs.size(); ++pos) - { - if( UbMath::equal(vx2BCs[pos].getEndTime(),BCFunction::INFTIMEDEPENDENT)) maxEndtime=Ub::inf; - maxEndtime = UbMath::max(maxEndtime,vx2BCs[pos].getStartTime(),vx2BCs[pos].getEndTime()); //startTime abfragen, da INFCONST=-10 - - if( UbMath::greaterEqual(this->timeStep,vx2BCs[pos].getStartTime()) ) - { - if( UbMath::lessEqual( this->timeStep , vx2BCs[pos].getEndTime() ) - || UbMath::equal( vx2BCs[pos].getEndTime(), (double)BCFunction::INFCONST ) - || UbMath::equal( vx2BCs[pos].getEndTime(), (double)BCFunction::INFTIMEDEPENDENT ) ) - { - tmpVx2Function = &vx2BCs[pos].getFunction(); - break; - } - } - } - for(size_t pos=0; pos<vx3BCs.size(); ++pos) - { - if( UbMath::equal(vx3BCs[pos].getEndTime(),BCFunction::INFTIMEDEPENDENT)) maxEndtime=Ub::inf; - maxEndtime = UbMath::max(maxEndtime,vx3BCs[pos].getStartTime(),vx3BCs[pos].getEndTime()); //startTime abfragen, da INFCONST=-10 - - if( UbMath::greaterEqual(this->timeStep,vx3BCs[pos].getStartTime()) ) - { - if( UbMath::lessEqual( this->timeStep , vx3BCs[pos].getEndTime() ) - || UbMath::equal( vx3BCs[pos].getEndTime(), (double)BCFunction::INFCONST ) - || UbMath::equal( vx3BCs[pos].getEndTime(), (double)BCFunction::INFTIMEDEPENDENT ) ) - { - tmpVx3Function = &vx3BCs[pos].getFunction(); - break; - } - } - } - - if( UbMath::greaterEqual(time,maxEndtime) ) - { - 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 ); - } - this->init(interactor,time); - } - } - - UBLOG(logDEBUG4,"D3Q27VelocityBCAdapter::init(time="<<time<<") " - <<", vx1= \""<<(tmpVx1Function ? tmpVx1Function->GetExpr() : "-")<<"\"" - <<", vx2= \""<<(tmpVx2Function ? tmpVx2Function->GetExpr() : "-")<<"\"" - <<", vx3= \""<<(tmpVx3Function ? tmpVx3Function->GetExpr() : "-")<<"\"" - <<", timedependent="<<boolalpha<<this->isTimeDependent() ); -} -/*==========================================================*/ -void VelocityBCAdapter::update( const D3Q27Interactor* const& interactor, const double& time ) -{ - this->init(interactor,time); -} -/*==========================================================*/ -void VelocityBCAdapter::adaptBCForDirection( const D3Q27Interactor& interactor, BoundaryConditionsPtr 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 VelocityBCAdapter::adaptBC( const D3Q27Interactor& interactor, BoundaryConditionsPtr 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 VelocityBCAdapter::setNodeVelocity( const D3Q27Interactor& interactor, BoundaryConditionsPtr bc, const double& worldX1, const double& worldX2, const double& worldX3, const double& timestep) -{ - //Geschwindigkeiten setzen - try - { - //PunktKoordinaten bestimmen - this->x1 = worldX1; - this->x2 = worldX2; - this->x3 = worldX3; - this->timeStep = timestep; - - if(tmpVx1Function) bc->setBoundaryVelocityX1((float)tmpVx1Function->Eval()); - if(tmpVx2Function) bc->setBoundaryVelocityX2((float)tmpVx2Function->Eval()); - if(tmpVx3Function) bc->setBoundaryVelocityX3((float)tmpVx3Function->Eval()); - } - catch(mu::Parser::exception_type& e){ stringstream error; error<<"mu::parser exception occurs, message("<<e.GetMsg()<<"), formula("<<e.GetExpr()+"), token("+e.GetToken()<<")" - <<", pos("<<e.GetPos()<<"), error code("<<e.GetCode(); throw UbException(error.str()); } - catch(...) { throw UbException(UB_EXARGS,"unknown exception" ); } -} -/*==========================================================*/ -UbTupleDouble3 VelocityBCAdapter::getVelocity(const double& x1, const double& x2, const double& x3, const double& timeStep) const -{ - double vx1 = 0.0; - double vx2 = 0.0; - double vx3 = 0.0; - this->x1 = x1; - this->x2 = x2; - this->x3 = x3; - this->timeStep = timeStep; - - if(tmpVx1Function) vx1 = tmpVx1Function->Eval(); - if(tmpVx2Function) vx2 = tmpVx2Function->Eval(); - if(tmpVx3Function) vx3 = tmpVx3Function->Eval(); - - return UbTupleDouble3(vx1,vx2,vx3); -} -/*==========================================================*/ -string VelocityBCAdapter::toString() -{ - stringstream info; - info<<"D3Q27VelocityBCAdapter:\n"; - info<<" #vx1-functions = "<<(int)vx1BCs.size()<<endl; - info<<" #vx2-functions = "<<(int)vx2BCs.size()<<endl; - info<<" #vx3-functions = "<<(int)vx3BCs.size()<<endl; - info<<" protected variables: x1, x2, x3, t"<<endl; - - const vector<BCFunction>* bcvecs[3] = { &vx1BCs, &vx2BCs, &vx3BCs }; - for(int i=0; i<3; i++) - { - for(size_t pos=0; pos<bcvecs[i]->size(); ++pos) - { - info<<"\n vx"<<(i+1)<<"-function nr."<<pos<<":"<<endl; - info<<(*bcvecs[i])[pos]<<endl; - } - } - return info.str(); -} - - diff --git a/src/VirtualFluids/BoundaryConditions/VelocityBCAdapter.h b/src/VirtualFluids/BoundaryConditions/VelocityBCAdapter.h deleted file mode 100644 index 92e5e3c82..000000000 --- a/src/VirtualFluids/BoundaryConditions/VelocityBCAdapter.h +++ /dev/null @@ -1,156 +0,0 @@ -// _ ___ __ __________ _ __ -// | | / (_)____/ /___ ______ _/ / ____/ /_ __(_)___/ /____ -// | | / / / ___/ __/ / / / __ `/ / /_ / / / / / / __ / ___/ -// | |/ / / / / /_/ /_/ / /_/ / / __/ / / /_/ / / /_/ (__ ) -// |___/_/_/ \__/\__,_/\__,_/_/_/ /_/\__,_/_/\__,_/____/ -// -#ifndef VelocityBCAdapter_H -#define VelocityBCAdapter_H - -#include <iostream> -#include <string> -#include <sstream> -#include <vector> - -#ifdef CAB_RCF - #include <3rdParty/rcf/RcfSerializationIncludes.h> -#endif - -#include <basics/utilities/UbInfinity.h> -#include <basics/utilities/UbFileOutput.h> -#include <basics/utilities/UbFileInput.h> - -class UbFileOutput; -class UbFileInput; - -#include <BCAdapter.h> -#include <BCFunction.h> - -//example: -// vector<D3Q27BCFunction> vx1BCs,vx2BCs,vx3BCs; -// vx1BCs.push_back(D3Q27BCFunction(0.01 , 0 , 100) ); //t=[0 ..100[ -> vx1 = 0.01 -// vx1BCs.push_back(D3Q27BCFunction(0.004, 100, 200) ); //t=[100..200[ -> vx1 = 0.004 -// vx1BCs.push_back(D3Q27BCFunction(0.03 , 200, 400) ); //t=[200..400] -> vx1 = 0.03 -// -// vx2BCs.push_back(D3Q27BCFunction(0.02 , 0 , 200) ); //t=[0 ..200[ -> vx2 = 0.02 -// vx2BCs.push_back(D3Q27BCFunction(0.002, 200, 300) ); //t=[200..300[ -> vx2 = 0.002 -// vx2BCs.push_back(D3Q27BCFunction(0.043, 300, 600) ); //t=[300..600] -> vx2 = 0.043 -// -// D3Q27VelocityBCAdapter bcAdapter(vx1BCs,vx2BCs,vx3BCs); -// bcAdapter.setTimePeriodic(); //-> t=[0 ..100[ -> vx1 = 0.01 -// // t=[100..200[ -> vx1 = 0.004 -// // t=[200..400[ -> vx1 = 0.03 -// // t=[400..500[ -> vx1 = 0.01 -// // t=[500..600[ -> vx1 = 0.004 -// // t=[600..800[ -> vx1 = 0.03 ... -// // t=[0 ..200[ -> vx2 = 0.02 -// // t=[200..300[ -> vx2 = 0.002 -// // t=[300..600] -> vx2 = 0.043 -// // t=[600..800[ -> vx2 = 0.02 -// // t=[800..900[ -> vx2 = 0.002 -// // t=[900..1200]-> vx2 = 0.043 ... -// -// example parabolic inflow: -// mu::Parser fct; -// fct.SetExpr("max(vmax*(1.0-4.0*((x2-x2_vmax)^2+(x3-x3_vmax)^2)/H^2),0.0)"); //paraboloid (mit vmax bei (0/x2_vmax/x3_vmax) -// fct.DefineConst("x2Vmax", 0.0 ); //x2-Pos für vmax -// fct.DefineConst("x3Vmax", 0.0 ); //x3-Pos für vmax -// fct.DefineConst("H" , rohrDurchmesser); -// fct.DefineConst("vmax" , vmax ); -// D3Q27VelocityBCAdapter velBC(true, false ,false ,fct, 0, D3Q27BCFunction::INFCONST); - -/*=========================================================================*/ -/* D3Q27VelocityBCAdapter */ -/* */ -/** -<BR><BR> -@author <A HREF="mailto:muffmolch@gmx.de">S. Freudiger</A> -@version 1.0 - 06.09.06 -*/ - -class VelocityBCAdapter : public BCAdapter -{ -public: - //constructors - VelocityBCAdapter() { this->init(); } - - VelocityBCAdapter(const bool& vx1, const bool& vx2, const bool& vx3, const BCFunction& velVxBC ); - - VelocityBCAdapter(const bool& vx1, const bool& vx2, const bool& vx3, const mu::Parser& function, const double& startTime, const double& endTime ); - - VelocityBCAdapter(const bool& vx1, const bool& vx2, const bool& vx3, const mu::Parser& function1, const mu::Parser& function2, const mu::Parser& function3, const double& startTime, const double& endTime ); - - VelocityBCAdapter(const bool& vx1, const bool& vx2, const bool& vx3, const std::string& functionstring, const double& startTime, const double& endTime ); - - VelocityBCAdapter(const BCFunction& velBC, bool x1Dir, bool x2Dir, bool x3Dir); - - VelocityBCAdapter(const BCFunction& velVx1BC, const BCFunction& velVx2BC, const BCFunction& velVx3BC); - - VelocityBCAdapter(const std::vector< BCFunction >& velVx1BCs, const std::vector< BCFunction >& velVx2BCs, const std::vector< BCFunction >& velVx3BCs); - - VelocityBCAdapter(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); - - VelocityBCAdapter(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 ); - - //methods - void setTimePeriodic() { (this->type |= TIMEPERIODIC); } - void unsetTimePeriodic() { (this->type &= ~TIMEPERIODIC); } - bool isTimePeriodic() { return ((this->type & TIMEPERIODIC) == TIMEPERIODIC); } - - //folgendes ist fuer moving objects gedadacht... - void 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); - - - //------------- implements D3Q27BoundaryConditionAdapter ----- start - std::string toString(); - - void init(const D3Q27Interactor* const& interactor, const double& time=0); - void update(const D3Q27Interactor* const& interactor, const double& time=0); - - void adaptBCForDirection( const D3Q27Interactor& interactor, BoundaryConditionsPtr bc, const double& worldX1, const double& worldX2, const double& worldX3, const double& q, const int& fdirection, const double& time=0 ); - void adaptBC( const D3Q27Interactor& interactor, BoundaryConditionsPtr bc, const double& worldX1, const double& worldX2, const double& worldX3, const double& time=0 ); - - //------------- implements D3Q27BoundaryConditionAdapter ----- end - - UbTupleDouble3 getVelocity(const double& x1, const double& x2, const double& x3, const double& timeStep) const; - - -protected: - void init(); - void init(std::vector<BCFunction>& vxBCs); - - //time dependency wird automatisch ueber D3Q27BCFunction Intervalle ermittelt! - void setTimeDependent() { (this->type |= TIMEDEPENDENT); } - void unsetTimeDependent() { (this->type &= ~TIMEDEPENDENT); } - - void clear() { vx1BCs.clear(); vx2BCs.clear(); vx3BCs.clear(); this->init(); } - void setNodeVelocity(const D3Q27Interactor& interactor, BoundaryConditionsPtr bc, const double& worldX1, const double& worldX2, const double& worldX3, const double& timestep); - -private: - mutable mu::value_type x1, x2, x3; - mutable mu::value_type timeStep; - - mu::Parser* tmpVx1Function; - mu::Parser* tmpVx2Function; - mu::Parser* tmpVx3Function; - - std::vector<BCFunction> vx1BCs; - std::vector<BCFunction> vx2BCs; - std::vector<BCFunction> vx3BCs; - -private: - friend class boost::serialization::access; - template<class Archive> - void serialize(Archive & ar, const unsigned int version) - { - ar & boost::serialization::base_object<BCAdapter>(*this); - } -}; - -#endif diff --git a/src/VirtualFluids/BoundaryConditions/VelocityBCAlgorithm.cpp b/src/VirtualFluids/BoundaryConditions/VelocityBCAlgorithm.cpp deleted file mode 100644 index bb1cc3131..000000000 --- a/src/VirtualFluids/BoundaryConditions/VelocityBCAlgorithm.cpp +++ /dev/null @@ -1,50 +0,0 @@ -#include "VelocityBCAlgorithm.h" -#include "DistributionArray3D.h" -#include "BoundaryConditions.h" - -VelocityBCAlgorithm::VelocityBCAlgorithm() -{ - BCAlgorithm::type = BCAlgorithm::VelocityBCAlgorithm; - BCAlgorithm::preCollision = false; -} -////////////////////////////////////////////////////////////////////////// -VelocityBCAlgorithm::~VelocityBCAlgorithm() -{ -} -////////////////////////////////////////////////////////////////////////// -BCAlgorithmPtr VelocityBCAlgorithm::clone() -{ - BCAlgorithmPtr bc(new VelocityBCAlgorithm()); - return bc; -} -////////////////////////////////////////////////////////////////////////// -void VelocityBCAlgorithm::addDistributions(DistributionArray3DPtr distributions) -{ - this->distributions = distributions; -} -////////////////////////////////////////////////////////////////////////// -void VelocityBCAlgorithm::applyBC() -{ - LBMReal f[D3Q27System::ENDF+1]; - LBMReal feq[D3Q27System::ENDF+1]; - distributions->getDistributionInv(f, x1, x2, x3); - LBMReal rho, vx1, vx2, vx3, drho; - calcMacrosFct(f, drho, vx1, vx2, vx3); - calcFeqFct(feq, drho, vx1, vx2, vx3); - - rho = 1.0+drho*compressibleFactor; - - for (int fdir = D3Q27System::FSTARTDIR; fdir<=D3Q27System::FENDDIR; fdir++) - { - if (bcPtr->hasVelocityBoundaryFlag(fdir)) - { - const int invDir = D3Q27System::INVDIR[fdir]; - LBMReal q = bcPtr->getQ(invDir);// m+m q=0 stabiler - LBMReal velocity = bcPtr->getBoundaryVelocity(invDir); - LBMReal fReturn = ((1.0-q)/(1.0+q))*((f[invDir]-feq[invDir])/(1.0-collFactor)+feq[invDir])+((q*(f[invDir]+f[fdir])-velocity*rho)/(1.0+q)); - distributions->setDistributionForDirection(fReturn, x1+D3Q27System::DX1[invDir], x2+D3Q27System::DX2[invDir], x3+D3Q27System::DX3[invDir], fdir); - } - } - -} - diff --git a/src/VirtualFluids/BoundaryConditions/VelocityBCAlgorithm.h b/src/VirtualFluids/BoundaryConditions/VelocityBCAlgorithm.h deleted file mode 100644 index 667e4ae3d..000000000 --- a/src/VirtualFluids/BoundaryConditions/VelocityBCAlgorithm.h +++ /dev/null @@ -1,30 +0,0 @@ -#ifndef VelocityBoundaryCondition_h__ -#define VelocityBoundaryCondition_h__ - -#include "BCAlgorithm.h" - -class DistributionArray3D; - -class VelocityBCAlgorithm; -typedef std::shared_ptr<VelocityBCAlgorithm> VelocityBCAlgorithmPtr; - -class VelocityBCAlgorithm : public BCAlgorithm -{ -public: - VelocityBCAlgorithm(); - ~VelocityBCAlgorithm(); - BCAlgorithmPtr clone(); - void addDistributions(std::shared_ptr<DistributionArray3D> distributions); - - void applyBC() override; -private: - //friend class boost::serialization::access; - //template<class Archive> - //void serialize(Archive & ar, const unsigned int version) - //{ - // ar & boost::serialization::base_object<BCAlgorithm>(*this); - //} -}; - -#endif // VelocityBoundaryCondition_h__ - diff --git a/src/VirtualFluids/BoundaryConditions/VelocityWithDensityBCAlgorithm.cpp b/src/VirtualFluids/BoundaryConditions/VelocityWithDensityBCAlgorithm.cpp deleted file mode 100644 index ee945daf5..000000000 --- a/src/VirtualFluids/BoundaryConditions/VelocityWithDensityBCAlgorithm.cpp +++ /dev/null @@ -1,84 +0,0 @@ -#include "VelocityWithDensityBCAlgorithm.h" -#include "DistributionArray3D.h" -#include "BCArray3D.h" - -VelocityWithDensityBCAlgorithm::VelocityWithDensityBCAlgorithm() -{ - BCAlgorithm::type = BCAlgorithm::VelocityWithDensityBCAlgorithm; - BCAlgorithm::preCollision = false; -} -////////////////////////////////////////////////////////////////////////// -VelocityWithDensityBCAlgorithm::~VelocityWithDensityBCAlgorithm() -{ - -} -////////////////////////////////////////////////////////////////////////// -BCAlgorithmPtr VelocityWithDensityBCAlgorithm::clone() -{ - BCAlgorithmPtr bc(new VelocityWithDensityBCAlgorithm()); - return bc; -} -////////////////////////////////////////////////////////////////////////// -void VelocityWithDensityBCAlgorithm::addDistributions(DistributionArray3DPtr distributions) -{ - this->distributions = distributions; -} -////////////////////////////////////////////////////////////////////////// -void VelocityWithDensityBCAlgorithm::applyBC() -{ - //velocity bc for non reflecting pressure bc - LBMReal f[D3Q27System::ENDF+1]; - LBMReal feq[D3Q27System::ENDF+1]; - distributions->getDistributionInv(f, x1, x2, x3); - LBMReal rho, vx1, vx2, vx3, drho; - calcMacrosFct(f, drho, vx1, vx2, vx3); - calcFeqFct(feq, drho, vx1, vx2, vx3); - - rho = 1.0+drho*compressibleFactor; - - for (int fdir = D3Q27System::FSTARTDIR; fdir <= D3Q27System::FENDDIR; fdir++) - { - //if (bcPtr->hasVelocityBoundaryFlag(fdir)) - //{ - // const int invDir = D3Q27System::INVDIR[fdir]; - // LBMReal q = bcPtr->getQ(invDir);// m+m q=0 stabiler - // LBMReal velocity = bcPtr->getBoundaryVelocity(invDir); - // //normal velocity bc: LBMReal fReturn = ((1.0-q)/(1.0+q))*((f[invDir]-feq[invDir])/(1.0-collFactor)+feq[invDir])+((q*(f[invDir]+f[fdir])-velocity*rho)/(1.0+q)); - // //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))-drho*D3Q27System::WEIGTH[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) / (1.0 + q))-drho*D3Q27System::WEIGTH[invDir]; - // LBMReal fReturn = ((1.0 - q) / (1.0 + q))*((f[invDir] - feq[invDir]*collFactor) / (1.0 - collFactor)) + ((q*(f[invDir] + f[fdir]) - velocity*rho) / (1.0 + q))-drho*D3Q27System::WEIGTH[invDir]; - // - // distributions->setDistributionForDirection(fReturn, x1 + D3Q27System::DX1[invDir], x2 + D3Q27System::DX2[invDir], x3 + D3Q27System::DX3[invDir], fdir); - //} - - int nX1 = x1 + D3Q27System::DX1[fdir]; - int nX2 = x2 + D3Q27System::DX2[fdir]; - int nX3 = x3 + D3Q27System::DX3[fdir]; - - int minX1 = 0; - int minX2 = 0; - int minX3 = 0; - - int maxX1 = (int)bcArray->getNX1(); - int maxX2 = (int)bcArray->getNX2(); - int maxX3 = (int)bcArray->getNX3(); - - if (minX1 <= nX1 && maxX1 > nX1 && minX2 <= nX2 && maxX2 > nX2 && minX3 <= nX3 && maxX3 > nX3) - { - if (bcArray->isSolid(nX1,nX2,nX3)) - { - const int invDir = D3Q27System::INVDIR[fdir]; - LBMReal q =1.0;// bcPtr->getQ(invDir);// m+m q=0 stabiler - LBMReal velocity = bcPtr->getBoundaryVelocity(fdir); - //LBMReal fReturn = ((1.0 - q) / (1.0 + q))*((f[fdir] - feq[fdir]*collFactor) / (1.0 - collFactor)) + ((q*(f[fdir] + f[invDir]) - velocity*rho) / (1.0 + q))-drho*D3Q27System::WEIGTH[invDir]; - - //if q=1 - //LBMReal fReturn = ((q*(f[fdir] + f[invDir]) - velocity*rho) / (1.0 + q))-drho*D3Q27System::WEIGTH[invDir]; - LBMReal fReturn = (f[fdir] + f[invDir] - velocity*rho) / 2.0 - drho*D3Q27System::WEIGTH[invDir]; - - distributions->setDistributionForDirection(fReturn, nX1, nX2, nX3, invDir); - } - } - - } -} diff --git a/src/VirtualFluids/BoundaryConditions/VelocityWithDensityBCAlgorithm.h b/src/VirtualFluids/BoundaryConditions/VelocityWithDensityBCAlgorithm.h deleted file mode 100644 index 5aca0a97e..000000000 --- a/src/VirtualFluids/BoundaryConditions/VelocityWithDensityBCAlgorithm.h +++ /dev/null @@ -1,33 +0,0 @@ -//! \file NonReflectingVelocityBCAlgorithm.h -//! \brief Class implements velocity bc for non reflecting pressure bc. -//! \author Konstantin Kutscher - -#ifndef VelocityWithDensityBCAlgorithm_h__ -#define VelocityWithDensityBCAlgorithm_h__ - -#include "BCAlgorithm.h" - -class DistributionArray3D; - -class VelocityWithDensityBCAlgorithm; -typedef std::shared_ptr<VelocityWithDensityBCAlgorithm> VelocityWithDensityBCAlgorithmPtr; - -//! \brief Class implements Dirichlet boundary condition for velocity. Set density in system. It is used together with non reflecting outflow. - -class VelocityWithDensityBCAlgorithm : public BCAlgorithm -{ -public: - VelocityWithDensityBCAlgorithm(); - ~VelocityWithDensityBCAlgorithm(); - BCAlgorithmPtr clone(); - void addDistributions(std::shared_ptr<DistributionArray3D> distributions); - void applyBC(); -private: - //friend class boost::serialization::access; - //template<class Archive> - //void serialize(Archive & ar, const unsigned int version) - //{ - // ar & boost::serialization::base_object<BCAlgorithm>(*this); - //} -}; -#endif // NonReflectingVelocityBCAlgorithm_h__ diff --git a/src/VirtualFluids/CoProcessors/AdjustForcingCoProcessor.cpp b/src/VirtualFluids/CoProcessors/AdjustForcingCoProcessor.cpp deleted file mode 100644 index 99f0919b2..000000000 --- a/src/VirtualFluids/CoProcessors/AdjustForcingCoProcessor.cpp +++ /dev/null @@ -1,173 +0,0 @@ -/* -* D3Q27AdjustForcingCoProcessor.cpp -* Author: Konstantin Kutscher -*/ -#include "AdjustForcingCoProcessor.h" - -#include <fstream> - -#include <SetForcingBlockVisitor.h> -#include "IntegrateValuesHelper.h" -#include "Communicator.h" -#include "UbScheduler.h" -#include "Grid3D.h" - - -AdjustForcingCoProcessor::AdjustForcingCoProcessor(Grid3DPtr grid, UbSchedulerPtr s, - const std::string& path, - IntegrateValuesHelperPtr integrateValues, - double vTarged, - CommunicatorPtr comm) - - : CoProcessor(grid, s), - path(path), - integrateValues(integrateValues), - comm(comm), - vx1Targed(vTarged), - forcing(forcing) -{ - //cnodes = integrateValues->getCNodes(); - root = comm->isRoot(); - - Ta = scheduler->getMaxStep(); - - Kpcrit = 3.0 / Ta;// 0.3; - Tcrit = 3.0 * Ta; // 30.0; - Tn = 0.5 * Tcrit; - Tv = 0.12 * Tcrit; - - Kp = 0.6 * Kpcrit; - Ki = Kp / Tn; - Kd = Kp * Tv; - - y = 0; - e = 0; - esum = 0; - eold = 0; - forcing = 0; - - if (root) - { - std::string fname = path + "/forcing/forcing.csv"; - std::ofstream ostr; - ostr.open(fname.c_str(), std::ios_base::out | std::ios_base::app); - if (!ostr) - { - ostr.clear(); - std::string path = UbSystem::getPathFromString(fname); - if (path.size() > 0) { UbSystem::makeDirectory(path); ostr.open(fname.c_str(), std::ios_base::out | std::ios_base::app); } - if (!ostr) throw UbException(UB_EXARGS, "couldn't open file " + fname); - } - ostr << "step;volume;vx1average;forcing\n"; - ostr.close(); - - ////////////////////////////////////////////////////////////////////////////////////////////////// - //temporary solution - std::string fNameCfg = path + "/forcing/forcing.cfg"; - std::ifstream istr2; - istr2.open(fNameCfg.c_str(), std::ios_base::in); - if (istr2) - { - istr2 >> forcing; - //istr2 >> esum; - //istr2 >> eold; - } - istr2.close(); - } - //////////////////////////////////////////////////////////////////////////////////////////////////////// -} -////////////////////////////////////////////////////////////////////////// -AdjustForcingCoProcessor::~AdjustForcingCoProcessor() -{ -} -////////////////////////////////////////////////////////////////////////// -void AdjustForcingCoProcessor::process(double step) -{ - if (scheduler->isDue(step)) - collectData(step); -} -////////////////////////////////////////////////////////////////////////// -void AdjustForcingCoProcessor::collectData(double step) -{ - ////////////////////////////////////////////////////////////////////////////////////////////////// - //temporary solution - if (root) - { - std::string fNameCfg = path + "/forcing/forcing.cfg"; - std::ofstream ostr2; - ostr2.open(fNameCfg.c_str(), std::ios_base::out); - if (!ostr2) - { - ostr2.clear(); - std::string path = UbSystem::getPathFromString(fNameCfg); - if (path.size() > 0) { UbSystem::makeDirectory(path); ostr2.open(fNameCfg.c_str(), std::ios_base::out); } - if (!ostr2) throw UbException(UB_EXARGS, "couldn't open file " + fNameCfg); - } - ostr2 << forcing << " " << esum << " " << eold; - ostr2.close(); - } - //////////////////////////////////////////////////////////////////////////////////////////////////////// - - integrateValues->calculateMQ(); - - if (root) - { - cellsVolume = integrateValues->getCellsVolume(); - double vx1 = integrateValues->getVx1(); - vx1Average = (vx1 / cellsVolume); - - ////////////////////////////////////////////////////////////////////////// - //PID-Controller (PID-Regler) - e = vx1Targed - vx1Average; - esum = esum + e; - y = Kp * e + Ki * Ta * esum + Kd * (e - eold) / Ta; - eold = e; - - forcing = forcing + y; - ////////////////////////////////////////////////////////////////////////// - } - ////////////////////////////////////////////////////////////////////////// - comm->broadcast(forcing); - - mu::Parser fctForcingX1, fctForcingX2, fctForcingX3; - fctForcingX1.SetExpr("Fx1"); - fctForcingX1.DefineConst("Fx1", forcing); - fctForcingX2.SetExpr("0.0"); - fctForcingX3.SetExpr("0.0"); - SetForcingBlockVisitor forcingVisitor(fctForcingX1, fctForcingX2, fctForcingX3); - grid->accept(forcingVisitor); - - //for(CalcNodes cn : cnodes) - //{ - // LBMKernel3DPtr kernel = cn.block->getKernel(); - // if (kernel) - // { - // kernel->setForcingX1(fctForcingX1); - // kernel->setWithForcing(true); - // } - // - //} - - if (root) - { - //UBLOG(logINFO, "D3Q27AdjustForcingCoProcessor step: " << static_cast<int>(step)); - //UBLOG(logINFO, "new forcing is: " << forcing); - std::string fname = path + "/forcing/forcing.csv"; - //std::string fname = path + "/forcing/forcing_"+UbSystem::toString(comm->getProcessID())+".csv"; - std::ofstream ostr; - ostr.open(fname.c_str(), std::ios_base::out | std::ios_base::app); - if (!ostr) - { - ostr.clear(); - std::string path = UbSystem::getPathFromString(fname); - if (path.size() > 0) { UbSystem::makeDirectory(path); ostr.open(fname.c_str(), std::ios_base::out | std::ios_base::app); } - if (!ostr) throw UbException(UB_EXARGS, "couldn't open file " + fname); - } - int istep = static_cast<int>(step); - - //ostr << istep << ";" << cellsVolume << ";" << vx1Average << "; " << forcing << "\n"; - ostr << istep << ";" << cellsVolume << ";" << vx1Average << "; " << forcing << "; " << e << "; " << esum << "; " << y <<"\n"; - ostr.close(); - - } -} diff --git a/src/VirtualFluids/CoProcessors/AdjustForcingCoProcessor.h b/src/VirtualFluids/CoProcessors/AdjustForcingCoProcessor.h deleted file mode 100644 index 21faea08a..000000000 --- a/src/VirtualFluids/CoProcessors/AdjustForcingCoProcessor.h +++ /dev/null @@ -1,61 +0,0 @@ -#ifndef D3Q27ADJUSTFORCINGCoProcessor_H -#define D3Q27ADJUSTFORCINGCoProcessor_H - -#include <memory> -#include <string> - -#include "CoProcessor.h" - - -class Communicator; -class UbScheduler; -class Grid3D; -class IntegrateValuesHelper; - -class AdjustForcingCoProcessor; -typedef std::shared_ptr<AdjustForcingCoProcessor> AdjustForcingCoProcessorPtr; - -//! \brief Computes forcing such that a given velocity (vx1Targed) is reached inside an averaging domain (h1). -//! \details Algorithm based on PID controller (proportional–integral–derivative controller). The parameters of PID controller estimation based on Ziegler–Nichols method. -//! Integrate values helper, scheduler must be set in test case. -//! \author: Konstantin Kutscher - -class AdjustForcingCoProcessor: public CoProcessor { -public: - AdjustForcingCoProcessor(std::shared_ptr<Grid3D> grid, std::shared_ptr<UbScheduler> s, - const std::string& path, - std::shared_ptr<IntegrateValuesHelper> integrateValues, - double vTarged, std::shared_ptr<Communicator> comm); - virtual ~AdjustForcingCoProcessor(); - //!< calls collect PostprocessData - void process(double step) override; -protected: - //!< object that can compute spacial average values in 3D-subdomain. - std::shared_ptr<IntegrateValuesHelper> integrateValues; - //!< compares velocity in integrateValues with target velocity and adjusts forcing accordingly. - void collectData(double step); - std::shared_ptr<Communicator> comm; -private: - double vx1Targed; //!< target velocity. - double forcing; //!< forcing at previous update step. - double cellsVolume; - double vx1Average; - bool root; - double Kpcrit; //Kp critical - double Tcrit; //the oscillation period - double Tn; - double Tv; - double e; - double Ta; - double Kp; - double Ki; - double Kd; - double y; - double esum; - double eold; - //std::vector<CalcNodes> cnodes; - std::string path; -}; - - -#endif /* D3Q27RHODIFFERENCECoProcessor_H_ */ diff --git a/src/VirtualFluids/CoProcessors/AverageValuesCoProcessor.cpp b/src/VirtualFluids/CoProcessors/AverageValuesCoProcessor.cpp deleted file mode 100644 index 1658b7f52..000000000 --- a/src/VirtualFluids/CoProcessors/AverageValuesCoProcessor.cpp +++ /dev/null @@ -1,573 +0,0 @@ -#include "AverageValuesCoProcessor.h" - -#include "LBMKernel.h" -#include "BCProcessor.h" - -#include "basics/writer/WbWriterVtkXmlASCII.h" - -#include "DataSet3D.h" -#include "WbWriter.h" -#include "Grid3D.h" -#include "Block3D.h" -#include "UbScheduler.h" -#include "Communicator.h" -#include "BCArray3D.h" - -using namespace std; - -AverageValuesCoProcessor::AverageValuesCoProcessor() -{ - -} -////////////////////////////////////////////////////////////////////////// -AverageValuesCoProcessor::AverageValuesCoProcessor(Grid3DPtr grid, const std::string& path, WbWriter* const writer, - UbSchedulerPtr s, UbSchedulerPtr Avs, UbSchedulerPtr rsMeans, UbSchedulerPtr rsRMS, bool restart) - : CoProcessor(grid, s), - averageScheduler(Avs), - resetSchedulerMeans(rsMeans), - resetSchedulerRMS(rsRMS), - path(path), - writer(writer) -{ - resetStepMeans = (int)rsMeans->getMinBegin(); - resetStepRMS = (int)rsRMS->getMinBegin(); - averageInterval = (double)Avs->getMinStep(); - - gridRank = grid->getRank(); - minInitLevel = this->grid->getCoarsestInitializedLevel(); - maxInitLevel = this->grid->getFinestInitializedLevel(); - - blockVector.resize(maxInitLevel+1); - - for(int level = minInitLevel; level<=maxInitLevel;level++) - { - grid->getBlocks(level, gridRank, true, blockVector[level]); - - if (blockVector[level].size() > 0) - compressible = blockVector[level][0]->getKernel()->getCompressible(); - - if (!restart) - { - for(Block3DPtr block : blockVector[level]) - { - UbTupleInt3 nx = grid->getBlockNX(); - AverageValuesArray3DPtr averageValues = AverageValuesArray3DPtr(new AverageValuesArray3D(11, val<1>(nx)+1, val<2>(nx)+1, val<3>(nx)+1, 0.0)); - block->getKernel()->getDataSet()->setAverageValues(averageValues); - } - } - } - - // for musis special use - //initPlotDataZ(0.0); - //restartStep = 0.0; -} -////////////////////////////////////////////////////////////////////////// -void AverageValuesCoProcessor::process(double step) -{ - //resetRMS(step); - if(resetSchedulerRMS->isDue(step) ) - resetDataRMS(step); - - //reset(step); - if(resetSchedulerMeans->isDue(step) ) - resetDataMeans(step); - - if(averageScheduler->isDue(step) ){ - calculateAverageValues(step); - // for musis special use - //collectPlotDataZ(step); - } - if(scheduler->isDue(step) ){ - collectData(step); - - } - - UBLOG(logDEBUG3, "AverageValuesCoProcessor::update:" << step); -} - -void AverageValuesCoProcessor::resetDataRMS(double step) -{ - resetStepRMS=(int)step; - - for(int level = minInitLevel; level<=maxInitLevel;level++) - { - for(Block3DPtr block : blockVector[level]) - { - if (block) - { - ILBMKernelPtr kernel = block->getKernel(); - BCArray3DPtr bcArray = kernel->getBCProcessor()->getBCArray(); - DistributionArray3DPtr distributions = kernel->getDataSet()->getFdistributions(); - AverageValuesArray3DPtr av = kernel->getDataSet()->getAverageValues(); - - int minX1 = 0; - int minX2 = 0; - int minX3 = 0; - - int maxX1 = int(distributions->getNX1()); - int maxX2 = int(distributions->getNX2()); - int maxX3 = int(distributions->getNX3()); - - for(int ix3=minX3; ix3<maxX3-1; ix3++) - { - for(int ix2=minX2; ix2<maxX2-1; ix2++) - { - for(int ix1=minX1; ix1<maxX1-1; ix1++) - { - if(!bcArray->isUndefined(ix1,ix2,ix3) && !bcArray->isSolid(ix1,ix2,ix3)) - { - ////////////////////////////////////////////////////////////////////////// - //compute average values - ////////////////////////////////////////////////////////////////////////// - (*av)(AvVxx,ix1,ix2,ix3) = 0.0; - (*av)(AvVyy,ix1,ix2,ix3) = 0.0; - (*av)(AvVzz,ix1,ix2,ix3) = 0.0; - (*av)(AvVxy,ix1,ix2,ix3) = 0.0; - (*av)(AvVxz,ix1,ix2,ix3) = 0.0; - (*av)(AvVyz,ix1,ix2,ix3) = 0.0; - (*av)(AvPrms,ix1,ix2,ix3) = 0.0; - ////////////////////////////////////////////////////////////////////////// - } - } - } - } - } - } - } -} -////////////////////////////////////////////////////////////////////////// -void AverageValuesCoProcessor::resetDataMeans(double step) -{ - resetStepMeans=(int)step; - - for(int level = minInitLevel; level<=maxInitLevel;level++) - { - for(Block3DPtr block : blockVector[level]) - { - if (block) - { - ILBMKernelPtr kernel = block->getKernel(); - BCArray3DPtr bcArray = kernel->getBCProcessor()->getBCArray(); - DistributionArray3DPtr distributions = kernel->getDataSet()->getFdistributions(); - AverageValuesArray3DPtr av = kernel->getDataSet()->getAverageValues(); - - int minX1 = 0; - int minX2 = 0; - int minX3 = 0; - - int maxX1 = int(distributions->getNX1()); - int maxX2 = int(distributions->getNX2()); - int maxX3 = int(distributions->getNX3()); - - for(int ix3=minX3; ix3<maxX3-1; ix3++) - { - for(int ix2=minX2; ix2<maxX2-1; ix2++) - { - for(int ix1=minX1; ix1<maxX1-1; ix1++) - { - if(!bcArray->isUndefined(ix1,ix2,ix3) && !bcArray->isSolid(ix1,ix2,ix3)) - { - ////////////////////////////////////////////////////////////////////////// - //compute average values - ////////////////////////////////////////////////////////////////////////// - (*av)(AvVx,ix1,ix2,ix3) = 0.0; - (*av)(AvVy,ix1,ix2,ix3) = 0.0; - (*av)(AvVz,ix1,ix2,ix3) = 0.0; - (*av)(AvP,ix1,ix2,ix3) = 0.0; - ////////////////////////////////////////////////////////////////////////// - } - } - } - } - } - } - } -} -////////////////////////////////////////////////////////////////////////// -void AverageValuesCoProcessor::collectData(double step) -{ - int istep = int(step); - - for(int level = minInitLevel; level<=maxInitLevel;level++) - { - for(Block3DPtr block : blockVector[level]) - { - if (block) - { - addData(block); - } - } - } - - string pfilePath, partPath, subfolder, cfilePath; - subfolder = "av"+UbSystem::toString(istep); - pfilePath = path+"/av/"+subfolder; - cfilePath = path+"/av/av_collection"; - partPath = pfilePath+"/av"+UbSystem::toString(gridRank)+ "_" + UbSystem::toString(istep); - - string partName = writer->writeOctsWithNodeData(partPath,nodes,cells,datanames,data); - size_t found=partName.find_last_of("/"); - string piece = partName.substr(found+1); - piece = subfolder + "/" + piece; - - vector<string> cellDataNames; - CommunicatorPtr comm = Communicator::getInstance(); - vector<string> pieces = comm->gather(piece); - if (comm->getProcessID() == comm->getRoot()) - { - string pname = WbWriterVtkXmlASCII::getInstance()->writeParallelFile(pfilePath,pieces,datanames,cellDataNames); - found=pname.find_last_of("/"); - piece = pname.substr(found+1); - - vector<string> filenames; - filenames.push_back(piece); - if (step == CoProcessor::scheduler->getMinBegin()) - { - WbWriterVtkXmlASCII::getInstance()->writeCollection(cfilePath,filenames,istep,false); - } - else - { - WbWriterVtkXmlASCII::getInstance()->addFilesToCollection(cfilePath,filenames,istep,false); - } - UBLOG(logINFO,"AverageValuesCoProcessor step: " << istep); - } - - clearData(); -} -////////////////////////////////////////////////////////////////////////// -void AverageValuesCoProcessor::clearData() -{ - nodes.clear(); - cells.clear(); - datanames.clear(); - data.clear(); -} -////////////////////////////////////////////////////////////////////////// -void AverageValuesCoProcessor::addData(const Block3DPtr block) -{ - UbTupleDouble3 org = grid->getBlockWorldCoordinates(block); - UbTupleDouble3 blockLengths = grid->getBlockLengths(block); - UbTupleDouble3 nodeOffset = grid->getNodeOffset(block); - double dx = grid->getDeltaX(block); - - //Diese Daten werden geschrieben: - datanames.resize(0); - datanames.push_back("AvVx"); - datanames.push_back("AvVy"); - datanames.push_back("AvVz"); - datanames.push_back("AvVxx"); - datanames.push_back("AvVyy"); - datanames.push_back("AvVzz"); - datanames.push_back("AvVxy"); - datanames.push_back("AvVxz"); - datanames.push_back("AvVyz"); - datanames.push_back("AvP"); - datanames.push_back("AvPrms"); - - - data.resize(datanames.size()); - - ILBMKernelPtr kernel = block->getKernel(); - BCArray3DPtr bcArray = kernel->getBCProcessor()->getBCArray(); - DistributionArray3DPtr distributions = kernel->getDataSet()->getFdistributions(); - AverageValuesArray3DPtr av = kernel->getDataSet()->getAverageValues(); - //int ghostLayerWidth = kernel->getGhostLayerWidth(); - - //knotennummerierung faengt immer bei 0 an! - int SWB,SEB,NEB,NWB,SWT,SET,NET,NWT; - - int minX1 = 0; - int minX2 = 0; - int minX3 = 0; - - int maxX1 = int(distributions->getNX1()); - int maxX2 = int(distributions->getNX2()); - int maxX3 = int(distributions->getNX3()); - - //nummern vergeben und node vector erstellen + daten sammeln - CbArray3D<int> nodeNumbers((int)maxX1, (int)maxX2, (int)maxX3,-1); - - maxX1 -= 2; - maxX2 -= 2; - maxX3 -= 2; - - //D3Q27BoundaryConditionPtr bcPtr; - - int nr = (int)nodes.size(); - - for(int ix3=minX3; ix3<=maxX3; ix3++) - { - for(int ix2=minX2; ix2<=maxX2; ix2++) - { - for(int ix1=minX1; ix1<=maxX1; ix1++) - { - if(!bcArray->isUndefined(ix1,ix2,ix3) && !bcArray->isSolid(ix1,ix2,ix3)) - { - int index = 0; - nodeNumbers(ix1,ix2,ix3) = nr++; - nodes.push_back( makeUbTuple(float(val<1>(org) - val<1>(nodeOffset) + ix1*dx), - float(val<2>(org) - val<2>(nodeOffset) + ix2*dx), - float(val<3>(org) - val<3>(nodeOffset) + ix3*dx)) ); - - LBMReal vx=(*av)(AvVx,ix1,ix2,ix3); - LBMReal vy=(*av)(AvVy,ix1,ix2,ix3); - LBMReal vz=(*av)(AvVz,ix1,ix2,ix3); - - LBMReal vxx=(*av)(AvVxx,ix1,ix2,ix3); - LBMReal vyy=(*av)(AvVyy,ix1,ix2,ix3); - LBMReal vzz=(*av)(AvVzz,ix1,ix2,ix3); - - LBMReal vxy=(*av)(AvVxy,ix1,ix2,ix3); - LBMReal vxz=(*av)(AvVxz,ix1,ix2,ix3); - LBMReal vyz=(*av)(AvVyz,ix1,ix2,ix3); - - LBMReal vp=(*av)(AvP,ix1,ix2,ix3); - LBMReal vprms=(*av)(AvPrms,ix1,ix2,ix3); - - - data[index++].push_back(vx); - data[index++].push_back(vy); - data[index++].push_back(vz); - - data[index++].push_back(vxx); - data[index++].push_back(vyy); - data[index++].push_back(vzz); - - data[index++].push_back(vxy); - data[index++].push_back(vxz); - data[index++].push_back(vyz); - - data[index++].push_back(vp); - data[index++].push_back(vprms); - } - } - } - } - - maxX1 -= 1; - maxX2 -= 1; - maxX3 -= 1; - - //cell vector erstellen - for(int ix3=minX3; ix3<=maxX3; ix3++) - { - for(int ix2=minX2; ix2<=maxX2; ix2++) - { - for(int ix1=minX1; ix1<=maxX1; ix1++) - { - if( (SWB=nodeNumbers( ix1 , ix2, ix3 )) >= 0 - && (SEB=nodeNumbers( ix1+1, ix2, ix3 )) >= 0 - && (NEB=nodeNumbers( ix1+1, ix2+1, ix3 )) >= 0 - && (NWB=nodeNumbers( ix1 , ix2+1, ix3 )) >= 0 - && (SWT=nodeNumbers( ix1 , ix2, ix3+1 )) >= 0 - && (SET=nodeNumbers( ix1+1, ix2, ix3+1 )) >= 0 - && (NET=nodeNumbers( ix1+1, ix2+1, ix3+1 )) >= 0 - && (NWT=nodeNumbers( ix1 , ix2+1, ix3+1 )) >= 0 ) - { - cells.push_back( makeUbTuple(SWB,SEB,NEB,NWB,SWT,SET,NET,NWT) ); - } - } - } - } -} -////////////////////////////////////////////////////////////////////////// -void AverageValuesCoProcessor::calculateAverageValues(double timeStep) -{ - using namespace D3Q27System; - - //Funktionszeiger - calcMacros = NULL; - if (compressible) - { - calcMacros = &calcCompMacroscopicValues; - } - else - { - calcMacros = &calcIncompMacroscopicValues; - } - - LBMReal f[27]; - - for(int level = minInitLevel; level<=maxInitLevel;level++) - { - for(Block3DPtr block : blockVector[level]) - { - if (block) - { - ILBMKernelPtr kernel = block->getKernel(); - BCArray3DPtr bcArray = kernel->getBCProcessor()->getBCArray(); - DistributionArray3DPtr distributions = kernel->getDataSet()->getFdistributions(); - AverageValuesArray3DPtr av = kernel->getDataSet()->getAverageValues(); - - int minX1 = 0; - int minX2 = 0; - int minX3 = 0; - - int maxX1 = int(distributions->getNX1()); - int maxX2 = int(distributions->getNX2()); - int maxX3 = int(distributions->getNX3()); - - maxX1 -= 2; - maxX2 -= 2; - maxX3 -= 2; - - for(int ix3=minX3; ix3<=maxX3; ix3++) - { - for(int ix2=minX2; ix2<=maxX2; ix2++) - { - for(int ix1=minX1; ix1<=maxX1; ix1++) - { - if(!bcArray->isUndefined(ix1,ix2,ix3) && !bcArray->isSolid(ix1,ix2,ix3)) - { - ////////////////////////////////////////////////////////////////////////// - //read distribution - //////////////////////////////////////////////////////////////////////////// - distributions->getDistribution(f, ix1, ix2, ix3); - ////////////////////////////////////////////////////////////////////////// - //compute velocity - ////////////////////////////////////////////////////////////////////////// - LBMReal vx,vy,vz,rho; - calcMacros(f,rho,vx,vy,vz); - double press = D3Q27System::calcPress(f,rho,vx,vy,vz); - - ////////////////////////////////////////////////////////////////////////// - //compute average values - ////////////////////////////////////////////////////////////////////////// - - LBMReal timeStepAfterResetRMS=(double)(timeStep-resetStepRMS)/((double)averageInterval); - LBMReal timeStepAfterResetMeans=(double)(timeStep-resetStepMeans)/((double)averageInterval); - - //mean velocity - (*av)(AvVx,ix1,ix2,ix3) = ((*av)(AvVx,ix1,ix2,ix3)*timeStepAfterResetMeans + vx)/(timeStepAfterResetMeans+1.0); - (*av)(AvVy,ix1,ix2,ix3) = ((*av)(AvVy,ix1,ix2,ix3)*timeStepAfterResetMeans + vy)/(timeStepAfterResetMeans+1.0); - (*av)(AvVz,ix1,ix2,ix3) = ((*av)(AvVz,ix1,ix2,ix3)*timeStepAfterResetMeans + vz)/(timeStepAfterResetMeans+1.0); - - //rms - (*av)(AvVxx,ix1,ix2,ix3) = ((vx-(*av)(AvVx,ix1,ix2,ix3))*(vx-(*av)(AvVx,ix1,ix2,ix3)) + - (*av)(AvVxx,ix1,ix2,ix3)*timeStepAfterResetRMS)/(timeStepAfterResetRMS+1.0); - (*av)(AvVyy,ix1,ix2,ix3) = ((vy-(*av)(AvVy,ix1,ix2,ix3))*(vy-(*av)(AvVy,ix1,ix2,ix3)) + - (*av)(AvVyy,ix1,ix2,ix3)*timeStepAfterResetRMS)/(timeStepAfterResetRMS+1.0); - (*av)(AvVzz,ix1,ix2,ix3) = ((vz-(*av)(AvVz,ix1,ix2,ix3))*(vz-(*av)(AvVz,ix1,ix2,ix3)) + - (*av)(AvVzz,ix1,ix2,ix3)*timeStepAfterResetRMS)/(timeStepAfterResetRMS+1.0); - - //cross-correlations - (*av)(AvVxy,ix1,ix2,ix3) = ((vx-(*av)(AvVx,ix1,ix2,ix3))*(vy-(*av)(AvVy,ix1,ix2,ix3)) + - (*av)(AvVxy,ix1,ix2,ix3)*timeStepAfterResetRMS)/(timeStepAfterResetRMS+1.0); - (*av)(AvVxz,ix1,ix2,ix3) = ((vx-(*av)(AvVx,ix1,ix2,ix3))*(vz-(*av)(AvVz,ix1,ix2,ix3)) + - (*av)(AvVxz,ix1,ix2,ix3)*timeStepAfterResetRMS)/(timeStepAfterResetRMS+1.0); - (*av)(AvVyz,ix1,ix2,ix3) = ((vy-(*av)(AvVy,ix1,ix2,ix3))*(vz-(*av)(AvVz,ix1,ix2,ix3)) + - (*av)(AvVyz,ix1,ix2,ix3)*timeStepAfterResetRMS)/(timeStepAfterResetRMS+1.0); - - //mean and rms press - (*av)(AvP,ix1,ix2,ix3) = ((*av)(AvP,ix1,ix2,ix3)*timeStepAfterResetMeans + press)/(timeStepAfterResetMeans+1.0); - (*av)(AvPrms,ix1,ix2,ix3) = ((press-(*av)(AvP,ix1,ix2,ix3))*(press-(*av)(AvP,ix1,ix2,ix3)) + - (*av)(AvPrms,ix1,ix2,ix3)*timeStepAfterResetRMS)/(timeStepAfterResetRMS+1.0); - - ////////////////////////////////////////////////////////////////////////// - } - } - } - } - } - } - } -} -//////////////////////////////////////////////////////////////////////////// -//void AverageValuesCoProcessor::initPlotData(double step) -//{ -// CommunicatorPtr comm = Communicator::getInstance(); -// if (comm->getProcessID() == comm->getRoot()) -// { -// std::ofstream ostr; -// string fname = path + "_PlotData_" + UbSystem::toString(step) + ".txt"; -// ostr.open(fname.c_str(), std::ios_base::out); -// if(!ostr) -// { -// ostr.clear(); -// string path = UbSystem::getPathFromString(fname); -// if(path.size()>0){ UbSystem::makeDirectory(path); ostr.open(fname.c_str(), std::ios_base::out);} -// if(!ostr) throw UbException(UB_EXARGS,"couldn't open file "+fname); -// } -// ostr << "Time"<< "\t" <<"Ref.Time"<<"\t"<< "Z_Coor"<< "\t" << "Pore fraction" << "\t"; -// ostr << "Vx" << "\t" << "Vy" << "\t" << "Vz" << "\t"; -// ostr << "TSx" << "\t" << "TSy"<< "\t" << "TSz"<< "TSxz"; -// ostr << endl; -// ostr.close(); -// } -//} -////////////////////////////////////////////////////////////////////////////// -//void AverageValuesCoProcessor::collectPlotData(double step) -//{ -// -// double hminX1 = 0.9; -// double hminX2 = 0.0; -// double hmaxX1 = 0.95; -// double hmaxX2 = 0.01; //systemabmessungen world units -// -// // 3 level platte standard: -// double hX3_level[] = {0.305, 0.309,0.3365,0.35}; -// //0.004, 0,0365,0.045 -// //musis: 3 level refinement -// //double hX3_level[] = {0.42, 0.28, 0.105, 0.0}; //refinement coords -// //bsislevel von 0.42-0.28,... (level 0 bis 2 , 3 insgesamt) -// //musis: 4 level refinement -// //double hX3_level[] = {0.42, 0.3, 0.195, 0.078, 0.0}; -// //musis: 5 level refinement -// //double hX3_level[] = {0.396, 0.28, 0.18, 0.08, 0.006, 0.0}; -// -// ostringstream Str; -// Str << step; -// string step2string(Str.str()); -// string fname = path + "_PlotZ_" + step2string + ".txt"; -// -// -// for(int level = minInitLevel; level<=maxInitLevel;level++) -// { -// double dx = grid->getDeltaX(level); -// -// for (double hi =hX3_level[level]; hi >= hX3_level[level+1]; hi=hi-dx ){ -// D3Q27IntegrateValuesHelper h1(grid, comm, -// hminX1, hminX2, hi, -// hmaxX1, hmaxX2, hi-dx); -// -// h1.calculateAV(); -// double nn1 = h1.getNumberOfNodes(); -// double ns1 = h1.getNumberOfSolids(); -// if (nn1 > 0.0){ -// // get data and write into txt files -// if (comm->getProcessID() == comm->getRoot()) -// { -// int istep = static_cast<int>(step); -// std::ofstream ostr; -// -// double AvVx1 = h1.getAvVx1()/nn1; -// double AvVx2 = h1.getAvVx2()/nn1; -// double AvVx3 = h1.getAvVx3()/nn1; -// -// double AvTSx1 = h1.getTSx1()/nn1; -// double AvTSx2 = h1.getTSx2()/nn1; -// double AvTSx3 = h1.getTSx3()/nn1; -// -// double AvTSx1x3 = h1.getTSx1x3()/nn1; -// -// ostr.open(fname.c_str(), std::ios_base::out | std::ios_base::app); -// if(!ostr) -// { -// ostr.clear(); -// string path = UbSystem::getPathFromString(fname); -// if(path.size()>0){ UbSystem::makeDirectory(path); ostr.open(fname.c_str(), std::ios_base::out | std::ios_base::app);} -// if(!ostr) throw UbException(UB_EXARGS,"couldn't open file "+fname); -// } -// ostr << istep << "\t" << resetStep << "\t" << hi+0.5*dx << "\t" << nn1/(nn1+ns1)*100.0 << "%\t"; -// ostr << AvVx1 << "\t" << AvVx2 << "\t" << AvVx3 << "\t"; -// ostr << AvTSx1<< "\t" << AvTSx2<< "\t" << AvTSx3<< "\t" << AvTSx1x3; -// ostr << endl; -// ostr.close(); -// -// } -// } -// } -// -// } -//} - diff --git a/src/VirtualFluids/CoProcessors/AverageValuesCoProcessor.h b/src/VirtualFluids/CoProcessors/AverageValuesCoProcessor.h deleted file mode 100644 index 88ca2434c..000000000 --- a/src/VirtualFluids/CoProcessors/AverageValuesCoProcessor.h +++ /dev/null @@ -1,97 +0,0 @@ -#ifndef AverageValuesCoProcessor_H -#define AverageValuesCoProcessor_H - -#include <memory> -#include <vector> -#include <string> - -#include "CoProcessor.h" -#include "LBMSystem.h" -#include "UbTuple.h" - -class AverageValuesCoProcessor; -typedef std::shared_ptr<AverageValuesCoProcessor> AverageValuesCoProcessorPtr; - -class UbScheduler; -class WbWriter; -class Grid3D; -class Block3D; - -//! \brief Computes the time averaged mean velocity and RMS values and writes to parallel .vtk -//! \details writes at given time intervals specified in scheduler (s), does averaging according to scheduler (Avs) and resets according to scheduler (rs). <br> -//! Computes the time averaged mean velocity \f$ u_{mean}=\frac{1}{N}\sum\limits_{i=1}^n u_{i} \f$ and RMS of fluctuations. You need to calculate a square root before plotting RMS. <br> -// -//! \author Sonja Uphoff, Kostyantyn Kucher -// \f$ u_{mean}=\frac{1}{N}\sum\limits_{i=1}^n u_{i} \f$ -class AverageValuesCoProcessor : public CoProcessor -{ -public: - AverageValuesCoProcessor(); - AverageValuesCoProcessor(std::shared_ptr<Grid3D> grid, const std::string& path, WbWriter* const writer, - std::shared_ptr<UbScheduler> s, std::shared_ptr<UbScheduler> Avs, std::shared_ptr<UbScheduler> rsMeans, std::shared_ptr<UbScheduler> rsRMS, bool restart); - //! Make update - void process(double step); - //! Resets averaged velocity and RMS-values according to ResetSceduler - void reset(double step); -protected: - //! Prepare data and write in .vtk file - void collectData(double step); - //! Reset data - void resetDataRMS(double step); - void resetDataMeans(double step); - //! prepare data - void addData(const std::shared_ptr<Block3D> block); - void clearData(); - //! Computes average and RMS values of macroscopic quantities - void calculateAverageValues(double timeStep); - ////! write .txt file spatial intergrated averaged value, fluctuation, porous features - //void collectPlotDataZ(double step); - ////! create txt file and write head line - //void initPlotDataZ(double step); - -private: - std::vector<UbTupleFloat3> nodes; - std::vector<UbTupleInt8> cells; - std::vector<std::string> datanames; - std::vector<std::vector<double> > data; - std::vector<std::vector<std::shared_ptr<Block3D>> > blockVector; - int minInitLevel; //min init level - int maxInitLevel; - int gridRank; - int resetStepRMS; - int resetStepMeans; - double averageInterval; - std::string path; - WbWriter* writer; - bool restart, compressible; - std::shared_ptr<UbScheduler> averageScheduler; //additional scheduler to averaging after a given interval - std::shared_ptr<UbScheduler> resetSchedulerRMS; //additional scheduler to restart averaging after a given interval - std::shared_ptr<UbScheduler> resetSchedulerMeans; //additional scheduler to restart averaging after a given interval - //labels for the different components, e.g. AvVxx for time averaged RMS: 1/n SUM((U-Umean)^2) - //you need to calculate a square root before plotting RMS - enum Values{AvVx = 0, AvVy = 1, AvVz = 2, AvVxx = 3, AvVyy = 4, AvVzz = 5, AvVxy = 6, AvVxz = 7, AvVyz = 8, AvP = 9, AvPrms = 10}; - - typedef void (*CalcMacrosFct)(const LBMReal* const& /*feq[27]*/,LBMReal& /*(d)rho*/, LBMReal& /*vx1*/, LBMReal& /*vx2*/, LBMReal& /*vx3*/); - CalcMacrosFct calcMacros; - - friend class boost::serialization::access; - template<class Archive> - void serialize(Archive & ar, const unsigned int version) - { - ar & boost::serialization::base_object<CoProcessor>(*this); - ar & path; - ar & blockVector; - ar & minInitLevel; - ar & maxInitLevel; - ar & gridRank; - ar & writer; - ar & resetStepRMS; - ar & resetStepMeans; - ar & averageInterval; - ar & averageScheduler; - ar & resetSchedulerRMS; - ar & resetSchedulerMeans; - ar & compressible; - } -}; -#endif diff --git a/src/VirtualFluids/CoProcessors/CMakePackage.txt b/src/VirtualFluids/CoProcessors/CMakePackage.txt deleted file mode 100644 index 1b8416f01..000000000 --- a/src/VirtualFluids/CoProcessors/CMakePackage.txt +++ /dev/null @@ -1,2 +0,0 @@ -GET_FILENAME_COMPONENT( CURRENT_DIR ${CMAKE_CURRENT_LIST_FILE} PATH) -COLLECT_PACKAGE_DATA_WITH_OPTION(${CURRENT_DIR} ALL_SOURCES) diff --git a/src/VirtualFluids/CoProcessors/CalculateForcesCoProcessor.cpp b/src/VirtualFluids/CoProcessors/CalculateForcesCoProcessor.cpp deleted file mode 100644 index 08d0e02f6..000000000 --- a/src/VirtualFluids/CoProcessors/CalculateForcesCoProcessor.cpp +++ /dev/null @@ -1,112 +0,0 @@ -#include "CalculateForcesCoProcessor.h" -#include "BCProcessor.h" - -#include "Communicator.h" -#include "D3Q27Interactor.h" -#include "ForceCalculator.h" -#include "UbScheduler.h" -#include "Grid3D.h" - -CalculateForcesCoProcessor::CalculateForcesCoProcessor( Grid3DPtr grid, UbSchedulerPtr s, - const std::string &path, - CommunicatorPtr comm , - double v, double a, - std::shared_ptr<ForceCalculator> forceCalculator) : - CoProcessor(grid, s), - path(path), comm(comm), - v(v), a(a), - forceCalculator(forceCalculator) -{ - if (comm->getProcessID() == comm->getRoot()) - { - std::ofstream ostr; - std::string fname = path; - ostr.open(fname.c_str(), std::ios_base::out | std::ios_base::app); - if(!ostr) - { - ostr.clear(); - std::string path = UbSystem::getPathFromString(fname); - if(path.size()>0){ UbSystem::makeDirectory(path); ostr.open(fname.c_str(), std::ios_base::out | std::ios_base::app);} - if(!ostr) throw UbException(UB_EXARGS,"couldn't open file "+fname); - } - ostr.width(12); - ostr << "step" << "\t"; - ostr.width(12); - ostr << "Cx" << "\t"; - ostr.width(12); - ostr << "Cy" << "\t"; - ostr.width(12); - ostr << "Cz" << std::endl; - ostr.close(); - } -} -////////////////////////////////////////////////////////////////////////// -CalculateForcesCoProcessor::~CalculateForcesCoProcessor() -{ - -} -////////////////////////////////////////////////////////////////////////// -void CalculateForcesCoProcessor::process( double step ) -{ - if(scheduler->isDue(step) ) - collectData(step); - - UBLOG(logDEBUG3, "D3Q27ForcesCoProcessor::update:" << step); -} -////////////////////////////////////////////////////////////////////////// -void CalculateForcesCoProcessor::collectData( double step ) -{ - forceCalculator->calculateForces(this->interactors); - - if (comm->getProcessID() == comm->getRoot()) - { - int istep = static_cast<int>(step); - std::ofstream ostr; - std::string fname = path; - ostr.open(fname.c_str(), std::ios_base::out | std::ios_base::app); - if(!ostr) - { - ostr.clear(); - std::string path = UbSystem::getPathFromString(fname); - if(path.size()>0){ UbSystem::makeDirectory(path); ostr.open(fname.c_str(), std::ios_base::out | std::ios_base::app);} - if(!ostr) throw UbException(UB_EXARGS,"couldn't open file "+fname); - } - - - Vector3D globalForces = forceCalculator->getGlobalForces(); - double C1 = getCoefficient(globalForces[0]); - double C2 = getCoefficient(globalForces[1]); - double C3 = getCoefficient(globalForces[2]); - - - ostr.width(12); - ostr.setf(std::ios::fixed); - ostr << istep << "\t"; - write(&ostr, C1, (char*)"\t"); - write(&ostr, C2, (char*)"\t"); - write(&ostr, C3, (char*)"\t"); - ostr << std::endl; - ostr.close(); - } -} - -double CalculateForcesCoProcessor::getCoefficient(double force) -{ - return 2.0* force / (v*v*a); -} - -void CalculateForcesCoProcessor::addInteractor( D3Q27InteractorPtr interactor ) -{ - interactors.push_back(interactor); -} - -void CalculateForcesCoProcessor::write(std::ofstream *fileObject, double value, char *separator) -{ - (*fileObject).width(12); - //(*fileObject).precision(2); - (*fileObject).setf(std::ios::fixed); - (*fileObject) << value; - (*fileObject) << separator; -} - - diff --git a/src/VirtualFluids/CoProcessors/CalculateForcesCoProcessor.h b/src/VirtualFluids/CoProcessors/CalculateForcesCoProcessor.h deleted file mode 100644 index ac7cf0119..000000000 --- a/src/VirtualFluids/CoProcessors/CalculateForcesCoProcessor.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - * D3Q27ForcesCoProcessor.h - * - * Created on: 29.09.2012 - * Author: K. Kucher - */ - -#ifndef D3Q27ForcesCoProcessor_H -#define D3Q27ForcesCoProcessor_H - -#include <memory> -#include <string> -#include <vector> - -#include "CoProcessor.h" - -class ForceCalculator; -class Communicator; -class Grid3D; -class UbScheduler; -class D3Q27Interactor; - -class CalculateForcesCoProcessor: public CoProcessor -{ -public: - //! Constructor - //! \param v - velocity of fluid in LB units - //! \param a - area of object in LB units - CalculateForcesCoProcessor(std::shared_ptr<Grid3D> grid, std::shared_ptr<UbScheduler> s, const std::string& path, std::shared_ptr<Communicator> comm, double v, double a, - std::shared_ptr<ForceCalculator> forceCalculator); - virtual ~CalculateForcesCoProcessor(); - - void process(double step) override; - - void addInteractor(std::shared_ptr<D3Q27Interactor> interactor); - -protected: - void collectData(double step); - double getCoefficient(double force); - void write(std::ofstream *fileObject, double value, char *separator); - -private: - std::shared_ptr<ForceCalculator> forceCalculator; - std::string path; - std::shared_ptr<Communicator> comm; - std::vector<std::shared_ptr<D3Q27Interactor> > interactors; - - double v; //!< is the speed of the object relative to the fluid - double a; //!< is the reference area - - - friend class boost::serialization::access; - template<class Archive> - void serialize(Archive & ar, const unsigned int version) - { - ar & boost::serialization::base_object<CoProcessor>(*this); - ar & path; - ar & v; - ar & a; - ar & interactors; - } -}; - - -#endif /* D3Q27ForcesCoProcessor_H */ diff --git a/src/VirtualFluids/CoProcessors/CoProcessor.cpp b/src/VirtualFluids/CoProcessors/CoProcessor.cpp deleted file mode 100644 index be71b9c22..000000000 --- a/src/VirtualFluids/CoProcessors/CoProcessor.cpp +++ /dev/null @@ -1,31 +0,0 @@ -#include "CoProcessor.h" - -#include <basics/utilities/UbScheduler.h> -#include <boost/bind.hpp> - - -CoProcessor::CoProcessor() -{ -} - -CoProcessor::CoProcessor(std::shared_ptr<Grid3D> grid, UbSchedulerPtr s): grid(grid), scheduler(s) -{ - connection = grid->connect(boost::bind(&CoProcessor::process, this, _1)); -} - -CoProcessor::~CoProcessor() -{ - grid->disconnect(connection); -} - -void CoProcessor::disconnect() -{ - grid->disconnect(connection); -} - -void CoProcessor::reconnect(std::shared_ptr<Grid3D> grid) -{ - this->grid = grid; - this->grid->disconnect(connection); - connection = this->grid->connect(boost::bind(&CoProcessor::process, this, _1)); -} diff --git a/src/VirtualFluids/CoProcessors/CoProcessor.h b/src/VirtualFluids/CoProcessors/CoProcessor.h deleted file mode 100644 index 5df8815c6..000000000 --- a/src/VirtualFluids/CoProcessors/CoProcessor.h +++ /dev/null @@ -1,45 +0,0 @@ -#ifndef CoProcessor_H -#define CoProcessor_H - -#include <memory> - -#include <VirtualFluidsDefinitions.h> - - -#include <boost/serialization/serialization.hpp> - -#include "Grid3D.h" - -class UbScheduler; - -class CoProcessor; -typedef std::shared_ptr<CoProcessor> CoProcessorPtr; - -class VF_PUBLIC CoProcessor -{ -public: - CoProcessor(); - CoProcessor(std::shared_ptr<Grid3D> grid, std::shared_ptr<UbScheduler> s); - virtual ~CoProcessor(); - - virtual void process(double step) = 0; - - virtual void disconnect(); - virtual void reconnect(std::shared_ptr<Grid3D> grid); - -protected: - std::shared_ptr<Grid3D> grid; - std::shared_ptr<UbScheduler> scheduler; - Grid3D::connection_t connection; - -private: - friend class boost::serialization::access; - template<class Archive> - void serialize(Archive & ar, const unsigned int version) - { - //ar & grid; - ar & scheduler; - } -}; -#endif - diff --git a/src/VirtualFluids/CoProcessors/DecreaseViscosityCoProcessor.cpp b/src/VirtualFluids/CoProcessors/DecreaseViscosityCoProcessor.cpp deleted file mode 100644 index ef18eaa66..000000000 --- a/src/VirtualFluids/CoProcessors/DecreaseViscosityCoProcessor.cpp +++ /dev/null @@ -1,83 +0,0 @@ -/* -* DecreaseViscosityCoProcessor -* -* Created on: 10.05.2013 -* Author: uphoff -*/ - -#include "DecreaseViscosityCoProcessor.h" - -#include <vector> - -#include "LBMKernel.h" -#include "Communicator.h" -#include "UbScheduler.h" -#include "Grid3D.h" -#include "Block3D.h" - -DecreaseViscosityCoProcessor::DecreaseViscosityCoProcessor(Grid3DPtr grid, UbSchedulerPtr s, - mu::Parser* nueFunc, CommunicatorPtr comm) - - : CoProcessor(grid, s) - ,nueFunc(nueFunc) - ,comm(comm) -{ - if (comm->getProcessID() == comm->getRoot()) - { - - } -} -////////////////////////////////////////////////////////////////////////// -DecreaseViscosityCoProcessor::~DecreaseViscosityCoProcessor() -{ -} -////////////////////////////////////////////////////////////////////////// -void DecreaseViscosityCoProcessor::process(double step) -{ - if(scheduler->isDue(step) ) - setViscosity(step); -} -////////////////////////////////////////////////////////////////////////// -void DecreaseViscosityCoProcessor::setViscosity(double step) -{ - - UBLOG(logDEBUG3, "DecreaseViscosityCoProcessor::update:" << step); - int gridRank = grid->getRank(); - int minInitLevel = this->grid->getCoarsestInitializedLevel(); - int maxInitLevel = this->grid->getFinestInitializedLevel(); - - if (comm->getProcessID() == comm->getRoot()) - { - - for(int level = minInitLevel; level<=maxInitLevel;level++) - { - std::vector<Block3DPtr> blockVector; - grid->getBlocks(level, gridRank, blockVector); - for(Block3DPtr block : blockVector) - { - ILBMKernelPtr kernel = block->getKernel(); - } - } - - int istep = static_cast<int>(step); - this->timeStep = istep; - nueFunc->DefineVar("t" , &this->timeStep); - double nue=nueFunc->Eval(); - - for(int level = minInitLevel; level<=maxInitLevel;level++) - { - std::vector<Block3DPtr> blockVector; - grid->getBlocks(level, gridRank, blockVector); - for(Block3DPtr block : blockVector) - { - ILBMKernelPtr kernel =block->getKernel(); - if(kernel) - { - LBMReal collFactor = LBMSystem::calcCollisionFactor(nue, block->getLevel()); - kernel->setCollisionFactor(collFactor); - } - } - } - - } -} diff --git a/src/VirtualFluids/CoProcessors/DecreaseViscosityCoProcessor.h b/src/VirtualFluids/CoProcessors/DecreaseViscosityCoProcessor.h deleted file mode 100644 index 49e60c1bb..000000000 --- a/src/VirtualFluids/CoProcessors/DecreaseViscosityCoProcessor.h +++ /dev/null @@ -1,51 +0,0 @@ -#ifndef DecreaseViscosityCoProcessor_H -#define DecreaseViscosityCoProcessor_H - -#include <memory> - -#include "CoProcessor.h" -#include "IntegrateValuesHelper.h" -#include "LBMUnitConverter.h" - -#include "MuParser/include/muParser.h" - - -class DecreaseViscosityCoProcessor; -typedef std::shared_ptr<DecreaseViscosityCoProcessor> DecreaseViscosityCoProcessorPtr; - -class UbScheduler; -class Grid3D; -class Communicator; - -//! \brief The class sets viscosity/collision factor according to a previously defined function in time. -//! \details initialization in test case (example): -//! \code{.cpp} -//! mu::Parser decrViscFunc; //define a mu-parser function -//! decrViscFunc.SetExpr("nue0+c0/(t+1)/(t+1)"); //this function is time-dependent, the viscosity decreases a 1/t^2 -//! decrViscFunc.DefineConst("nue0", nueLB); -//! decrViscFunc.DefineConst("c0", 0.1); //constants such as c0 controll how fast the viscosity decreasis -//! UbSchedulerPtr DecrViscSch(new UbScheduler()); //the CoProcessor is called according to a Scheduler -//! DecrViscSch->addSchedule(10,10,1000); //in this case the viscosity is reset every 10 timesteps for the first 1000 timesteps -//! DecreaseViscosityCoProcessor decrViscPPPtr(grid, DecrViscSch,&decrViscFunc, comm); -//! \endcode -//! \author Sonja Uphoff - -class DecreaseViscosityCoProcessor: public CoProcessor -{ -public: - DecreaseViscosityCoProcessor(std::shared_ptr<Grid3D> grid, std::shared_ptr<UbScheduler> s, - mu::Parser* nueFunc, std::shared_ptr<Communicator> comm); - virtual ~DecreaseViscosityCoProcessor(); - //! calls collect PostprocessData. - void process(double step); -protected: - //! resets the collision factor depending on the current timestep. - void setViscosity(double step); - std::shared_ptr<Communicator> comm; -private: - mutable mu::value_type timeStep; - mu::Parser* nueFunc; -}; - - -#endif /* DecreaseViscosityCoProcessor_H_ */ diff --git a/src/VirtualFluids/CoProcessors/EmergencyExitCoProcessor.cpp b/src/VirtualFluids/CoProcessors/EmergencyExitCoProcessor.cpp deleted file mode 100644 index b21cf40f4..000000000 --- a/src/VirtualFluids/CoProcessors/EmergencyExitCoProcessor.cpp +++ /dev/null @@ -1,75 +0,0 @@ -#include "EmergencyExitCoProcessor.h" -#include <basics/utilities/UbFileOutputASCII.h> -#include <basics/utilities/UbFileInputASCII.h> -#include "UbLogger.h" -#include "UbScheduler.h" -#include "Communicator.h" -#include "RestartCoProcessor.h" -#include "Grid3D.h" - -EmergencyExitCoProcessor::EmergencyExitCoProcessor( Grid3DPtr grid, UbSchedulerPtr s, - const std::string& path, - RestartCoProcessorPtr rp, CommunicatorPtr comm) : - CoProcessor(grid, s), - path(path), - rp(rp), - comm(comm) -{ - this->path = path + "/exit"; - metafile = this->path + "/stop.txt"; - if (comm->getProcessID() == comm->getRoot()) - { - //checkMetafile(); - writeMetafile(false); - } - comm->barrier(); -} -////////////////////////////////////////////////////////////////////////// -EmergencyExitCoProcessor::~EmergencyExitCoProcessor() -{ - -} -////////////////////////////////////////////////////////////////////////// -void EmergencyExitCoProcessor::process( double step ) -{ - if(scheduler->isDue(step) ) - collectData(step); - - UBLOG(logDEBUG3, "EmergencyExitCoProcessor::update:" << step); -} - -void EmergencyExitCoProcessor::collectData( double step ) -{ - if(readMetafile()) - { - rp->doCheckPoint((int)step); - if(comm->getProcessID() == comm->getRoot()) UBLOG(logINFO,"EmergencyExitCoProcessor save step: " << step); - comm->barrier(); - exit(EXIT_SUCCESS); - } -} -////////////////////////////////////////////////////////////////////////// -void EmergencyExitCoProcessor::writeMetafile(int status ) -{ - UbFileOutputASCII out(metafile); - out.writeBool(false); -} -////////////////////////////////////////////////////////////////////////// -bool EmergencyExitCoProcessor::readMetafile() -{ - UbFileInputASCII in(metafile); - return in.readBool(); -} -////////////////////////////////////////////////////////////////////////// -void EmergencyExitCoProcessor::checkMetafile() -{ - std::ifstream file(metafile.c_str()); - if (!file.is_open()) - { - writeMetafile(false); - return; - } - file.close(); -} - - diff --git a/src/VirtualFluids/CoProcessors/EmergencyExitCoProcessor.h b/src/VirtualFluids/CoProcessors/EmergencyExitCoProcessor.h deleted file mode 100644 index 20342d06b..000000000 --- a/src/VirtualFluids/CoProcessors/EmergencyExitCoProcessor.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * EmergencyExitCoProcessor.h - * - * Created on: 05.10.2012 - * Author: K. Kucher - */ - -#ifndef EmergencyExitCoProcessor_H -#define EmergencyExitCoProcessor_H - -#include <memory> -#include <string> - -#include "CoProcessor.h" - -class RestartCoProcessor; -class Communicator; -class Grid3D; -class UbScheduler; - -class EmergencyExitCoProcessor; -typedef std::shared_ptr<EmergencyExitCoProcessor> EmergencyExitCoProcessorPtr; - -class EmergencyExitCoProcessor : public CoProcessor -{ -public: - EmergencyExitCoProcessor(std::shared_ptr<Grid3D> grid, std::shared_ptr<UbScheduler> s, const std::string& path, std::shared_ptr<RestartCoProcessor> rp, std::shared_ptr<Communicator> comm); - virtual ~EmergencyExitCoProcessor(); - - void process(double step) override; - -protected: - void collectData(double step); - void writeMetafile(int status); - bool readMetafile(); - void checkMetafile(); - -private: - std::string path; - std::shared_ptr<Communicator> comm; - std::shared_ptr<RestartCoProcessor> rp; - std::string metafile; -}; - - -#endif /* EmergencyExitCoProcessor_H */ diff --git a/src/VirtualFluids/CoProcessors/ForceCalculator.cpp b/src/VirtualFluids/CoProcessors/ForceCalculator.cpp deleted file mode 100644 index 355154d89..000000000 --- a/src/VirtualFluids/CoProcessors/ForceCalculator.cpp +++ /dev/null @@ -1,138 +0,0 @@ -#include "ForceCalculator.h" -#include "BCProcessor.h" - -#include "Communicator.h" -#include "D3Q27Interactor.h" -#include "DataSet3D.h" -#include "LBMKernel.h" -#include "Block3D.h" -#include "BoundaryConditions.h" -#include "BCArray3D.h" - -ForceCalculator::ForceCalculator(CommunicatorPtr comm) : comm(comm), forceX1global(0), forceX2global(0), forceX3global(0) -{ - -} - -ForceCalculator::~ForceCalculator() -{ - -} - - - - -Vector3D ForceCalculator::getForces(int x1, int x2, int x3, DistributionArray3DPtr distributions, BoundaryConditionsPtr bc, const Vector3D& boundaryVelocity) const -{ - double forceX1 = 0; - double forceX2 = 0; - double forceX3 = 0; - if (bc) - { - for (int fdir = D3Q27System::FSTARTDIR; fdir <= D3Q27System::FENDDIR; fdir++) - { - if (bc->hasNoSlipBoundaryFlag(fdir) || bc->hasVelocityBoundaryFlag(fdir)) - { - const int invDir = D3Q27System::INVDIR[fdir]; - const double f = distributions->getDistributionInvForDirection(x1, x2, x3, invDir); - const double fnbr = distributions->getDistributionInvForDirection(x1 + D3Q27System::DX1[invDir], x2 + D3Q27System::DX2[invDir], x3 + D3Q27System::DX3[invDir], fdir); - - double correction[3] = { 0.0, 0.0, 0.0 }; - if(bc->hasVelocityBoundaryFlag(fdir)) - { - const double forceTerm = f - fnbr; - correction[0] = forceTerm * boundaryVelocity[0]; - correction[1] = forceTerm * boundaryVelocity[1]; - correction[2] = forceTerm * boundaryVelocity[2]; - } - - //UBLOG(logINFO, "c, c * bv(x,y,z): " << correction << ", " << correction * val<1>(boundaryVelocity) << ", " << correction * val<2>(boundaryVelocity) << ", " << correction * val<3>(boundaryVelocity)); - - // force consists of the MEM part and the galilean invariance correction including the boundary velocity - forceX1 += (f + fnbr) * D3Q27System::DX1[invDir] - correction[0]; - forceX2 += (f + fnbr) * D3Q27System::DX2[invDir] - correction[1]; - forceX3 += (f + fnbr) * D3Q27System::DX3[invDir] - correction[2]; - } - } - } - return Vector3D(forceX1, forceX2, forceX3); -} - -void ForceCalculator::calculateForces(std::vector<D3Q27InteractorPtr> interactors) -{ - forceX1global = 0.0; - forceX2global = 0.0; - forceX3global = 0.0; - - for (const D3Q27InteractorPtr interactor : interactors) - { - for (BcNodeIndicesMap::value_type t : interactor->getBcNodeIndicesMap()) - { - double forceX1 = 0.0; - double forceX2 = 0.0; - double forceX3 = 0.0; - - Block3DPtr block = t.first; - ILBMKernelPtr kernel = block->getKernel(); - BCArray3DPtr bcArray = kernel->getBCProcessor()->getBCArray(); - DistributionArray3DPtr distributions = kernel->getDataSet()->getFdistributions(); - distributions->swap(); - - std::set< std::vector<int> >& transNodeIndices = t.second; - for (std::vector<int> node : transNodeIndices) - { - int x1 = node[0]; - int x2 = node[1]; - int x3 = node[2]; - - if (kernel->isInsideOfDomain(x1, x2, x3) && bcArray->isFluid(x1, x2, x3)) - { - BoundaryConditionsPtr bc = bcArray->getBC(x1, x2, x3); - Vector3D forceVec = getForces(x1, x2, x3, distributions, bc); - forceX1 += forceVec[0]; - forceX2 += forceVec[1]; - forceX3 += forceVec[2]; - } - } - //if we have got discretization with more level - // deltaX is LBM deltaX and equal LBM deltaT - double deltaX = LBMSystem::getDeltaT(block->getLevel()); //grid->getDeltaT(block); - double deltaXquadrat = deltaX*deltaX; - forceX1 *= deltaXquadrat; - forceX2 *= deltaXquadrat; - forceX3 *= deltaXquadrat; - - distributions->swap(); - - forceX1global += forceX1; - forceX2global += forceX2; - forceX3global += forceX3; - } - } - gatherGlobalForces(); -} - -void ForceCalculator::gatherGlobalForces() -{ - std::vector<double> values{ forceX1global , forceX2global, forceX3global }; - std::vector<double> rvalues = comm->gather(values); - - if (comm->isRoot()) - { - forceX1global = 0.0; - forceX2global = 0.0; - forceX3global = 0.0; - - for (int i = 0; i < (int)rvalues.size(); i += 3) - { - forceX1global += rvalues[i]; - forceX2global += rvalues[i + 1]; - forceX3global += rvalues[i + 2]; - } - } -} - -Vector3D ForceCalculator::getGlobalForces() const -{ - return Vector3D(forceX1global, forceX2global, forceX3global); -} diff --git a/src/VirtualFluids/CoProcessors/ForceCalculator.h b/src/VirtualFluids/CoProcessors/ForceCalculator.h deleted file mode 100644 index f9f2c90e4..000000000 --- a/src/VirtualFluids/CoProcessors/ForceCalculator.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * ForceCalculator.h - * - * Created on: 25.10.2017 - * Author: S. Peters - */ - -#ifndef ForceCalculator_H -#define ForceCalculator_H - -#include <vector> -#include <memory> - -#include <VirtualFluidsDefinitions.h> -#include "VirtualFluidsBasics/basics/utilities/Vector3D.h" - -class D3Q27Interactor; -class Communicator; -class DistributionArray3D; -class BoundaryConditions; - -class VF_PUBLIC ForceCalculator -{ -public: - ForceCalculator(std::shared_ptr<Communicator> comm); - virtual ~ForceCalculator(); - - void calculateForces(std::vector<std::shared_ptr<D3Q27Interactor> > interactors); - Vector3D getForces(int x1, int x2, int x3, std::shared_ptr<DistributionArray3D> distributions, std::shared_ptr<BoundaryConditions> bc, const Vector3D& boundaryVelocity = Vector3D(0.0, 0.0, 0.0)) const; - - Vector3D getGlobalForces() const; - -private: - void gatherGlobalForces(); - - std::shared_ptr<Communicator> comm; - - double forceX1global; - double forceX2global; - double forceX3global; -}; - - -#endif diff --git a/src/VirtualFluids/CoProcessors/InSituCatalystCoProcessor.cpp b/src/VirtualFluids/CoProcessors/InSituCatalystCoProcessor.cpp deleted file mode 100644 index e11dd876d..000000000 --- a/src/VirtualFluids/CoProcessors/InSituCatalystCoProcessor.cpp +++ /dev/null @@ -1,349 +0,0 @@ -#ifdef VF_CATALYST - -#include "InSituCatalystCoProcessor.h" -#include <LBMKernel.h> -#include <D3Q27ETBCProcessor.h> -#include <vector> -#include <string> - -#include <vtkCellType.h> -#include <vtkPointData.h> -#include <vtkXMLUnstructuredGridWriter.h> - -#include <iostream> -#include <fstream> - -using namespace std; - -InSituCatalystCoProcessor::InSituCatalystCoProcessor() -{ - -} -////////////////////////////////////////////////////////////////////////// -InSituCatalystCoProcessor::InSituCatalystCoProcessor(Grid3DPtr grid, UbSchedulerPtr s, std::string script) : CoProcessor(grid, s) -{ - gridRank = Communicator::getInstance()->getProcessID(); - minInitLevel = this->grid->getCoarsestInitializedLevel(); - maxInitLevel = this->grid->getFinestInitializedLevel(); - - blockVector.resize(maxInitLevel + 1); - - for (int level = minInitLevel; level <= maxInitLevel; level++) - { - grid->getBlocks(level, gridRank, true, blockVector[level]); - } - - Processor = vtkSmartPointer<vtkCPProcessor>::New(); - Processor->Initialize(); - - vtkNew<vtkCPPythonScriptPipeline> pipeline; - pipeline->Initialize(script.c_str()); - Processor->AddPipeline(pipeline.GetPointer()); - - buildVTKGrid(); -} -////////////////////////////////////////////////////////////////////////// -InSituCatalystCoProcessor::~InSituCatalystCoProcessor() -{ - -} -////////////////////////////////////////////////////////////////////////// -void InSituCatalystCoProcessor::process(double step) -{ - if (scheduler->isDue(step)) - collectData(step); - - UBLOG(logDEBUG3, "InSituCatalystCoProcessor::update:" << step); -} -////////////////////////////////////////////////////////////////////////// -void InSituCatalystCoProcessor::collectData(double step) -{ - unsigned int istep = static_cast<int>(step); - - vtkNew<vtkCPDataDescription> dataDescription; - dataDescription->AddInput("input"); - dataDescription->SetTimeData(step, istep); - - if (Processor->RequestDataDescription(dataDescription.GetPointer()) != 0) - { - - index = 0; - - for (int level = minInitLevel; level <= maxInitLevel; level++) - { - for(Block3DPtr block : blockVector[level]) - { - if (block) - { - addData(block); - } - } - } - - vtkDoubleArray* rho = vtkDoubleArray::SafeDownCast(unstructuredGrid->GetPointData()->GetArray("Rho")); - rho->SetArray(&rhoArray[0], static_cast<vtkIdType>(rhoArray.size()), 1); - - vtkDoubleArray* vx1 = vtkDoubleArray::SafeDownCast(unstructuredGrid->GetPointData()->GetArray("Vx")); - vx1->SetArray(&vx1Array[0], static_cast<vtkIdType>(vx1Array.size()), 1); - - vtkDoubleArray* vx2 = vtkDoubleArray::SafeDownCast(unstructuredGrid->GetPointData()->GetArray("Vy")); - vx2->SetArray(&vx2Array[0], static_cast<vtkIdType>(vx2Array.size()), 1); - - vtkDoubleArray* vx3 = vtkDoubleArray::SafeDownCast(unstructuredGrid->GetPointData()->GetArray("Vz")); - vx3->SetArray(&vx3Array[0], static_cast<vtkIdType>(vx3Array.size()), 1); - - dataDescription->GetInputDescriptionByName("input")->SetGrid(unstructuredGrid); - Processor->CoProcess(dataDescription.GetPointer()); - } - - UBLOG(logINFO, "InSituCatalystCoProcessor step: " << istep); -} -////////////////////////////////////////////////////////////////////////// -void InSituCatalystCoProcessor::addData(Block3DPtr block) -{ - UbTupleDouble3 org = grid->getBlockWorldCoordinates(block); - UbTupleDouble3 blockLengths = grid->getBlockLengths(block); - UbTupleDouble3 nodeOffset = grid->getNodeOffset(block); - double dx = grid->getDeltaX(block); - - LBMKernelPtr kernel = block->getKernel(); - BCArray3DPtr bcArray = kernel->getBCProcessor()->getBCArray(); - DistributionArray3DPtr distributions = kernel->getDataSet()->getFdistributions(); - LBMReal f[D3Q27System::ENDF + 1]; - LBMReal vx1, vx2, vx3, rho; - - int minX1 = 0; - int minX2 = 0; - int minX3 = 0; - - int maxX1 = (int)(distributions->getNX1()); - int maxX2 = (int)(distributions->getNX2()); - int maxX3 = (int)(distributions->getNX3()); - - //nummern vergeben und node vector erstellen + daten sammeln - CbArray3D<int> nodeNumbers((int)maxX1, (int)maxX2, (int)maxX3, -1); - maxX1 -= 2; - maxX2 -= 2; - maxX3 -= 2; - - - - for (size_t ix3 = minX3; ix3 <= maxX3; ix3++) - { - for (size_t ix2 = minX2; ix2 <= maxX2; ix2++) - { - for (size_t ix1 = minX1; ix1 <= maxX1; ix1++) - { - if (!bcArray->isUndefined(ix1, ix2, ix3) && !bcArray->isSolid(ix1, ix2, ix3)) - { - distributions->getDistribution(f, ix1, ix2, ix3); - calcMacros(f, rho, vx1, vx2, vx3); - double press = D3Q27System::calcPress(f, rho, vx1, vx2, vx3); - - if (UbMath::isNaN(rho) || UbMath::isInfinity(rho)) - UB_THROW(UbException(UB_EXARGS, "rho is not a number (nan or -1.#IND) or infinity number -1.#INF in block=" + block->toString() + - ", node=" + UbSystem::toString(ix1) + "," + UbSystem::toString(ix2) + "," + UbSystem::toString(ix3))); - //rho=999.0; - if (UbMath::isNaN(press) || UbMath::isInfinity(press)) - UB_THROW(UbException(UB_EXARGS, "press is not a number (nan or -1.#IND) or infinity number -1.#INF in block=" + block->toString() + - ", node=" + UbSystem::toString(ix1) + "," + UbSystem::toString(ix2) + "," + UbSystem::toString(ix3))); - //press=999.0; - if (UbMath::isNaN(vx1) || UbMath::isInfinity(vx1)) - UB_THROW(UbException(UB_EXARGS, "vx1 is not a number (nan or -1.#IND) or infinity number -1.#INF in block=" + block->toString() + - ", node=" + UbSystem::toString(ix1) + "," + UbSystem::toString(ix2) + "," + UbSystem::toString(ix3))); - //vx1=999.0; - if (UbMath::isNaN(vx2) || UbMath::isInfinity(vx2)) - UB_THROW(UbException(UB_EXARGS, "vx2 is not a number (nan or -1.#IND) or infinity number -1.#INF in block=" + block->toString() + - ", node=" + UbSystem::toString(ix1) + "," + UbSystem::toString(ix2) + "," + UbSystem::toString(ix3))); - //vx2=999.0; - if (UbMath::isNaN(vx3) || UbMath::isInfinity(vx3)) - UB_THROW(UbException(UB_EXARGS, "vx3 is not a number (nan or -1.#IND) or infinity number -1.#INF in block=" + block->toString() + - ", node=" + UbSystem::toString(ix1) + "," + UbSystem::toString(ix2) + "," + UbSystem::toString(ix3))); - //vx3=999.0; - - rhoArray[index] = rho; - vx1Array[index] = vx1; - vx2Array[index] = vx2; - vx3Array[index] = vx3; - index++; - } - } - } - } -} -////////////////////////////////////////////////////////////////////////// -void InSituCatalystCoProcessor::buildVTKGrid() -{ - unstructuredGrid = vtkSmartPointer<vtkUnstructuredGrid>::New(); - points = vtkPoints::New(); - unstructuredGrid->SetPoints(points); - arrays[0] = vtkSmartPointer<vtkDoubleArray>::New(); - arrays[0]->SetNumberOfComponents(1); - arrays[0]->SetName("Rho"); - arrays[1] = vtkSmartPointer<vtkDoubleArray>::New(); - arrays[1]->SetNumberOfComponents(1); - arrays[1]->SetName("Vx"); - arrays[2] = vtkSmartPointer<vtkDoubleArray>::New(); - arrays[2]->SetNumberOfComponents(1); - arrays[2]->SetName("Vy"); - arrays[3] = vtkSmartPointer<vtkDoubleArray>::New(); - arrays[3]->SetNumberOfComponents(1); - arrays[3]->SetName("Vz"); - - numOfPoints = 0; - - for (int level = minInitLevel; level <= maxInitLevel; level++) - { - for(Block3DPtr block : blockVector[level]) - { - if (block) - { - addVTKGridData(block); - } - } - } - - unstructuredGrid->GetPointData()->AddArray(arrays[0]); - unstructuredGrid->GetPointData()->AddArray(arrays[1]); - unstructuredGrid->GetPointData()->AddArray(arrays[2]); - unstructuredGrid->GetPointData()->AddArray(arrays[3]); - unstructuredGrid->GetPointData()->SetScalars(arrays[1]); - - rhoArray.resize(numOfPoints); - vx1Array.resize(numOfPoints); - vx2Array.resize(numOfPoints); - vx3Array.resize(numOfPoints); -} -////////////////////////////////////////////////////////////////////////// -void InSituCatalystCoProcessor::addVTKGridData(Block3DPtr block) -{ - UbTupleDouble3 org = grid->getBlockWorldCoordinates(block); - UbTupleDouble3 blockLengths = grid->getBlockLengths(block); - UbTupleDouble3 nodeOffset = grid->getNodeOffset(block); - double dx = grid->getDeltaX(block); - - LBMKernelPtr kernel = block->getKernel(); - BCArray3DPtr bcArray = kernel->getBCProcessor()->getBCArray(); - DistributionArray3DPtr distributions = kernel->getDataSet()->getFdistributions(); - LBMReal f[D3Q27System::ENDF + 1]; - LBMReal vx1, vx2, vx3, rho; - - //knotennummerierung faengt immer bei 0 an! - int SWB, SEB, NEB, NWB, SWT, SET, NET, NWT; - - //Funktionszeiger - //typedef void(*CalcMacrosFct)(const LBMReal* const& /*feq[27]*/, LBMReal& /*(d)rho*/, LBMReal& /*vx1*/, LBMReal& /*vx2*/, LBMReal& /*vx3*/); - - //CalcMacrosFct calcMacros = NULL; - - if (block->getKernel()->getCompressible()) - { - calcMacros = &D3Q27System::calcCompMacroscopicValues; - } - else - { - calcMacros = &D3Q27System::calcIncompMacroscopicValues; - } - - int minX1 = 0; - int minX2 = 0; - int minX3 = 0; - - int maxX1 = (int)(distributions->getNX1()); - int maxX2 = (int)(distributions->getNX2()); - int maxX3 = (int)(distributions->getNX3()); - - //nummern vergeben und node vector erstellen + daten sammeln - CbArray3D<int> nodeNumbers((int)maxX1, (int)maxX2, (int)maxX3, -1); - maxX1 -= 2; - maxX2 -= 2; - maxX3 -= 2; - - BoundaryConditionsPtr bcPtr; - int nr = points->GetNumberOfPoints(); - - double x[3]; - - for (size_t ix3 = minX3; ix3 <= maxX3; ix3++) - { - for (size_t ix2 = minX2; ix2 <= maxX2; ix2++) - { - for (size_t ix1 = minX1; ix1 <= maxX1; ix1++) - { - if (!bcArray->isUndefined(ix1, ix2, ix3) && !bcArray->isSolid(ix1, ix2, ix3)) - { - x[0] = double(val<1>(org) -val<1>(nodeOffset) +ix1*dx); - x[1] = double(val<2>(org) -val<2>(nodeOffset) +ix2*dx); - x[2] = double(val<3>(org) -val<3>(nodeOffset) +ix3*dx); - - points->InsertPoint((vtkIdType)nr, x); - - nodeNumbers(ix1, ix2, ix3) = nr++; - - distributions->getDistribution(f, ix1, ix2, ix3); - calcMacros(f, rho, vx1, vx2, vx3); - double press = D3Q27System::calcPress(f, rho, vx1, vx2, vx3); - - if (UbMath::isNaN(rho) || UbMath::isInfinity(rho)) - UB_THROW(UbException(UB_EXARGS, "rho is not a number (nan or -1.#IND) or infinity number -1.#INF in block=" + block->toString() + - ", node=" + UbSystem::toString(ix1) + "," + UbSystem::toString(ix2) + "," + UbSystem::toString(ix3))); - //rho=999.0; - if (UbMath::isNaN(press) || UbMath::isInfinity(press)) - UB_THROW(UbException(UB_EXARGS, "press is not a number (nan or -1.#IND) or infinity number -1.#INF in block=" + block->toString() + - ", node=" + UbSystem::toString(ix1) + "," + UbSystem::toString(ix2) + "," + UbSystem::toString(ix3))); - //press=999.0; - if (UbMath::isNaN(vx1) || UbMath::isInfinity(vx1)) - UB_THROW(UbException(UB_EXARGS, "vx1 is not a number (nan or -1.#IND) or infinity number -1.#INF in block=" + block->toString() + - ", node=" + UbSystem::toString(ix1) + "," + UbSystem::toString(ix2) + "," + UbSystem::toString(ix3))); - //vx1=999.0; - if (UbMath::isNaN(vx2) || UbMath::isInfinity(vx2)) - UB_THROW(UbException(UB_EXARGS, "vx2 is not a number (nan or -1.#IND) or infinity number -1.#INF in block=" + block->toString() + - ", node=" + UbSystem::toString(ix1) + "," + UbSystem::toString(ix2) + "," + UbSystem::toString(ix3))); - //vx2=999.0; - if (UbMath::isNaN(vx3) || UbMath::isInfinity(vx3)) - UB_THROW(UbException(UB_EXARGS, "vx3 is not a number (nan or -1.#IND) or infinity number -1.#INF in block=" + block->toString() + - ", node=" + UbSystem::toString(ix1) + "," + UbSystem::toString(ix2) + "," + UbSystem::toString(ix3))); - //vx3=999.0; - - arrays[0]->InsertNextValue(rho); - arrays[1]->InsertNextValue(vx1); - arrays[2]->InsertNextValue(vx2); - arrays[3]->InsertNextValue(vx3); - numOfPoints++; - } - } - } - } - maxX1 -= 1; - maxX2 -= 1; - maxX3 -= 1; - - vtkIdType ptIds[8]; - //cell vector erstellen - for (int ix3 = minX3; ix3 <= maxX3; ix3++) - { - for (int ix2 = minX2; ix2 <= maxX2; ix2++) - { - for (int ix1 = minX1; ix1 <= maxX1; ix1++) - { - if ((ptIds[0] = SWB = nodeNumbers(ix1, ix2, ix3)) >= 0 - && (ptIds[1] = SEB = nodeNumbers(ix1 + 1, ix2, ix3)) >= 0 - && (ptIds[2] = NWB = nodeNumbers(ix1, ix2 + 1, ix3)) >= 0 - && (ptIds[3] = NEB = nodeNumbers(ix1 + 1, ix2 + 1, ix3)) >= 0 - && (ptIds[4] = SWT = nodeNumbers(ix1, ix2, ix3 + 1)) >= 0 - && (ptIds[5] = SET = nodeNumbers(ix1 + 1, ix2, ix3 + 1)) >= 0 - && (ptIds[6] = NWT = nodeNumbers(ix1, ix2 + 1, ix3 + 1)) >= 0 - && (ptIds[7] = NET = nodeNumbers(ix1 + 1, ix2 + 1, ix3 + 1)) >= 0 - ) - { - unstructuredGrid->InsertNextCell((int)VTK_VOXEL, (vtkIdType)8, ptIds); - } - } - } - } -} -////////////////////////////////////////////////////////////////////////// - - -#endif - diff --git a/src/VirtualFluids/CoProcessors/InSituCatalystCoProcessor.h b/src/VirtualFluids/CoProcessors/InSituCatalystCoProcessor.h deleted file mode 100644 index 022eb4cb4..000000000 --- a/src/VirtualFluids/CoProcessors/InSituCatalystCoProcessor.h +++ /dev/null @@ -1,54 +0,0 @@ -#ifdef VF_CATALYST - -#ifndef InSituCatalystCoProcessor_h__ -#define InSituCatalystCoProcessor_h__ - - -#include <CoProcessor.h> -#include <Grid3D.h> -#include <LBMUnitConverter.h> - -#include <string> - -#include <vtkSmartPointer.h> -#include <vtkUnstructuredGrid.h> -#include <vtkDoubleArray.h> -#include <vtkCPDataDescription.h> -#include <vtkCPInputDataDescription.h> -#include <vtkCPProcessor.h> -#include <vtkCPPythonScriptPipeline.h> -#include <vtkNew.h> - -class InSituCatalystCoProcessor : public CoProcessor -{ -public: - InSituCatalystCoProcessor(); - InSituCatalystCoProcessor(Grid3DPtr grid, UbSchedulerPtr s, std::string script); - virtual ~InSituCatalystCoProcessor(); - void process(double step); -protected: - void collectData(double step); - void addData(Block3DPtr block); - void buildVTKGrid(); - void addVTKGridData(Block3DPtr block); -private: - std::vector<std::vector<Block3DPtr> > blockVector; - int minInitLevel; - int maxInitLevel; - int gridRank; - vtkSmartPointer<vtkCPProcessor> Processor; - vtkSmartPointer<vtkUnstructuredGrid> unstructuredGrid; - vtkSmartPointer<vtkPoints> points; - vtkSmartPointer<vtkDoubleArray> arrays[4]; - std::vector<double> vx1Array; - std::vector<double> vx2Array; - std::vector<double> vx3Array; - std::vector<double> rhoArray; - int index; - int numOfPoints; - typedef void(*CalcMacrosFct)(const LBMReal* const& /*feq[27]*/, LBMReal& /*(d)rho*/, LBMReal& /*vx1*/, LBMReal& /*vx2*/, LBMReal& /*vx3*/); - CalcMacrosFct calcMacros; -}; -#endif // InSituCatalystCoProcessor_h__ - -#endif diff --git a/src/VirtualFluids/CoProcessors/InSituVTKCoProcessor.cpp b/src/VirtualFluids/CoProcessors/InSituVTKCoProcessor.cpp deleted file mode 100644 index 51773f6d8..000000000 --- a/src/VirtualFluids/CoProcessors/InSituVTKCoProcessor.cpp +++ /dev/null @@ -1,294 +0,0 @@ -#ifdef VF_VTK - -#include "InSituVTKCoProcessor.h" -#include <LBMKernel.h> -#include <D3Q27ETBCProcessor.h> -#include <vector> -#include <string> - -#include <vtkCellType.h> -#include <vtkPointData.h> -#include <vtkXMLUnstructuredGridWriter.h> - -#include <iostream> -#include <fstream> - -using namespace std; - -InSituVTKCoProcessor::InSituVTKCoProcessor() -{ - -} -////////////////////////////////////////////////////////////////////////// -InSituVTKCoProcessor::InSituVTKCoProcessor( Grid3DPtr grid, UbSchedulerPtr s, const std::string& configFile, LBMUnitConverterPtr conv ) : CoProcessor(grid, s), conv(conv) -{ - gridRank = Communicator::getInstance()->getProcessID(); - minInitLevel = this->grid->getCoarsestInitializedLevel(); - maxInitLevel = this->grid->getFinestInitializedLevel(); - - readConfigFile(configFile); - - blockVector.resize(maxInitLevel+1); - - for(int level = minInitLevel; level<=maxInitLevel;level++) - { - grid->getBlocks(level, gridRank, true, blockVector[level]); - } - - //initialization of communicator - contr = vtkSmartPointer<vtkSocketController>::New(); - contr->Initialize(); - - comm = vtkSmartPointer<vtkSocketCommunicator>::New(); - - // Establish connection - if (!comm->ConnectTo(wHostname.c_str(), wPort)) - { - cerr << "Client error: Could not connect to the server."<< endl; - return; - } - -} -////////////////////////////////////////////////////////////////////////// -InSituVTKCoProcessor::~InSituVTKCoProcessor() -{ - comm->CloseConnection(); -} -////////////////////////////////////////////////////////////////////////// -void InSituVTKCoProcessor::process( double step ) -{ - if(scheduler->isDue(step) ) - collectData(step); - - UBLOG(logDEBUG3, "InSituVTKCoProcessor::update:" << step); -} -////////////////////////////////////////////////////////////////////////// -void InSituVTKCoProcessor::collectData( double step ) -{ - int istep = static_cast<int>(step); - - unstructuredGrid = vtkSmartPointer<vtkUnstructuredGrid>::New(); - points = vtkPoints::New(); - unstructuredGrid->SetPoints(points); - arrays[0] = vtkSmartPointer<vtkDoubleArray>::New(); - arrays[0]->SetNumberOfComponents(1); - arrays[0]->SetName( "Rho" ); - arrays[1] = vtkSmartPointer<vtkDoubleArray>::New(); - arrays[1]->SetNumberOfComponents(1); - arrays[1]->SetName( "Vx" ); - arrays[2] = vtkSmartPointer<vtkDoubleArray>::New(); - arrays[2]->SetNumberOfComponents(1); - arrays[2]->SetName( "Vy" ); - arrays[3] = vtkSmartPointer<vtkDoubleArray>::New(); - arrays[3]->SetNumberOfComponents(1); - arrays[3]->SetName( "Vz" ); - arrays[4] = vtkSmartPointer<vtkDoubleArray>::New(); - arrays[4]->SetNumberOfComponents(1); - arrays[4]->SetName( "Press" ); - - for(int level = minInitLevel; level<=maxInitLevel;level++) - { - for(Block3DPtr block : blockVector[level]) - { - if (block) - { - addData(block); - } - } - } - - unstructuredGrid->GetPointData()->AddArray(arrays[0]); - unstructuredGrid->GetPointData()->AddArray(arrays[1]); - unstructuredGrid->GetPointData()->AddArray(arrays[2]); - unstructuredGrid->GetPointData()->AddArray(arrays[3]); - unstructuredGrid->GetPointData()->AddArray(arrays[4]); - unstructuredGrid->GetPointData()->SetScalars(arrays[1]); - - if (!comm->Send(&istep, 1, 1, 11)) - { - cerr << "Client error: Error sending data." << endl; - return; - } - - if (!comm->Send(unstructuredGrid, 1, 9)) - { - cerr << "Server error: Error sending data." << endl; - return; - } - - //vtkSmartPointer<vtkXMLUnstructuredGridWriter> writer = vtkSmartPointer<vtkXMLUnstructuredGridWriter>::New(); - //writer->SetInput(unstructuredGrid); - //writer->SetFileName("test.vtu"); - //writer->SetDataModeToAscii(); - //writer->Update(); - - UBLOG(logINFO,"InSituVTKCoProcessor step: " << istep); -} -////////////////////////////////////////////////////////////////////////// -void InSituVTKCoProcessor::addData( Block3DPtr block ) -{ - UbTupleDouble3 org = grid->getBlockWorldCoordinates(block); - UbTupleDouble3 blockLengths = grid->getBlockLengths(block); - UbTupleDouble3 nodeOffset = grid->getNodeOffset(block); - double dx = grid->getDeltaX(block); - - LBMKernelPtr kernel = block->getKernel(); - BCArray3DPtr bcArray = kernel->getBCProcessor()->getBCArray(); - DistributionArray3DPtr distributions = kernel->getDataSet()->getFdistributions(); - LBMReal f[D3Q27System::ENDF+1]; - LBMReal vx1,vx2,vx3,rho; - - //knotennummerierung faengt immer bei 0 an! - int SWB,SEB,NEB,NWB,SWT,SET,NET,NWT; - - //Funktionszeiger - typedef void (*CalcMacrosFct)(const LBMReal* const& /*feq[27]*/,LBMReal& /*(d)rho*/, LBMReal& /*vx1*/, LBMReal& /*vx2*/, LBMReal& /*vx3*/); - - CalcMacrosFct calcMacros = NULL; - - if(block->getKernel()->getCompressible()) - { - calcMacros = &D3Q27System::calcCompMacroscopicValues; - } - else - { - calcMacros = &D3Q27System::calcIncompMacroscopicValues; - } - - int minX1 = 0; - int minX2 = 0; - int minX3 = 0; - - int maxX1 = (int)(distributions->getNX1()); - int maxX2 = (int)(distributions->getNX2()); - int maxX3 = (int)(distributions->getNX3()); - - //int minX1 = 1; - //int minX2 = 1; - //int minX3 = 1; - - //int maxX1 = (int)(distributions->getNX1()); - //int maxX2 = (int)(distributions->getNX2()); - //int maxX3 = (int)(distributions->getNX3()); - - //nummern vergeben und node vector erstellen + daten sammeln - CbArray3D<int> nodeNumbers((int)maxX1, (int)maxX2, (int)maxX3,-1); - maxX1 -= 2; - maxX2 -= 2; - maxX3 -= 2; - - BoundaryConditionsPtr bcPtr; - int nr = points->GetNumberOfPoints(); - - double x[3]; - - for(size_t ix3=minX3; ix3<=maxX3; ix3++) - { - for(size_t ix2=minX2; ix2<=maxX2; ix2++) - { - for(size_t ix1=minX1; ix1<=maxX1; ix1++) - { - if(!bcArray->isUndefined(ix1,ix2,ix3) && !bcArray->isSolid(ix1,ix2,ix3)) - { - int index = 0; - - x[0] = double(val<1>(org) - val<1>(nodeOffset) + ix1*dx); - x[1] = double(val<2>(org) - val<2>(nodeOffset) + ix2*dx); - x[2] = double(val<3>(org) - val<3>(nodeOffset) + ix3*dx); - - points->InsertPoint((vtkIdType)nr, x); - - nodeNumbers(ix1,ix2,ix3) = nr++; - - distributions->getDistribution(f, ix1, ix2, ix3); - calcMacros(f,rho,vx1,vx2,vx3); - double press = D3Q27System::calcPress(f,rho,vx1,vx2,vx3); - - if (UbMath::isNaN(rho) || UbMath::isInfinity(rho)) - UB_THROW( UbException(UB_EXARGS,"rho is not a number (nan or -1.#IND) or infinity number -1.#INF in block="+block->toString()+ - ", node="+UbSystem::toString(ix1)+","+UbSystem::toString(ix2)+","+UbSystem::toString(ix3))); - //rho=999.0; - if (UbMath::isNaN(press) || UbMath::isInfinity(press)) - UB_THROW( UbException(UB_EXARGS,"press is not a number (nan or -1.#IND) or infinity number -1.#INF in block="+block->toString()+ - ", node="+UbSystem::toString(ix1)+","+UbSystem::toString(ix2)+","+UbSystem::toString(ix3))); - //press=999.0; - if (UbMath::isNaN(vx1) || UbMath::isInfinity(vx1)) - UB_THROW( UbException(UB_EXARGS,"vx1 is not a number (nan or -1.#IND) or infinity number -1.#INF in block="+block->toString()+ - ", node="+UbSystem::toString(ix1)+","+UbSystem::toString(ix2)+","+UbSystem::toString(ix3))); - //vx1=999.0; - if (UbMath::isNaN(vx2) || UbMath::isInfinity(vx2)) - UB_THROW( UbException(UB_EXARGS,"vx2 is not a number (nan or -1.#IND) or infinity number -1.#INF in block="+block->toString()+ - ", node="+UbSystem::toString(ix1)+","+UbSystem::toString(ix2)+","+UbSystem::toString(ix3))); - //vx2=999.0; - if (UbMath::isNaN(vx3) || UbMath::isInfinity(vx3)) - UB_THROW( UbException(UB_EXARGS,"vx3 is not a number (nan or -1.#IND) or infinity number -1.#INF in block="+block->toString()+ - ", node="+UbSystem::toString(ix1)+","+UbSystem::toString(ix2)+","+UbSystem::toString(ix3))); - //vx3=999.0; - - arrays[0]->InsertNextValue(rho * conv->getFactorDensityLbToW2()); - arrays[1]->InsertNextValue(vx1 * conv->getFactorVelocityLbToW2()); - arrays[2]->InsertNextValue(vx2 * conv->getFactorVelocityLbToW2()); - arrays[3]->InsertNextValue(vx3 * conv->getFactorVelocityLbToW2()); - arrays[4]->InsertNextValue(press * conv->getFactorPressureLbToW2()); - } - } - } - } - maxX1 -= 1; - maxX2 -= 1; - maxX3 -= 1; - - vtkIdType ptIds[8]; - //cell vector erstellen - for(int ix3=minX3; ix3<=maxX3; ix3++) - { - for(int ix2=minX2; ix2<=maxX2; ix2++) - { - for(int ix1=minX1; ix1<=maxX1; ix1++) - { - if( (ptIds[0]=SWB=nodeNumbers( ix1 , ix2, ix3 )) >= 0 - && (ptIds[1]=SEB=nodeNumbers( ix1+1, ix2, ix3 )) >= 0 - && (ptIds[2]=NWB=nodeNumbers( ix1 , ix2+1, ix3 )) >= 0 - && (ptIds[3]=NEB=nodeNumbers( ix1+1, ix2+1, ix3 )) >= 0 - && (ptIds[4]=SWT=nodeNumbers( ix1 , ix2, ix3+1 )) >= 0 - && (ptIds[5]=SET=nodeNumbers( ix1+1, ix2, ix3+1 )) >= 0 - && (ptIds[6]=NWT=nodeNumbers( ix1 , ix2+1, ix3+1 )) >= 0 - && (ptIds[7]=NET=nodeNumbers( ix1+1, ix2+1, ix3+1 )) >= 0 - ) - { - unstructuredGrid->InsertNextCell((int)VTK_VOXEL, (vtkIdType)8, ptIds); - } - } - } - } -} -////////////////////////////////////////////////////////////////////////// -void InSituVTKCoProcessor::readConfigFile( const std::string& configFile ) -{ - ifstream ifs; - ifs.open (configFile, ifstream::in); - if(!ifs) throw UbException(UB_EXARGS,"can not open "+configFile); - - string dummy; - int wRank = 0; - getline(ifs, dummy); - int np = Communicator::getInstance()->getNumberOfProcesses(); - - while (ifs.good()) - { - getline(ifs, dummy, ';'); - getline(ifs, wIP, ';'); - getline(ifs, wHostname, ';'); - getline(ifs, dummy); - wPort = stoi(dummy); - if(wRank == gridRank) break; - wRank++; - } - ifs.close(); -} - -////////////////////////////////////////////////////////////////////////// - -#endif - - diff --git a/src/VirtualFluids/CoProcessors/InSituVTKCoProcessor.h b/src/VirtualFluids/CoProcessors/InSituVTKCoProcessor.h deleted file mode 100644 index a85d92d73..000000000 --- a/src/VirtualFluids/CoProcessors/InSituVTKCoProcessor.h +++ /dev/null @@ -1,52 +0,0 @@ -#ifdef VF_VTK - -#ifndef InSituVTKCoProcessor_h__ -#define InSituVTKCoProcessor_h__ - -#include <CoProcessor.h> -#include <Grid3D.h> -#include <LBMUnitConverter.h> - -#include <string> - -//VTK headers -#include <vtkSocketCommunicator.h> -#include <vtkSocketController.h> -#include <vtkSmartPointer.h> -#include <vtkUnstructuredGrid.h> -#include <vtkDoubleArray.h> - -class InSituVTKCoProcessor : public CoProcessor -{ -public: - InSituVTKCoProcessor(); - InSituVTKCoProcessor(Grid3DPtr grid, UbSchedulerPtr s, const std::string& configFile, LBMUnitConverterPtr conv); - virtual ~InSituVTKCoProcessor(); - void process(double step); -protected: - void collectData(double step); - void addData(Block3DPtr block); - void readConfigFile(const std::string& configFile); - - //void clearData(); -private: - std::string path; - LBMUnitConverterPtr conv; - std::vector<std::vector<Block3DPtr> > blockVector; - int minInitLevel; - int maxInitLevel; - int gridRank; - vtkSmartPointer<vtkSocketCommunicator> comm; - vtkSmartPointer<vtkSocketController> contr; - vtkSmartPointer<vtkUnstructuredGrid> unstructuredGrid; - vtkSmartPointer<vtkPoints> points; - vtkSmartPointer<vtkDoubleArray> arrays[5]; - int wPort; - std::string wHostname; - std::string wIP; -}; - -#endif // InSituVTKCoProcessor_h__ - -#endif - diff --git a/src/VirtualFluids/CoProcessors/IntegrateValuesHelper.cpp b/src/VirtualFluids/CoProcessors/IntegrateValuesHelper.cpp deleted file mode 100644 index c88e4c23e..000000000 --- a/src/VirtualFluids/CoProcessors/IntegrateValuesHelper.cpp +++ /dev/null @@ -1,559 +0,0 @@ -#include "IntegrateValuesHelper.h" - - -#include <numerics/geometry3d/GbCuboid3D.h> -#include <numerics/geometry3d/CoordinateTransformation3D.h> -#include <vector> - -#include "LBMKernel.h" -#include "BCProcessor.h" -#include "DataSet3D.h" -#include "BCArray3D.h" - -////////////////////////////////////////////////////////////////////////// -IntegrateValuesHelper::IntegrateValuesHelper(Grid3DPtr grid, CommunicatorPtr comm, - double minX1, double minX2, - double minX3, double maxX1, - double maxX2, double maxX3) : - - grid(grid), - comm(comm), - sVx1(0.0), sVx2(0.0), sVx3(0.0), sRho(0.0), sCellVolume(0.0), - numberOfFluidsNodes(0), - numberOfSolidNodes(0) -{ - boundingBox = GbCuboid3DPtr(new GbCuboid3D(minX1, minX2, minX3, maxX1, maxX2, maxX3)); - init(-1); -} -////////////////////////////////////////////////////////////////////////// -IntegrateValuesHelper::IntegrateValuesHelper(Grid3DPtr grid, CommunicatorPtr comm, - double minX1, double minX2, - double minX3, double maxX1, - double maxX2, double maxX3, - int level) : - - grid(grid), - comm(comm), - sVx1(0.0), sVx2(0.0), sVx3(0.0), sRho(0.0), sCellVolume(0.0), - numberOfFluidsNodes(0), - numberOfSolidNodes(0) -{ - boundingBox = GbCuboid3DPtr(new GbCuboid3D(minX1, minX2, minX3, maxX1, maxX2, maxX3)); - init(level); -} -////////////////////////////////////////////////////////////////////////// -IntegrateValuesHelper::~IntegrateValuesHelper() -{ -} -////////////////////////////////////////////////////////////////////////// -void IntegrateValuesHelper::init(int level) -{ - root = comm->isRoot(); - - double orgX1, orgX2, orgX3; - int gridRank = grid->getRank(); - int minInitLevel, maxInitLevel; - if (level < 0) - { - minInitLevel = this->grid->getCoarsestInitializedLevel(); - maxInitLevel = this->grid->getFinestInitializedLevel(); - } - else - { - minInitLevel = level; - maxInitLevel = level; - } - - double numSolids = 0.0; - double numFluids = 0.0; - for (int level = minInitLevel; level <= maxInitLevel; level++) - { - std::vector<Block3DPtr> blockVector; - grid->getBlocks(level, gridRank, blockVector); - for(Block3DPtr block : blockVector) - { - CalcNodes cn; - cn.block = block; - //Koords bestimmen - UbTupleDouble3 org = grid->getBlockWorldCoordinates(block); - - orgX1 = val<1>(org); - orgX2 = val<2>(org); - orgX3 = val<3>(org); - - LBMKernelPtr kernel = std::dynamic_pointer_cast<LBMKernel>(block->getKernel()); - BCArray3DPtr bcArray = kernel->getBCProcessor()->getBCArray(); - int ghostLayerWitdh = kernel->getGhostLayerWidth(); - DistributionArray3DPtr distributions = kernel->getDataSet()->getFdistributions(); - double internX1, internX2, internX3; - - double dx = grid->getDeltaX(block); - UbTupleDouble3 orgDelta = grid->getNodeOffset(block); - - for (int ix3 = ghostLayerWitdh; ix3 < (int)distributions->getNX3() - ghostLayerWitdh; ix3++) - { - for (int ix2 = ghostLayerWitdh; ix2 < (int)distributions->getNX2() - ghostLayerWitdh; ix2++) - { - for (int ix1 = ghostLayerWitdh; ix1 < (int)distributions->getNX1() - ghostLayerWitdh; ix1++) - { - internX1 = orgX1 - val<1>(orgDelta) + ix1 * dx; - internX2 = orgX2 - val<2>(orgDelta) + ix2 * dx; - internX3 = orgX3 - val<3>(orgDelta) + ix3 * dx; - if (boundingBox->isPointInGbObject3D(internX1, internX2, internX3)) - { - if (!bcArray->isSolid(ix1, ix2, ix3) && !bcArray->isUndefined(ix1, ix2, ix3)) - { - cn.nodes.push_back(UbTupleInt3(ix1, ix2, ix3)); - numFluids++; - } - else if (bcArray->isSolid(ix1, ix2, ix3)) - { - numSolids++; - } - } - } - } - } - if (cn.nodes.size() > 0) - cnodes.push_back(cn); - } - } - std::vector<double> rvalues; - std::vector<double> values; - values.push_back(numSolids); - values.push_back(numFluids); - rvalues = comm->gather(values); - - if (root) - { - numberOfSolidNodes = 0.0; - numberOfFluidsNodes = 0.0; - int rsize = (int)rvalues.size(); - int vsize = (int)values.size(); - for (int i = 0; i < rsize; i += vsize) - { - numberOfSolidNodes += rvalues[i]; - numberOfFluidsNodes += rvalues[i + 1]; - } - } - -} -////////////////////////////////////////////////////////////////////////// -void IntegrateValuesHelper::prepare2DMatrix(int level) -{ - root = comm->isRoot(); - - double orgX1, orgX2, orgX3; - int gridRank = grid->getRank(); - int minInitLevel, maxInitLevel; - if (level<0) - { - minInitLevel = this->grid->getCoarsestInitializedLevel(); - maxInitLevel = this->grid->getFinestInitializedLevel(); - } - else - { - minInitLevel = level; - maxInitLevel = level; - } - double dx = grid->getDeltaX(level); - CoordinateTransformation3D trafo(boundingBox->getX1Minimum(),boundingBox->getX2Minimum(),boundingBox->getX3Minimum(),dx,dx,dx); - cnodes2DMatrix.resize(UbMath::integerRounding<double>(boundingBox->getX1Maximum()/dx),UbMath::integerRounding<double>(boundingBox->getX2Maximum()/dx)); - - double numSolids = 0.0; - double numFluids = 0.0; - for (int level = minInitLevel; level<=maxInitLevel; level++) - { - std::vector<Block3DPtr> blockVector; - grid->getBlocks(level, gridRank, blockVector); - for(Block3DPtr block : blockVector) - { - Node cn; - cn.block = block; - //Koords bestimmen - UbTupleDouble3 org = grid->getBlockWorldCoordinates(block); - - orgX1 = val<1>(org); - orgX2 = val<2>(org); - orgX3 = val<3>(org); - - ILBMKernelPtr kernel = block->getKernel(); - BCArray3DPtr bcArray = kernel->getBCProcessor()->getBCArray(); - int ghostLayerWitdh = kernel->getGhostLayerWidth(); - DistributionArray3DPtr distributions = kernel->getDataSet()->getFdistributions(); - double internX1, internX2, internX3; - - double dx = grid->getDeltaX(block); - UbTupleDouble3 orgDelta = grid->getNodeOffset(block); - - for (int ix3 = ghostLayerWitdh; ix3<(int)distributions->getNX3()-ghostLayerWitdh; ix3++) - { - for (int ix2 = ghostLayerWitdh; ix2<(int)distributions->getNX2()-ghostLayerWitdh; ix2++) - { - for (int ix1 = ghostLayerWitdh; ix1<(int)distributions->getNX1()-ghostLayerWitdh; ix1++) - { - internX1 = orgX1-val<1>(orgDelta)+ix1 * dx; - internX2 = orgX2-val<2>(orgDelta)+ix2 * dx; - internX3 = orgX3-val<3>(orgDelta)+ix3 * dx; - if (boundingBox->isPointInGbObject3D(internX1, internX2, internX3)) - { - if (!bcArray->isSolid(ix1, ix2, ix3)&&!bcArray->isUndefined(ix1, ix2, ix3)) - { - cn.node = UbTupleInt3(ix1, ix2, ix3); - int x1 = (int)trafo.transformForwardToX1Coordinate(internX1, internX2, internX3); - int x2 = (int)trafo.transformForwardToX2Coordinate(internX1, internX2, internX3); - cnodes2DMatrix(x1,x2)=cn; - numFluids++; - } - else if (bcArray->isSolid(ix1, ix2, ix3)) - { - numSolids++; - } - } - } - } - } - - } - } - std::vector<double> rvalues; - std::vector<double> values; - values.push_back(numSolids); - values.push_back(numFluids); - rvalues = comm->gather(values); - - if (root) - { - numberOfSolidNodes = 0.0; - numberOfFluidsNodes = 0.0; - int rsize = (int)rvalues.size(); - int vsize = (int)values.size(); - for (int i = 0; i<rsize; i += vsize) - { - numberOfSolidNodes += rvalues[i]; - numberOfFluidsNodes += rvalues[i+1]; - } - } - -} -// calculation conventional rho, velocity and averaged data -void IntegrateValuesHelper::calculateAV() -{ - clearData(); - - for(CalcNodes cn : cnodes) - { - ILBMKernelPtr kernel = cn.block->getKernel(); - AverageValuesArray3DPtr averagedValues = kernel->getDataSet()->getAverageValues(); - - for(UbTupleInt3 node : cn.nodes) - { - double Avx = (*averagedValues)(val<1>(node), val<2>(node), val<3>(node), AvVx); - double Avy = (*averagedValues)(val<1>(node), val<2>(node), val<3>(node), AvVy); - double Avz = (*averagedValues)(val<1>(node), val<2>(node), val<3>(node), AvVz); - - double Avxx = (*averagedValues)(val<1>(node), val<2>(node), val<3>(node), AvVxx); - double Avyy = (*averagedValues)(val<1>(node), val<2>(node), val<3>(node), AvVyy); - double Avzz = (*averagedValues)(val<1>(node), val<2>(node), val<3>(node), AvVzz); - - double Avxz = (*averagedValues)(val<1>(node), val<2>(node), val<3>(node), AvVxz); - sAvVx1 += abs(Avx); - sAvVx2 += abs(Avy); - sAvVx3 += abs(Avz); - - sTSx1 += sqrt(Avxx); - sTSx2 += sqrt(Avyy); - sTSx3 += sqrt(Avzz); - - sTSx1x3 += Avxz; - numberOfFluidsNodes++; - } - } - std::vector<double> values; - std::vector<double> rvalues; - values.push_back(sAvVx1); - values.push_back(sAvVx2); - values.push_back(sAvVx3); - values.push_back(sTSx1); - values.push_back(sTSx2); - values.push_back(sTSx3); - values.push_back(sTSx1x3); - values.push_back(numberOfFluidsNodes); - - rvalues = comm->gather(values); - if (root) - { - clearData(); - for (int i = 0; i < (int)rvalues.size(); i += 8) - { - sAvVx1 += rvalues[i]; - sAvVx2 += rvalues[i + 1]; - sAvVx3 += rvalues[i + 2]; - sTSx1 += rvalues[i + 3]; - sTSx2 += rvalues[i + 4]; - sTSx3 += rvalues[i + 5]; - sTSx1x3 += rvalues[i + 6]; - numberOfFluidsNodes += rvalues[i + 7]; - } - } -} -// calculation conventional rho, velocity and averaged data -void IntegrateValuesHelper::calculateAV2() -{ - saVx = 0; - saVy = 0; - saVz = 0; - - saVxx = 0; - saVyy = 0; - saVzz = 0; - saVxy = 0; - saVxz = 0; - saVyz = 0; - - saVxxx = 0; - saVxxy = 0; - saVxxz = 0; - saVyyy = 0; - saVyyx = 0; - saVyyz = 0; - saVzzz = 0; - saVzzx = 0; - saVzzy = 0; - saVxyz = 0; - - double lsaVx = 0; - double lsaVy = 0; - double lsaVz = 0; - - double lsaVxx = 0; - double lsaVyy = 0; - double lsaVzz = 0; - double lsaVxy = 0; - double lsaVxz = 0; - double lsaVyz = 0; - - double lsaVxxx = 0; - double lsaVxxy = 0; - double lsaVxxz = 0; - double lsaVyyy = 0; - double lsaVyyx = 0; - double lsaVyyz = 0; - double lsaVzzz = 0; - double lsaVzzx = 0; - double lsaVzzy = 0; - double lsaVxyz = 0; - - for(CalcNodes cn : cnodes) - { - ILBMKernelPtr kernel = cn.block->getKernel(); - AverageValuesArray3DPtr averagedVelocity = kernel->getDataSet()->getAverageVelocity(); - AverageValuesArray3DPtr averagedFluctuations = kernel->getDataSet()->getAverageFluctuations(); - AverageValuesArray3DPtr averagedTriplecorrelations = kernel->getDataSet()->getAverageTriplecorrelations(); - - for(UbTupleInt3 node : cn.nodes) - { - double aVx = (*averagedVelocity)(Vx, val<1>(node), val<2>(node), val<3>(node)); - double aVy = (*averagedVelocity)(Vy, val<1>(node), val<2>(node), val<3>(node)); - double aVz = (*averagedVelocity)(Vz, val<1>(node), val<2>(node), val<3>(node)); - - double aVxx = (*averagedFluctuations)(Vxx, val<1>(node), val<2>(node), val<3>(node)); - double aVyy = (*averagedFluctuations)(Vyy, val<1>(node), val<2>(node), val<3>(node)); - double aVzz = (*averagedFluctuations)(Vzz, val<1>(node), val<2>(node), val<3>(node)); - double aVxy = (*averagedFluctuations)(Vxy, val<1>(node), val<2>(node), val<3>(node)); - double aVxz = (*averagedFluctuations)(Vxz, val<1>(node), val<2>(node), val<3>(node)); - double aVyz = (*averagedFluctuations)(Vyz, val<1>(node), val<2>(node), val<3>(node)); - - double aVxxx = (*averagedTriplecorrelations)(Vxxx, val<1>(node), val<2>(node), val<3>(node)); - double aVxxy = (*averagedTriplecorrelations)(Vxxy, val<1>(node), val<2>(node), val<3>(node)); - double aVxxz = (*averagedTriplecorrelations)(Vxxz, val<1>(node), val<2>(node), val<3>(node)); - double aVyyy = (*averagedTriplecorrelations)(Vyyy, val<1>(node), val<2>(node), val<3>(node)); - double aVyyx = (*averagedTriplecorrelations)(Vyyx, val<1>(node), val<2>(node), val<3>(node)); - double aVyyz = (*averagedTriplecorrelations)(Vyyz, val<1>(node), val<2>(node), val<3>(node)); - double aVzzz = (*averagedTriplecorrelations)(Vzzz, val<1>(node), val<2>(node), val<3>(node)); - double aVzzx = (*averagedTriplecorrelations)(Vzzx, val<1>(node), val<2>(node), val<3>(node)); - double aVzzy = (*averagedTriplecorrelations)(Vzzy, val<1>(node), val<2>(node), val<3>(node)); - double aVxyz = (*averagedTriplecorrelations)(Vxyz, val<1>(node), val<2>(node), val<3>(node)); - - lsaVx += aVx; - lsaVy += aVy; - lsaVz += aVz; - - lsaVxx += aVxx; - lsaVyy += aVyy; - lsaVzz += aVzz; - lsaVxy += aVxy; - lsaVxz += aVxz; - lsaVyz += aVyz; - - lsaVxxx += aVxxx; - lsaVxxy += aVxxy; - lsaVxxz += aVxxz; - lsaVyyy += aVyyy; - lsaVyyx += aVyyx; - lsaVyyz += aVyyz; - lsaVzzz += aVzzz; - lsaVzzx += aVzzx; - lsaVzzy += aVzzy; - lsaVxyz += aVxyz; - - //numberOfFluidsNodes++; - } - } - std::vector<double> values; - std::vector<double> rvalues; - values.push_back(lsaVx); - values.push_back(lsaVy); - values.push_back(lsaVz); - - values.push_back(lsaVxx); - values.push_back(lsaVyy); - values.push_back(lsaVzz); - values.push_back(lsaVxy); - values.push_back(lsaVxz); - values.push_back(lsaVyz); - - values.push_back(lsaVxxx); - values.push_back(lsaVxxy); - values.push_back(lsaVxxz); - values.push_back(lsaVyyy); - values.push_back(lsaVyyx); - values.push_back(lsaVyyz); - values.push_back(lsaVzzz); - values.push_back(lsaVzzx); - values.push_back(lsaVzzy); - values.push_back(lsaVxyz); - - rvalues = comm->gather(values); - if (root) - { - for (int i = 0; i < (int)rvalues.size(); i += 19) - { - saVx += rvalues[i]; - saVy += rvalues[i + 1]; - saVz += rvalues[i + 2]; - - saVxx += rvalues[i + 3]; - saVyy += rvalues[i + 4]; - saVzz += rvalues[i + 5]; - saVxy += rvalues[i + 6]; - saVxz += rvalues[i + 7]; - saVyz += rvalues[i + 8]; - - saVxxx += rvalues[i + 9]; - saVxxy += rvalues[i + 10]; - saVxxz += rvalues[i + 11]; - saVyyy += rvalues[i + 12]; - saVyyx += rvalues[i + 13]; - saVyyz += rvalues[i + 14]; - saVzzz += rvalues[i + 15]; - saVzzx += rvalues[i + 16]; - saVzzy += rvalues[i + 17]; - saVxyz += rvalues[i + 18]; - - } - } -} -////////////////////////////////////////////////////////////////////////// -void IntegrateValuesHelper::calculateMQ() -{ - LBMReal f[D3Q27System::ENDF + 1]; - LBMReal vx1, vx2, vx3, rho; - clearData(); - - //Funktionszeiger - typedef void(*CalcMacrosFct)(const LBMReal* const& /*feq[27]*/, LBMReal& /*(d)rho*/, LBMReal& /*vx1*/, LBMReal& /*vx2*/, LBMReal& /*vx3*/); - - CalcMacrosFct calcMacros = NULL; - - for(CalcNodes cn : cnodes) - { - ILBMKernelPtr kernel = cn.block->getKernel(); - LBMReal dx = 1.0 / (LBMReal)(1 << cn.block->getLevel()); - LBMReal cellVolume = dx*dx*dx; - - if (kernel->getCompressible()) - { - calcMacros = &D3Q27System::calcCompMacroscopicValues; - } - else - { - calcMacros = &D3Q27System::calcIncompMacroscopicValues; - } - - BCArray3DPtr bcArray = kernel->getBCProcessor()->getBCArray(); - DistributionArray3DPtr distributions = kernel->getDataSet()->getFdistributions(); - for(UbTupleInt3 node : cn.nodes) - { - distributions->getDistribution(f, val<1>(node), val<2>(node), val<3>(node)); - calcMacros(f, rho, vx1, vx2, vx3); - sRho += rho*cellVolume; - sVx1 += vx1*cellVolume; - sVx2 += vx2*cellVolume; - sVx3 += vx3*cellVolume; - sCellVolume += cellVolume; - } - } - std::vector<double> values(5); - std::vector<double> rvalues; - values[0] = sRho; - values[1] = sVx1; - values[2] = sVx2; - values[3] = sVx3; - values[4] = sCellVolume; - - rvalues = comm->gather(values); - if (root) - { - clearData(); - int rsize = (int)rvalues.size(); - int vsize = (int)values.size(); - for (int i = 0; i < rsize; i += vsize) - { - sRho += rvalues[i]; - sVx1 += rvalues[i + 1]; - sVx2 += rvalues[i + 2]; - sVx3 += rvalues[i + 3]; - sCellVolume += rvalues[i + 4]; - } - } -} -////////////////////////////////////////////////////////////////////////// -void IntegrateValuesHelper::clearData() -{ - sRho = 0.0; - sVx1 = 0.0; - sVx2 = 0.0; - sVx3 = 0.0; - sCellVolume = 0.0; - //sVm = 0.0; - //sPress = 0.0; - //numberOfFluidsNodes = 0.0; - sAvVx1 = 0.0; - sAvVx2 = 0.0; - sAvVx3 = 0.0; - sTSx1 = 0.0; - sTSx2 = 0.0; - sTSx3 = 0.0; - sTSx1x3 = 0.0; -} -////////////////////////////////////////////////////////////////////////// -LBMReal IntegrateValuesHelper::getNumberOfFluidsNodes() -{ - return this->numberOfFluidsNodes; -} -////////////////////////////////////////////////////////////////////////// -LBMReal IntegrateValuesHelper::getNumberOfSolidNodes() -{ - return this->numberOfSolidNodes; -} -////////////////////////////////////////////////////////////////////////// -GbCuboid3DPtr IntegrateValuesHelper::getBoundingBox() -{ - return this->boundingBox; -} -////////////////////////////////////////////////////////////////////////// -std::vector<IntegrateValuesHelper::CalcNodes> IntegrateValuesHelper::getCNodes() -{ - return cnodes; -} diff --git a/src/VirtualFluids/CoProcessors/IntegrateValuesHelper.h b/src/VirtualFluids/CoProcessors/IntegrateValuesHelper.h deleted file mode 100644 index 06055bd8a..000000000 --- a/src/VirtualFluids/CoProcessors/IntegrateValuesHelper.h +++ /dev/null @@ -1,123 +0,0 @@ -#ifndef INTEGRATEVALUESHELPER_H -#define INTEGRATEVALUESHELPER_H - -#include "Grid3D.h" -#include "D3Q27System.h" -#include "Communicator.h" -#include "GbCuboid3D.h" -#include "CbArray2D.h" -#include "Block3D.h" - -//struct CalcNodes -//{ -// Block3DPtr block; -// std::vector<UbTupleInt3> nodes; -//}; -// -//struct Nodes -//{ -// Block3DPtr block; -// UbTupleInt3 nodes; -//}; - -class IntegrateValuesHelper; -typedef std::shared_ptr<IntegrateValuesHelper> IntegrateValuesHelperPtr; - -class IntegrateValuesHelper -{ -public: - struct CalcNodes - { - Block3DPtr block; - std::vector<UbTupleInt3> nodes; - }; - - struct Node - { - Block3DPtr block; - UbTupleInt3 node; - }; -public: - IntegrateValuesHelper(Grid3DPtr grid, CommunicatorPtr comm, - double minX1, double minX2, double minX3, - double maxX1, double maxX2, double maxX3); - IntegrateValuesHelper(Grid3DPtr grid, CommunicatorPtr comm, - double minX1, double minX2, double minX3, - double maxX1, double maxX2, double maxX3, int level); - virtual ~IntegrateValuesHelper(); - - void calculateMQ(); - void calculateAV(); - void calculateAV2(); - void prepare2DMatrix(int level); - void clearData(); - - double getRho() {return sRho;} - double getVx1() {return sVx1;} - double getVx2() {return sVx2;} - double getVx3() {return sVx3;} - double getCellsVolume() { return sCellVolume; } - // LBMReal getVm() { return sVm; } - //LBMReal getPress() {return sPress;} - double getAvVx1(){return sAvVx1;} - double getAvVx2(){return sAvVx2;} - double getAvVx3(){return sAvVx3;} - double getTSx1(){return sTSx1;} - double getTSx2(){return sTSx2;} - double getTSx3(){return sTSx3;} - double getTSx1x3(){return sTSx1x3;} - - double getAVx() { return saVx ; } - double getAVy() { return saVy ; } - double getAVz() { return saVz ; } - - double getAVxx() { return saVxx ; } - double getAVyy() { return saVyy ; } - double getAVzz() { return saVzz ; } - double getAVxy() { return saVxy ; } - double getAVxz() { return saVxz ; } - double getAVyz() { return saVyz ; } - - double getAVxxx() { return saVxxx; } - double getAVxxy() { return saVxxy; } - double getAVxxz() { return saVxxz; } - double getAVyyy() { return saVyyy; } - double getAVyyx() { return saVyyx; } - double getAVyyz() { return saVyyz; } - double getAVzzz() { return saVzzz; } - double getAVzzx() { return saVzzx; } - double getAVzzy() { return saVzzy; } - double getAVxyz() { return saVxyz; } - - - LBMReal getNumberOfFluidsNodes(); - LBMReal getNumberOfSolidNodes(); - GbCuboid3DPtr getBoundingBox(); - std::vector<CalcNodes> getCNodes(); - -protected: -private: - void init(int level); - - bool root; - Grid3DPtr grid; - double sVx1, sVx2, sVx3, sRho, sCellVolume;// sPress, sVm; - double numberOfFluidsNodes, numberOfSolidNodes; - double sAvVx1, sAvVx2, sAvVx3, sTSx1, sTSx2, sTSx3, sTSx1x3; - std::vector<CalcNodes> cnodes; - GbCuboid3DPtr boundingBox; - CommunicatorPtr comm; - CbArray2D<Node> cnodes2DMatrix; - enum Values{AvVx = 0, AvVy = 1, AvVz = 2, AvVxx = 3, AvVyy = 4, AvVzz = 5, AvVxy = 6, AvVyz = 7, AvVxz = 8}; - - double saVx, saVy, saVz; - double saVxx, saVyy, saVzz, saVxy, saVxz, saVyz; - double saVxxx, saVxxy, saVxxz, saVyyy, saVyyx, saVyyz, saVzzz, saVzzx, saVzzy, saVxyz; - - enum Velocity { Vx, Vy, Vz }; - enum Fluctuations { Vxx, Vyy, Vzz, Vxy, Vxz, Vyz }; - enum Triplecorrelations { Vxxx, Vxxy, Vxxz, Vyyy, Vyyx, Vyyz, Vzzz, Vzzx, Vzzy, Vxyz }; - -}; - -#endif diff --git a/src/VirtualFluids/CoProcessors/LineTimeSeriesCoProcessor.cpp b/src/VirtualFluids/CoProcessors/LineTimeSeriesCoProcessor.cpp deleted file mode 100644 index e6b9f0cb1..000000000 --- a/src/VirtualFluids/CoProcessors/LineTimeSeriesCoProcessor.cpp +++ /dev/null @@ -1,247 +0,0 @@ -#include "LineTimeSeriesCoProcessor.h" -#include "BCProcessor.h" -#include "WbWriterVtkXmlASCII.h" - -#include "DataSet3D.h" -#include "LBMKernel.h" -#include "CoordinateTransformation3D.h" -#include "Block3D.h" -#include "GbLine3D.h" -#include "UbScheduler.h" -#include "Grid3D.h" -#include "Communicator.h" -#include "CompressibleCumulantLBMKernel.h" - -LineTimeSeriesCoProcessor::LineTimeSeriesCoProcessor(Grid3DPtr grid, UbSchedulerPtr s, const std::string& path, GbLine3DPtr line, int level, CommunicatorPtr comm) : - CoProcessor(grid, s), - path(path), - length(0), - ix1(0), - ix2(0), - ix3(0), - level(level), - line(line) -{ - root = comm->isRoot(); - fname = path; - - mpi_comm = *((MPI_Comm*)comm->getNativeCommunicator()); - numOfProc = comm->getNumberOfProcesses(); - gridRank = comm->getProcessID(); - - double dx = CoProcessor::grid->getDeltaX(level); - - CoordinateTransformation3DPtr trafo = grid->getCoordinateTransformator(); - double orgX1 = trafo->getX1CoordinateOffset(); - double orgX2 = trafo->getX2CoordinateOffset(); - double orgX3 = trafo->getX3CoordinateOffset(); - - - int x1min = (int)((line->getX1Minimum()-orgX1)/dx); - int x1max = (int)((line->getX1Maximum()-orgX1)/dx); - int x2min = (int)((line->getX2Minimum()-orgX2)/dx); - int x2max = (int)((line->getX2Maximum()-orgX2)/dx); - int x3min = (int)((line->getX3Minimum()-orgX3)/dx); - int x3max = (int)((line->getX3Maximum()-orgX3)/dx); - - UbTupleInt3 blockNx = grid->getBlockNX(); - - if (x1min!=x1max) - { - dir = X1; - blocknx = val<1>(blockNx); - length = x1max; - } - else if (x2min!=x2max) - { - dir = X2; - blocknx = val<2>(blockNx); - length = x2max; - } - else if (x3min!=x3max) - { - dir = X3; - blocknx = val<3>(blockNx); - length = x3max; - } - blockix1 = x1min/val<1>(blockNx); - blockix2 = x2min/val<2>(blockNx); - blockix3 = x3min/val<3>(blockNx); - - ix1 = x1min%val<1>(blockNx)+1; - ix2 = x2min%val<2>(blockNx)+1; - ix3 = x3min%val<3>(blockNx)+1; -} -////////////////////////////////////////////////////////////////////////// -void LineTimeSeriesCoProcessor::process(double step) -{ - if (scheduler->isDue(step)) - { - collectData(); - } - - UBLOG(logDEBUG3, "MacroscopicQuantitiesCoProcessor::update:"<<step); -} -////////////////////////////////////////////////////////////////////////// -void LineTimeSeriesCoProcessor::writeLine(const std::string& path) -{ - std::vector<UbTupleFloat3 > nodes(2); - std::vector<UbTupleInt2 > lines(1); - val<1>(nodes[0]) = (float)line->getX1Minimum(); - val<2>(nodes[0]) = (float)line->getX2Minimum(); - val<3>(nodes[0]) = (float)line->getX3Minimum(); - val<1>(nodes[1]) = (float)line->getX1Maximum(); - val<2>(nodes[1]) = (float)line->getX2Maximum(); - val<3>(nodes[1]) = (float)line->getX3Maximum(); - val<1>(lines[0]) = 0; - val<1>(lines[0]) = 1; - WbWriterVtkXmlASCII *writer = WbWriterVtkXmlASCII::getInstance(); - writer->writeLines(path, nodes, lines); -} -////////////////////////////////////////////////////////////////////////// -void LineTimeSeriesCoProcessor::collectData() -{ - LBMReal f[27]; - LBMReal vx1, vx2, vx3, rho; - MPI_Status status; - std::vector<double> v1(length, 0); - std::vector<double> v2(length, 0); - std::vector<double> v3(length, 0); - std::vector<double> p(length, 0); - for (int x = 0; x<length; x += blocknx) - { - if (dir == X1) - { - blockix1 = x/blocknx; - } - else if (dir == X2) - { - blockix2 = x/blocknx; - } - else if (dir == X3) - { - blockix3 = x/blocknx; - } - - Block3DPtr block = CoProcessor::grid->getBlock(blockix1, blockix2, blockix3, level); - if (block) - { - if (block->getRank()==gridRank) - { - ILBMKernelPtr kernel = block->getKernel(); - calcMacros = NULL; - if (kernel->getCompressible()) - { - calcMacros = &D3Q27System::calcCompMacroscopicValues; - } - else - { - calcMacros = &D3Q27System::calcIncompMacroscopicValues; - } - DistributionArray3DPtr distributions = kernel->getDataSet()->getFdistributions(); - - for (int ix = 1; ix<=blocknx; ix++) - { - if (dir==X1) - { - ix1 = ix; - } - else if (dir==X2) - { - ix2 = ix; - } - else if (dir==X3) - { - ix3 = ix; - } - distributions->getDistribution(f, ix1, ix2, ix3); - calcMacros(f, rho, vx1, vx2, vx3); - v1[x+(ix-1)] = vx1; - v2[x+(ix-1)] = vx2; - v3[x+(ix-1)] = vx3; - p[x+(ix-1)] = rho; - } - } - } - - } - - if (root) - { - for (int i = 1; i<numOfProc; i++) - { - std::vector<double> v1temp(length, 0); - std::vector<double> v2temp(length, 0); - std::vector<double> v3temp(length, 0); - std::vector<double> ptemp(length, 0); - MPI_Recv(&v1temp[0], length, MPI_DOUBLE, i, 1, mpi_comm, &status); - MPI_Recv(&v2temp[0], length, MPI_DOUBLE, i, 2, mpi_comm, &status); - MPI_Recv(&v3temp[0], length, MPI_DOUBLE, i, 3, mpi_comm, &status); - MPI_Recv( &ptemp[0], length, MPI_DOUBLE, i, 4, mpi_comm, &status); - for (int j = 0; j<length; j++) - { - v1[j] += v1temp[j]; - v2[j] += v2temp[j]; - v3[j] += v3temp[j]; - p[j] += ptemp[j]; - } - } - - std::ofstream ostr; - ostr.open(fname.c_str(), std::ios_base::out|std::ios_base::app); - if (!ostr) - { - ostr.clear(); - std::string path = UbSystem::getPathFromString(fname); - if (path.size()>0) { UbSystem::makeDirectory(path); ostr.open(fname.c_str(), std::ios_base::out|std::ios_base::app); } - if (!ostr) throw UbException(UB_EXARGS, "couldn't open file "+fname); - } - - for (int x = 0; x<length; x++) - { - ostr<<v1[x]; - if (x<length-1) - { - ostr<<";"; - } - } - ostr<<"\n"; - for (int x = 0; x<length; x++) - { - ostr<<v2[x]; - if (x<length-1) - { - ostr<<";"; - } - } - ostr<<"\n"; - for (int x = 0; x<length; x++) - { - ostr<<v3[x]; - if (x<length-1) - { - ostr<<";"; - } - } - ostr<<"\n"; - for (int x = 0; x<length; x++) - { - ostr<<p[x]; - if (x<length-1) - { - ostr<<";"; - } - } - ostr<<"\n"; - ostr.close(); - } - else - { - MPI_Send(&v1[0], length, MPI_DOUBLE, 0, 1, mpi_comm); - MPI_Send(&v2[0], length, MPI_DOUBLE, 0, 2, mpi_comm); - MPI_Send(&v3[0], length, MPI_DOUBLE, 0, 3, mpi_comm); - MPI_Send( &p[0], length, MPI_DOUBLE, 0, 4, mpi_comm); - } -} - - diff --git a/src/VirtualFluids/CoProcessors/LineTimeSeriesCoProcessor.h b/src/VirtualFluids/CoProcessors/LineTimeSeriesCoProcessor.h deleted file mode 100644 index 5c63f9ba8..000000000 --- a/src/VirtualFluids/CoProcessors/LineTimeSeriesCoProcessor.h +++ /dev/null @@ -1,58 +0,0 @@ -#ifndef LineTimeSeriesCoProcessor_h__ -#define LineTimeSeriesCoProcessor_h__ - -#include <memory> -#include <string> - -#include <mpi.h> - -#include "CoProcessor.h" -#include "LBMSystem.h" - -class Communicator; -class Grid3D; -class UbScheduler; -class GbLine3D; - -//! \brief Writes to .csv file time series for a line in x1 direction. -//! \details It can be used to compute for given time range the time averaged two-point correlations for a line. <br> -//! \f$ R_{ij}(x_{a},x{b},t) = <u_{i}(x_{a},t)u_{j}(x_{a}+r,t)> \f$ <br> -// -//! \author Konstantin Kutscher - -class LineTimeSeriesCoProcessor : public CoProcessor -{ -public: -enum Direction {X1, X2, X3}; -public: - LineTimeSeriesCoProcessor(std::shared_ptr<Grid3D> grid, std::shared_ptr<UbScheduler> s, const std::string& path, std::shared_ptr<GbLine3D> line, int level,std::shared_ptr<Communicator> comm); - ~LineTimeSeriesCoProcessor(){} - - void process(double step) override; - void writeLine(const std::string& path); - -protected: - void collectData(); -private: - std::string path; - std::string fname; - bool root; - std::shared_ptr<GbLine3D> line; - //function pointer - typedef void(*CalcMacrosFct)(const LBMReal* const& /*feq[27]*/, LBMReal& /*(d)rho*/, LBMReal& /*vx1*/, LBMReal& /*vx2*/, LBMReal& /*vx3*/); - CalcMacrosFct calcMacros; - int blocknx; - int blockix1; - int blockix2; - int blockix3; - int level; - int ix1; - int ix2; - int ix3; - int length; - MPI_Comm mpi_comm; - int numOfProc; - int gridRank; - Direction dir; -}; -#endif // LineTimeSeriesCoProcessor_h__ diff --git a/src/VirtualFluids/CoProcessors/MPIIORestart11CoProcessor.cpp b/src/VirtualFluids/CoProcessors/MPIIORestart11CoProcessor.cpp deleted file mode 100644 index b63477019..000000000 --- a/src/VirtualFluids/CoProcessors/MPIIORestart11CoProcessor.cpp +++ /dev/null @@ -1,1414 +0,0 @@ -#include "MPIIORestart11CoProcessor.h" -#include <boost/foreach.hpp> -#include "D3Q27System.h" -//#include "LBMKernel.h" -#include "CompressibleCumulantLBMKernel.h" -#include "IncompressibleCumulantLBMKernel.h" -#include "ThinWallBCProcessor.h" -#include "D3Q27EsoTwist3DSplittedVector.h" -#include <UbSystem.h> -#include <MemoryUtil.h> -#include "BoundaryConditions.h" -#include "Block3D.h" -#include "CoordinateTransformation3D.h" -#include "DataSet3D.h" -#include "Grid3D.h" -#include "BCArray3D.h" - -//! BLOCK_SIZE defines the quantity of the BoundaryCondition-structures written as one block to the file -//! To avoid overflow in the parameter \a count of the function MPI_File_write_at -//! structures BoundaryCondition are being written in blocks containing each of them BLOCK_SIZE structures -#define BLOCK_SIZE 1024 - -MPIIORestart11CoProcessor::MPIIORestart11CoProcessor(Grid3DPtr grid, UbSchedulerPtr s, - const std::string& path, - CommunicatorPtr comm) : - CoProcessor(grid, s), - path(path), - comm(comm), - mpiTypeFreeFlag(false) -{ - UbSystem::makeDirectory(path+"/mpi_io_cp"); - - memset(&dataSetParamStr, 0, sizeof(dataSetParamStr)); - memset(&boundCondParamStr, 0, sizeof(boundCondParamStr)); - - //------------------------- define MPI types --------------------------------- - - MPI_Datatype typesGP[3] = { MPI_DOUBLE, MPI_INT, MPI_CHAR }; - int blocksGP[3] = { 34, 6, 5 }; - MPI_Aint offsetsGP[3], lbGP, extentGP; - - offsetsGP[0] = 0; - MPI_Type_get_extent(MPI_DOUBLE, &lbGP, &extentGP); - offsetsGP[1] = blocksGP[0]*extentGP; - - MPI_Type_get_extent(MPI_INT, &lbGP, &extentGP); - offsetsGP[2] = offsetsGP[1]+blocksGP[1]*extentGP; - - MPI_Type_create_struct (3, blocksGP, offsetsGP, typesGP, &gridParamType); - MPI_Type_commit(&gridParamType); - - //----------------------------------------------------------------------- - - MPI_Datatype typesBlock[2] = { MPI_INT, MPI_CHAR }; - int blocksBlock[2] = { 13, 1 }; - MPI_Aint offsetsBlock[2], lbBlock, extentBlock; - - offsetsBlock[0] = 0; - MPI_Type_get_extent(MPI_INT, &lbBlock, &extentBlock); - offsetsBlock[1] = blocksBlock[0]*extentBlock; - - MPI_Type_create_struct(2, blocksBlock, offsetsBlock, typesBlock, &block3dType); - MPI_Type_commit(&block3dType); - - //----------------------------------------------------------------------- - - MPI_Type_contiguous(40, MPI_INT, &dataSetParamType); - MPI_Type_commit(&dataSetParamType); - - //----------------------------------------------------------------------- - - MPI_Datatype typesDataSet[3] = { MPI_DOUBLE, MPI_INT, MPI_CHAR }; - int blocksDataSet[3] = { 2, 5, 2 }; - MPI_Aint offsetsDatatSet[3], lbDataSet, extentDataSet; - - offsetsDatatSet[0] = 0; - MPI_Type_get_extent(MPI_DOUBLE, &lbDataSet, &extentDataSet); - offsetsDatatSet[1] = blocksDataSet[0]*extentDataSet; - - MPI_Type_get_extent(MPI_INT, &lbDataSet, &extentDataSet); - offsetsDatatSet[2] = offsetsDatatSet[1]+blocksDataSet[1]*extentDataSet; - - MPI_Type_create_struct(3, blocksDataSet, offsetsDatatSet, typesDataSet, &dataSetType); - MPI_Type_commit(&dataSetType); - - //----------------------------------------------------------------------- - - MPI_Type_contiguous(4, MPI_INT, &boundCondParamType); - MPI_Type_commit(&boundCondParamType); - - //----------------------------------------------------------------------- - - MPI_Datatype typesBC[3] = { MPI_LONG_LONG_INT, MPI_FLOAT, MPI_CHAR }; - int blocksBC[3] = { 5, 38, 1 }; - MPI_Aint offsetsBC[3], lbBC, extentBC; - - offsetsBC[0] = 0; - MPI_Type_get_extent(MPI_LONG_LONG_INT, &lbBC, &extentBC); - offsetsBC[1] = blocksBC[0]*extentBC; - - MPI_Type_get_extent(MPI_FLOAT, &lbBC, &extentBC); - offsetsBC[2] = offsetsBC[1]+blocksBC[1]*extentBC; - - MPI_Type_create_struct(3, blocksBC, offsetsBC, typesBC, &boundCondType); - MPI_Type_commit(&boundCondType); - - //--------------------------------------- - - MPI_Type_contiguous(BLOCK_SIZE, boundCondType, &boundCondType1000); - MPI_Type_commit(&boundCondType1000); - - //--------------------------------------- - - MPI_Type_contiguous(6, MPI_INT, &boundCondTypeAdd); - MPI_Type_commit(&boundCondTypeAdd); - -} -////////////////////////////////////////////////////////////////////////// -MPIIORestart11CoProcessor::~MPIIORestart11CoProcessor() -{ - MPI_Type_free(&gridParamType); - MPI_Type_free(&block3dType); - MPI_Type_free(&dataSetParamType); - MPI_Type_free(&dataSetType); - MPI_Type_free(&boundCondParamType); - MPI_Type_free(&boundCondType); - MPI_Type_free(&boundCondType1000); - MPI_Type_free(&boundCondTypeAdd); - - if (mpiTypeFreeFlag) - { - MPI_Type_free(&dataSetDoubleType); - MPI_Type_free(&bcindexmatrixType); - } -} - -////////////////////////////////////////////////////////////////////////// -void MPIIORestart11CoProcessor::process(double step) -{ - if (scheduler->isDue(step)) - { - if (comm->isRoot()) UBLOG(logINFO, "MPIIORestart11CoProcessor save step: "<<step); - if (comm->isRoot()) UBLOG(logINFO, "Save check point - start"); - /*if (comm->isRoot())*/ clearAllFiles((int)step); - writeBlocks((int)step); - writeDataSet((int)step); - writeBoundaryConds((int)step); - if (comm->isRoot()) UBLOG(logINFO, "Save check point - end"); - - //readDataSet((int)step); - //readBoundaryConds((int)step); - } -} -////////////////////////////////////////////////////////////////////////// -void MPIIORestart11CoProcessor::clearAllFiles(int step) -{ - MPI_File file_handler1, file_handler2, file_handler3; - MPI_Info info = MPI_INFO_NULL; - MPI_Offset new_size = 0; - - UbSystem::makeDirectory(path + "/mpi_io_cp/mpi_io_cp_" + UbSystem::toString(step)); - std::string filename1 = path + "/mpi_io_cp/mpi_io_cp_" + UbSystem::toString(step) + "/cpBlocks.bin"; - //MPI_File_delete(filename1.c_str(), info); - int rc1 = MPI_File_open(MPI_COMM_WORLD, filename1.c_str(), MPI_MODE_CREATE | MPI_MODE_WRONLY, MPI_INFO_NULL, &file_handler1); - if (rc1 != MPI_SUCCESS) throw UbException(UB_EXARGS, "couldn't open file " + filename1); - MPI_File_set_size(file_handler1, new_size); - //MPI_File_sync(file_handler1); - MPI_File_close(&file_handler1); - - std::string filename2 = path + "/mpi_io_cp/mpi_io_cp_" + UbSystem::toString(step) + "/cpDataSet.bin"; - //MPI_File_delete(filename2.c_str(), info); - int rc2 = MPI_File_open(MPI_COMM_WORLD, filename2.c_str(), MPI_MODE_CREATE | MPI_MODE_WRONLY, info, &file_handler2); - if (rc2 != MPI_SUCCESS) throw UbException(UB_EXARGS, "couldn't open file " + filename2); - MPI_File_set_size(file_handler2, new_size); - //MPI_File_sync(file_handler2); - MPI_File_close(&file_handler2); - - std::string filename3 = path + "/mpi_io_cp/mpi_io_cp_" + UbSystem::toString(step) + "/cpBC.bin"; - //MPI_File_delete(filename3.c_str(), info); - int rc3 = MPI_File_open(MPI_COMM_WORLD, filename3.c_str(), MPI_MODE_CREATE | MPI_MODE_WRONLY, info, &file_handler3); - if (rc3 != MPI_SUCCESS) throw UbException(UB_EXARGS, "couldn't open file " + filename3); - MPI_File_set_size(file_handler3, new_size); - //MPI_File_sync(file_handler3); - MPI_File_close(&file_handler3); -} -////////////////////////////////////////////////////////////////////////// -void MPIIORestart11CoProcessor::writeBlocks(int step) -{ - int rank, size; - MPI_Comm_rank(MPI_COMM_WORLD, &rank); - //MPI_Comm_size(MPI_COMM_WORLD, &size); - size=1; - - if (comm->isRoot()) - { - UBLOG(logINFO, "MPIIORestart11CoProcessor::writeBlocks start collect data rank = "<<rank); - UBLOG(logINFO, "Physical Memory currently used by current process: "<<Utilities::getPhysMemUsedByMe()/1073741824.0<<" GB"); - } - - int blocksCount = 0; // quantity of blocks in the grid, max 2147483648 blocks! - int minInitLevel = this->grid->getCoarsestInitializedLevel(); - int maxInitLevel = this->grid->getFinestInitializedLevel(); - - std::vector<Block3DPtr> blocksVector[25]; // max 25 levels - for (int level = minInitLevel; level<=maxInitLevel; level++) - { - //grid->getBlocks(level, rank, blockVector[level]); - grid->getBlocks(level, blocksVector[level]); - blocksCount += static_cast<int>(blocksVector[level].size()); - } - - GridParam* gridParameters = new GridParam; - gridParameters->trafoParams[0] = grid->getCoordinateTransformator()->Tx1; - gridParameters->trafoParams[1] = grid->getCoordinateTransformator()->Tx2; - gridParameters->trafoParams[2] = grid->getCoordinateTransformator()->Tx3; - gridParameters->trafoParams[3] = grid->getCoordinateTransformator()->Sx1; - gridParameters->trafoParams[4] = grid->getCoordinateTransformator()->Sx2; - gridParameters->trafoParams[5] = grid->getCoordinateTransformator()->Sx3; - gridParameters->trafoParams[6] = grid->getCoordinateTransformator()->alpha; - gridParameters->trafoParams[7] = grid->getCoordinateTransformator()->beta; - gridParameters->trafoParams[8] = grid->getCoordinateTransformator()->gamma; - - gridParameters->trafoParams[9] = grid->getCoordinateTransformator()->toX1factorX1; - gridParameters->trafoParams[10] = grid->getCoordinateTransformator()->toX1factorX2; - gridParameters->trafoParams[11] = grid->getCoordinateTransformator()->toX1factorX3; - gridParameters->trafoParams[12] = grid->getCoordinateTransformator()->toX1delta; - gridParameters->trafoParams[13] = grid->getCoordinateTransformator()->toX2factorX1; - gridParameters->trafoParams[14] = grid->getCoordinateTransformator()->toX2factorX2; - gridParameters->trafoParams[15] = grid->getCoordinateTransformator()->toX2factorX3; - gridParameters->trafoParams[16] = grid->getCoordinateTransformator()->toX2delta; - gridParameters->trafoParams[17] = grid->getCoordinateTransformator()->toX3factorX1; - gridParameters->trafoParams[18] = grid->getCoordinateTransformator()->toX3factorX2; - gridParameters->trafoParams[19] = grid->getCoordinateTransformator()->toX3factorX3; - gridParameters->trafoParams[20] = grid->getCoordinateTransformator()->toX3delta; - - gridParameters->trafoParams[21] = grid->getCoordinateTransformator()->fromX1factorX1; - gridParameters->trafoParams[22] = grid->getCoordinateTransformator()->fromX1factorX2; - gridParameters->trafoParams[23] = grid->getCoordinateTransformator()->fromX1factorX3; - gridParameters->trafoParams[24] = grid->getCoordinateTransformator()->fromX1delta; - gridParameters->trafoParams[25] = grid->getCoordinateTransformator()->fromX2factorX1; - gridParameters->trafoParams[26] = grid->getCoordinateTransformator()->fromX2factorX2; - gridParameters->trafoParams[27] = grid->getCoordinateTransformator()->fromX2factorX3; - gridParameters->trafoParams[28] = grid->getCoordinateTransformator()->fromX2delta; - gridParameters->trafoParams[29] = grid->getCoordinateTransformator()->fromX3factorX1; - gridParameters->trafoParams[30] = grid->getCoordinateTransformator()->fromX3factorX2; - gridParameters->trafoParams[31] = grid->getCoordinateTransformator()->fromX3factorX3; - gridParameters->trafoParams[32] = grid->getCoordinateTransformator()->fromX3delta; - - gridParameters->active = grid->getCoordinateTransformator()->active; - gridParameters->transformation = grid->getCoordinateTransformator()->transformation; - - gridParameters->deltaX = grid->getDeltaX(minInitLevel); - UbTupleInt3 blocknx = grid->getBlockNX(); - gridParameters->blockNx1 = val<1>(blocknx); - gridParameters->blockNx2 = val<2>(blocknx); - gridParameters->blockNx3 = val<3>(blocknx); - gridParameters->nx1 = grid->getNX1(); - gridParameters->nx2 = grid->getNX2(); - gridParameters->nx3 = grid->getNX3(); - gridParameters->periodicX1 = grid->isPeriodicX1(); - gridParameters->periodicX2 = grid->isPeriodicX2(); - gridParameters->periodicX3 = grid->isPeriodicX3(); - - //---------------------------------------------------------------------- - - Block3d* block3dArray = new Block3d[blocksCount]; - int ic = 0; - for (int level = minInitLevel; level<=maxInitLevel; level++) - { - for(Block3DPtr block : blocksVector[level]) // all the blocks of the current level - { - // save data describing the block - block3dArray[ic].x1 = block->getX1(); - block3dArray[ic].x2 = block->getX2(); - block3dArray[ic].x3 = block->getX3(); - block3dArray[ic].bundle = block->getBundle(); - block3dArray[ic].rank = block->getRank(); - block3dArray[ic].lrank = block->getLocalRank(); - block3dArray[ic].part = block->getPart(); - block3dArray[ic].globalID = block->getGlobalID(); - block3dArray[ic].localID = block->getLocalID(); - block3dArray[ic].level = block->getLevel(); - block3dArray[ic].interpolationFlagCF = block->getInterpolationFlagCF(); - block3dArray[ic].interpolationFlagFC = block->getInterpolationFlagFC(); - block3dArray[ic].counter = block->getMaxGlobalID(); - block3dArray[ic].active = block->isActive(); - - ic++; - } - } - - if (comm->isRoot()) - { - UBLOG(logINFO, "MPIIORestart11CoProcessor::writeBlocks start MPI IO rank = "<<rank); - UBLOG(logINFO, "Physical Memory currently used by current process: "<<Utilities::getPhysMemUsedByMe()/1073741824.0<<" GB"); - } - - MPI_File file_handler; - MPI_Info info = MPI_INFO_NULL; - //MPI_Info_create (&info); - //MPI_Info_set(info,"romio_cb_write","enable"); - //MPI_Info_set(info,"cb_buffer_size","4194304"); - //MPI_Info_set(info,"striping_unit","4194304"); - - // if (comm->isRoot()) - // { - UbSystem::makeDirectory(path + "/mpi_io_cp/mpi_io_cp_" + UbSystem::toString(step)); - std::string filename = path + "/mpi_io_cp/mpi_io_cp_" + UbSystem::toString(step) + "/cpBlocks.bin"; - int rc = MPI_File_open(MPI_COMM_WORLD, filename.c_str(), MPI_MODE_CREATE | MPI_MODE_WRONLY, MPI_INFO_NULL, &file_handler); - if (rc != MPI_SUCCESS) throw UbException(UB_EXARGS, "couldn't open file " + filename); - // } - - double start, finish; - MPI_Offset write_offset = (MPI_Offset)(size * sizeof(int)); - - if (comm->isRoot()) - { - start = MPI_Wtime(); - - // each process writes the quantity of it's blocks - MPI_File_write_at(file_handler, (MPI_Offset)(rank*sizeof(int)), &blocksCount, 1, MPI_INT, MPI_STATUS_IGNORE); - // each process writes parameters of the grid - MPI_File_write_at(file_handler, write_offset, gridParameters, 1, gridParamType, MPI_STATUS_IGNORE); - // each process writes it's blocks - MPI_File_write_at(file_handler, (MPI_Offset)(write_offset +sizeof(GridParam)), &block3dArray[0], blocksCount, block3dType, MPI_STATUS_IGNORE); - } - - MPI_File_sync(file_handler); - MPI_File_close(&file_handler); - - if (comm->isRoot()) - { - finish = MPI_Wtime(); - UBLOG(logINFO, "MPIIORestart11CoProcessor::writeBlocks time: "<<finish-start<<" s"); - } - - delete[] block3dArray; - delete gridParameters; -} - -void MPIIORestart11CoProcessor::writeDataSet(int step) -{ - int rank, size; - MPI_Comm_rank(MPI_COMM_WORLD, &rank); - MPI_Comm_size(MPI_COMM_WORLD, &size); - - int blocksCount = 0; // quantity of blocks in the grid, max 2147483648 blocks! - - std::vector<Block3DPtr> blocksVector[25]; - int minInitLevel = this->grid->getCoarsestInitializedLevel(); - int maxInitLevel = this->grid->getFinestInitializedLevel(); - for (int level = minInitLevel; level<=maxInitLevel; level++) - { - grid->getBlocks(level, rank, blocksVector[level]); - blocksCount += static_cast<int>(blocksVector[level].size()); - } - - DataSet* dataSetArray = new DataSet[blocksCount]; - std::vector<double> doubleValuesArray; // double-values (arrays of f's) in all blocks - - if (comm->isRoot()) - { - UBLOG(logINFO, "MPIIORestart11CoProcessor::writeDataSet start collect data rank = "<<rank); - UBLOG(logINFO, "Physical Memory currently used by current process: "<<Utilities::getPhysMemUsedByMe()/1073741824.0<<" GB"); - } - - bool firstBlock = true; - int ic = 0; - for (int level = minInitLevel; level<=maxInitLevel; level++) - { - for(Block3DPtr block : blocksVector[level]) // blocks of the current level - { - dataSetArray[ic].x1 = block->getX1(); // coordinates of the block needed to find it while regenerating the grid - dataSetArray[ic].x2 = block->getX2(); - dataSetArray[ic].x3 = block->getX3(); - dataSetArray[ic].level = block->getLevel(); - //if (block->getKernel()) - //{ - dataSetArray[ic].ghostLayerWidth = block->getKernel()->getGhostLayerWidth(); - dataSetArray[ic].collFactor = block->getKernel()->getCollisionFactor(); - dataSetArray[ic].deltaT = block->getKernel()->getDeltaT(); - dataSetArray[ic].compressible = block->getKernel()->getCompressible(); - dataSetArray[ic].withForcing = block->getKernel()->getWithForcing(); - //} - //else - //{ - // dataSetArray[ic].ghostLayerWidth = 0; - // dataSetArray[ic].collFactor = 0.0; - // dataSetArray[ic].deltaT = 0.0; - // dataSetArray[ic].compressible = false; - // dataSetArray[ic].withForcing = false; - //} - //std::cout << "ic="<<ic<<"-"<<dataSetArray[ic].x1 << "," << dataSetArray[ic].x2 << "," << dataSetArray[ic].x3 << "," << dataSetArray[ic].level << "," << dataSetArray[ic].ghostLayerWidth; - //std::cout << dataSetArray[ic].collFactor<<","<<dataSetArray[ic].deltaT<<","<<dataSetArray[ic].compressible<<","<<dataSetArray[ic].withForcing<<std::endl; - //dataSetArrayGW[ic].x1 = dataSetArray[ic].x1; - //dataSetArrayGW[ic].x2 = dataSetArray[ic].x2; - //dataSetArrayGW[ic].x3 = dataSetArray[ic].x3; - //dataSetArrayGW[ic].level = dataSetArray[ic].level; - //dataSetArrayGW[ic].ghostLayerWidth = dataSetArray[ic].ghostLayerWidth; - //dataSetArrayGW[ic].collFactor = dataSetArray[ic].collFactor; - //dataSetArrayGW[ic].deltaT = dataSetArray[ic].deltaT; - //dataSetArrayGW[ic].compressible = dataSetArray[ic].compressible; - //dataSetArrayGW[ic].withForcing = dataSetArray[ic].withForcing; - - if (firstBlock /*&& block->getKernel()*/) // when first (any) valid block... - { - std::shared_ptr< CbArray4D<LBMReal, IndexerX4X3X2X1> > averageDensityArray = block->getKernel()->getDataSet()->getAverageDencity(); - if (averageDensityArray) - { - dataSetParamStr.nx[0][0] = static_cast<int>(averageDensityArray->getNX1()); - dataSetParamStr.nx[0][1] = static_cast<int>(averageDensityArray->getNX2()); - dataSetParamStr.nx[0][2] = static_cast<int>(averageDensityArray->getNX3()); - dataSetParamStr.nx[0][3] = static_cast<int>(averageDensityArray->getNX4()); - } - - std::shared_ptr< CbArray4D<LBMReal, IndexerX4X3X2X1> > AverageVelocityArray3DPtr = block->getKernel()->getDataSet()->getAverageVelocity(); - if (AverageVelocityArray3DPtr) - { - dataSetParamStr.nx[1][0] = static_cast<int>(AverageVelocityArray3DPtr->getNX1()); - dataSetParamStr.nx[1][1] = static_cast<int>(AverageVelocityArray3DPtr->getNX2()); - dataSetParamStr.nx[1][2] = static_cast<int>(AverageVelocityArray3DPtr->getNX3()); - dataSetParamStr.nx[1][3] = static_cast<int>(AverageVelocityArray3DPtr->getNX4()); - } - - std::shared_ptr< CbArray4D<LBMReal, IndexerX4X3X2X1> > AverageFluctArray3DPtr = block->getKernel()->getDataSet()->getAverageFluctuations(); - if (AverageFluctArray3DPtr) - { - dataSetParamStr.nx[2][0] = static_cast<int>(AverageFluctArray3DPtr->getNX1()); - dataSetParamStr.nx[2][1] = static_cast<int>(AverageFluctArray3DPtr->getNX2()); - dataSetParamStr.nx[2][2] = static_cast<int>(AverageFluctArray3DPtr->getNX3()); - dataSetParamStr.nx[2][3] = static_cast<int>(AverageFluctArray3DPtr->getNX4()); - } - - std::shared_ptr< CbArray4D<LBMReal, IndexerX4X3X2X1> > AverageTripleArray3DPtr = block->getKernel()->getDataSet()->getAverageTriplecorrelations(); - if (AverageTripleArray3DPtr) - { - dataSetParamStr.nx[3][0] = static_cast<int>(AverageTripleArray3DPtr->getNX1()); - dataSetParamStr.nx[3][1] = static_cast<int>(AverageTripleArray3DPtr->getNX2()); - dataSetParamStr.nx[3][2] = static_cast<int>(AverageTripleArray3DPtr->getNX3()); - dataSetParamStr.nx[3][3] = static_cast<int>(AverageTripleArray3DPtr->getNX4()); - } - - std::shared_ptr< CbArray4D<LBMReal, IndexerX4X3X2X1> > ShearStressValArray3DPtr = block->getKernel()->getDataSet()->getShearStressValues(); - if (ShearStressValArray3DPtr) - { - dataSetParamStr.nx[4][0] = static_cast<int>(ShearStressValArray3DPtr->getNX1()); - dataSetParamStr.nx[4][1] = static_cast<int>(ShearStressValArray3DPtr->getNX2()); - dataSetParamStr.nx[4][2] = static_cast<int>(ShearStressValArray3DPtr->getNX3()); - dataSetParamStr.nx[4][3] = static_cast<int>(ShearStressValArray3DPtr->getNX4()); - } - - std::shared_ptr< CbArray3D<LBMReal, IndexerX3X2X1> > relaxationFactor3DPtr = block->getKernel()->getDataSet()->getRelaxationFactor(); - if (relaxationFactor3DPtr) - { - dataSetParamStr.nx[5][0] = static_cast<int>(relaxationFactor3DPtr->getNX1()); - dataSetParamStr.nx[5][1] = static_cast<int>(relaxationFactor3DPtr->getNX2()); - dataSetParamStr.nx[5][2] = static_cast<int>(relaxationFactor3DPtr->getNX3()); - dataSetParamStr.nx[5][3] = 1; - } - - std::shared_ptr< D3Q27EsoTwist3DSplittedVector > D3Q27EsoTwist3DSplittedVectorPtr = std::dynamic_pointer_cast<D3Q27EsoTwist3DSplittedVector>(block->getKernel()->getDataSet()->getFdistributions()); - CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr localDistributions = D3Q27EsoTwist3DSplittedVectorPtr->getLocalDistributions(); - if (localDistributions) - { - dataSetParamStr.nx[6][0] = static_cast<int>(localDistributions->getNX1()); - dataSetParamStr.nx[6][1] = static_cast<int>(localDistributions->getNX2()); - dataSetParamStr.nx[6][2] = static_cast<int>(localDistributions->getNX3()); - dataSetParamStr.nx[6][3] = static_cast<int>(localDistributions->getNX4()); - } - - CbArray4D <LBMReal, IndexerX4X3X2X1>::CbArray4DPtr nonLocalDistributions = D3Q27EsoTwist3DSplittedVectorPtr->getNonLocalDistributions(); - if (nonLocalDistributions) - { - dataSetParamStr.nx[7][0] = static_cast<int>(nonLocalDistributions->getNX1()); - dataSetParamStr.nx[7][1] = static_cast<int>(nonLocalDistributions->getNX2()); - dataSetParamStr.nx[7][2] = static_cast<int>(nonLocalDistributions->getNX3()); - dataSetParamStr.nx[7][3] = static_cast<int>(nonLocalDistributions->getNX4()); - } - - CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr zeroDistributions = D3Q27EsoTwist3DSplittedVectorPtr->getZeroDistributions(); - if (zeroDistributions) - { - dataSetParamStr.nx[8][0] = static_cast<int>(zeroDistributions->getNX1()); - dataSetParamStr.nx[8][1] = static_cast<int>(zeroDistributions->getNX2()); - dataSetParamStr.nx[8][2] = static_cast<int>(zeroDistributions->getNX3()); - dataSetParamStr.nx[8][3] = 1; - } - - // ... than save some parameters that are equal in all dataSets - dataSetParamStr.nx1 = static_cast<int>(block->getKernel()->getDataSet()->getFdistributions()->getNX1()); - dataSetParamStr.nx2 = static_cast<int>(block->getKernel()->getDataSet()->getFdistributions()->getNX2()); - dataSetParamStr.nx3 = static_cast<int>(block->getKernel()->getDataSet()->getFdistributions()->getNX3()); - - firstBlock = false; - - // how many elements are in all arrays of DataSet (equal in all blocks) - int doubleCount = 0, temp; - for (int i = 0; i<9; i++) // 9 arrays ( averageValues, averageVelocity, averageFluktuations, - { // averageTriplecorrelations, shearStressValues, relaxationFactor, 3 * fdistributions - temp = 1; - for (int ii = 0; ii < 4; ii++) - { - temp *= dataSetParamStr.nx[i][ii]; - //std::cout << ",dataSetParamStr.nx[" << i << "][" << ii << "]" << "=" << dataSetParamStr.nx[i][ii]; - } - doubleCount += temp; - } - dataSetParamStr.doubleCountInBlock = doubleCount; - } - //std::cout << ",doubleCountInBlock="<<dataSetParamStr.doubleCountInBlock<< "," << dataSetParamStr.nx1 << "," << dataSetParamStr.nx2 << "," << dataSetParamStr.nx3 << std::endl; - - std::shared_ptr< CbArray4D<LBMReal, IndexerX4X3X2X1> > AverageValuesArray3DPtr = block->getKernel()->getDataSet()->getAverageDencity(); - if (AverageValuesArray3DPtr&&(dataSetParamStr.nx[0][0]>0)&&(dataSetParamStr.nx[0][1]>0)&&(dataSetParamStr.nx[0][2]>0)&&(dataSetParamStr.nx[0][3]>0)) - doubleValuesArray.insert(doubleValuesArray.end(), AverageValuesArray3DPtr->getDataVector().begin(), AverageValuesArray3DPtr->getDataVector().end()); - - std::shared_ptr< CbArray4D<LBMReal, IndexerX4X3X2X1> > AverageVelocityArray3DPtr = block->getKernel()->getDataSet()->getAverageVelocity(); - if (AverageVelocityArray3DPtr&&(dataSetParamStr.nx[1][0]>0)&&(dataSetParamStr.nx[1][1]>0)&&(dataSetParamStr.nx[1][2]>0)&&(dataSetParamStr.nx[1][3]>0)) - doubleValuesArray.insert(doubleValuesArray.end(), AverageVelocityArray3DPtr->getDataVector().begin(), AverageVelocityArray3DPtr->getDataVector().end()); - - std::shared_ptr< CbArray4D<LBMReal, IndexerX4X3X2X1> > AverageFluctArray3DPtr = block->getKernel()->getDataSet()->getAverageFluctuations(); - if (AverageFluctArray3DPtr&&(dataSetParamStr.nx[2][0]>0)&&(dataSetParamStr.nx[2][1]>0)&&(dataSetParamStr.nx[2][2]>0)&&(dataSetParamStr.nx[2][3]>0)) - doubleValuesArray.insert(doubleValuesArray.end(), AverageFluctArray3DPtr->getDataVector().begin(), AverageFluctArray3DPtr->getDataVector().end()); - - std::shared_ptr< CbArray4D<LBMReal, IndexerX4X3X2X1> > AverageTripleArray3DPtr = block->getKernel()->getDataSet()->getAverageTriplecorrelations(); - if (AverageTripleArray3DPtr&&(dataSetParamStr.nx[3][0]>0)&&(dataSetParamStr.nx[3][1]>0)&&(dataSetParamStr.nx[3][2]>0)&&(dataSetParamStr.nx[3][3]>0)) - doubleValuesArray.insert(doubleValuesArray.end(), AverageTripleArray3DPtr->getDataVector().begin(), AverageTripleArray3DPtr->getDataVector().end()); - - std::shared_ptr< CbArray4D<LBMReal, IndexerX4X3X2X1> > ShearStressValArray3DPtr = block->getKernel()->getDataSet()->getShearStressValues(); - if (ShearStressValArray3DPtr&&(dataSetParamStr.nx[4][0]>0)&&(dataSetParamStr.nx[4][1]>0)&&(dataSetParamStr.nx[4][2]>0)&&(dataSetParamStr.nx[4][3]>0)) - doubleValuesArray.insert(doubleValuesArray.end(), ShearStressValArray3DPtr->getDataVector().begin(), ShearStressValArray3DPtr->getDataVector().end()); - - std::shared_ptr< CbArray3D<LBMReal, IndexerX3X2X1> > RelaxationFactor3DPtr = block->getKernel()->getDataSet()->getRelaxationFactor(); - if (RelaxationFactor3DPtr&&(dataSetParamStr.nx[5][0]>0)&&(dataSetParamStr.nx[5][1]>0)&&(dataSetParamStr.nx[5][2]>0)) - doubleValuesArray.insert(doubleValuesArray.end(), RelaxationFactor3DPtr->getDataVector().begin(), RelaxationFactor3DPtr->getDataVector().end()); - - std::shared_ptr< D3Q27EsoTwist3DSplittedVector > D3Q27EsoTwist3DSplittedVectorPtr = std::dynamic_pointer_cast<D3Q27EsoTwist3DSplittedVector>(block->getKernel()->getDataSet()->getFdistributions()); - CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr localDistributions = D3Q27EsoTwist3DSplittedVectorPtr->getLocalDistributions(); - if (localDistributions&&(dataSetParamStr.nx[6][0]>0)&&(dataSetParamStr.nx[6][1]>0)&&(dataSetParamStr.nx[6][2]>0)&&(dataSetParamStr.nx[6][3]>0)) - doubleValuesArray.insert(doubleValuesArray.end(), localDistributions->getDataVector().begin(), localDistributions->getDataVector().end()); - - CbArray4D <LBMReal, IndexerX4X3X2X1>::CbArray4DPtr nonLocalDistributions = D3Q27EsoTwist3DSplittedVectorPtr->getNonLocalDistributions(); - if (nonLocalDistributions&&(dataSetParamStr.nx[7][0]>0)&&(dataSetParamStr.nx[7][1]>0)&&(dataSetParamStr.nx[7][2]>0)&&(dataSetParamStr.nx[7][3]>0)) - doubleValuesArray.insert(doubleValuesArray.end(), nonLocalDistributions->getDataVector().begin(), nonLocalDistributions->getDataVector().end()); - - CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr zeroDistributions = D3Q27EsoTwist3DSplittedVectorPtr->getZeroDistributions(); - if (zeroDistributions&&(dataSetParamStr.nx[8][0]>0)&&(dataSetParamStr.nx[8][1]>0)&&(dataSetParamStr.nx[8][2]>0)) - doubleValuesArray.insert(doubleValuesArray.end(), zeroDistributions->getDataVector().begin(), zeroDistributions->getDataVector().end()); - - ic++; - } - } - - // register new MPI-types depending on the block-specific information - MPI_Type_contiguous(dataSetParamStr.doubleCountInBlock, MPI_DOUBLE, &dataSetDoubleType); - MPI_Type_commit(&dataSetDoubleType); - mpiTypeFreeFlag = true; - - //doubleValuesArrayGW.assign(doubleValuesArray.begin(), doubleValuesArray.end()); - - if (comm->isRoot()) - { - UBLOG(logINFO, "MPIIORestart11CoProcessor::writeDataSet start MPI IO rank = "<<rank); - UBLOG(logINFO, "Physical Memory currently used by current process: "<<Utilities::getPhysMemUsedByMe()/1073741824.0<<" GB"); - } - - // write to the file - // all processes calculate their offsets (quantity of bytes that the process is going to write) - // and notify the next process (with the rank = rank + 1) - MPI_Offset write_offset = (MPI_Offset)(size * sizeof(int)); - size_t next_write_offset = 0; - - if (size>1) - { - if (rank==0) - { - next_write_offset = write_offset + sizeof(dataSetParam) + blocksCount * (sizeof(DataSet)+ dataSetParamStr.doubleCountInBlock*sizeof(double)); - MPI_Send(&next_write_offset, 1, MPI_LONG_LONG_INT, 1, 5, MPI_COMM_WORLD); - } - else - { - MPI_Recv(&write_offset, 1, MPI_LONG_LONG_INT, rank-1, 5, MPI_COMM_WORLD, MPI_STATUS_IGNORE); - next_write_offset = write_offset + sizeof(dataSetParam) + blocksCount * (sizeof(DataSet)+ dataSetParamStr.doubleCountInBlock*sizeof(double)); - if (rank<size-1) - MPI_Send(&next_write_offset, 1, MPI_LONG_LONG_INT, rank+1, 5, MPI_COMM_WORLD); - } - } - - double start, finish; - if (comm->isRoot()) start = MPI_Wtime(); - - MPI_Info info = MPI_INFO_NULL; - -#ifdef HLRN - MPI_Info_create(&info); - MPI_Info_set(info, "striping_factor", "40"); - MPI_Info_set(info, "striping_unit", "4M"); -#endif - - MPI_File file_handler; - std::string filename = path+"/mpi_io_cp/mpi_io_cp_"+UbSystem::toString(step)+"/cpDataSet.bin"; - int rc = MPI_File_open(MPI_COMM_WORLD, filename.c_str(), MPI_MODE_CREATE| MPI_MODE_WRONLY, info, &file_handler); - if (rc!=MPI_SUCCESS) throw UbException(UB_EXARGS, "couldn't open file "+filename); - - //std::cout << "writeDataSet rank=" << rank << ",blocksCount=" << blocksCount; - //std::cout << ", rank*sizeof(int)=" << (MPI_Offset)(rank * sizeof(int)) << ", write_offset=" << write_offset << std::endl; - - // each process writes the quantity of it's blocks - MPI_File_write_at(file_handler, (MPI_Offset)(rank*sizeof(int)), &blocksCount, 1, MPI_INT, MPI_STATUS_IGNORE); - // each process writes common parameters of a dataSet - MPI_File_write_at(file_handler, write_offset, &dataSetParamStr, 1, dataSetParamType, MPI_STATUS_IGNORE); - // each process writes data identifying blocks - MPI_File_write_at(file_handler, (MPI_Offset)(write_offset+sizeof(dataSetParam)), dataSetArray, blocksCount, dataSetType, MPI_STATUS_IGNORE); - // each process writes the dataSet arrays - MPI_File_write_at(file_handler, (MPI_Offset)(write_offset+sizeof(dataSetParam)+blocksCount*sizeof(DataSet)), &doubleValuesArray[0], blocksCount, dataSetDoubleType, MPI_STATUS_IGNORE); - MPI_File_sync(file_handler); - - //int blockC; - //MPI_File_read_at(file_handler, (MPI_Offset)(rank * sizeof(int)), &blockC, 1, MPI_INT, MPI_STATUS_IGNORE); - //std::cout << "readDataSet rank=" << rank << ", blockC=" << blockC << std::endl; - - MPI_File_close(&file_handler); - - if (comm->isRoot()) - { - finish = MPI_Wtime(); - UBLOG(logINFO, "MPIIORestart11CoProcessor::writeDataSet time: "<<finish-start<<" s"); - } - - delete[] dataSetArray; -} - -void MPIIORestart11CoProcessor::writeBoundaryConds(int step) -{ - int rank, size; - MPI_Comm_rank(MPI_COMM_WORLD, &rank); - MPI_Comm_size(MPI_COMM_WORLD, &size); - - if (comm->isRoot()) - { - UBLOG(logINFO, "MPIIORestart11CoProcessor::writeBoundaryConds start collect data rank = "<<rank); - UBLOG(logINFO, "Physical Memory currently used by current process: "<<Utilities::getPhysMemUsedByMe()/1073741824.0<<" GB"); - } - - int blocksCount = 0; // quantity of blocks in the grid, max 2147483648 blocks! - size_t count_boundCond = 0; // how many BoundaryConditions in all blocks - int count_indexContainer = 0; // how many indexContainer-values in all blocks - size_t byteCount = 0; // how many bytes writes this process in the file - - std::vector<Block3DPtr> blocksVector[25]; - int minInitLevel = this->grid->getCoarsestInitializedLevel(); - int maxInitLevel = this->grid->getFinestInitializedLevel(); - for (int level = minInitLevel; level<=maxInitLevel; level++) - { - grid->getBlocks(level, rank, blocksVector[level]); - blocksCount += static_cast<int>(blocksVector[level].size()); - } - - BCAdd* bcAddArray = new BCAdd[blocksCount]; - std::vector<BoundaryCondition> bcVector; - std::vector<int> bcindexmatrixV; - std::vector<int> indexContainerV; - bool bcindexmatrixCountNotInit = true; - - int ic = 0; - for (int level = minInitLevel; level<=maxInitLevel; level++) - { - for(Block3DPtr block : blocksVector[level]) // all the blocks of the current level - { - BCArray3DPtr bcArr = block->getKernel()->getBCProcessor()->getBCArray(); - - bcAddArray[ic].x1 = block->getX1(); // coordinates of the block needed to find it while regenerating the grid - bcAddArray[ic].x2 = block->getX2(); - bcAddArray[ic].x3 = block->getX3(); - bcAddArray[ic].level = block->getLevel(); - bcAddArray[ic].boundCond_count = 0; // how many BoundaryConditions in this block - bcAddArray[ic].indexContainer_count = 0; // how many indexContainer-values in this block - - for (int bc = 0; bc<bcArr->getBCVectorSize(); bc++) - { - BoundaryCondition* bouCond = new BoundaryCondition(); - if (bcArr->bcvector[bc]==NULL) - { - memset(bouCond, 0, sizeof(BoundaryCondition)); - } - else - { - bouCond->noslipBoundaryFlags = bcArr->bcvector[bc]->getNoSlipBoundary(); - bouCond->slipBoundaryFlags = bcArr->bcvector[bc]->getSlipBoundary(); - bouCond->velocityBoundaryFlags = bcArr->bcvector[bc]->getVelocityBoundary(); - bouCond->densityBoundaryFlags = bcArr->bcvector[bc]->getDensityBoundary(); - bouCond->wallModelBoundaryFlags = bcArr->bcvector[bc]->getWallModelBoundary(); - bouCond->bcVelocityX1 = bcArr->bcvector[bc]->getBoundaryVelocityX1(); - bouCond->bcVelocityX2 = bcArr->bcvector[bc]->getBoundaryVelocityX2(); - bouCond->bcVelocityX3 = bcArr->bcvector[bc]->getBoundaryVelocityX3(); - bouCond->bcDensity = bcArr->bcvector[bc]->getBoundaryDensity(); - bouCond->bcLodiDensity = bcArr->bcvector[bc]->getDensityLodiDensity(); - bouCond->bcLodiVelocityX1 = bcArr->bcvector[bc]->getDensityLodiVelocityX1(); - bouCond->bcLodiVelocityX2 = bcArr->bcvector[bc]->getDensityLodiVelocityX2(); - bouCond->bcLodiVelocityX3 = bcArr->bcvector[bc]->getDensityLodiVelocityX3(); - bouCond->bcLodiLentgh = bcArr->bcvector[bc]->getDensityLodiLength(); - bouCond->nx1 = bcArr->bcvector[bc]->nx1; - bouCond->nx2 = bcArr->bcvector[bc]->nx2; - bouCond->nx3 = bcArr->bcvector[bc]->nx3; - for (int iq = 0; iq<26; iq++) - bouCond->q[iq] = bcArr->bcvector[bc]->getQ(iq); - bouCond->algorithmType = bcArr->bcvector[bc]->getBcAlgorithmType(); - } - //std::cout << "writeBoundaryConds noslipBoundaryFlags="<< bouCond->noslipBoundaryFlags << std::endl; - bcVector.push_back(*bouCond); - //bcVectorGW.push_back(*bouCond); - //if (bcVector[count_boundCond].noslipBoundaryFlags != bcVectorGW[count_boundCond].noslipBoundaryFlags) - // std::cout << "bcVector[count_boundCond].noslipBoundaryFlags != bcVectorGW[count_boundCond].noslipBoundaryFlags!!!" << std::endl; - bcAddArray[ic].boundCond_count++; - count_boundCond++; - } - - // the quantity of elements in the bcindexmatrix array (CbArray3D<int, IndexerX3X2X1>) in bcArray(BCArray3D) is always equal, - // this will be the size of the "write-read-block" in MPI_write_.../MPI_read-functions when writing/reading BoundConds - if (bcindexmatrixCountNotInit) - { - boundCondParamStr.nx1 = static_cast<int>(bcArr->bcindexmatrix.getNX1()); - boundCondParamStr.nx2 = static_cast<int>(bcArr->bcindexmatrix.getNX2()); - boundCondParamStr.nx3 = static_cast<int>(bcArr->bcindexmatrix.getNX3()); - boundCondParamStr.bcindexmatrixCount = static_cast<int>(bcArr->bcindexmatrix.getDataVector().size()); - bcindexmatrixCountNotInit = false; - } - bcindexmatrixV.insert(bcindexmatrixV.end(), bcArr->bcindexmatrix.getDataVector().begin(), bcArr->bcindexmatrix.getDataVector().end()); - - indexContainerV.insert(indexContainerV.end(), bcArr->indexContainer.begin(), bcArr->indexContainer.end()); - bcAddArray[ic].indexContainer_count = static_cast<int>(bcArr->indexContainer.size()); - count_indexContainer += bcAddArray[ic].indexContainer_count; - - ic++; - } - } - - //bcindexmatrixVGW.assign(bcindexmatrixV.begin(), bcindexmatrixV.end()); - //indexContainerVGW.assign(indexContainerV.begin(), indexContainerV.end()); - - MPI_Type_contiguous(boundCondParamStr.bcindexmatrixCount, MPI_INT, &bcindexmatrixType); - MPI_Type_commit(&bcindexmatrixType); - mpiTypeFreeFlag = true; - - //how many "big blocks" of BLOCK_SIZE size can by formed - int bcBlockCount = (int)(count_boundCond/BLOCK_SIZE); - if (bcBlockCount * BLOCK_SIZE<count_boundCond) - bcBlockCount += 1; - for (int i = (int)count_boundCond; i<bcBlockCount * BLOCK_SIZE; i++) - { - BoundaryCondition* bouCond = new BoundaryCondition(); - memset(bouCond, 0, sizeof(BoundaryCondition)); - bcVector.push_back(*bouCond); - } - - byteCount = bcBlockCount * BLOCK_SIZE * sizeof(BoundaryCondition) + blocksCount * sizeof(BCAdd) + sizeof(int) * (blocksCount * boundCondParamStr.bcindexmatrixCount + count_indexContainer); - - // write to the file - // all processes calculate their offsets (quantity of bytes that the process is going to write) - // and notify the next process (with the rank = rank + 1) - MPI_Offset write_offset = (MPI_Offset)(size * (3 * sizeof(int) + sizeof(boundCondParam))); - size_t next_write_offset = 0; - - if (size>1) - { - if (rank==0) - { - next_write_offset = write_offset + byteCount; - MPI_Send(&next_write_offset, 1, MPI_LONG_LONG_INT, 1, 5, MPI_COMM_WORLD); - } - else - { - MPI_Recv(&write_offset, 1, MPI_LONG_LONG_INT, rank-1, 5, MPI_COMM_WORLD, MPI_STATUS_IGNORE); - next_write_offset = write_offset + byteCount; - if (rank<size-1) - MPI_Send(&next_write_offset, 1, MPI_LONG_LONG_INT, rank+1, 5, MPI_COMM_WORLD); - } - } - - if (comm->isRoot()) - { - UBLOG(logINFO, "MPIIORestart11CoProcessor::writeBoundaryConds start MPI IO rank = "<<rank); - UBLOG(logINFO, "Physical Memory currently used by current process: "<<Utilities::getPhysMemUsedByMe()/1073741824.0<<" GB"); - } - - double start, finish; - if (comm->isRoot()) start = MPI_Wtime(); - - MPI_Info info = MPI_INFO_NULL; - -#ifdef HLRN - MPI_Info_create(&info); - MPI_Info_set(info, "striping_factor", "40"); - MPI_Info_set(info, "striping_unit", "4M"); -#endif - - MPI_File file_handler; - std::string filename = path+"/mpi_io_cp/mpi_io_cp_"+UbSystem::toString(step)+"/cpBC.bin"; - int rc = MPI_File_open(MPI_COMM_WORLD, filename.c_str(), MPI_MODE_CREATE|MPI_MODE_WRONLY, info, &file_handler); - if (rc!=MPI_SUCCESS) throw UbException(UB_EXARGS, "couldn't open file "+filename); - - MPI_Offset write_offset1 = (MPI_Offset)(rank * (3 * sizeof(int) + sizeof(boundCondParam))); - - // each process writes the quantity of it's blocks - MPI_File_write_at(file_handler, write_offset1, &blocksCount, 1, MPI_INT, MPI_STATUS_IGNORE); - // each process writes the quantity of "big blocks" of BLOCK_SIZE of boundary conditions - MPI_File_write_at(file_handler, (MPI_Offset)(write_offset1+sizeof(int)), &bcBlockCount, 1, MPI_INT, MPI_STATUS_IGNORE); - // each process writes the quantity of indexContainer elements in all blocks - MPI_File_write_at(file_handler, (MPI_Offset)(write_offset1+2*sizeof(int)), &count_indexContainer, 1, MPI_INT, MPI_STATUS_IGNORE); - // each process writes the quantity of bcindexmatrix elements in every block - MPI_File_write_at(file_handler, (MPI_Offset)(write_offset1+3*sizeof(int)), &boundCondParamStr, 1, boundCondParamType, MPI_STATUS_IGNORE); - - //std::cout << "rank=" << rank << ",(rank*write_offset1)=" << rank*write_offset1<< ",blocksCount=" << blocksCount ; - //std::cout << ", " << rank*write_offset1 + sizeof(int) << ",bcBlockCount=" << bcBlockCount; - //std::cout << ", " << rank*write_offset1 + 2 * sizeof(int) << ",count_indexContainer=" << count_indexContainer; - //std::cout << ", " << rank*write_offset1 + 3 * sizeof(int) << ",boundCondParamStr=" << boundCondParamStr.bcindexmatrixCount << std::endl; - - // each process writes data identifying the blocks - MPI_File_write_at(file_handler, write_offset, bcAddArray, blocksCount, boundCondTypeAdd, MPI_STATUS_IGNORE); - // each process writes boundary conditions - if (bcVector.size()>0) - MPI_File_write_at(file_handler, (MPI_Offset)(write_offset+blocksCount*sizeof(BCAdd)), &bcVector[0], bcBlockCount, boundCondType1000, MPI_STATUS_IGNORE); - // each process writes bcindexmatrix values - if (bcindexmatrixV.size()>0) - MPI_File_write_at(file_handler, (MPI_Offset)(write_offset+blocksCount*sizeof(BCAdd)+bcBlockCount*BLOCK_SIZE*sizeof(BoundaryCondition)), &bcindexmatrixV[0], blocksCount, bcindexmatrixType, MPI_STATUS_IGNORE); - // each process writes indexContainer values - if (indexContainerV.size()>0) - MPI_File_write_at(file_handler, (MPI_Offset)(write_offset+blocksCount*sizeof(BCAdd)+bcBlockCount*BLOCK_SIZE*sizeof(BoundaryCondition)+blocksCount*boundCondParamStr.bcindexmatrixCount*sizeof(int)), &indexContainerV[0], count_indexContainer, MPI_INT, MPI_STATUS_IGNORE); - MPI_File_sync(file_handler); - - //std::cout <<"rank="<<rank<<",blocksCount="<< blocksCount<<", "<< bcBlockCount<<", "<< count_indexContainer<<", "<< bcindexmatrixCount << std::endl; - //std::cout <<"rank="<<rank<<",write_offset="<< write_offset <<", "<< write_offset + blocksCount * sizeof(BCAdd) <<", "<< write_offset + blocksCount * sizeof(BCAdd) + bcBlockCount*BLOCK_SIZE * sizeof(BoundaryCondition) <<", "<< write_offset + blocksCount * sizeof(BCAdd) + bcBlockCount*BLOCK_SIZE * sizeof(BoundaryCondition) + blocksCount*bcindexmatrixCount * sizeof(int)<< std::endl; - - MPI_File_close(&file_handler); - - if (comm->isRoot()) - { - finish = MPI_Wtime(); - UBLOG(logINFO, "MPIIORestart11CoProcessor::writeBoundaryConds time: "<<finish-start<<" s"); - } - - delete[] bcAddArray; -} - -//------------------------------------------- READ ----------------------------------------------- -void MPIIORestart11CoProcessor::restart(int step) -{ - if (comm->isRoot()) UBLOG(logINFO, "MPIIORestart11CoProcessor restart step: "<<step); - if (comm->isRoot()) UBLOG(logINFO, "Load check point - start"); - readBlocks(step); - readDataSet(step); - readBoundaryConds(step); - if (comm->isRoot()) UBLOG(logINFO, "Load check point - end"); - this->reconnect(grid); -} - -void MPIIORestart11CoProcessor::readBlocks(int step) -{ - int rank, size; - MPI_Comm_rank(MPI_COMM_WORLD, &rank); - //MPI_Comm_size(MPI_COMM_WORLD, &size); - size = 1; - - if (comm->isRoot()) - { - UBLOG(logINFO, "MPIIORestart11CoProcessor::readBlocks start MPI IO rank = "<<rank); - UBLOG(logINFO, "Physical Memory currently used by current process: "<<Utilities::getPhysMemUsedByMe()/1073741824.0<<" GB"); - } - - double start, finish; - if (comm->isRoot()) start = MPI_Wtime(); - - MPI_File file_handler; - std::string filename = path+"/mpi_io_cp/mpi_io_cp_"+UbSystem::toString(step)+"/cpBlocks.bin"; - int rc = MPI_File_open(MPI_COMM_WORLD, filename.c_str(), MPI_MODE_RDONLY, MPI_INFO_NULL, &file_handler); - if (rc!=MPI_SUCCESS) throw UbException(UB_EXARGS, "couldn't open file "+filename); - - // read count of blocks - int blocksCount = 0; - //MPI_File_read_at(file_handler, rank*sizeof(int), &blocksCount, 1, MPI_INT, MPI_STATUS_IGNORE); - MPI_File_read_at(file_handler, 0, &blocksCount, 1, MPI_INT, MPI_STATUS_IGNORE); - Block3d* block3dArray = new Block3d[blocksCount]; - - // calculate the read offset - MPI_Offset read_offset = (MPI_Offset)(size * sizeof(int)); - - GridParam* gridParameters = new GridParam; - - // read parameters of the grid - MPI_File_read_at(file_handler, read_offset, gridParameters, 1, gridParamType, MPI_STATUS_IGNORE); - // read all the blocks - MPI_File_read_at(file_handler, (MPI_Offset)(read_offset+sizeof(GridParam)), &block3dArray[0], blocksCount, block3dType, MPI_STATUS_IGNORE); - - MPI_File_close(&file_handler); - - if (comm->isRoot()) - { - finish = MPI_Wtime(); - UBLOG(logINFO, "MPIIORestart11CoProcessor::readBlocks time: "<<finish-start<<" s"); - } - - if (comm->isRoot()) - { - UBLOG(logINFO, "MPIIORestart11CoProcessor::readBlocks start of restore of data, rank = "<<rank); - UBLOG(logINFO, "Physical Memory currently used by current process: "<<Utilities::getPhysMemUsedByMe()/1073741824.0<<" GB"); - } - - // clear the grid - std::vector<Block3DPtr> blocksVector; - grid->getBlocks(0, blocksVector); - int del = 0; - for(Block3DPtr block : blocksVector) - { - grid->deleteBlock(block); - del++; - } - - // restore the grid - CoordinateTransformation3DPtr trafo(new CoordinateTransformation3D()); - trafo->Tx1 = gridParameters->trafoParams[0]; - trafo->Tx2 = gridParameters->trafoParams[1]; - trafo->Tx3 = gridParameters->trafoParams[2]; - trafo->Sx1 = gridParameters->trafoParams[3]; - trafo->Sx2 = gridParameters->trafoParams[4]; - trafo->Sx3 = gridParameters->trafoParams[5]; - trafo->alpha = gridParameters->trafoParams[6]; - trafo->beta = gridParameters->trafoParams[7]; - trafo->gamma = gridParameters->trafoParams[8]; - - trafo->toX1factorX1 = gridParameters->trafoParams[9]; - trafo->toX1factorX2 = gridParameters->trafoParams[10]; - trafo->toX1factorX3 = gridParameters->trafoParams[11]; - trafo->toX1delta = gridParameters->trafoParams[12]; - trafo->toX2factorX1 = gridParameters->trafoParams[13]; - trafo->toX2factorX2 = gridParameters->trafoParams[14]; - trafo->toX2factorX3 = gridParameters->trafoParams[15]; - trafo->toX2delta = gridParameters->trafoParams[16]; - trafo->toX3factorX1 = gridParameters->trafoParams[17]; - trafo->toX3factorX2 = gridParameters->trafoParams[18]; - trafo->toX3factorX3 = gridParameters->trafoParams[19]; - trafo->toX3delta = gridParameters->trafoParams[20]; - - trafo->fromX1factorX1 = gridParameters->trafoParams[21]; - trafo->fromX1factorX2 = gridParameters->trafoParams[22]; - trafo->fromX1factorX3 = gridParameters->trafoParams[23]; - trafo->fromX1delta = gridParameters->trafoParams[24]; - trafo->fromX2factorX1 = gridParameters->trafoParams[25]; - trafo->fromX2factorX2 = gridParameters->trafoParams[26]; - trafo->fromX2factorX3 = gridParameters->trafoParams[27]; - trafo->fromX2delta = gridParameters->trafoParams[28]; - trafo->fromX3factorX1 = gridParameters->trafoParams[29]; - trafo->fromX3factorX2 = gridParameters->trafoParams[30]; - trafo->fromX3factorX3 = gridParameters->trafoParams[31]; - trafo->fromX3delta = gridParameters->trafoParams[32]; - - trafo->active = gridParameters->active; - trafo->transformation = gridParameters->transformation; - - grid->setCoordinateTransformator(trafo); - - grid->setDeltaX(gridParameters->deltaX); - grid->setBlockNX(gridParameters->blockNx1, gridParameters->blockNx2, gridParameters->blockNx3); - grid->setNX1(gridParameters->nx1); - grid->setNX2(gridParameters->nx2); - grid->setNX3(gridParameters->nx3); - grid->setPeriodicX1(gridParameters->periodicX1); - grid->setPeriodicX2(gridParameters->periodicX2); - grid->setPeriodicX3(gridParameters->periodicX3); - - // regenerate blocks - for (int n = 0; n<blocksCount; n++) - { - Block3DPtr block(new Block3D(block3dArray[n].x1, block3dArray[n].x2, block3dArray[n].x3, block3dArray[n].level)); - block->setActive(block3dArray[n].active); - block->setBundle(block3dArray[n].bundle); - block->setRank(block3dArray[n].rank); - block->setLocalRank(block3dArray[n].lrank); - block->setGlobalID(block3dArray[n].globalID); - block->setLocalID(block3dArray[n].localID); - block->setPart(block3dArray[n].part); - block->setLevel(block3dArray[n].level); - block->interpolationFlagCF = block3dArray[n].interpolationFlagCF; - block->interpolationFlagFC = block3dArray[n].interpolationFlagFC; - - grid->addBlock(block); - } - - delete gridParameters; - delete[] block3dArray; - - if (comm->isRoot()) - { - UBLOG(logINFO, "MPIIORestart11CoProcessor::readBlocks end of restore of data, rank = "<<rank); - UBLOG(logINFO, "Physical Memory currently used by current process: "<<Utilities::getPhysMemUsedByMe()/1073741824.0<<" GB"); - } -} - -void MPIIORestart11CoProcessor::readDataSet(int step) -{ - int rank, size; - MPI_Comm_rank(MPI_COMM_WORLD, &rank); - MPI_Comm_size(MPI_COMM_WORLD, &size); - - if (comm->isRoot()) - { - UBLOG(logINFO, "MPIIORestart11CoProcessor::readDataSet start MPI IO rank = "<<rank); - UBLOG(logINFO, "Physical Memory currently used by current process: "<<Utilities::getPhysMemUsedByMe()/1073741824.0<<" GB"); - } - double start, finish; - if (comm->isRoot()) start = MPI_Wtime(); - - MPI_File file_handler; - std::string filename = path+"/mpi_io_cp/mpi_io_cp_"+UbSystem::toString(step)+"/cpDataSet.bin"; - int rc = MPI_File_open(MPI_COMM_WORLD, filename.c_str(), MPI_MODE_RDONLY, MPI_INFO_NULL, &file_handler); - if (rc!=MPI_SUCCESS) throw UbException(UB_EXARGS, "couldn't open file "+filename); - - // read count of blocks - int blocksCount = 0; - MPI_File_read_at(file_handler, (MPI_Offset)(rank*sizeof(int)), &blocksCount, 1, MPI_INT, MPI_STATUS_IGNORE); - MPI_File_read_at(file_handler, (MPI_Offset)(size*sizeof(int)), &dataSetParamStr, 1, dataSetParamType, MPI_STATUS_IGNORE); - //std::cout <<"MPIIORestart11CoProcessor::readDataSet rank=" << rank <<", dataSetParamStr.doubleCountInBlock="<< dataSetParamStr.doubleCountInBlock << std::endl; - //std::cout << ",dataSetParamStr.nx[6][0]" << "=" << dataSetParamStr.nx[6][0] << "," << dataSetParamStr.nx[6][1] << "," << dataSetParamStr.nx[6][2] << "," << dataSetParamStr.nx[6][3]; - //std::cout << ",doubleCountInBlock=" << dataSetParamStr.doubleCountInBlock << "," << dataSetParamStr.nx1 << "," << dataSetParamStr.nx2 << "," << dataSetParamStr.nx3 << std::endl; - - DataSet* dataSetArray = new DataSet[blocksCount]; - std::vector<double> doubleValuesArray(blocksCount * dataSetParamStr.doubleCountInBlock); // double-values in all blocks - - // define MPI_types depending on the block-specific information - MPI_Type_contiguous(dataSetParamStr.doubleCountInBlock, MPI_DOUBLE, &dataSetDoubleType); - MPI_Type_commit(&dataSetDoubleType); - mpiTypeFreeFlag = true; - //std::cout << "MPIIORestart11CoProcessor::readDataSet rank=" << rank << " 123=" << dataSetParamStr.doubleCountInBlock << std::endl; - - // calculate the read offset - MPI_Offset read_offset = (MPI_Offset)(size * sizeof(int)); - size_t next_read_offset = 0; - - if(size > 1) - { - if(rank == 0) - { - next_read_offset = read_offset + sizeof(dataSetParam) + blocksCount * (sizeof(DataSet) + dataSetParamStr.doubleCountInBlock * sizeof(double)); - MPI_Send(&next_read_offset, 1, MPI_LONG_LONG_INT, 1, 5, MPI_COMM_WORLD); - } - else - { - MPI_Recv(&read_offset, 1, MPI_LONG_LONG_INT, rank - 1, 5, MPI_COMM_WORLD, MPI_STATUS_IGNORE); - next_read_offset = read_offset + sizeof(dataSetParam) + blocksCount * (sizeof(DataSet) + dataSetParamStr.doubleCountInBlock * sizeof(double)); - if(rank < size - 1) - MPI_Send(&next_read_offset, 1, MPI_LONG_LONG_INT, rank + 1, 5, MPI_COMM_WORLD); - } - } - - /*int chunkFlag = 0; - - if (rank == 0) - { - MPI_File_read_at(file_handler, read_offset, dataSetArray, blocksCount, dataSetType, MPI_STATUS_IGNORE); - MPI_File_read_at(file_handler, (MPI_Offset)(read_offset+blocksCount*sizeof(DataSet)), &doubleValuesArray[0], blocksCount, dataSetDoubleType, MPI_STATUS_IGNORE); - - for (int i=1; i<size; i+=chunk) - { - for (int j=i; j<i+chunk; j++) - { - if (j < size) - { - MPI_Send(&chunkFlag, 1, MPI_INT, j, 77, MPI_COMM_WORLD); - //UBLOG(logINFO, "j= "<<j); - } - } - for (int j=i; j<i+chunk; j++) - { - if (j < size) - { - MPI_Recv(&chunkFlag, 1, MPI_INT, j, 77, MPI_COMM_WORLD, MPI_STATUS_IGNORE); - } - } - } - } - else - { - MPI_Recv(&chunkFlag, 1, MPI_INT, 0, 77, MPI_COMM_WORLD, MPI_STATUS_IGNORE); - MPI_File_read_at(file_handler, read_offset, dataSetArray, blocksCount, dataSetType, MPI_STATUS_IGNORE); - MPI_File_read_at(file_handler, (MPI_Offset)(read_offset+blocksCount*sizeof(DataSet)), &doubleValuesArray[0], blocksCount, dataSetDoubleType, MPI_STATUS_IGNORE); - MPI_Send(&chunkFlag, 1, MPI_INT, 0, 77, MPI_COMM_WORLD); - //UBLOG(logINFO, "read rank= "<<rank); - }*/ - - MPI_File_read_at(file_handler, (MPI_Offset)(read_offset+sizeof(dataSetParam)), dataSetArray, blocksCount, dataSetType, MPI_STATUS_IGNORE); - MPI_File_read_at(file_handler, (MPI_Offset)(read_offset+sizeof(dataSetParam)+blocksCount*sizeof(DataSet)), &doubleValuesArray[0], blocksCount, dataSetDoubleType, MPI_STATUS_IGNORE); - MPI_File_close(&file_handler); - - //for (int ch = 0; ch < blocksCount; ch++) - //{ - // if ((dataSetArrayGW[ch].x1 != dataSetArray[ch].x1) || - // (dataSetArrayGW[ch].x2 != dataSetArray[ch].x2) || - // (dataSetArrayGW[ch].x3 != dataSetArray[ch].x3) || - // (dataSetArrayGW[ch].level != dataSetArray[ch].level) || - // (dataSetArrayGW[ch].ghostLayerWidth != dataSetArray[ch].ghostLayerWidth) || - // (dataSetArrayGW[ch].collFactor != dataSetArray[ch].collFactor) || - // (dataSetArrayGW[ch].deltaT != dataSetArray[ch].deltaT) || - // (dataSetArrayGW[ch].compressible != dataSetArray[ch].compressible) || - // (dataSetArrayGW[ch].withForcing != dataSetArray[ch].withForcing)) - // std::cout << "dataSetArrayGW != rank" << rank << ", !!!!!====="<< std::endl; - //} - //std::cout << "doubleValuesArrayGW.size" << doubleValuesArrayGW.size() << ", " << doubleValuesArray.size() << std::endl; - //for (int vl = 0; vl < doubleValuesArrayGW.size(); vl++) - // if(doubleValuesArrayGW[vl] != doubleValuesArray[vl]) - // std::cout << "doubleValuesArrayGW != rank" << rank << ", !!!!!====="<< std::endl; - - if (comm->isRoot()) - { - finish = MPI_Wtime(); - UBLOG(logINFO, "MPIIORestart11CoProcessor::readDataSet time: "<<finish-start<<" s"); - UBLOG(logINFO, "MPIIORestart11CoProcessor::readDataSet start of restore of data, rank = "<<rank); - UBLOG(logINFO, "Physical Memory currently used by current process: "<<Utilities::getPhysMemUsedByMe()/1073741824.0<<" GB"); - } - - size_t index = 0, nextVectorSize = 0; - std::vector<double> vectorsOfValues[9]; - for (int n = 0; n<blocksCount; n++) - { - for (int b = 0; b<9; b++) // assign approciate vectors for 9 dataSet arrays - { - nextVectorSize = dataSetParamStr.nx[b][0]* dataSetParamStr.nx[b][1]* dataSetParamStr.nx[b][2]* dataSetParamStr.nx[b][3]; - vectorsOfValues[b].assign(doubleValuesArray.data()+index, doubleValuesArray.data()+index+nextVectorSize); - index += nextVectorSize; - } - - // fill dataSet arrays - AverageValuesArray3DPtr mAverageDensity; - if ((dataSetParamStr.nx[0][0]==0)&&(dataSetParamStr.nx[0][1]==0)&&(dataSetParamStr.nx[0][2]==0)&&(dataSetParamStr.nx[0][3]==0)) - mAverageDensity = CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr(); - else - mAverageDensity = CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr(new CbArray4D<LBMReal, IndexerX4X3X2X1>(vectorsOfValues[0], dataSetParamStr.nx[0][0], dataSetParamStr.nx[0][1], dataSetParamStr.nx[0][2], dataSetParamStr.nx[0][3])); - - AverageValuesArray3DPtr mAverageVelocity; - if ((dataSetParamStr.nx[1][0]==0)&&(dataSetParamStr.nx[1][1]==0)&&(dataSetParamStr.nx[1][2]==0)&&(dataSetParamStr.nx[1][3]==0)) - mAverageVelocity = CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr(); - else - mAverageVelocity = CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr(new CbArray4D<LBMReal, IndexerX4X3X2X1>(vectorsOfValues[1], dataSetParamStr.nx[1][0], dataSetParamStr.nx[1][1], dataSetParamStr.nx[1][2], dataSetParamStr.nx[1][3])); - - AverageValuesArray3DPtr mAverageFluktuations; - if ((dataSetParamStr.nx[2][0]==0)&&(dataSetParamStr.nx[2][1]==0)&&(dataSetParamStr.nx[2][2]==0)&&(dataSetParamStr.nx[2][3]==0)) - mAverageFluktuations = CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr(); - else - mAverageFluktuations = CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr(new CbArray4D<LBMReal, IndexerX4X3X2X1>(vectorsOfValues[2], dataSetParamStr.nx[2][0], dataSetParamStr.nx[2][1], dataSetParamStr.nx[2][2], dataSetParamStr.nx[2][3])); - - AverageValuesArray3DPtr mAverageTriplecorrelations; - if ((dataSetParamStr.nx[3][0]==0)&&(dataSetParamStr.nx[3][1]==0)&&(dataSetParamStr.nx[3][2]==0)&&(dataSetParamStr.nx[3][3]==0)) - mAverageTriplecorrelations = CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr(); - else - mAverageTriplecorrelations = CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr(new CbArray4D<LBMReal, IndexerX4X3X2X1>(vectorsOfValues[3], dataSetParamStr.nx[3][0], dataSetParamStr.nx[3][1], dataSetParamStr.nx[3][2], dataSetParamStr.nx[3][3])); - - ShearStressValuesArray3DPtr mShearStressValues; - if ((dataSetParamStr.nx[4][0]==0)&&(dataSetParamStr.nx[4][1]==0)&&(dataSetParamStr.nx[4][2]==0)&&(dataSetParamStr.nx[4][3]==0)) - mShearStressValues = CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr(); - else - mShearStressValues = CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr(new CbArray4D<LBMReal, IndexerX4X3X2X1>(vectorsOfValues[4], dataSetParamStr.nx[4][0], dataSetParamStr.nx[4][1], dataSetParamStr.nx[4][2], dataSetParamStr.nx[4][3])); - - RelaxationFactorArray3DPtr mRelaxationFactor; - if ((dataSetParamStr.nx[5][0]==0)&&(dataSetParamStr.nx[5][1]==0)&&(dataSetParamStr.nx[5][2]==0)) - mRelaxationFactor = CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr(); - else - mRelaxationFactor = CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<LBMReal, IndexerX3X2X1>(vectorsOfValues[5], dataSetParamStr.nx[5][0], dataSetParamStr.nx[5][1], dataSetParamStr.nx[5][2])); - - //DistributionArray3DPtr mFdistributions(new D3Q27EsoTwist3DSplittedVector(dataSetParamStr.nx1, dataSetParamStr.nx2, dataSetParamStr.nx3, -999.0)); - DistributionArray3DPtr mFdistributions(new D3Q27EsoTwist3DSplittedVector()); - - std::dynamic_pointer_cast<D3Q27EsoTwist3DSplittedVector>(mFdistributions)->setLocalDistributions(CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr(new CbArray4D<LBMReal, IndexerX4X3X2X1>(vectorsOfValues[6], dataSetParamStr.nx[6][0], dataSetParamStr.nx[6][1], dataSetParamStr.nx[6][2], dataSetParamStr.nx[6][3]))); - std::dynamic_pointer_cast<D3Q27EsoTwist3DSplittedVector>(mFdistributions)->setNonLocalDistributions(CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr(new CbArray4D<LBMReal, IndexerX4X3X2X1>(vectorsOfValues[7], dataSetParamStr.nx[7][0], dataSetParamStr.nx[7][1], dataSetParamStr.nx[7][2], dataSetParamStr.nx[7][3]))); - std::dynamic_pointer_cast<D3Q27EsoTwist3DSplittedVector>(mFdistributions)->setZeroDistributions(CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<LBMReal, IndexerX3X2X1>(vectorsOfValues[8], dataSetParamStr.nx[8][0], dataSetParamStr.nx[8][1], dataSetParamStr.nx[8][2]))); - - std::dynamic_pointer_cast<D3Q27EsoTwist3DSplittedVector>(mFdistributions)->setNX1(dataSetParamStr.nx1); - std::dynamic_pointer_cast<D3Q27EsoTwist3DSplittedVector>(mFdistributions)->setNX2(dataSetParamStr.nx2); - std::dynamic_pointer_cast<D3Q27EsoTwist3DSplittedVector>(mFdistributions)->setNX3(dataSetParamStr.nx3); - - DataSet3DPtr dataSetPtr = DataSet3DPtr(new DataSet3D()); - dataSetPtr->setAverageDencity(mAverageDensity); - dataSetPtr->setAverageVelocity(mAverageVelocity); - dataSetPtr->setAverageFluctuations(mAverageFluktuations); - dataSetPtr->setAverageTriplecorrelations(mAverageTriplecorrelations); - dataSetPtr->setShearStressValues(mShearStressValues); - dataSetPtr->setRelaxationFactor(mRelaxationFactor); - dataSetPtr->setFdistributions(mFdistributions); - - // find the nesessary block and fill it - Block3DPtr block = grid->getBlock(dataSetArray[n].x1, dataSetArray[n].x2, dataSetArray[n].x3, dataSetArray[n].level); - //LBMKernelPtr kernel(new CompressibleCumulantLBMKernel()); - //LBMKernelPtr kernel(new IncompressibleCumulantLBMKernel()); - LBMKernelPtr kernel = this->lbmKernel->clone(); - kernel->setGhostLayerWidth(dataSetArray[n].ghostLayerWidth); - kernel->setCollisionFactor(dataSetArray[n].collFactor); - kernel->setDeltaT(dataSetArray[n].deltaT); - kernel->setCompressible(dataSetArray[n].compressible); - kernel->setWithForcing(dataSetArray[n].withForcing); - kernel->setDataSet(dataSetPtr); - block->setKernel(kernel); - //block->getKernel()->setDataSet(dataSetPtr); - } - - delete[] dataSetArray; - - if (comm->isRoot()) - { - UBLOG(logINFO, "MPIIORestartCoProcessor::readDataSet end of restore of data, rank = "<<rank); - UBLOG(logINFO, "Physical Memory currently used by current process: "<<Utilities::getPhysMemUsedByMe()/1073741824.0<<" GB"); - } -} - -void MPIIORestart11CoProcessor::readBoundaryConds(int step) -{ - int rank, size; - MPI_Comm_rank(MPI_COMM_WORLD, &rank); - MPI_Comm_size(MPI_COMM_WORLD, &size); - - if (comm->isRoot()) - { - UBLOG(logINFO, "MPIIORestart11CoProcessor::readBoundaryConds start MPI IO rank = "<<rank); - UBLOG(logINFO, "Physical Memory currently used by current process: "<<Utilities::getPhysMemUsedByMe()/1073741824.0<<" GB"); - } - double start, finish; - if (comm->isRoot()) start = MPI_Wtime(); - - MPI_File file_handler; - std::string filename = path+"/mpi_io_cp/mpi_io_cp_"+UbSystem::toString(step)+"/cpBC.bin"; - int rc = MPI_File_open(MPI_COMM_WORLD, filename.c_str(), MPI_MODE_RDONLY, MPI_INFO_NULL, &file_handler); - if (rc!=MPI_SUCCESS) throw UbException(UB_EXARGS, "couldn't open file "+filename); - - int blocksCount = 0; - int dataCount1000 = 0; - int dataCount2 = 0; - MPI_Offset read_offset1 = (MPI_Offset)(rank * (3 * sizeof(int) + sizeof(boundCondParam))); - - // read count of blocks - MPI_File_read_at(file_handler, read_offset1, &blocksCount, 1, MPI_INT, MPI_STATUS_IGNORE); - // read count of big BoundaryCondition blocks - MPI_File_read_at(file_handler, (MPI_Offset)(read_offset1+sizeof(int)), &dataCount1000, 1, MPI_INT, MPI_STATUS_IGNORE); - // read count of indexContainer values in all blocks - MPI_File_read_at(file_handler, (MPI_Offset)(read_offset1+2*sizeof(int)), &dataCount2, 1, MPI_INT, MPI_STATUS_IGNORE); - // read count of bcindexmatrix values in every block - MPI_File_read_at(file_handler, (MPI_Offset)(read_offset1+3*sizeof(int)), &boundCondParamStr, 1, boundCondParamType, MPI_STATUS_IGNORE); - - //std::cout << "rank=" << rank << ",(rank*read_offset1)=" << rank*read_offset1 << ",blocksCount=" << blocksCount; - //std::cout << ", " << rank*read_offset1 + sizeof(int) << ",bcBlockCount=" << dataCount1000; - //std::cout << ", " << rank*read_offset1 + 2 * sizeof(int) << ",count_indexContainer=" << dataCount2; - //std::cout << ", " << rank*read_offset1 + 3 * sizeof(int) << ",boundCondParamStr=" << boundCondParamStr.bcindexmatrixCount << std::endl; - //std::cout << "readrank=" << rank << ",blocksCount=" << blocksCount << ", " << dataCount1000 << ", " << dataCount2 << ", " << boundCondParamStr.bcindexmatrixCount << std::endl; - - MPI_Type_contiguous(boundCondParamStr.bcindexmatrixCount, MPI_INT, &bcindexmatrixType); - MPI_Type_commit(&bcindexmatrixType); - mpiTypeFreeFlag = true; - - size_t dataCount = dataCount1000 * BLOCK_SIZE; - BCAdd* bcAddArray = new BCAdd[blocksCount]; - BoundaryCondition* bcArray = new BoundaryCondition[dataCount]; - BoundaryCondition* nullBouCond = new BoundaryCondition(); - memset(nullBouCond, 0, sizeof(BoundaryCondition)); - int* intArray1 = new int[blocksCount * boundCondParamStr.bcindexmatrixCount]; - int* intArray2 = new int[dataCount2]; - - MPI_Offset read_offset = (MPI_Offset)(size * (3 * sizeof(int) + sizeof(boundCondParam))); - size_t next_read_offset = 0; - - if (size>1) - { - if (rank==0) - { - next_read_offset = read_offset+blocksCount*sizeof(BCAdd)+dataCount*sizeof(BoundaryCondition)+(blocksCount * boundCondParamStr.bcindexmatrixCount + dataCount2)*sizeof(int); - MPI_Send(&next_read_offset, 1, MPI_LONG_LONG_INT, 1, 5, MPI_COMM_WORLD); - } - else - { - MPI_Recv(&read_offset, 1, MPI_LONG_LONG_INT, rank-1, 5, MPI_COMM_WORLD, MPI_STATUS_IGNORE); - next_read_offset = read_offset+blocksCount*sizeof(BCAdd)+dataCount*sizeof(BoundaryCondition)+(blocksCount * boundCondParamStr.bcindexmatrixCount + dataCount2)*sizeof(int); - if (rank<size-1) - MPI_Send(&next_read_offset, 1, MPI_LONG_LONG_INT, rank+1, 5, MPI_COMM_WORLD); - } - } - //std::cout << "readrank=" << rank << ",read_offset=" << read_offset << ", " << read_offset + blocksCount * sizeof(BCAdd) << ", " << read_offset + blocksCount * sizeof(BCAdd) + dataCount * sizeof(BoundaryCondition) << ", " << read_offset + blocksCount * sizeof(BCAdd) + dataCount * sizeof(BoundaryCondition) + blocksCount * bcindexmatrixCount * sizeof(int) << std::endl; - - MPI_File_read_at(file_handler, read_offset, bcAddArray, blocksCount, boundCondTypeAdd, MPI_STATUS_IGNORE); - MPI_File_read_at(file_handler, (MPI_Offset)(read_offset+blocksCount*sizeof(BCAdd)), &bcArray[0], dataCount1000, boundCondType1000, MPI_STATUS_IGNORE); - MPI_File_read_at(file_handler, (MPI_Offset)(read_offset+blocksCount*sizeof(BCAdd)+dataCount*sizeof(BoundaryCondition)), &intArray1[0], blocksCount, bcindexmatrixType, MPI_STATUS_IGNORE); - MPI_File_read_at(file_handler, (MPI_Offset)(read_offset+blocksCount*sizeof(BCAdd)+dataCount*sizeof(BoundaryCondition)+blocksCount * boundCondParamStr.bcindexmatrixCount*sizeof(int)), &intArray2[0], dataCount2, MPI_INT, MPI_STATUS_IGNORE); - //MPI_File_sync(file_handler); - - MPI_File_close(&file_handler); - - if (comm->isRoot()) - { - finish = MPI_Wtime(); - UBLOG(logINFO, "MPIIORestart11CoProcessor::readBoundaryConds time: "<<finish-start<<" s"); - UBLOG(logINFO, "MPIIORestart11CoProcessor::readBoundaryConds start of restore of data, rank = "<<rank); - UBLOG(logINFO, "Physical Memory currently used by current process: "<<Utilities::getPhysMemUsedByMe()/1073741824.0<<" GB"); - } - - int index = 0, index1 = 0, index2 = 0; - std::vector<BoundaryConditionsPtr> bcVector; - std::vector<int> bcindexmatrixV; - std::vector<int> indexContainerV; - - for (size_t n = 0; n<blocksCount; n++) - { - bcVector.resize(0); - bcindexmatrixV.resize(0); - indexContainerV.resize(0); - - for (size_t ibc = 0; ibc<bcAddArray[n].boundCond_count; ibc++) - { - BoundaryConditionsPtr bc; - if (memcmp(&bcArray[index], nullBouCond, sizeof(BoundaryCondition))==0) - bc = BoundaryConditionsPtr(); - else - { - bc = BoundaryConditionsPtr(new BoundaryConditions); - bc->noslipBoundaryFlags = bcArray[index].noslipBoundaryFlags; - bc->slipBoundaryFlags = bcArray[index].slipBoundaryFlags; - bc->densityBoundaryFlags = bcArray[index].densityBoundaryFlags; - bc->velocityBoundaryFlags = bcArray[index].velocityBoundaryFlags; - bc->wallModelBoundaryFlags = bcArray[index].wallModelBoundaryFlags; - bc->bcVelocityX1 = bcArray[index].bcVelocityX1; - bc->bcVelocityX2 = bcArray[index].bcVelocityX2; - bc->bcVelocityX3 = bcArray[index].bcVelocityX3; - bc->bcDensity = bcArray[index].bcDensity; - bc->bcLodiDensity = bcArray[index].bcLodiDensity; - bc->bcLodiVelocityX1 = bcArray[index].bcLodiVelocityX1; - bc->bcLodiVelocityX2 = bcArray[index].bcLodiVelocityX2; - bc->bcLodiVelocityX3 = bcArray[index].bcLodiVelocityX3; - bc->bcLodiLentgh = bcArray[index].bcLodiLentgh; - - bc->nx1 = bcArray[index].nx1; - bc->nx2 = bcArray[index].nx2; - bc->nx3 = bcArray[index].nx3; - for (int iq = 0; iq<26; iq++) - bc->setQ(bcArray[index].q[iq], iq); - bc->setBcAlgorithmType(bcArray[index].algorithmType); - - //if (bcVectorGW[index].nx1 != bc->nx1) - // std::cout << "readBoundaryConds nx1 !!!!===" << bcVectorGW[index].nx1 << " ---- " << bc->nx1 << std::endl; - //if (bcVectorGW[index].nx2 != bc->nx2) - // std::cout << "readBoundaryConds nx2 !!!!===" << bcVectorGW[index].nx2 << " ---- " << bc->nx2 << std::endl; - //if (bcVectorGW[index].nx3 != bc->nx3) - // std::cout << "readBoundaryConds nx3 !!!!===" << bcVectorGW[index].nx3 << " ---- " << bc->nx3 << std::endl; - //if (bcVectorGW[index].algorithmType != bc->algorithmType) - // std::cout << "readBoundaryConds algorithmType !!!!===" << bcVectorGW[index].algorithmType << " ---- " << bc->algorithmType << std::endl; - //for (int iq = 0; iq<26; iq++) - // if (bcVectorGW[index].q[iq] != bc->q[iq]) - // std::cout << "readBoundaryConds q !!!!===" /*<< bcVectorGW[index].q << " ---- " << bc->q*/ << std::endl; - //std::cout << "readBoundaryConds BoundaryConditionsPtr !!!!===" <<std::endl; - - } - - bcVector.push_back(bc); - index++; - } - - for (int b1 = 0; b1 < boundCondParamStr.bcindexmatrixCount; b1++) - { - //if (bcindexmatrixVGW[index1] != intArray1[index1]) - // std::cout << "readBoundaryConds bcindexmatrixVGW !!!!===" << std::endl; - bcindexmatrixV.push_back(intArray1[index1++]); - } - for (int b2 = 0; b2 < bcAddArray[n].indexContainer_count; b2++) - { - //if (indexContainerVGW[index2] != intArray2[index2]) - // std::cout << "readBoundaryConds indexContainerVGW !!!!===" << std::endl; - indexContainerV.push_back(intArray2[index2++]); - } - - CbArray3D<int, IndexerX3X2X1> bcim(bcindexmatrixV, boundCondParamStr.nx1, boundCondParamStr.nx2, boundCondParamStr.nx3); - - Block3DPtr block = grid->getBlock(bcAddArray[n].x1, bcAddArray[n].x2, bcAddArray[n].x3, bcAddArray[n].level); - //if(!block) std::cout << "readBoundaryConds can't find the block!!!" << std::endl; - BCProcessorPtr bcProc = bcProcessor->clone(block->getKernel()); - //if(!bcProc) std::cout << "readBoundaryConds can't find the bcProc!!!" << std::endl; - BCArray3DPtr bcArr(new BCArray3D()); - bcArr->bcindexmatrix = bcim; - bcArr->bcvector = bcVector; - bcArr->indexContainer = indexContainerV; - bcProc->setBCArray(bcArr); - - //if (!(block->getKernel())) - // std::cout << "readBoundaryConds kernel=" << block->getKernel() <<" "<< bcAddArray[n].x1 << " " << bcAddArray[n].x2 << " " << bcAddArray[n].x3 << std::endl; - block->getKernel()->setBCProcessor(bcProc); - } - - delete nullBouCond; - delete[] bcArray; - delete[] bcAddArray; - delete[] intArray1; - delete[] intArray2; - - if (comm->isRoot()) - { - UBLOG(logINFO, "MPIIORestart11CoProcessor::readBoundaryConds end of restore of data, rank = "<<rank); - UBLOG(logINFO, "Physical Memory currently used by current process: "<<Utilities::getPhysMemUsedByMe()/1073741824.0<<" GB"); - } -} -////////////////////////////////////////////////////////////////////////// -void MPIIORestart11CoProcessor::setChunk(int val) -{ - chunk = val; -} -////////////////////////////////////////////////////////////////////////// -void MPIIORestart11CoProcessor::setLBMKernel(LBMKernelPtr kernel) -{ - this->lbmKernel = kernel; -} -////////////////////////////////////////////////////////////////////////// -void MPIIORestart11CoProcessor::setBCProcessor(BCProcessorPtr bcProcessor) -{ - this->bcProcessor = bcProcessor; -} - diff --git a/src/VirtualFluids/CoProcessors/MPIIORestart11CoProcessor.h b/src/VirtualFluids/CoProcessors/MPIIORestart11CoProcessor.h deleted file mode 100644 index 2bb652863..000000000 --- a/src/VirtualFluids/CoProcessors/MPIIORestart11CoProcessor.h +++ /dev/null @@ -1,196 +0,0 @@ -#ifndef _MPIIORestart11CoProcessor_H_ -#define _MPIIORestart11CoProcessor_H_ - -#include "mpi.h" - -#include "CoProcessor.h" -#include "Communicator.h" -#include "WbWriter.h" - - -#include "UbScheduler.h" -#include "LBMKernel.h" -#include "BCProcessor.h" - -class MPIIORestart11CoProcessor; -typedef std::shared_ptr<MPIIORestart11CoProcessor> MPIIORestart11CoProcessorPtr; - -//! \class MPIWriteBlocksCoProcessor -//! \brief Writes the grid each timestep into the files and reads the grip from the files before regenerating -class MPIIORestart11CoProcessor: public CoProcessor -{ - //! \struct GridParam - //! \brief Structure describes parameters of the grid - //! \details The structure is nessasary to restore the grid correctly - struct GridParam - { - double trafoParams[33]; - double deltaX; - int blockNx1; - int blockNx2; - int blockNx3; - int nx1; - int nx2; - int nx3; - bool periodicX1; - bool periodicX2; - bool periodicX3; - bool active; - bool transformation; - }; - - //! \struct Block3d - //! \brief Structure contains information of the block - //! \details The structure is used to write the data describing the block in the grid when saving the grid - //! and to read it when restoring the grid - struct Block3d - { - int x1; - int x2; - int x3; - int bundle; - int rank; - int lrank; - int part; - int globalID; - int localID; - int level; - int interpolationFlagCF; - int interpolationFlagFC; - int counter; - bool active; - }; - - //! \struct dataSetParam - //! \brief Structure describes parameters of the dataSet that are equal in all blocks - //! \details The structure used to store some parameters needed to restore dataSet arrays - struct dataSetParam - { - int nx1; // to find the right block - int nx2; - int nx3; - int nx[9][4]; // 9 arrays x (nx1, nx2, nx3, nx4) - int doubleCountInBlock; // how many double-values are in all arrays dataSet in one (any) block - }; - - //! \struct dataSet - //! \brief Structure containes information identifying the block - //! \details The structure is used to find the needed block in the grid when restoring a dataSet - struct DataSet - { - double collFactor; - double deltaT; - int x1; - int x2; - int x3; - int level; - int ghostLayerWidth; - bool compressible; - bool withForcing; - }; - - //! \struct BoundaryCondition - //! \brief Structure containes information about boundary conditions of the block - //! \details The structure is used to write data describing boundary conditions of the blocks when saving the grid - //! and to read it when restoring the grid - struct BoundaryCondition - { - long long noslipBoundaryFlags; // MPI_LONG_LONG - long long slipBoundaryFlags; - long long velocityBoundaryFlags; - long long densityBoundaryFlags; - long long wallModelBoundaryFlags; - - float bcVelocityX1; - float bcVelocityX2; - float bcVelocityX3; - float bcDensity; - - float bcLodiDensity; - float bcLodiVelocityX1; - float bcLodiVelocityX2; - float bcLodiVelocityX3; - float bcLodiLentgh; - - float nx1,nx2,nx3; - float q[26]; // MPI_FLOAT - - char algorithmType; - }; - - //! \struct boundCondParam - //! \brief Structure describes parameters of the boundaryConditions that are equal in all blocks - //! \details The structure used to store some parameters needed to restore boundaryConditions arrays - struct boundCondParam - { - int nx1; - int nx2; - int nx3; - int bcindexmatrixCount; // how many bcindexmatrix-values in one (any) block - }; - - //! \struct BCAdd - //! \brief Structure containes information identifying the block - //! and some parameters of the arrays of boundary conditions that are equal in all blocks - //! \details The structure is used to find the needed block in the grid when restoring a dataSet - //! and to set common parameters - struct BCAdd - { - int x1; // to find the right block - int x2; - int x3; - int level; - int boundCond_count; // how many BoundaryCondition-structures are in this block - int indexContainer_count; // how many indexContainer-values are in this block - }; - -public: - MPIIORestart11CoProcessor(Grid3DPtr grid, UbSchedulerPtr s, const std::string& path, CommunicatorPtr comm); - virtual ~MPIIORestart11CoProcessor(); - //! Each timestep writes the grid into the files - void process(double step); - //! Reads the grid from the files before grid reconstruction - void restart(int step); - //! Writes the blocks of the grid into the file outputBlocks.bin - void writeBlocks(int step); - //! Writes the datasets of the blocks into the file outputDataSet.bin - void writeDataSet(int step); - //! Writes the boundary conditions of the blocks into the file outputBoundCond.bin - void writeBoundaryConds(int step); - //! Reads the blocks of the grid from the file outputBlocks.bin - void readBlocks(int step); - //! Reads the datasets of the blocks from the file outputDataSet.bin - void readDataSet(int step); - //! Reads the boundary conditions of the blocks from the file outputBoundCond.bin - void readBoundaryConds(int step); - //! The function sets number of ranks that read simultaneously - void setChunk(int val); - //! The function sets LBMKernel - void setLBMKernel(LBMKernelPtr kernel); - //!The function sets BCProcessor - void setBCProcessor(BCProcessorPtr bcProcessor); - //!The function truncates the data files - void clearAllFiles(int step); - -protected: - std::string path; - CommunicatorPtr comm; - bool mpiTypeFreeFlag; - -private: - MPI_Datatype gridParamType, block3dType, dataSetParamType, dataSetType, dataSetDoubleType, boundCondParamType, boundCondType, boundCondType1000, boundCondTypeAdd, bcindexmatrixType; - dataSetParam dataSetParamStr; - boundCondParam boundCondParamStr; - int chunk; - LBMKernelPtr lbmKernel; - BCProcessorPtr bcProcessor; - - /*DataSet dataSetArrayGW[128]; - std::vector<double> doubleValuesArrayGW; - std::vector<BoundaryCondition> bcVectorGW; - std::vector<int> bcindexmatrixVGW; - std::vector<int> indexContainerVGW;*/ - -}; - -#endif diff --git a/src/VirtualFluids/CoProcessors/MPIIORestart1CoProcessor.cpp b/src/VirtualFluids/CoProcessors/MPIIORestart1CoProcessor.cpp deleted file mode 100644 index 2f2645f2c..000000000 --- a/src/VirtualFluids/CoProcessors/MPIIORestart1CoProcessor.cpp +++ /dev/null @@ -1,1381 +0,0 @@ -#include "MPIIORestart1CoProcessor.h" -#include <boost/foreach.hpp> -#include "D3Q27System.h" -//#include "LBMKernel.h" -#include "CompressibleCumulantLBMKernel.h" -#include "IncompressibleCumulantLBMKernel.h" -#include "ThinWallBCProcessor.h" -#include "D3Q27EsoTwist3DSplittedVector.h" -#include <UbSystem.h> -#include <MemoryUtil.h> -#include "BoundaryConditions.h" -#include "Block3D.h" -#include "CoordinateTransformation3D.h" -#include "DataSet3D.h" -#include "Grid3D.h" -#include "BCArray3D.h" -#include "UbScheduler.h" - - -//! BLOCK_SIZE defines the quantity of the BoundaryCondition-structures written as one block to the file -//! To avoid overflow in the parameter \a count of the function MPI_File_write_at -//! structures BoundaryCondition are being written in blocks containing each of them BLOCK_SIZE structures -#define BLOCK_SIZE 1024 - -MPIIORestart1CoProcessor::MPIIORestart1CoProcessor(Grid3DPtr grid, UbSchedulerPtr s, - const std::string& path, - CommunicatorPtr comm) : - CoProcessor(grid, s), - path(path), - comm(comm), - mpiTypeFreeFlag(false) -{ - UbSystem::makeDirectory(path+"/mpi_io_cp"); - - memset(&blockParamStr, 0, sizeof(blockParamStr)); - - //------------------------- define MPI types --------------------------------- - - MPI_Datatype typesGP[3] = { MPI_DOUBLE, MPI_INT, MPI_CHAR }; - int blocksGP[3] = { 34, 6, 5 }; - MPI_Aint offsetsGP[3], lbGP, extentGP; - - offsetsGP[0] = 0; - MPI_Type_get_extent(MPI_DOUBLE, &lbGP, &extentGP); - offsetsGP[1] = blocksGP[0]*extentGP; - - MPI_Type_get_extent(MPI_INT, &lbGP, &extentGP); - offsetsGP[2] = offsetsGP[1]+blocksGP[1]*extentGP; - - MPI_Type_create_struct (3, blocksGP, offsetsGP, typesGP, &gridParamType); - MPI_Type_commit(&gridParamType); - - //----------------------------------------------------------------------- - - MPI_Type_contiguous(41, MPI_INT, &blockParamType); - MPI_Type_commit(&blockParamType); - - //----------------------------------------------------------------------- - - MPI_Datatype typesBlock[2] = { MPI_INT, MPI_CHAR }; - int blocksBlock[2] = { 13, 1 }; - MPI_Aint offsetsBlock[2], lbBlock, extentBlock; - - offsetsBlock[0] = 0; - MPI_Type_get_extent(MPI_INT, &lbBlock, &extentBlock); - offsetsBlock[1] = blocksBlock[0]*extentBlock; - - MPI_Type_create_struct(2, blocksBlock, offsetsBlock, typesBlock, &block3dType); - MPI_Type_commit(&block3dType); - - //----------------------------------------------------------------------- - MPI_Datatype typesDataSet[3] = { MPI_DOUBLE, MPI_INT, MPI_CHAR }; - int blocksDataSet[3] = { 2, 5, 2 }; - MPI_Aint offsetsDatatSet[3], lbDataSet, extentDataSet; - - offsetsDatatSet[0] = 0; - MPI_Type_get_extent(MPI_DOUBLE, &lbDataSet, &extentDataSet); - offsetsDatatSet[1] = blocksDataSet[0]*extentDataSet; - - MPI_Type_get_extent(MPI_INT, &lbDataSet, &extentDataSet); - offsetsDatatSet[2] = offsetsDatatSet[1]+blocksDataSet[1]*extentDataSet; - - MPI_Type_create_struct(3, blocksDataSet, offsetsDatatSet, typesDataSet, &dataSetType); - MPI_Type_commit(&dataSetType); - - //----------------------------------------------------------------------- - - MPI_Datatype typesBC[3] = { MPI_LONG_LONG_INT, MPI_FLOAT, MPI_CHAR }; - int blocksBC[3] = { 5, 38, 1 }; - MPI_Aint offsetsBC[3], lbBC, extentBC; - - offsetsBC[0] = 0; - MPI_Type_get_extent(MPI_LONG_LONG_INT, &lbBC, &extentBC); - offsetsBC[1] = blocksBC[0]*extentBC; - - MPI_Type_get_extent(MPI_FLOAT, &lbBC, &extentBC); - offsetsBC[2] = offsetsBC[1]+blocksBC[1]*extentBC; - - MPI_Type_create_struct(3, blocksBC, offsetsBC, typesBC, &boundCondType); - MPI_Type_commit(&boundCondType); - - //--------------------------------------- - - MPI_Type_contiguous(BLOCK_SIZE, boundCondType, &boundCondType1000); - MPI_Type_commit(&boundCondType1000); - - //--------------------------------------- - - MPI_Type_contiguous(6, MPI_INT, &boundCondTypeAdd); - MPI_Type_commit(&boundCondTypeAdd); - -} -////////////////////////////////////////////////////////////////////////// -MPIIORestart1CoProcessor::~MPIIORestart1CoProcessor() -{ - MPI_Type_free(&gridParamType); - MPI_Type_free(&blockParamType); - MPI_Type_free(&block3dType); - MPI_Type_free(&dataSetType); - MPI_Type_free(&boundCondType); - MPI_Type_free(&boundCondType1000); - MPI_Type_free(&boundCondTypeAdd); - - if (mpiTypeFreeFlag) - { - MPI_Type_free(&dataSetDoubleType); - MPI_Type_free(&bcindexmatrixType); - } -} - -////////////////////////////////////////////////////////////////////////// -void MPIIORestart1CoProcessor::process(double step) -{ - if (scheduler->isDue(step)) - { - if (comm->isRoot()) UBLOG(logINFO, "MPIIORestart3CoProcessor save step: "<<step); - if (comm->isRoot()) UBLOG(logINFO, "Save check point - start"); - /*if (comm->isRoot())*/ clearAllFiles((int)step); - writeBlocks((int)step); - writeDataSet((int)step); - writeBoundaryConds((int)step); - if (comm->isRoot()) UBLOG(logINFO, "Save check point - end"); - - //readDataSet((int)step); - } -} -////////////////////////////////////////////////////////////////////////// -void MPIIORestart1CoProcessor::clearAllFiles(int step) -{ - MPI_File file_handler1, file_handler2, file_handler3; - MPI_Info info = MPI_INFO_NULL; - MPI_Offset new_size = 0; - - UbSystem::makeDirectory(path + "/mpi_io_cp/mpi_io_cp_" + UbSystem::toString(step)); - std::string filename1 = path + "/mpi_io_cp/mpi_io_cp_" + UbSystem::toString(step) + "/cpBlocks.bin"; - //MPI_File_delete(filename1.c_str(), info); - int rc1 = MPI_File_open(MPI_COMM_WORLD, filename1.c_str(), MPI_MODE_CREATE | MPI_MODE_WRONLY, MPI_INFO_NULL, &file_handler1); - if (rc1 != MPI_SUCCESS) throw UbException(UB_EXARGS, "couldn't open file " + filename1); - MPI_File_set_size(file_handler1, new_size); - //MPI_File_sync(file_handler1); - MPI_File_close(&file_handler1); - - std::string filename2 = path + "/mpi_io_cp/mpi_io_cp_" + UbSystem::toString(step) + "/cpDataSet.bin"; - //MPI_File_delete(filename2.c_str(), info); - int rc2 = MPI_File_open(MPI_COMM_WORLD, filename2.c_str(), MPI_MODE_CREATE | MPI_MODE_WRONLY, info, &file_handler2); - if (rc2 != MPI_SUCCESS) throw UbException(UB_EXARGS, "couldn't open file " + filename2); - MPI_File_set_size(file_handler2, new_size); - //MPI_File_sync(file_handler2); - MPI_File_close(&file_handler2); - - std::string filename3 = path + "/mpi_io_cp/mpi_io_cp_" + UbSystem::toString(step) + "/cpBC.bin"; - //MPI_File_delete(filename3.c_str(), info); - int rc3 = MPI_File_open(MPI_COMM_WORLD, filename3.c_str(), MPI_MODE_CREATE | MPI_MODE_WRONLY, info, &file_handler3); - if (rc3 != MPI_SUCCESS) throw UbException(UB_EXARGS, "couldn't open file " + filename3); - MPI_File_set_size(file_handler3, new_size); - //MPI_File_sync(file_handler3); - MPI_File_close(&file_handler3); -} -////////////////////////////////////////////////////////////////////////// -void MPIIORestart1CoProcessor::writeBlocks(int step) -{ - int rank, size; - MPI_Comm_rank(MPI_COMM_WORLD, &rank); - //MPI_Comm_size(MPI_COMM_WORLD, &size); - size=1; - - if (comm->isRoot()) - { - UBLOG(logINFO, "MPIIORestart3CoProcessor::writeBlocks start collect data rank = "<<rank); - UBLOG(logINFO, "Physical Memory currently used by current process: "<<Utilities::getPhysMemUsedByMe()/1073741824.0<<" GB"); - } - - int blocksCount = 0; // quantity of blocks in the grid, max 2147483648 blocks! - int minInitLevel = this->grid->getCoarsestInitializedLevel(); - int maxInitLevel = this->grid->getFinestInitializedLevel(); - - std::vector<Block3DPtr> blocksVector[25]; // max 25 levels - for (int level = minInitLevel; level<=maxInitLevel; level++) - { - //grid->getBlocks(level, rank, blockVector[level]); - grid->getBlocks(level, blocksVector[level]); - blocksCount += static_cast<int>(blocksVector[level].size()); - } - - GridParam* gridParameters = new GridParam; - gridParameters->trafoParams[0] = grid->getCoordinateTransformator()->Tx1; - gridParameters->trafoParams[1] = grid->getCoordinateTransformator()->Tx2; - gridParameters->trafoParams[2] = grid->getCoordinateTransformator()->Tx3; - gridParameters->trafoParams[3] = grid->getCoordinateTransformator()->Sx1; - gridParameters->trafoParams[4] = grid->getCoordinateTransformator()->Sx2; - gridParameters->trafoParams[5] = grid->getCoordinateTransformator()->Sx3; - gridParameters->trafoParams[6] = grid->getCoordinateTransformator()->alpha; - gridParameters->trafoParams[7] = grid->getCoordinateTransformator()->beta; - gridParameters->trafoParams[8] = grid->getCoordinateTransformator()->gamma; - - gridParameters->trafoParams[9] = grid->getCoordinateTransformator()->toX1factorX1; - gridParameters->trafoParams[10] = grid->getCoordinateTransformator()->toX1factorX2; - gridParameters->trafoParams[11] = grid->getCoordinateTransformator()->toX1factorX3; - gridParameters->trafoParams[12] = grid->getCoordinateTransformator()->toX1delta; - gridParameters->trafoParams[13] = grid->getCoordinateTransformator()->toX2factorX1; - gridParameters->trafoParams[14] = grid->getCoordinateTransformator()->toX2factorX2; - gridParameters->trafoParams[15] = grid->getCoordinateTransformator()->toX2factorX3; - gridParameters->trafoParams[16] = grid->getCoordinateTransformator()->toX2delta; - gridParameters->trafoParams[17] = grid->getCoordinateTransformator()->toX3factorX1; - gridParameters->trafoParams[18] = grid->getCoordinateTransformator()->toX3factorX2; - gridParameters->trafoParams[19] = grid->getCoordinateTransformator()->toX3factorX3; - gridParameters->trafoParams[20] = grid->getCoordinateTransformator()->toX3delta; - - gridParameters->trafoParams[21] = grid->getCoordinateTransformator()->fromX1factorX1; - gridParameters->trafoParams[22] = grid->getCoordinateTransformator()->fromX1factorX2; - gridParameters->trafoParams[23] = grid->getCoordinateTransformator()->fromX1factorX3; - gridParameters->trafoParams[24] = grid->getCoordinateTransformator()->fromX1delta; - gridParameters->trafoParams[25] = grid->getCoordinateTransformator()->fromX2factorX1; - gridParameters->trafoParams[26] = grid->getCoordinateTransformator()->fromX2factorX2; - gridParameters->trafoParams[27] = grid->getCoordinateTransformator()->fromX2factorX3; - gridParameters->trafoParams[28] = grid->getCoordinateTransformator()->fromX2delta; - gridParameters->trafoParams[29] = grid->getCoordinateTransformator()->fromX3factorX1; - gridParameters->trafoParams[30] = grid->getCoordinateTransformator()->fromX3factorX2; - gridParameters->trafoParams[31] = grid->getCoordinateTransformator()->fromX3factorX3; - gridParameters->trafoParams[32] = grid->getCoordinateTransformator()->fromX3delta; - - gridParameters->active = grid->getCoordinateTransformator()->active; - gridParameters->transformation = grid->getCoordinateTransformator()->transformation; - - gridParameters->deltaX = grid->getDeltaX(minInitLevel); - UbTupleInt3 blocknx = grid->getBlockNX(); - gridParameters->blockNx1 = val<1>(blocknx); - gridParameters->blockNx2 = val<2>(blocknx); - gridParameters->blockNx3 = val<3>(blocknx); - gridParameters->nx1 = grid->getNX1(); - gridParameters->nx2 = grid->getNX2(); - gridParameters->nx3 = grid->getNX3(); - gridParameters->periodicX1 = grid->isPeriodicX1(); - gridParameters->periodicX2 = grid->isPeriodicX2(); - gridParameters->periodicX3 = grid->isPeriodicX3(); - - //---------------------------------------------------------------------- - - Block3d* block3dArray = new Block3d[blocksCount]; - bool firstBlock = true; - int ic = 0; - for (int level = minInitLevel; level<=maxInitLevel; level++) - { - for(Block3DPtr block : blocksVector[level]) // all the blocks of the current level - { - if (firstBlock && block->getKernel()) // when first (any) valid block... - { - std::shared_ptr< CbArray4D<LBMReal, IndexerX4X3X2X1> > averageDensityArray = block->getKernel()->getDataSet()->getAverageDencity(); - if (averageDensityArray) - { - blockParamStr.nx[0][0] = static_cast<int>(averageDensityArray->getNX1()); - blockParamStr.nx[0][1] = static_cast<int>(averageDensityArray->getNX2()); - blockParamStr.nx[0][2] = static_cast<int>(averageDensityArray->getNX3()); - blockParamStr.nx[0][3] = static_cast<int>(averageDensityArray->getNX4()); - } - - std::shared_ptr< CbArray4D<LBMReal, IndexerX4X3X2X1> > AverageVelocityArray3DPtr = block->getKernel()->getDataSet()->getAverageVelocity(); - if (AverageVelocityArray3DPtr) - { - blockParamStr.nx[1][0] = static_cast<int>(AverageVelocityArray3DPtr->getNX1()); - blockParamStr.nx[1][1] = static_cast<int>(AverageVelocityArray3DPtr->getNX2()); - blockParamStr.nx[1][2] = static_cast<int>(AverageVelocityArray3DPtr->getNX3()); - blockParamStr.nx[1][3] = static_cast<int>(AverageVelocityArray3DPtr->getNX4()); - } - - std::shared_ptr< CbArray4D<LBMReal, IndexerX4X3X2X1> > AverageFluctArray3DPtr = block->getKernel()->getDataSet()->getAverageFluctuations(); - if (AverageFluctArray3DPtr) - { - blockParamStr.nx[2][0] = static_cast<int>(AverageFluctArray3DPtr->getNX1()); - blockParamStr.nx[2][1] = static_cast<int>(AverageFluctArray3DPtr->getNX2()); - blockParamStr.nx[2][2] = static_cast<int>(AverageFluctArray3DPtr->getNX3()); - blockParamStr.nx[2][3] = static_cast<int>(AverageFluctArray3DPtr->getNX4()); - } - - std::shared_ptr< CbArray4D<LBMReal, IndexerX4X3X2X1> > AverageTripleArray3DPtr = block->getKernel()->getDataSet()->getAverageTriplecorrelations(); - if (AverageTripleArray3DPtr) - { - blockParamStr.nx[3][0] = static_cast<int>(AverageTripleArray3DPtr->getNX1()); - blockParamStr.nx[3][1] = static_cast<int>(AverageTripleArray3DPtr->getNX2()); - blockParamStr.nx[3][2] = static_cast<int>(AverageTripleArray3DPtr->getNX3()); - blockParamStr.nx[3][3] = static_cast<int>(AverageTripleArray3DPtr->getNX4()); - } - - std::shared_ptr< CbArray4D<LBMReal, IndexerX4X3X2X1> > ShearStressValArray3DPtr = block->getKernel()->getDataSet()->getShearStressValues(); - if (ShearStressValArray3DPtr) - { - blockParamStr.nx[4][0] = static_cast<int>(ShearStressValArray3DPtr->getNX1()); - blockParamStr.nx[4][1] = static_cast<int>(ShearStressValArray3DPtr->getNX2()); - blockParamStr.nx[4][2] = static_cast<int>(ShearStressValArray3DPtr->getNX3()); - blockParamStr.nx[4][3] = static_cast<int>(ShearStressValArray3DPtr->getNX4()); - } - - std::shared_ptr< CbArray3D<LBMReal, IndexerX3X2X1> > relaxationFactor3DPtr = block->getKernel()->getDataSet()->getRelaxationFactor(); - if (relaxationFactor3DPtr) - { - blockParamStr.nx[5][0] = static_cast<int>(relaxationFactor3DPtr->getNX1()); - blockParamStr.nx[5][1] = static_cast<int>(relaxationFactor3DPtr->getNX2()); - blockParamStr.nx[5][2] = static_cast<int>(relaxationFactor3DPtr->getNX3()); - blockParamStr.nx[5][3] = 1; - } - - std::shared_ptr< D3Q27EsoTwist3DSplittedVector > D3Q27EsoTwist3DSplittedVectorPtr = std::dynamic_pointer_cast<D3Q27EsoTwist3DSplittedVector>(block->getKernel()->getDataSet()->getFdistributions()); - CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr localDistributions = D3Q27EsoTwist3DSplittedVectorPtr->getLocalDistributions(); - if (localDistributions) - { - blockParamStr.nx[6][0] = static_cast<int>(localDistributions->getNX1()); - blockParamStr.nx[6][1] = static_cast<int>(localDistributions->getNX2()); - blockParamStr.nx[6][2] = static_cast<int>(localDistributions->getNX3()); - blockParamStr.nx[6][3] = static_cast<int>(localDistributions->getNX4()); - } - - CbArray4D <LBMReal, IndexerX4X3X2X1>::CbArray4DPtr nonLocalDistributions = D3Q27EsoTwist3DSplittedVectorPtr->getNonLocalDistributions(); - if (nonLocalDistributions) - { - blockParamStr.nx[7][0] = static_cast<int>(nonLocalDistributions->getNX1()); - blockParamStr.nx[7][1] = static_cast<int>(nonLocalDistributions->getNX2()); - blockParamStr.nx[7][2] = static_cast<int>(nonLocalDistributions->getNX3()); - blockParamStr.nx[7][3] = static_cast<int>(nonLocalDistributions->getNX4()); - } - - CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr zeroDistributions = D3Q27EsoTwist3DSplittedVectorPtr->getZeroDistributions(); - if (zeroDistributions) - { - blockParamStr.nx[8][0] = static_cast<int>(zeroDistributions->getNX1()); - blockParamStr.nx[8][1] = static_cast<int>(zeroDistributions->getNX2()); - blockParamStr.nx[8][2] = static_cast<int>(zeroDistributions->getNX3()); - blockParamStr.nx[8][3] = 1; - } - - // ... than save some parameters that are equal in all blocks - blockParamStr.nx1 = static_cast<int>(block->getKernel()->getDataSet()->getFdistributions()->getNX1()); - blockParamStr.nx2 = static_cast<int>(block->getKernel()->getDataSet()->getFdistributions()->getNX2()); - blockParamStr.nx3 = static_cast<int>(block->getKernel()->getDataSet()->getFdistributions()->getNX3()); - - firstBlock = false; - - // how many elements are in all arrays of DataSet (equal in all blocks) - int doubleCount = 0, temp; - for (int i = 0; i<9; i++) // 9 arrays ( averageValues, averageVelocity, averageFluktuations, - { // averageTriplecorrelations, shearStressValues, relaxationFactor, 3 * fdistributions - temp = 1; - for (int ii = 0; ii<4; ii++) - temp *= blockParamStr.nx[i][ii]; - doubleCount += temp; - } - blockParamStr.doubleCountInBlock = doubleCount; - - // the quantity of elements in the bcindexmatrix array (CbArray3D<int, IndexerX3X2X1>) in bcArray(BCArray3D) is always equal, - // this will be the size of the "write-read-block" in MPI_write_.../MPI_read-functions when writing/reading BoundConds - BCArray3DPtr bcArr = block->getKernel()->getBCProcessor()->getBCArray(); - blockParamStr.bcindexmatrix_count = static_cast<int>(bcArr->bcindexmatrix.getDataVector().size()); - } - - // save data describing the block - block3dArray[ic].x1 = block->getX1(); - block3dArray[ic].x2 = block->getX2(); - block3dArray[ic].x3 = block->getX3(); - block3dArray[ic].bundle = block->getBundle(); - block3dArray[ic].rank = block->getRank(); - block3dArray[ic].lrank = block->getLocalRank(); - block3dArray[ic].part = block->getPart(); - block3dArray[ic].globalID = block->getGlobalID(); - block3dArray[ic].localID = block->getLocalID(); - block3dArray[ic].level = block->getLevel(); - block3dArray[ic].interpolationFlagCF = block->getInterpolationFlagCF(); - block3dArray[ic].interpolationFlagFC = block->getInterpolationFlagFC(); - block3dArray[ic].counter = block->getMaxGlobalID(); - block3dArray[ic].active = block->isActive(); - - ic++; - } - } - - if (comm->isRoot()) - { - UBLOG(logINFO, "MPIIORestart3CoProcessor::writeBlocks start MPI IO rank = "<<rank); - UBLOG(logINFO, "Physical Memory currently used by current process: "<<Utilities::getPhysMemUsedByMe()/1073741824.0<<" GB"); - } - - MPI_File file_handler; - MPI_Info info = MPI_INFO_NULL; - //MPI_Info_create (&info); - //MPI_Info_set(info,"romio_cb_write","enable"); - //MPI_Info_set(info,"cb_buffer_size","4194304"); - //MPI_Info_set(info,"striping_unit","4194304"); - - // if (comm->isRoot()) - // { - UbSystem::makeDirectory(path + "/mpi_io_cp/mpi_io_cp_" + UbSystem::toString(step)); - std::string filename = path + "/mpi_io_cp/mpi_io_cp_" + UbSystem::toString(step) + "/cpBlocks.bin"; - int rc = MPI_File_open(MPI_COMM_WORLD, filename.c_str(), MPI_MODE_CREATE | MPI_MODE_WRONLY, MPI_INFO_NULL, &file_handler); - if (rc != MPI_SUCCESS) throw UbException(UB_EXARGS, "couldn't open file " + filename); - // } - - double start, finish; - MPI_Offset write_offset = (MPI_Offset)(size * sizeof(int)); - - //MPI_Offset new_size = 0; - //MPI_File_set_size(file_handler, new_size); - - if (comm->isRoot()) - { - start = MPI_Wtime(); - - // each process writes the quantity of it's blocks - MPI_File_write_at(file_handler, (MPI_Offset)(rank*sizeof(int)), &blocksCount, 1, MPI_INT, MPI_STATUS_IGNORE); - // each process writes parameters of the grid - MPI_File_write_at(file_handler, write_offset, gridParameters, 1, gridParamType, MPI_STATUS_IGNORE); - // each process writes common parameters of a block - MPI_File_write_at(file_handler, (MPI_Offset)(write_offset +sizeof(GridParam)), &blockParamStr, 1, blockParamType, MPI_STATUS_IGNORE); - // each process writes it's blocks - MPI_File_write_at(file_handler, (MPI_Offset)(write_offset +sizeof(GridParam)+sizeof(BlockParam)), &block3dArray[0], blocksCount, block3dType, MPI_STATUS_IGNORE); - } - - MPI_File_sync(file_handler); - MPI_File_close(&file_handler); - - if (comm->isRoot()) - { - finish = MPI_Wtime(); - UBLOG(logINFO, "MPIIORestart3CoProcessor::writeBlocks time: "<<finish-start<<" s"); - } - - // register new MPI-types depending on the block-specific information - MPI_Type_contiguous(blockParamStr.doubleCountInBlock, MPI_DOUBLE, &dataSetDoubleType); - MPI_Type_commit(&dataSetDoubleType); - - MPI_Type_contiguous(blockParamStr.bcindexmatrix_count, MPI_INT, &bcindexmatrixType); - MPI_Type_commit(&bcindexmatrixType); - - mpiTypeFreeFlag = true; - - delete[] block3dArray; - delete gridParameters; -} - -void MPIIORestart1CoProcessor::writeDataSet(int step) -{ - int rank, size; - MPI_Comm_rank(MPI_COMM_WORLD, &rank); - MPI_Comm_size(MPI_COMM_WORLD, &size); - - int blocksCount = 0; // quantity of blocks in the grid, max 2147483648 blocks! - - std::vector<Block3DPtr> blocksVector[25]; - int minInitLevel = this->grid->getCoarsestInitializedLevel(); - int maxInitLevel = this->grid->getFinestInitializedLevel(); - for (int level = minInitLevel; level<=maxInitLevel; level++) - { - grid->getBlocks(level, rank, blocksVector[level]); - blocksCount += static_cast<int>(blocksVector[level].size()); - } - - DataSet* dataSetArray = new DataSet[blocksCount]; - std::vector<double> doubleValuesArray; // double-values (arrays of f's) in all blocks - - if (comm->isRoot()) - { - UBLOG(logINFO, "MPIIORestart3CoProcessor::writeDataSet start collect data rank = "<<rank); - UBLOG(logINFO, "Physical Memory currently used by current process: "<<Utilities::getPhysMemUsedByMe()/1073741824.0<<" GB"); - } - - int ic = 0; - for (int level = minInitLevel; level<=maxInitLevel; level++) - { - for(Block3DPtr block : blocksVector[level]) // blocks of the current level - { - dataSetArray[ic].x1 = block->getX1(); // coordinates of the block needed to find it while regenerating the grid - dataSetArray[ic].x2 = block->getX2(); - dataSetArray[ic].x3 = block->getX3(); - dataSetArray[ic].level = block->getLevel(); - if (block->getKernel()) - { - dataSetArray[ic].ghostLayerWidth = block->getKernel()->getGhostLayerWidth(); - dataSetArray[ic].collFactor = block->getKernel()->getCollisionFactor(); - dataSetArray[ic].deltaT = block->getKernel()->getDeltaT(); - dataSetArray[ic].compressible = block->getKernel()->getCompressible(); - dataSetArray[ic].withForcing = block->getKernel()->getWithForcing(); - } - else - { - dataSetArray[ic].ghostLayerWidth = 0; - dataSetArray[ic].collFactor = 0.0; - dataSetArray[ic].deltaT = 0.0; - dataSetArray[ic].compressible = false; - dataSetArray[ic].withForcing = false; - } - //dataSetArrayGW[ic].x1 = dataSetArray[ic].x1; - //dataSetArrayGW[ic].x2 = dataSetArray[ic].x2; - //dataSetArrayGW[ic].x3 = dataSetArray[ic].x3; - //dataSetArrayGW[ic].level = dataSetArray[ic].level; - //dataSetArrayGW[ic].ghostLayerWidth = dataSetArray[ic].ghostLayerWidth; - //dataSetArrayGW[ic].collFactor = dataSetArray[ic].collFactor; - //dataSetArrayGW[ic].deltaT = dataSetArray[ic].deltaT; - //dataSetArrayGW[ic].compressible = dataSetArray[ic].compressible; - //dataSetArrayGW[ic].withForcing = dataSetArray[ic].withForcing; - - std::shared_ptr< CbArray4D<LBMReal, IndexerX4X3X2X1> > AverageValuesArray3DPtr = block->getKernel()->getDataSet()->getAverageDencity(); - if (AverageValuesArray3DPtr&&(blockParamStr.nx[0][0]>0)&&(blockParamStr.nx[0][1]>0)&&(blockParamStr.nx[0][2]>0)&&(blockParamStr.nx[0][3]>0)) - doubleValuesArray.insert(doubleValuesArray.end(), AverageValuesArray3DPtr->getDataVector().begin(), AverageValuesArray3DPtr->getDataVector().end()); - - std::shared_ptr< CbArray4D<LBMReal, IndexerX4X3X2X1> > AverageVelocityArray3DPtr = block->getKernel()->getDataSet()->getAverageVelocity(); - if (AverageVelocityArray3DPtr&&(blockParamStr.nx[1][0]>0)&&(blockParamStr.nx[1][1]>0)&&(blockParamStr.nx[1][2]>0)&&(blockParamStr.nx[1][3]>0)) - doubleValuesArray.insert(doubleValuesArray.end(), AverageVelocityArray3DPtr->getDataVector().begin(), AverageVelocityArray3DPtr->getDataVector().end()); - - std::shared_ptr< CbArray4D<LBMReal, IndexerX4X3X2X1> > AverageFluctArray3DPtr = block->getKernel()->getDataSet()->getAverageFluctuations(); - if (AverageFluctArray3DPtr&&(blockParamStr.nx[2][0]>0)&&(blockParamStr.nx[2][1]>0)&&(blockParamStr.nx[2][2]>0)&&(blockParamStr.nx[2][3]>0)) - doubleValuesArray.insert(doubleValuesArray.end(), AverageFluctArray3DPtr->getDataVector().begin(), AverageFluctArray3DPtr->getDataVector().end()); - - std::shared_ptr< CbArray4D<LBMReal, IndexerX4X3X2X1> > AverageTripleArray3DPtr = block->getKernel()->getDataSet()->getAverageTriplecorrelations(); - if (AverageTripleArray3DPtr&&(blockParamStr.nx[3][0]>0)&&(blockParamStr.nx[3][1]>0)&&(blockParamStr.nx[3][2]>0)&&(blockParamStr.nx[3][3]>0)) - doubleValuesArray.insert(doubleValuesArray.end(), AverageTripleArray3DPtr->getDataVector().begin(), AverageTripleArray3DPtr->getDataVector().end()); - - std::shared_ptr< CbArray4D<LBMReal, IndexerX4X3X2X1> > ShearStressValArray3DPtr = block->getKernel()->getDataSet()->getShearStressValues(); - if (ShearStressValArray3DPtr&&(blockParamStr.nx[4][0]>0)&&(blockParamStr.nx[4][1]>0)&&(blockParamStr.nx[4][2]>0)&&(blockParamStr.nx[4][3]>0)) - doubleValuesArray.insert(doubleValuesArray.end(), ShearStressValArray3DPtr->getDataVector().begin(), ShearStressValArray3DPtr->getDataVector().end()); - - std::shared_ptr< CbArray3D<LBMReal, IndexerX3X2X1> > RelaxationFactor3DPtr = block->getKernel()->getDataSet()->getRelaxationFactor(); - if (RelaxationFactor3DPtr&&(blockParamStr.nx[5][0]>0)&&(blockParamStr.nx[5][1]>0)&&(blockParamStr.nx[5][2]>0)) - doubleValuesArray.insert(doubleValuesArray.end(), RelaxationFactor3DPtr->getDataVector().begin(), RelaxationFactor3DPtr->getDataVector().end()); - - std::shared_ptr< D3Q27EsoTwist3DSplittedVector > D3Q27EsoTwist3DSplittedVectorPtr = std::dynamic_pointer_cast<D3Q27EsoTwist3DSplittedVector>(block->getKernel()->getDataSet()->getFdistributions()); - CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr localDistributions = D3Q27EsoTwist3DSplittedVectorPtr->getLocalDistributions(); - if (localDistributions&&(blockParamStr.nx[6][0]>0)&&(blockParamStr.nx[6][1]>0)&&(blockParamStr.nx[6][2]>0)&&(blockParamStr.nx[6][3]>0)) - doubleValuesArray.insert(doubleValuesArray.end(), localDistributions->getDataVector().begin(), localDistributions->getDataVector().end()); - - CbArray4D <LBMReal, IndexerX4X3X2X1>::CbArray4DPtr nonLocalDistributions = D3Q27EsoTwist3DSplittedVectorPtr->getNonLocalDistributions(); - if (nonLocalDistributions&&(blockParamStr.nx[7][0]>0)&&(blockParamStr.nx[7][1]>0)&&(blockParamStr.nx[7][2]>0)&&(blockParamStr.nx[7][3]>0)) - doubleValuesArray.insert(doubleValuesArray.end(), nonLocalDistributions->getDataVector().begin(), nonLocalDistributions->getDataVector().end()); - - CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr zeroDistributions = D3Q27EsoTwist3DSplittedVectorPtr->getZeroDistributions(); - if (zeroDistributions&&(blockParamStr.nx[8][0]>0)&&(blockParamStr.nx[8][1]>0)&&(blockParamStr.nx[8][2]>0)) - doubleValuesArray.insert(doubleValuesArray.end(), zeroDistributions->getDataVector().begin(), zeroDistributions->getDataVector().end()); - - ic++; - } - } - - //doubleValuesArrayGW.assign(doubleValuesArray.begin(), doubleValuesArray.end()); - - if (comm->isRoot()) - { - UBLOG(logINFO, "MPIIORestart3CoProcessor::writeDataSet start MPI IO rank = "<<rank); - UBLOG(logINFO, "Physical Memory currently used by current process: "<<Utilities::getPhysMemUsedByMe()/1073741824.0<<" GB"); - } - - // write to the file - // all processes calculate their offsets (quantity of bytes that the process is going to write) - // and notify the next process (with the rank = rank + 1) - MPI_Offset write_offset = (MPI_Offset)(size*sizeof(int)); - size_t next_write_offset = 0; - - if (size>1) - { - if (rank==0) - { - next_write_offset = write_offset + blocksCount * (sizeof(DataSet)+blockParamStr.doubleCountInBlock*sizeof(double)); - MPI_Send(&next_write_offset, 1, MPI_LONG_LONG_INT, 1, 5, MPI_COMM_WORLD); - } - else - { - MPI_Recv(&write_offset, 1, MPI_LONG_LONG_INT, rank-1, 5, MPI_COMM_WORLD, MPI_STATUS_IGNORE); - next_write_offset = write_offset + blocksCount * (sizeof(DataSet)+blockParamStr.doubleCountInBlock*sizeof(double)); - if (rank<size-1) - MPI_Send(&next_write_offset, 1, MPI_LONG_LONG_INT, rank+1, 5, MPI_COMM_WORLD); - } - } - - double start, finish; - if (comm->isRoot()) start = MPI_Wtime(); - - MPI_Info info = MPI_INFO_NULL; - -#ifdef HLRN - MPI_Info_create(&info); - MPI_Info_set(info, "striping_factor", "40"); - MPI_Info_set(info, "striping_unit", "4M"); -#endif - - MPI_File file_handler; - std::string filename = path+"/mpi_io_cp/mpi_io_cp_"+UbSystem::toString(step)+"/cpDataSet.bin"; - int rc = MPI_File_open(MPI_COMM_WORLD, filename.c_str(), MPI_MODE_CREATE| MPI_MODE_WRONLY, info, &file_handler); - if (rc!=MPI_SUCCESS) throw UbException(UB_EXARGS, "couldn't open file "+filename); - - //MPI_Offset new_size = 0; - //MPI_File_set_size(file_handler, new_size); - - //std::cout << "writeDataSet rank=" << rank << ",blocksCount=" << blocksCount; - //std::cout << ", rank*sizeof(int)=" << (MPI_Offset)(rank * sizeof(int)) << ", write_offset=" << write_offset << std::endl; - - // each process writes the quantity of it's blocks - MPI_File_write_at(file_handler, (MPI_Offset)(rank*sizeof(int)), &blocksCount, 1, MPI_INT, MPI_STATUS_IGNORE); - // each process writes data identifying blocks - MPI_File_write_at(file_handler, write_offset, dataSetArray, blocksCount, dataSetType, MPI_STATUS_IGNORE); - // each process writes the dataSet arrays - MPI_File_write_at(file_handler, (MPI_Offset)(write_offset +blocksCount*sizeof(DataSet)), &doubleValuesArray[0], blocksCount, dataSetDoubleType, MPI_STATUS_IGNORE); - MPI_File_sync(file_handler); - //std::cout << "writeDataSet rank=" << rank << ", write_offset1=" << write_offset << ", write_offset2=" << write_offset + blocksCount * sizeof(DataSet) << std::endl; - - //int blockC; - //MPI_File_read_at(file_handler, (MPI_Offset)(rank * sizeof(int)), &blockC, 1, MPI_INT, MPI_STATUS_IGNORE); - //std::cout << "readDataSet rank=" << rank << ", blockC=" << blockC << std::endl; - - MPI_File_close(&file_handler); - - if (comm->isRoot()) - { - finish = MPI_Wtime(); - UBLOG(logINFO, "MPIIORestart3CoProcessor::writeDataSet time: "<<finish-start<<" s"); - } - - delete[] dataSetArray; -} - -void MPIIORestart1CoProcessor::writeBoundaryConds(int step) -{ - int rank, size; - MPI_Comm_rank(MPI_COMM_WORLD, &rank); - MPI_Comm_size(MPI_COMM_WORLD, &size); - - if (comm->isRoot()) - { - UBLOG(logINFO, "MPIIORestart3CoProcessor::writeBoundaryConds start collect data rank = "<<rank); - UBLOG(logINFO, "Physical Memory currently used by current process: "<<Utilities::getPhysMemUsedByMe()/1073741824.0<<" GB"); - } - - int blocksCount = 0; // quantity of blocks in the grid, max 2147483648 blocks! - size_t count_boundCond = 0; // how many BoundaryConditions in all blocks - int count_indexContainer = 0; // how many indexContainer-values in all blocks - size_t byteCount = 0; // how many bytes writes this process in the file - - std::vector<Block3DPtr> blocksVector[25]; - int minInitLevel = this->grid->getCoarsestInitializedLevel(); - int maxInitLevel = this->grid->getFinestInitializedLevel(); - for (int level = minInitLevel; level<=maxInitLevel; level++) - { - grid->getBlocks(level, rank, blocksVector[level]); - blocksCount += static_cast<int>(blocksVector[level].size()); - } - - BCAdd* bcAddArray = new BCAdd[blocksCount]; - std::vector<BoundaryCondition> bcVector; - std::vector<int> bcindexmatrixV; - std::vector<int> indexContainerV; - - int ic = 0; - for (int level = minInitLevel; level<=maxInitLevel; level++) - { - for(Block3DPtr block : blocksVector[level]) // all the blocks of the current level - { - BCArray3DPtr bcArr = block->getKernel()->getBCProcessor()->getBCArray(); - - bcAddArray[ic].x1 = block->getX1(); // coordinates of the block needed to find it while regenerating the grid - bcAddArray[ic].x2 = block->getX2(); - bcAddArray[ic].x3 = block->getX3(); - bcAddArray[ic].level = block->getLevel(); - bcAddArray[ic].boundCond_count = 0; // how many BoundaryConditions in this block - bcAddArray[ic].indexContainer_count = 0; // how many indexContainer-values in this block - - for (int bc = 0; bc<bcArr->getBCVectorSize(); bc++) - { - BoundaryCondition* bouCond = new BoundaryCondition(); - if (bcArr->bcvector[bc]==NULL) - { - memset(bouCond, 0, sizeof(BoundaryCondition)); - } - else - { - bouCond->noslipBoundaryFlags = bcArr->bcvector[bc]->getNoSlipBoundary(); - bouCond->slipBoundaryFlags = bcArr->bcvector[bc]->getSlipBoundary(); - bouCond->velocityBoundaryFlags = bcArr->bcvector[bc]->getVelocityBoundary(); - bouCond->densityBoundaryFlags = bcArr->bcvector[bc]->getDensityBoundary(); - bouCond->wallModelBoundaryFlags = bcArr->bcvector[bc]->getWallModelBoundary(); - bouCond->bcVelocityX1 = bcArr->bcvector[bc]->getBoundaryVelocityX1(); - bouCond->bcVelocityX2 = bcArr->bcvector[bc]->getBoundaryVelocityX2(); - bouCond->bcVelocityX3 = bcArr->bcvector[bc]->getBoundaryVelocityX3(); - bouCond->bcDensity = bcArr->bcvector[bc]->getBoundaryDensity(); - bouCond->bcLodiDensity = bcArr->bcvector[bc]->getDensityLodiDensity(); - bouCond->bcLodiVelocityX1 = bcArr->bcvector[bc]->getDensityLodiVelocityX1(); - bouCond->bcLodiVelocityX2 = bcArr->bcvector[bc]->getDensityLodiVelocityX2(); - bouCond->bcLodiVelocityX3 = bcArr->bcvector[bc]->getDensityLodiVelocityX3(); - bouCond->bcLodiLentgh = bcArr->bcvector[bc]->getDensityLodiLength(); - bouCond->nx1 = bcArr->bcvector[bc]->nx1; - bouCond->nx2 = bcArr->bcvector[bc]->nx2; - bouCond->nx3 = bcArr->bcvector[bc]->nx3; - for (int iq = 0; iq<26; iq++) - bouCond->q[iq] = bcArr->bcvector[bc]->getQ(iq); - bouCond->algorithmType = bcArr->bcvector[bc]->getBcAlgorithmType(); - } - - bcVector.push_back(*bouCond); - //bcVectorGW.push_back(*bouCond); - bcAddArray[ic].boundCond_count++; - count_boundCond++; - } - - bcindexmatrixV.insert(bcindexmatrixV.end(), bcArr->bcindexmatrix.getDataVector().begin(), bcArr->bcindexmatrix.getDataVector().end()); - //bcindexmatrixVGW.assign(bcindexmatrixV.begin(), bcindexmatrixV.end()); - - indexContainerV.insert(indexContainerV.end(), bcArr->indexContainer.begin(), bcArr->indexContainer.end()); - //indexContainerVGW.assign(indexContainerV.begin(), indexContainerV.end()); - - bcAddArray[ic].indexContainer_count = static_cast<int>(bcArr->indexContainer.size()); - count_indexContainer += bcAddArray[ic].indexContainer_count; - - ic++; - } - } - - //how many "big blocks" of BLOCK_SIZE size can by formed - int bcBlockCount = (int)(count_boundCond/BLOCK_SIZE); - if (bcBlockCount * BLOCK_SIZE<count_boundCond) - bcBlockCount += 1; - for (int i = (int)count_boundCond; i<bcBlockCount * BLOCK_SIZE; i++) - { - BoundaryCondition* bouCond = new BoundaryCondition(); - memset(bouCond, 0, sizeof(BoundaryCondition)); - bcVector.push_back(*bouCond); - } - - byteCount = bcBlockCount * BLOCK_SIZE * sizeof(BoundaryCondition) + blocksCount * sizeof(BCAdd) + sizeof(int) * (blocksCount * blockParamStr.bcindexmatrix_count + count_indexContainer); - - // write to the file - // all processes calculate their offsets (quantity of bytes that the process is going to write) - // and notify the next process (with the rank = rank + 1) - MPI_Offset write_offset = (MPI_Offset)(3*size*sizeof(int)); - size_t next_write_offset = 0; - - if (size>1) - { - if (rank==0) - { - next_write_offset = write_offset + byteCount; - MPI_Send(&next_write_offset, 1, MPI_LONG_LONG_INT, 1, 5, MPI_COMM_WORLD); - } - else - { - MPI_Recv(&write_offset, 1, MPI_LONG_LONG_INT, rank-1, 5, MPI_COMM_WORLD, MPI_STATUS_IGNORE); - next_write_offset = write_offset + byteCount; - if (rank<size-1) - MPI_Send(&next_write_offset, 1, MPI_LONG_LONG_INT, rank+1, 5, MPI_COMM_WORLD); - } - } - - if (comm->isRoot()) - { - UBLOG(logINFO, "MPIIORestart3CoProcessor::writeBoundaryConds start MPI IO rank = "<<rank); - UBLOG(logINFO, "Physical Memory currently used by current process: "<<Utilities::getPhysMemUsedByMe()/1073741824.0<<" GB"); - } - - double start, finish; - if (comm->isRoot()) start = MPI_Wtime(); - - MPI_Info info = MPI_INFO_NULL; - -#ifdef HLRN - MPI_Info_create(&info); - MPI_Info_set(info, "striping_factor", "40"); - MPI_Info_set(info, "striping_unit", "4M"); -#endif - - MPI_File file_handler; - std::string filename = path+"/mpi_io_cp/mpi_io_cp_"+UbSystem::toString(step)+"/cpBC.bin"; - int rc = MPI_File_open(MPI_COMM_WORLD, filename.c_str(), MPI_MODE_CREATE|MPI_MODE_WRONLY, info, &file_handler); - if (rc!=MPI_SUCCESS) throw UbException(UB_EXARGS, "couldn't open file "+filename); - - //MPI_Offset new_size = 0; - //MPI_File_set_size(file_handler, new_size); - - // each process writes the quantity of it's blocks - MPI_File_write_at(file_handler, (MPI_Offset)(rank*sizeof(int)), &blocksCount, 1, MPI_INT, MPI_STATUS_IGNORE); // blocks quantity - // each process writes the quantity of "big blocks" of BLOCK_SIZE of boundary conditions - MPI_File_write_at(file_handler, (MPI_Offset)((rank+size)*sizeof(int)), &bcBlockCount, 1, MPI_INT, MPI_STATUS_IGNORE); // quantity of BoundConds / BLOCK_SIZE - // each process writes the quantity of indexContainer elements in all blocks - MPI_File_write_at(file_handler, (MPI_Offset)((rank+2*size)*sizeof(int)), &count_indexContainer, 1, MPI_INT, MPI_STATUS_IGNORE); // quantity of indexContainer - - // each process writes data identifying the blocks - MPI_File_write_at(file_handler, write_offset, bcAddArray, blocksCount, boundCondTypeAdd, MPI_STATUS_IGNORE); - // each process writes boundary conditions - if (bcVector.size()>0) - MPI_File_write_at(file_handler, (MPI_Offset)(write_offset +blocksCount*sizeof(BCAdd)), &bcVector[0], bcBlockCount, boundCondType1000, MPI_STATUS_IGNORE); - // each process writes bcindexmatrix values - if (bcindexmatrixV.size()>0) - MPI_File_write_at(file_handler, (MPI_Offset)(write_offset+blocksCount*sizeof(BCAdd)+bcBlockCount*BLOCK_SIZE*sizeof(BoundaryCondition)), &bcindexmatrixV[0], blocksCount, bcindexmatrixType, MPI_STATUS_IGNORE); - // each process writes indexContainer values - if (indexContainerV.size()>0) - MPI_File_write_at(file_handler, (MPI_Offset)(write_offset+blocksCount*sizeof(BCAdd)+bcBlockCount*BLOCK_SIZE*sizeof(BoundaryCondition)+blocksCount*blockParamStr.bcindexmatrix_count*sizeof(int)), &indexContainerV[0], count_indexContainer, MPI_INT, MPI_STATUS_IGNORE); - MPI_File_sync(file_handler); - - MPI_File_close(&file_handler); - - if (comm->isRoot()) - { - finish = MPI_Wtime(); - UBLOG(logINFO, "MPIIORestart3CoProcessor::writeBoundaryConds time: "<<finish-start<<" s"); - } - - delete[] bcAddArray; -} - -//------------------------------------------- READ ----------------------------------------------- -void MPIIORestart1CoProcessor::restart(int step) -{ - if (comm->isRoot()) UBLOG(logINFO, "MPIIORestart3CoProcessor restart step: "<<step); - if (comm->isRoot()) UBLOG(logINFO, "Load check point - start"); - readBlocks(step); - readDataSet(step); - readBoundaryConds(step); - if (comm->isRoot()) UBLOG(logINFO, "Load check point - end"); - this->reconnect(grid); -} - -void MPIIORestart1CoProcessor::readBlocks(int step) -{ - int rank, size; - MPI_Comm_rank(MPI_COMM_WORLD, &rank); - //MPI_Comm_size(MPI_COMM_WORLD, &size); - size = 1; - - if (comm->isRoot()) - { - UBLOG(logINFO, "MPIIORestart3CoProcessor::readBlocks start MPI IO rank = "<<rank); - UBLOG(logINFO, "Physical Memory currently used by current process: "<<Utilities::getPhysMemUsedByMe()/1073741824.0<<" GB"); - } - - double start, finish; - if (comm->isRoot()) start = MPI_Wtime(); - - MPI_File file_handler; - std::string filename = path+"/mpi_io_cp/mpi_io_cp_"+UbSystem::toString(step)+"/cpBlocks.bin"; - int rc = MPI_File_open(MPI_COMM_WORLD, filename.c_str(), MPI_MODE_RDONLY, MPI_INFO_NULL, &file_handler); - if (rc!=MPI_SUCCESS) throw UbException(UB_EXARGS, "couldn't open file "+filename); - - // read count of blocks - int blocksCount = 0; - //MPI_File_read_at(file_handler, rank*sizeof(int), &blocksCount, 1, MPI_INT, MPI_STATUS_IGNORE); - MPI_File_read_at(file_handler, 0, &blocksCount, 1, MPI_INT, MPI_STATUS_IGNORE); - Block3d* block3dArray = new Block3d[blocksCount]; - - // calculate the read offset - MPI_Offset read_offset = (MPI_Offset)(size * sizeof(int)); - - GridParam* gridParameters = new GridParam; - - // read parameters of the grid - MPI_File_read_at(file_handler, read_offset, gridParameters, 1, gridParamType, MPI_STATUS_IGNORE); - // read parameters of a block - MPI_File_read_at(file_handler, (MPI_Offset)(read_offset+sizeof(GridParam)), &blockParamStr, 1, blockParamType, MPI_STATUS_IGNORE); - // read all the blocks - MPI_File_read_at(file_handler, (MPI_Offset)(read_offset+sizeof(GridParam)+sizeof(BlockParam)), &block3dArray[0], blocksCount, block3dType, MPI_STATUS_IGNORE); - - MPI_File_close(&file_handler); - - if (comm->isRoot()) - { - finish = MPI_Wtime(); - UBLOG(logINFO, "MPIIORestart3CoProcessor::readBlocks time: "<<finish-start<<" s"); - } - - if (comm->isRoot()) - { - UBLOG(logINFO, "MPIIORestart3CoProcessor::readBlocks start of restore of data, rank = "<<rank); - UBLOG(logINFO, "Physical Memory currently used by current process: "<<Utilities::getPhysMemUsedByMe()/1073741824.0<<" GB"); - } - - // clear the grid - std::vector<Block3DPtr> blocksVector; - grid->getBlocks(0, blocksVector); - int del = 0; - for(Block3DPtr block : blocksVector) - { - grid->deleteBlock(block); - del++; - } - - // restore the grid - CoordinateTransformation3DPtr trafo(new CoordinateTransformation3D()); - trafo->Tx1 = gridParameters->trafoParams[0]; - trafo->Tx2 = gridParameters->trafoParams[1]; - trafo->Tx3 = gridParameters->trafoParams[2]; - trafo->Sx1 = gridParameters->trafoParams[3]; - trafo->Sx2 = gridParameters->trafoParams[4]; - trafo->Sx3 = gridParameters->trafoParams[5]; - trafo->alpha = gridParameters->trafoParams[6]; - trafo->beta = gridParameters->trafoParams[7]; - trafo->gamma = gridParameters->trafoParams[8]; - - trafo->toX1factorX1 = gridParameters->trafoParams[9]; - trafo->toX1factorX2 = gridParameters->trafoParams[10]; - trafo->toX1factorX3 = gridParameters->trafoParams[11]; - trafo->toX1delta = gridParameters->trafoParams[12]; - trafo->toX2factorX1 = gridParameters->trafoParams[13]; - trafo->toX2factorX2 = gridParameters->trafoParams[14]; - trafo->toX2factorX3 = gridParameters->trafoParams[15]; - trafo->toX2delta = gridParameters->trafoParams[16]; - trafo->toX3factorX1 = gridParameters->trafoParams[17]; - trafo->toX3factorX2 = gridParameters->trafoParams[18]; - trafo->toX3factorX3 = gridParameters->trafoParams[19]; - trafo->toX3delta = gridParameters->trafoParams[20]; - - trafo->fromX1factorX1 = gridParameters->trafoParams[21]; - trafo->fromX1factorX2 = gridParameters->trafoParams[22]; - trafo->fromX1factorX3 = gridParameters->trafoParams[23]; - trafo->fromX1delta = gridParameters->trafoParams[24]; - trafo->fromX2factorX1 = gridParameters->trafoParams[25]; - trafo->fromX2factorX2 = gridParameters->trafoParams[26]; - trafo->fromX2factorX3 = gridParameters->trafoParams[27]; - trafo->fromX2delta = gridParameters->trafoParams[28]; - trafo->fromX3factorX1 = gridParameters->trafoParams[29]; - trafo->fromX3factorX2 = gridParameters->trafoParams[30]; - trafo->fromX3factorX3 = gridParameters->trafoParams[31]; - trafo->fromX3delta = gridParameters->trafoParams[32]; - - trafo->active = gridParameters->active; - trafo->transformation = gridParameters->transformation; - - grid->setCoordinateTransformator(trafo); - - grid->setDeltaX(gridParameters->deltaX); - grid->setBlockNX(gridParameters->blockNx1, gridParameters->blockNx2, gridParameters->blockNx3); - grid->setNX1(gridParameters->nx1); - grid->setNX2(gridParameters->nx2); - grid->setNX3(gridParameters->nx3); - grid->setPeriodicX1(gridParameters->periodicX1); - grid->setPeriodicX2(gridParameters->periodicX2); - grid->setPeriodicX3(gridParameters->periodicX3); - - // regenerate blocks - for (int n = 0; n<blocksCount; n++) - { - Block3DPtr block(new Block3D(block3dArray[n].x1, block3dArray[n].x2, block3dArray[n].x3, block3dArray[n].level)); - block->setActive(block3dArray[n].active); - block->setBundle(block3dArray[n].bundle); - block->setRank(block3dArray[n].rank); - block->setLocalRank(block3dArray[n].lrank); - block->setGlobalID(block3dArray[n].globalID); - block->setLocalID(block3dArray[n].localID); - block->setPart(block3dArray[n].part); - block->setLevel(block3dArray[n].level); - block->interpolationFlagCF = block3dArray[n].interpolationFlagCF; - block->interpolationFlagFC = block3dArray[n].interpolationFlagFC; - - grid->addBlock(block); - } - - // define MPI_types depending on the block-specific information - MPI_Type_contiguous(blockParamStr.doubleCountInBlock, MPI_DOUBLE, &dataSetDoubleType); - MPI_Type_commit(&dataSetDoubleType); - - MPI_Type_contiguous(blockParamStr.bcindexmatrix_count, MPI_INT, &bcindexmatrixType); - MPI_Type_commit(&bcindexmatrixType); - - mpiTypeFreeFlag = true; - - delete gridParameters; - delete[] block3dArray; - - if (comm->isRoot()) - { - UBLOG(logINFO, "MPIIORestart3CoProcessor::readBlocks end of restore of data, rank = "<<rank); - UBLOG(logINFO, "Physical Memory currently used by current process: "<<Utilities::getPhysMemUsedByMe()/1073741824.0<<" GB"); - } -} - -void MPIIORestart1CoProcessor::readDataSet(int step) -{ - int rank, size; - MPI_Comm_rank(MPI_COMM_WORLD, &rank); - MPI_Comm_size(MPI_COMM_WORLD, &size); - - if (comm->isRoot()) - { - UBLOG(logINFO, "MPIIORestart3CoProcessor::readDataSet start MPI IO rank = "<<rank); - UBLOG(logINFO, "Physical Memory currently used by current process: "<<Utilities::getPhysMemUsedByMe()/1073741824.0<<" GB"); - } - double start, finish; - if (comm->isRoot()) start = MPI_Wtime(); - - MPI_File file_handler; - std::string filename = path+"/mpi_io_cp/mpi_io_cp_"+UbSystem::toString(step)+"/cpDataSet.bin"; - int rc = MPI_File_open(MPI_COMM_WORLD, filename.c_str(), MPI_MODE_RDONLY, MPI_INFO_NULL, &file_handler); - if (rc!=MPI_SUCCESS) throw UbException(UB_EXARGS, "couldn't open file "+filename); - - // read count of blocks - int blocksCount = 0; - MPI_File_read_at(file_handler, (MPI_Offset)(rank*sizeof(int)), &blocksCount, 1, MPI_INT, MPI_STATUS_IGNORE); - - DataSet* dataSetArray = new DataSet[blocksCount]; - std::vector<double> doubleValuesArray(blocksCount * blockParamStr.doubleCountInBlock); // double-values in all blocks - - // calculate the read offset - MPI_Offset read_offset = (MPI_Offset)(size*sizeof(int)); - size_t next_read_offset = 0; - - if(size > 1) - { - if(rank == 0) - { - next_read_offset = read_offset + blocksCount * (sizeof(DataSet) + blockParamStr.doubleCountInBlock * sizeof(double)); - MPI_Send(&next_read_offset, 1, MPI_LONG_LONG_INT, 1, 5, MPI_COMM_WORLD); - } - else - { - MPI_Recv(&read_offset, 1, MPI_LONG_LONG_INT, rank - 1, 5, MPI_COMM_WORLD, MPI_STATUS_IGNORE); - next_read_offset = read_offset + blocksCount * (sizeof(DataSet) + blockParamStr.doubleCountInBlock * sizeof(double)); - if(rank < size - 1) - MPI_Send(&next_read_offset, 1, MPI_LONG_LONG_INT, rank + 1, 5, MPI_COMM_WORLD); - } - } - - int chunkFlag = 0; - - //if (rank == 0) - //{ - // MPI_File_read_at(file_handler, read_offset, dataSetArray, blocksCount, dataSetType, MPI_STATUS_IGNORE); - // MPI_File_read_at(file_handler, (MPI_Offset)(read_offset+blocksCount*sizeof(DataSet)), &doubleValuesArray[0], blocksCount, dataSetDoubleType, MPI_STATUS_IGNORE); - // - // for (int i=1; i<size; i+=chunk) - // { - // for (int j=i; j<i+chunk; j++) - // { - // if (j < size) - // { - // MPI_Send(&chunkFlag, 1, MPI_INT, j, 77, MPI_COMM_WORLD); - // //UBLOG(logINFO, "j= "<<j); - // } - // } - // for (int j=i; j<i+chunk; j++) - // { - // if (j < size) - // { - // MPI_Recv(&chunkFlag, 1, MPI_INT, j, 77, MPI_COMM_WORLD, MPI_STATUS_IGNORE); - // } - // } - // } - //} - //else - //{ - // MPI_Recv(&chunkFlag, 1, MPI_INT, 0, 77, MPI_COMM_WORLD, MPI_STATUS_IGNORE); - // MPI_File_read_at(file_handler, read_offset, dataSetArray, blocksCount, dataSetType, MPI_STATUS_IGNORE); - // MPI_File_read_at(file_handler, (MPI_Offset)(read_offset+blocksCount*sizeof(DataSet)), &doubleValuesArray[0], blocksCount, dataSetDoubleType, MPI_STATUS_IGNORE); - // MPI_Send(&chunkFlag, 1, MPI_INT, 0, 77, MPI_COMM_WORLD); - // //UBLOG(logINFO, "read rank= "<<rank); - //} - - MPI_File_read_at(file_handler, read_offset, dataSetArray, blocksCount, dataSetType, MPI_STATUS_IGNORE); - MPI_File_read_at(file_handler, (MPI_Offset)(read_offset+blocksCount*sizeof(DataSet)), &doubleValuesArray[0], blocksCount, dataSetDoubleType, MPI_STATUS_IGNORE); - MPI_File_close(&file_handler); - - /*for (int ch = 0; ch < blocksCount; ch++) - { - if ((dataSetArrayGW[ch].x1 != dataSetArray[ch].x1) || - (dataSetArrayGW[ch].x2 != dataSetArray[ch].x2) || - (dataSetArrayGW[ch].x3 != dataSetArray[ch].x3) || - (dataSetArrayGW[ch].level != dataSetArray[ch].level) || - (dataSetArrayGW[ch].ghostLayerWidth != dataSetArray[ch].ghostLayerWidth) || - (dataSetArrayGW[ch].collFactor != dataSetArray[ch].collFactor) || - (dataSetArrayGW[ch].deltaT != dataSetArray[ch].deltaT) || - (dataSetArrayGW[ch].compressible != dataSetArray[ch].compressible) || - (dataSetArrayGW[ch].withForcing != dataSetArray[ch].withForcing)) - std::cout << "dataSetArrayGW != rank" << rank << ", !!!!!====="<< std::endl; - } - for (int vl = 0; vl < doubleValuesArrayGW.size(); vl++) - if(doubleValuesArrayGW[vl] != doubleValuesArray[vl]) - std::cout << "doubleValuesArrayGW != rank" << rank << ", !!!!!====="<< std::endl;*/ - - if (comm->isRoot()) - { - finish = MPI_Wtime(); - UBLOG(logINFO, "MPIIORestart3CoProcessor::readDataSet time: "<<finish-start<<" s"); - UBLOG(logINFO, "MPIIORestart3CoProcessor::readDataSet start of restore of data, rank = "<<rank); - UBLOG(logINFO, "Physical Memory currently used by current process: "<<Utilities::getPhysMemUsedByMe()/1073741824.0<<" GB"); - } - - size_t index = 0, nextVectorSize = 0; - std::vector<double> vectorsOfValues[9]; - for (int n = 0; n<blocksCount; n++) - { - for (int b = 0; b<9; b++) // assign approciate vectors for 9 dataSet arrays - { - nextVectorSize = blockParamStr.nx[b][0]*blockParamStr.nx[b][1]*blockParamStr.nx[b][2]*blockParamStr.nx[b][3]; - vectorsOfValues[b].assign(doubleValuesArray.data()+index, doubleValuesArray.data()+index+nextVectorSize); - index += nextVectorSize; - } - - // fill dataSet arrays - AverageValuesArray3DPtr mAverageDensity; - if ((blockParamStr.nx[0][0]==0)&&(blockParamStr.nx[0][1]==0)&&(blockParamStr.nx[0][2]==0)&&(blockParamStr.nx[0][3]==0)) - mAverageDensity = CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr(); - else - mAverageDensity = CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr(new CbArray4D<LBMReal, IndexerX4X3X2X1>(vectorsOfValues[0], blockParamStr.nx[0][0], blockParamStr.nx[0][1], blockParamStr.nx[0][2], blockParamStr.nx[0][3])); - - AverageValuesArray3DPtr mAverageVelocity; - if ((blockParamStr.nx[1][0]==0)&&(blockParamStr.nx[1][1]==0)&&(blockParamStr.nx[1][2]==0)&&(blockParamStr.nx[1][3]==0)) - mAverageVelocity = CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr(); - else - mAverageVelocity = CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr(new CbArray4D<LBMReal, IndexerX4X3X2X1>(vectorsOfValues[1], blockParamStr.nx[1][0], blockParamStr.nx[1][1], blockParamStr.nx[1][2], blockParamStr.nx[1][3])); - - AverageValuesArray3DPtr mAverageFluktuations; - if ((blockParamStr.nx[2][0]==0)&&(blockParamStr.nx[2][1]==0)&&(blockParamStr.nx[2][2]==0)&&(blockParamStr.nx[2][3]==0)) - mAverageFluktuations = CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr(); - else - mAverageFluktuations = CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr(new CbArray4D<LBMReal, IndexerX4X3X2X1>(vectorsOfValues[2], blockParamStr.nx[2][0], blockParamStr.nx[2][1], blockParamStr.nx[2][2], blockParamStr.nx[2][3])); - - AverageValuesArray3DPtr mAverageTriplecorrelations; - if ((blockParamStr.nx[3][0]==0)&&(blockParamStr.nx[3][1]==0)&&(blockParamStr.nx[3][2]==0)&&(blockParamStr.nx[3][3]==0)) - mAverageTriplecorrelations = CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr(); - else - mAverageTriplecorrelations = CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr(new CbArray4D<LBMReal, IndexerX4X3X2X1>(vectorsOfValues[3], blockParamStr.nx[3][0], blockParamStr.nx[3][1], blockParamStr.nx[3][2], blockParamStr.nx[3][3])); - - ShearStressValuesArray3DPtr mShearStressValues; - if ((blockParamStr.nx[4][0]==0)&&(blockParamStr.nx[4][1]==0)&&(blockParamStr.nx[4][2]==0)&&(blockParamStr.nx[4][3]==0)) - mShearStressValues = CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr(); - else - mShearStressValues = CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr(new CbArray4D<LBMReal, IndexerX4X3X2X1>(vectorsOfValues[4], blockParamStr.nx[4][0], blockParamStr.nx[4][1], blockParamStr.nx[4][2], blockParamStr.nx[4][3])); - - RelaxationFactorArray3DPtr mRelaxationFactor; - if ((blockParamStr.nx[5][0]==0)&&(blockParamStr.nx[5][1]==0)&&(blockParamStr.nx[5][2]==0)) - mRelaxationFactor = CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr(); - else - mRelaxationFactor = CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<LBMReal, IndexerX3X2X1>(vectorsOfValues[5], blockParamStr.nx[5][0], blockParamStr.nx[5][1], blockParamStr.nx[5][2])); - - //DistributionArray3DPtr mFdistributions(new D3Q27EsoTwist3DSplittedVector(blockParamStr.nx1, blockParamStr.nx2, blockParamStr.nx3, -999.0)); - DistributionArray3DPtr mFdistributions(new D3Q27EsoTwist3DSplittedVector()); - - std::dynamic_pointer_cast<D3Q27EsoTwist3DSplittedVector>(mFdistributions)->setLocalDistributions(CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr(new CbArray4D<LBMReal, IndexerX4X3X2X1>(vectorsOfValues[6], blockParamStr.nx[6][0], blockParamStr.nx[6][1], blockParamStr.nx[6][2], blockParamStr.nx[6][3]))); - std::dynamic_pointer_cast<D3Q27EsoTwist3DSplittedVector>(mFdistributions)->setNonLocalDistributions(CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr(new CbArray4D<LBMReal, IndexerX4X3X2X1>(vectorsOfValues[7], blockParamStr.nx[7][0], blockParamStr.nx[7][1], blockParamStr.nx[7][2], blockParamStr.nx[7][3]))); - std::dynamic_pointer_cast<D3Q27EsoTwist3DSplittedVector>(mFdistributions)->setZeroDistributions(CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<LBMReal, IndexerX3X2X1>(vectorsOfValues[8], blockParamStr.nx[8][0], blockParamStr.nx[8][1], blockParamStr.nx[8][2]))); - - std::dynamic_pointer_cast<D3Q27EsoTwist3DSplittedVector>(mFdistributions)->setNX1(blockParamStr.nx1); - std::dynamic_pointer_cast<D3Q27EsoTwist3DSplittedVector>(mFdistributions)->setNX2(blockParamStr.nx2); - std::dynamic_pointer_cast<D3Q27EsoTwist3DSplittedVector>(mFdistributions)->setNX3(blockParamStr.nx3); - - DataSet3DPtr dataSetPtr = DataSet3DPtr(new DataSet3D()); - dataSetPtr->setAverageDencity(mAverageDensity); - dataSetPtr->setAverageVelocity(mAverageVelocity); - dataSetPtr->setAverageFluctuations(mAverageFluktuations); - dataSetPtr->setAverageTriplecorrelations(mAverageTriplecorrelations); - dataSetPtr->setShearStressValues(mShearStressValues); - dataSetPtr->setRelaxationFactor(mRelaxationFactor); - dataSetPtr->setFdistributions(mFdistributions); - - // find the nesessary block and fill it - Block3DPtr block = grid->getBlock(dataSetArray[n].x1, dataSetArray[n].x2, dataSetArray[n].x3, dataSetArray[n].level); - //LBMKernelPtr kernel(new CompressibleCumulantLBMKernel()); - //LBMKernelPtr kernel(new IncompressibleCumulantLBMKernel()); - LBMKernelPtr kernel = this->lbmKernel->clone(); - kernel->setGhostLayerWidth(dataSetArray[n].ghostLayerWidth); - kernel->setCollisionFactor(dataSetArray[n].collFactor); - kernel->setDeltaT(dataSetArray[n].deltaT); - kernel->setCompressible(dataSetArray[n].compressible); - kernel->setWithForcing(dataSetArray[n].withForcing); - kernel->setDataSet(dataSetPtr); - block->setKernel(kernel); - //block->getKernel()->setDataSet(dataSetPtr); - } - - delete[] dataSetArray; - - if (comm->isRoot()) - { - UBLOG(logINFO, "MPIIORestart3CoProcessor::readDataSet end of restore of data, rank = "<<rank); - UBLOG(logINFO, "Physical Memory currently used by current process: "<<Utilities::getPhysMemUsedByMe()/1073741824.0<<" GB"); - } -} - -void MPIIORestart1CoProcessor::readBoundaryConds(int step) -{ - int rank, size; - MPI_Comm_rank(MPI_COMM_WORLD, &rank); - MPI_Comm_size(MPI_COMM_WORLD, &size); - - if (comm->isRoot()) - { - UBLOG(logINFO, "MPIIORestart3CoProcessor::readBoundaryConds start MPI IO rank = "<<rank); - UBLOG(logINFO, "Physical Memory currently used by current process: "<<Utilities::getPhysMemUsedByMe()/1073741824.0<<" GB"); - } - double start, finish; - if (comm->isRoot()) start = MPI_Wtime(); - - MPI_File file_handler; - std::string filename = path+"/mpi_io_cp/mpi_io_cp_"+UbSystem::toString(step)+"/cpBC.bin"; - int rc = MPI_File_open(MPI_COMM_WORLD, filename.c_str(), MPI_MODE_RDONLY, MPI_INFO_NULL, &file_handler); - if (rc!=MPI_SUCCESS) throw UbException(UB_EXARGS, "couldn't open file "+filename); - - int blocksCount = 0; - int dataCount1000 = 0; - int dataCount2 = 0; - // read count of blocks - MPI_File_read_at(file_handler, (MPI_Offset)(rank*sizeof(int)), &blocksCount, 1, MPI_INT, MPI_STATUS_IGNORE); - // read count of big BoundaryCondition blocks - MPI_File_read_at(file_handler, (MPI_Offset)((rank+size)*sizeof(int)), &dataCount1000, 1, MPI_INT, MPI_STATUS_IGNORE); - // read count of indexContainer values in all blocks - MPI_File_read_at(file_handler, (MPI_Offset)((rank+2*size)*sizeof(int)), &dataCount2, 1, MPI_INT, MPI_STATUS_IGNORE); - - size_t dataCount = dataCount1000 * BLOCK_SIZE; - BCAdd* bcAddArray = new BCAdd[blocksCount]; - BoundaryCondition* bcArray = new BoundaryCondition[dataCount]; - BoundaryCondition* nullBouCond = new BoundaryCondition(); - memset(nullBouCond, 0, sizeof(BoundaryCondition)); - int* intArray1 = new int[blocksCount * blockParamStr.bcindexmatrix_count]; - int* intArray2 = new int[dataCount2]; - - MPI_Offset read_offset = (MPI_Offset)(3*size*sizeof(int)); - size_t next_read_offset = 0; - - if (size>1) - { - if (rank==0) - { - next_read_offset = read_offset+blocksCount*sizeof(BCAdd)+dataCount*sizeof(BoundaryCondition)+(blocksCount * blockParamStr.bcindexmatrix_count+dataCount2)*sizeof(int); - MPI_Send(&next_read_offset, 1, MPI_LONG_LONG_INT, 1, 5, MPI_COMM_WORLD); - } - else - { - MPI_Recv(&read_offset, 1, MPI_LONG_LONG_INT, rank-1, 5, MPI_COMM_WORLD, MPI_STATUS_IGNORE); - next_read_offset = read_offset+blocksCount*sizeof(BCAdd)+dataCount*sizeof(BoundaryCondition)+(blocksCount * blockParamStr.bcindexmatrix_count+dataCount2)*sizeof(int); - if (rank<size-1) - MPI_Send(&next_read_offset, 1, MPI_LONG_LONG_INT, rank+1, 5, MPI_COMM_WORLD); - } - } - - MPI_File_read_at(file_handler, read_offset, bcAddArray, blocksCount, boundCondTypeAdd, MPI_STATUS_IGNORE); - MPI_File_read_at(file_handler, (MPI_Offset)(read_offset+blocksCount*sizeof(BCAdd)), &bcArray[0], dataCount1000, boundCondType1000, MPI_STATUS_IGNORE); - MPI_File_read_at(file_handler, (MPI_Offset)(read_offset+blocksCount*sizeof(BCAdd)+dataCount*sizeof(BoundaryCondition)), &intArray1[0], blocksCount, bcindexmatrixType, MPI_STATUS_IGNORE); - MPI_File_read_at(file_handler, (MPI_Offset)(read_offset+blocksCount*sizeof(BCAdd)+dataCount*sizeof(BoundaryCondition)+blocksCount * blockParamStr.bcindexmatrix_count*sizeof(int)), &intArray2[0], dataCount2, MPI_INT, MPI_STATUS_IGNORE); - //MPI_File_sync(file_handler); - - MPI_File_close(&file_handler); - - if (comm->isRoot()) - { - finish = MPI_Wtime(); - UBLOG(logINFO, "MPIIORestart3CoProcessor::readBoundaryConds time: "<<finish-start<<" s"); - UBLOG(logINFO, "MPIIORestart3CoProcessor::readBoundaryConds start of restore of data, rank = "<<rank); - UBLOG(logINFO, "Physical Memory currently used by current process: "<<Utilities::getPhysMemUsedByMe()/1073741824.0<<" GB"); - } - - int index = 0, index1 = 0, index2 = 0; - std::vector<BoundaryConditionsPtr> bcVector; - std::vector<int> bcindexmatrixV; - std::vector<int> indexContainerV; - - for (size_t n = 0; n<blocksCount; n++) - { - bcVector.resize(0); - bcindexmatrixV.resize(0); - indexContainerV.resize(0); - - for (size_t ibc = 0; ibc<bcAddArray[n].boundCond_count; ibc++) - { - BoundaryConditionsPtr bc; - if (memcmp(&bcArray[index], nullBouCond, sizeof(BoundaryCondition))==0) - bc = BoundaryConditionsPtr(); - else - { - bc = BoundaryConditionsPtr(new BoundaryConditions); - bc->noslipBoundaryFlags = bcArray[index].noslipBoundaryFlags; - bc->slipBoundaryFlags = bcArray[index].slipBoundaryFlags; - bc->densityBoundaryFlags = bcArray[index].densityBoundaryFlags; - bc->velocityBoundaryFlags = bcArray[index].velocityBoundaryFlags; - bc->wallModelBoundaryFlags = bcArray[index].wallModelBoundaryFlags; - bc->bcVelocityX1 = bcArray[index].bcVelocityX1; - bc->bcVelocityX2 = bcArray[index].bcVelocityX2; - bc->bcVelocityX3 = bcArray[index].bcVelocityX3; - bc->bcDensity = bcArray[index].bcDensity; - bc->bcLodiDensity = bcArray[index].bcLodiDensity; - bc->bcLodiVelocityX1 = bcArray[index].bcLodiVelocityX1; - bc->bcLodiVelocityX2 = bcArray[index].bcLodiVelocityX2; - bc->bcLodiVelocityX3 = bcArray[index].bcLodiVelocityX3; - bc->bcLodiLentgh = bcArray[index].bcLodiLentgh; - - /*if (bcVectorGW[n].noslipBoundaryFlags != bc->noslipBoundaryFlags || - bcVectorGW[n].slipBoundaryFlags != bc->slipBoundaryFlags || - bcVectorGW[n].densityBoundaryFlags != bc->densityBoundaryFlags || - bcVectorGW[n].velocityBoundaryFlags != bc->velocityBoundaryFlags || - bcVectorGW[n].wallModelBoundaryFlags != bc->wallModelBoundaryFlags) - std::cout << "readBoundaryConds BoundaryConditionsPtr !!!!===" <<std::endl;*/ - - bc->nx1 = bcArray[index].nx1; - bc->nx2 = bcArray[index].nx2; - bc->nx3 = bcArray[index].nx3; - for (int iq = 0; iq<26; iq++) - bc->setQ(bcArray[index].q[iq], iq); - bc->setBcAlgorithmType(bcArray[index].algorithmType); - } - - bcVector.push_back(bc); - index++; - } - - for (int b1 = 0; b1 < blockParamStr.bcindexmatrix_count; b1++) - bcindexmatrixV.push_back(intArray1[index1++]); - - for (int b2 = 0; b2 < bcAddArray[n].indexContainer_count; b2++) - indexContainerV.push_back(intArray2[index2++]); - - CbArray3D<int, IndexerX3X2X1> bcim(bcindexmatrixV, blockParamStr.nx1, blockParamStr.nx2, blockParamStr.nx3); - - Block3DPtr block = grid->getBlock(bcAddArray[n].x1, bcAddArray[n].x2, bcAddArray[n].x3, bcAddArray[n].level); - - ILBMKernelPtr kernel = block->getKernel(); - - if (!kernel) - { - throw UbException(UB_EXARGS, "LBMKernel in " + block->toString() + "is not exist!"); - } - - //BCProcessorPtr bcProc = bcProcessor->clone(block->getKernel()); - BCProcessorPtr bcProc = bcProcessor->clone(kernel); - - BCArray3DPtr bcArr(new BCArray3D()); - bcArr->bcindexmatrix = bcim; - bcArr->bcvector = bcVector; - bcArr->indexContainer = indexContainerV; - bcProc->setBCArray(bcArr); - - - //block->getKernel()->setBCProcessor(bcProc); - kernel->setBCProcessor(bcProc); - } - -/* for (int b1 = 0; b1 < bcindexmatrixVGW.size(); b1++) - { - if (bcindexmatrixVGW[b1] != bcindexmatrixV[b1]) - std::cout << "readBoundaryConds bcindexmatrixVGW !!!!===" << std::endl; - } - for (int b2 = 0; b2 < indexContainerVGW.size(); b2++) - { - if (indexContainerVGW[b2] != indexContainerV[b2]) - std::cout << "readBoundaryConds indexContainerVGW !!!!===" << std::endl; - } -*/ - delete nullBouCond; - delete[] bcArray; - delete[] bcAddArray; - delete[] intArray1; - delete[] intArray2; - - if (comm->isRoot()) - { - UBLOG(logINFO, "MPIIORestart3CoProcessor::readBoundaryConds end of restore of data, rank = "<<rank); - UBLOG(logINFO, "Physical Memory currently used by current process: "<<Utilities::getPhysMemUsedByMe()/1073741824.0<<" GB"); - } -} -////////////////////////////////////////////////////////////////////////// -void MPIIORestart1CoProcessor::setChunk(int val) -{ - chunk = val; -} -////////////////////////////////////////////////////////////////////////// -void MPIIORestart1CoProcessor::setLBMKernel(LBMKernelPtr kernel) -{ - this->lbmKernel = kernel; -} -////////////////////////////////////////////////////////////////////////// -void MPIIORestart1CoProcessor::setBCProcessor(BCProcessorPtr bcProcessor) -{ - this->bcProcessor = bcProcessor; -} - diff --git a/src/VirtualFluids/CoProcessors/MPIIORestart1CoProcessor.h b/src/VirtualFluids/CoProcessors/MPIIORestart1CoProcessor.h deleted file mode 100644 index e500aa2b9..000000000 --- a/src/VirtualFluids/CoProcessors/MPIIORestart1CoProcessor.h +++ /dev/null @@ -1,189 +0,0 @@ -#ifndef _MPIIORestart3CoProcessor_H_ -#define _MPIIORestart3CoProcessor_H_ - -#include "mpi.h" - -#include "CoProcessor.h" -#include "Communicator.h" -#include "WbWriter.h" -#include "UbScheduler.h" -#include "LBMKernel.h" -#include "BCProcessor.h" - - -class MPIIORestart1CoProcessor; -typedef std::shared_ptr<MPIIORestart1CoProcessor> MPIIORestart1CoProcessorPtr; - -//! \class MPIWriteBlocksCoProcessor -//! \brief Writes the grid each timestep into the files and reads the grip from the files before regenerating -class MPIIORestart1CoProcessor: public CoProcessor -{ - //! \struct GridParam - //! \brief Structure describes parameters of the grid - //! \details The structure is nessasary to restore the grid correctly - struct GridParam - { - double trafoParams[33]; - double deltaX; - int blockNx1; - int blockNx2; - int blockNx3; - int nx1; - int nx2; - int nx3; - bool periodicX1; - bool periodicX2; - bool periodicX3; - bool active; - bool transformation; - }; - - //! \struct blockParam - //! \brief Structure describes parameters of the block that are equal in all blocks - //! \details The structure used to store some parameters needed to restore dataSet arrays - struct BlockParam - { - int nx1; // to find the right block - int nx2; - int nx3; - int nx[9][4]; // 9 arrays x (nx1, nx2, nx3, nx4) - int doubleCountInBlock; // how many double-values are in all arrays dataSet in one (any) block - int bcindexmatrix_count; // how many bcindexmatrix-values are in one (any) block - }; - - //! \struct Block3d - //! \brief Structure contains information of the block - //! \details The structure is used to write the data describing the block in the grid when saving the grid - //! and to read it when restoring the grid - struct Block3d - { - //double collFactor; - //double deltaT; - int x1; - int x2; - int x3; - int bundle; - int rank; - int lrank; - int part; - int globalID; - int localID; - int level; - int interpolationFlagCF; - int interpolationFlagFC; - int counter; - //int ghostLayerWidth; - bool active; - //bool compressible; - //bool withForcing; - }; - - //! \struct dataSet - //! \brief Structure containes information identifying the block - //! \details The structure is used to find the needed block in the grid when restoring a dataSet - struct DataSet - { - double collFactor; - double deltaT; - int x1; - int x2; - int x3; - int level; - int ghostLayerWidth; - bool compressible; - bool withForcing; - }; - - //! \struct BoundaryCondition - //! \brief Structure containes information about boundary conditions of the block - //! \details The structure is used to write data describing boundary conditions of the blocks when saving the grid - //! and to read it when restoring the grid - struct BoundaryCondition - { - long long noslipBoundaryFlags; // MPI_LONG_LONG - long long slipBoundaryFlags; - long long velocityBoundaryFlags; - long long densityBoundaryFlags; - long long wallModelBoundaryFlags; - - float bcVelocityX1; - float bcVelocityX2; - float bcVelocityX3; - float bcDensity; - - float bcLodiDensity; - float bcLodiVelocityX1; - float bcLodiVelocityX2; - float bcLodiVelocityX3; - float bcLodiLentgh; - - float nx1,nx2,nx3; - float q[26]; // MPI_FLOAT - - char algorithmType; - }; - - //! \struct BCAdd - //! \brief Structure containes information identifying the block - //! and some parameters of the arrays of boundary conditions that are equal in all blocks - //! \details The structure is used to find the needed block in the grid when restoring a dataSet - //! and to set common parameters - struct BCAdd - { - int x1; // to find the right block - int x2; - int x3; - int level; - int boundCond_count; // how many BoundaryCondition-structures are in this block - int indexContainer_count; // how many indexContainer-values are in this block - }; - -public: - MPIIORestart1CoProcessor(Grid3DPtr grid, UbSchedulerPtr s, const std::string& path, CommunicatorPtr comm); - virtual ~MPIIORestart1CoProcessor(); - //! Each timestep writes the grid into the files - void process(double step); - //! Reads the grid from the files before grid reconstruction - void restart(int step); - //! Writes the blocks of the grid into the file outputBlocks.bin - void writeBlocks(int step); - //! Writes the datasets of the blocks into the file outputDataSet.bin - void writeDataSet(int step); - //! Writes the boundary conditions of the blocks into the file outputBoundCond.bin - void writeBoundaryConds(int step); - //! Reads the blocks of the grid from the file outputBlocks.bin - void readBlocks(int step); - //! Reads the datasets of the blocks from the file outputDataSet.bin - void readDataSet(int step); - //! Reads the boundary conditions of the blocks from the file outputBoundCond.bin - void readBoundaryConds(int step); - //! The function sets number of ranks that read simultaneously - void setChunk(int val); - //! The function sets LBMKernel - void setLBMKernel(LBMKernelPtr kernel); - //!The function sets BCProcessor - void setBCProcessor(BCProcessorPtr bcProcessor); - //!The function truncates the data files - void clearAllFiles(int step); - -protected: - std::string path; - CommunicatorPtr comm; - bool mpiTypeFreeFlag; - -private: - MPI_Datatype gridParamType, blockParamType, block3dType, dataSetType, dataSetDoubleType, boundCondType, boundCondType1000, boundCondTypeAdd, bcindexmatrixType; - BlockParam blockParamStr; - int chunk; - LBMKernelPtr lbmKernel; - BCProcessorPtr bcProcessor; - - //DataSet dataSetArrayGW[32]; - //std::vector<double> doubleValuesArrayGW; - //std::vector<BoundaryCondition> bcVectorGW; - //std::vector<int> bcindexmatrixVGW; - //std::vector<int> indexContainerVGW; - -}; - -#endif diff --git a/src/VirtualFluids/CoProcessors/MPIIORestart21CoProcessor.cpp b/src/VirtualFluids/CoProcessors/MPIIORestart21CoProcessor.cpp deleted file mode 100644 index f938c9015..000000000 --- a/src/VirtualFluids/CoProcessors/MPIIORestart21CoProcessor.cpp +++ /dev/null @@ -1,1231 +0,0 @@ -#include "MPIIORestart21CoProcessor.h" -#include <boost/foreach.hpp> -#include "D3Q27System.h" -#include "CompressibleCumulantLBMKernel.h" -#include "D3Q27EsoTwist3DSplittedVector.h" -#include <UbSystem.h> -#include <MemoryUtil.h> -#include "RenumberBlockVisitor.h" -#include "BoundaryConditions.h" -#include "Block3D.h" -#include "CoordinateTransformation3D.h" -#include "DataSet3D.h" -#include "Grid3D.h" -#include "BCArray3D.h" - -MPIIORestart21CoProcessor::MPIIORestart21CoProcessor(Grid3DPtr grid, UbSchedulerPtr s, - const std::string& path, - CommunicatorPtr comm) : - CoProcessor(grid, s), - path(path), - comm(comm), - mpiTypeFreeFlag(false) -{ - UbSystem::makeDirectory(path+"/mpi_io_cp"); - - memset(&dataSetParamStr, 0, sizeof(dataSetParamStr)); - memset(&boundCondParamStr, 0, sizeof(boundCondParamStr)); - - //------------------------- define MPI types --------------------------------- - - MPI_Datatype typesGP[3] = { MPI_DOUBLE, MPI_INT, MPI_CHAR }; - int blocksGP[3] = { 34, 6, 5 }; - MPI_Aint offsetsGP[3], lbGP, extentGP; - - offsetsGP[0] = 0; - MPI_Type_get_extent(MPI_DOUBLE, &lbGP, &extentGP); - offsetsGP[1] = blocksGP[0]*extentGP; - - MPI_Type_get_extent(MPI_INT, &lbGP, &extentGP); - offsetsGP[2] = offsetsGP[1]+blocksGP[1]*extentGP; - - MPI_Type_create_struct(3, blocksGP, offsetsGP, typesGP, &gridParamType); - MPI_Type_commit(&gridParamType); - - //----------------------------------------------------------------------- - - MPI_Type_contiguous(40, MPI_INT, &dataSetParamType); - MPI_Type_commit(&dataSetParamType); - - //----------------------------------------------------------------------- - - MPI_Datatype typesBlock[2] = { MPI_INT, MPI_CHAR }; - int blocksBlock[2] = { 13, 1 }; - MPI_Aint offsetsBlock[2], lbBlock, extentBlock; - - offsetsBlock[0] = 0; - MPI_Type_get_extent(MPI_INT, &lbBlock, &extentBlock); - offsetsBlock[1] = blocksBlock[0]*extentBlock; - - MPI_Type_create_struct(2, blocksBlock, offsetsBlock, typesBlock, &block3dType); - MPI_Type_commit(&block3dType); - - //----------------------------------------------------------------------- - - MPI_Datatype typesDataSet[3] = { MPI_DOUBLE, MPI_INT, MPI_CHAR }; - int blocksDataSet[3] = { 2, 2, 2 }; - MPI_Aint offsetsDatatSet[3], lbDataSet, extentDataSet; - - offsetsDatatSet[0] = 0; - MPI_Type_get_extent(MPI_DOUBLE, &lbDataSet, &extentDataSet); - offsetsDatatSet[1] = blocksDataSet[0]*extentDataSet; - - MPI_Type_get_extent(MPI_INT, &lbDataSet, &extentDataSet); - offsetsDatatSet[2] = offsetsDatatSet[1]+blocksDataSet[1]*extentDataSet; - - MPI_Type_create_struct(3, blocksDataSet, offsetsDatatSet, typesDataSet, &dataSetType); - MPI_Type_commit(&dataSetType); - - //----------------------------------------------------------------------- - - MPI_Type_contiguous(4, MPI_INT, &boundCondParamType); - MPI_Type_commit(&boundCondParamType); - - //----------------------------------------------------------------------- - - MPI_Datatype typesBC[3] = { MPI_LONG_LONG_INT, MPI_FLOAT, MPI_CHAR }; - int blocksBC[3] = { 5, 39, 1 }; - MPI_Aint offsetsBC[3], lbBC, extentBC; - - offsetsBC[0] = 0; - MPI_Type_get_extent(MPI_LONG_LONG_INT, &lbBC, &extentBC); - offsetsBC[1] = blocksBC[0]*extentBC; - - MPI_Type_get_extent(MPI_FLOAT, &lbBC, &extentBC); - offsetsBC[2] = offsetsBC[1]+blocksBC[1]*extentBC; - - MPI_Type_create_struct(3, blocksBC, offsetsBC, typesBC, &boundCondType); - MPI_Type_commit(&boundCondType); - - //--------------------------------------- - - MPI_Type_contiguous(3, MPI_INT, &boundCondTypeAdd); - MPI_Type_commit(&boundCondTypeAdd); - -} -////////////////////////////////////////////////////////////////////////// -MPIIORestart21CoProcessor::~MPIIORestart21CoProcessor() -{ - MPI_Type_free(&gridParamType); - MPI_Type_free(&dataSetParamType); - MPI_Type_free(&block3dType); - MPI_Type_free(&dataSetType); - MPI_Type_free(&boundCondParamType); - MPI_Type_free(&boundCondType); - MPI_Type_free(&boundCondTypeAdd); - - if (mpiTypeFreeFlag) - { - MPI_Type_free(&dataSetDoubleType); - MPI_Type_free(&bcindexmatrixType); - } -} - -////////////////////////////////////////////////////////////////////////// -void MPIIORestart21CoProcessor::process(double step) -{ - if (scheduler->isDue(step)) - { - if (comm->isRoot()) UBLOG(logINFO, "MPIIORestart2CoProcessor save step: "<<step); - if (comm->isRoot()) UBLOG(logINFO, "Save check point - start"); - /*if (comm->isRoot())*/ clearAllFiles((int)step); - writeBlocks((int)step); - writeDataSet((int)step); - writeBoundaryConds((int)step); - if (comm->isRoot()) UBLOG(logINFO, "Save check point - end"); - } -} -////////////////////////////////////////////////////////////////////////// -void MPIIORestart21CoProcessor::clearAllFiles(int step) -{ - MPI_File file_handler1, file_handler2, file_handler3; - MPI_Info info = MPI_INFO_NULL; - MPI_Offset new_size = 0; - - UbSystem::makeDirectory(path + "/mpi_io_cp/mpi_io_cp_" + UbSystem::toString(step)); - std::string filename1 = path + "/mpi_io_cp/mpi_io_cp_" + UbSystem::toString(step) + "/cpBlocks.bin"; - //MPI_File_delete(filename1.c_str(), info); - int rc1 = MPI_File_open(MPI_COMM_WORLD, filename1.c_str(), MPI_MODE_CREATE | MPI_MODE_WRONLY, MPI_INFO_NULL, &file_handler1); - if (rc1 != MPI_SUCCESS) throw UbException(UB_EXARGS, "couldn't open file " + filename1); - MPI_File_set_size(file_handler1, new_size); - //MPI_File_sync(file_handler1); - MPI_File_close(&file_handler1); - - std::string filename2 = path + "/mpi_io_cp/mpi_io_cp_" + UbSystem::toString(step) + "/cpDataSet.bin"; - //MPI_File_delete(filename2.c_str(), info); - int rc2 = MPI_File_open(MPI_COMM_WORLD, filename2.c_str(), MPI_MODE_CREATE | MPI_MODE_WRONLY, info, &file_handler2); - if (rc2 != MPI_SUCCESS) throw UbException(UB_EXARGS, "couldn't open file " + filename2); - MPI_File_set_size(file_handler2, new_size); - //MPI_File_sync(file_handler2); - MPI_File_close(&file_handler2); - - std::string filename3 = path + "/mpi_io_cp/mpi_io_cp_" + UbSystem::toString(step) + "/cpBC.bin"; - //MPI_File_delete(filename3.c_str(), info); - int rc3 = MPI_File_open(MPI_COMM_WORLD, filename3.c_str(), MPI_MODE_CREATE | MPI_MODE_WRONLY, info, &file_handler3); - if (rc3 != MPI_SUCCESS) throw UbException(UB_EXARGS, "couldn't open file " + filename3); - MPI_File_set_size(file_handler3, new_size); - //MPI_File_sync(file_handler3); - MPI_File_close(&file_handler3); -} -////////////////////////////////////////////////////////////////////////// -void MPIIORestart21CoProcessor::writeBlocks(int step) -{ - int rank, size; - MPI_Comm_rank(MPI_COMM_WORLD, &rank); - //MPI_Comm_size(MPI_COMM_WORLD, &size); - size=1; - - grid->deleteBlockIDs(); - RenumberBlockVisitor renumber; - grid->accept(renumber); - - if (comm->isRoot()) - { - UBLOG(logINFO, "MPIIORestart21CoProcessor::writeBlocks start collect data rank = "<<rank); - UBLOG(logINFO, "Physical Memory currently used by current process: "<<Utilities::getPhysMemUsedByMe()/1073741824.0<<" GB"); - } - - int blocksCount = 0; // quantity of all the blocks in the grid, max 2147483648 blocks! - int minInitLevel = this->grid->getCoarsestInitializedLevel(); - int maxInitLevel = this->grid->getFinestInitializedLevel(); - - std::vector<Block3DPtr> blocksVector[25]; // max 25 levels - for (int level = minInitLevel; level<=maxInitLevel; level++) - { - //grid->getBlocks(level, rank, blockVector[level]); - grid->getBlocks(level, blocksVector[level]); - blocksCount += static_cast<int>(blocksVector[level].size()); - } - - GridParam* gridParameters = new GridParam; - gridParameters->trafoParams[0] = grid->getCoordinateTransformator()->Tx1; - gridParameters->trafoParams[1] = grid->getCoordinateTransformator()->Tx2; - gridParameters->trafoParams[2] = grid->getCoordinateTransformator()->Tx3; - gridParameters->trafoParams[3] = grid->getCoordinateTransformator()->Sx1; - gridParameters->trafoParams[4] = grid->getCoordinateTransformator()->Sx2; - gridParameters->trafoParams[5] = grid->getCoordinateTransformator()->Sx3; - gridParameters->trafoParams[6] = grid->getCoordinateTransformator()->alpha; - gridParameters->trafoParams[7] = grid->getCoordinateTransformator()->beta; - gridParameters->trafoParams[8] = grid->getCoordinateTransformator()->gamma; - - gridParameters->trafoParams[9] = grid->getCoordinateTransformator()->toX1factorX1; - gridParameters->trafoParams[10] = grid->getCoordinateTransformator()->toX1factorX2; - gridParameters->trafoParams[11] = grid->getCoordinateTransformator()->toX1factorX3; - gridParameters->trafoParams[12] = grid->getCoordinateTransformator()->toX1delta; - gridParameters->trafoParams[13] = grid->getCoordinateTransformator()->toX2factorX1; - gridParameters->trafoParams[14] = grid->getCoordinateTransformator()->toX2factorX2; - gridParameters->trafoParams[15] = grid->getCoordinateTransformator()->toX2factorX3; - gridParameters->trafoParams[16] = grid->getCoordinateTransformator()->toX2delta; - gridParameters->trafoParams[17] = grid->getCoordinateTransformator()->toX3factorX1; - gridParameters->trafoParams[18] = grid->getCoordinateTransformator()->toX3factorX2; - gridParameters->trafoParams[19] = grid->getCoordinateTransformator()->toX3factorX3; - gridParameters->trafoParams[20] = grid->getCoordinateTransformator()->toX3delta; - - gridParameters->trafoParams[21] = grid->getCoordinateTransformator()->fromX1factorX1; - gridParameters->trafoParams[22] = grid->getCoordinateTransformator()->fromX1factorX2; - gridParameters->trafoParams[23] = grid->getCoordinateTransformator()->fromX1factorX3; - gridParameters->trafoParams[24] = grid->getCoordinateTransformator()->fromX1delta; - gridParameters->trafoParams[25] = grid->getCoordinateTransformator()->fromX2factorX1; - gridParameters->trafoParams[26] = grid->getCoordinateTransformator()->fromX2factorX2; - gridParameters->trafoParams[27] = grid->getCoordinateTransformator()->fromX2factorX3; - gridParameters->trafoParams[28] = grid->getCoordinateTransformator()->fromX2delta; - gridParameters->trafoParams[29] = grid->getCoordinateTransformator()->fromX3factorX1; - gridParameters->trafoParams[30] = grid->getCoordinateTransformator()->fromX3factorX2; - gridParameters->trafoParams[31] = grid->getCoordinateTransformator()->fromX3factorX3; - gridParameters->trafoParams[32] = grid->getCoordinateTransformator()->fromX3delta; - - gridParameters->active = grid->getCoordinateTransformator()->active; - gridParameters->transformation = grid->getCoordinateTransformator()->transformation; - - gridParameters->deltaX = grid->getDeltaX(minInitLevel); - UbTupleInt3 blocknx = grid->getBlockNX(); - gridParameters->blockNx1 = val<1>(blocknx); - gridParameters->blockNx2 = val<2>(blocknx); - gridParameters->blockNx3 = val<3>(blocknx); - gridParameters->nx1 = grid->getNX1(); - gridParameters->nx2 = grid->getNX2(); - gridParameters->nx3 = grid->getNX3(); - gridParameters->periodicX1 = grid->isPeriodicX1(); - gridParameters->periodicX2 = grid->isPeriodicX2(); - gridParameters->periodicX3 = grid->isPeriodicX3(); - - //---------------------------------------------------------------------- - - Block3d* block3dArray = new Block3d[blocksCount]; - int ic = 0; - for (int level = minInitLevel; level<=maxInitLevel; level++) - { - for(Block3DPtr block : blocksVector[level]) // all the blocks of the current level - { - // save data describing the block - block3dArray[ic].x1 = block->getX1(); - block3dArray[ic].x2 = block->getX2(); - block3dArray[ic].x3 = block->getX3(); - block3dArray[ic].bundle = block->getBundle(); - block3dArray[ic].rank = block->getRank(); - block3dArray[ic].lrank = block->getLocalRank(); - block3dArray[ic].part = block->getPart(); - block3dArray[ic].globalID = block->getGlobalID(); - block3dArray[ic].localID = block->getLocalID(); - block3dArray[ic].level = block->getLevel(); - block3dArray[ic].interpolationFlagCF = block->getInterpolationFlagCF(); - block3dArray[ic].interpolationFlagFC = block->getInterpolationFlagFC(); - block3dArray[ic].counter = block->getMaxGlobalID(); - block3dArray[ic].active = block->isActive(); - - ic++; - } - } - - if (comm->isRoot()) - { - UBLOG(logINFO, "MPIIORestart21CoProcessor::writeBlocks start MPI IO rank = "<<rank); - UBLOG(logINFO, "Physical Memory currently used by current process: "<<Utilities::getPhysMemUsedByMe()/1073741824.0<<" GB"); - } - - // write to the file - MPI_File file_handler; - MPI_Info info = MPI_INFO_NULL; - //MPI_Info_create (&info); - //MPI_Info_set(info,"romio_cb_write","enable"); - //MPI_Info_set(info,"cb_buffer_size","4194304"); - //MPI_Info_set(info,"striping_unit","4194304"); - - // if (comm->isRoot()) - // { - UbSystem::makeDirectory(path + "/mpi_io_cp/mpi_io_cp_" + UbSystem::toString(step)); - std::string filename = path + "/mpi_io_cp/mpi_io_cp_" + UbSystem::toString(step) + "/cpBlocks.bin"; - int rc = MPI_File_open(MPI_COMM_WORLD, filename.c_str(), MPI_MODE_CREATE | MPI_MODE_WRONLY, MPI_INFO_NULL, &file_handler); - if (rc != MPI_SUCCESS) throw UbException(UB_EXARGS, "couldn't open file " + filename); - // } - - double start, finish; - MPI_Offset write_offset = (MPI_Offset)(size*sizeof(int)); - - if (comm->isRoot()) - { - start = MPI_Wtime(); - - // each process writes the quantity of it's blocks - MPI_File_write_at(file_handler, 0/*rank*sizeof(int)*/, &blocksCount, 1, MPI_INT, MPI_STATUS_IGNORE); - // each process writes parameters of the grid - MPI_File_write_at(file_handler, write_offset, gridParameters, 1, gridParamType, MPI_STATUS_IGNORE); - // each process writes it's blocks - MPI_File_write_at(file_handler, (MPI_Offset)(write_offset +sizeof(GridParam)), &block3dArray[0], blocksCount, block3dType, MPI_STATUS_IGNORE); - //MPI_File_sync(file_handler); - } - MPI_File_close(&file_handler); - - if (comm->isRoot()) - { - finish = MPI_Wtime(); - UBLOG(logINFO, "MPIIORestart21CoProcessor::writeBlocks time: "<<finish-start<<" s"); - } - - delete[] block3dArray; - delete gridParameters; -} - -void MPIIORestart21CoProcessor::writeDataSet(int step) -{ - int rank, size; - MPI_Comm_rank(MPI_COMM_WORLD, &rank); - MPI_Comm_size(MPI_COMM_WORLD, &size); - - int blocksCount = 0; // quantity of blocks, that belong to this process - - std::vector<Block3DPtr> blocksVector[25]; - int minInitLevel = this->grid->getCoarsestInitializedLevel(); - int maxInitLevel = this->grid->getFinestInitializedLevel(); - for (int level = minInitLevel; level<=maxInitLevel; level++) - { - grid->getBlocks(level, rank, blocksVector[level]); - blocksCount += static_cast<int>(blocksVector[level].size()); - } - - DataSet* dataSetArray = new DataSet[blocksCount]; - std::vector<double> doubleValuesArray; // double-values (arrays of f's) in all blocks - - if (comm->isRoot()) - { - UBLOG(logINFO, "MPIIORestart21CoProcessor::writeDataSet start collect data rank = "<<rank); - UBLOG(logINFO, "Physical Memory currently used by current process: "<<Utilities::getPhysMemUsedByMe()/1073741824.0<<" GB"); - } - - bool firstBlock = true; - int ic = 0; - for (int level = minInitLevel; level<=maxInitLevel; level++) - { - for(Block3DPtr block : blocksVector[level]) // blocks of the current level - { - dataSetArray[ic].globalID = block->getGlobalID(); // id of the block needed to find it while regenerating the grid - dataSetArray[ic].ghostLayerWidth = block->getKernel()->getGhostLayerWidth(); - dataSetArray[ic].collFactor = block->getKernel()->getCollisionFactor(); - dataSetArray[ic].deltaT = block->getKernel()->getDeltaT(); - dataSetArray[ic].compressible = block->getKernel()->getCompressible(); - dataSetArray[ic].withForcing = block->getKernel()->getWithForcing(); - - if (firstBlock)// && block->getKernel()) // when first (any) valid block... - { - std::shared_ptr< CbArray4D<LBMReal, IndexerX4X3X2X1> > AverageValuesArray3DPtr = block->getKernel()->getDataSet()->getAverageValues(); - if (AverageValuesArray3DPtr) - { - dataSetParamStr.nx[0][0] = static_cast<int>(AverageValuesArray3DPtr->getNX1()); - dataSetParamStr.nx[0][1] = static_cast<int>(AverageValuesArray3DPtr->getNX2()); - dataSetParamStr.nx[0][2] = static_cast<int>(AverageValuesArray3DPtr->getNX3()); - dataSetParamStr.nx[0][3] = static_cast<int>(AverageValuesArray3DPtr->getNX4()); - } - - std::shared_ptr< CbArray4D<LBMReal, IndexerX4X3X2X1> > AverageVelocityArray3DPtr = block->getKernel()->getDataSet()->getAverageVelocity(); - if (AverageVelocityArray3DPtr) - { - dataSetParamStr.nx[1][0] = static_cast<int>(AverageVelocityArray3DPtr->getNX1()); - dataSetParamStr.nx[1][1] = static_cast<int>(AverageVelocityArray3DPtr->getNX2()); - dataSetParamStr.nx[1][2] = static_cast<int>(AverageVelocityArray3DPtr->getNX3()); - dataSetParamStr.nx[1][3] = static_cast<int>(AverageVelocityArray3DPtr->getNX4()); - } - - std::shared_ptr< CbArray4D<LBMReal, IndexerX4X3X2X1> > AverageFluctArray3DPtr = block->getKernel()->getDataSet()->getAverageFluctuations(); - if (AverageFluctArray3DPtr) - { - dataSetParamStr.nx[2][0] = static_cast<int>(AverageFluctArray3DPtr->getNX1()); - dataSetParamStr.nx[2][1] = static_cast<int>(AverageFluctArray3DPtr->getNX2()); - dataSetParamStr.nx[2][2] = static_cast<int>(AverageFluctArray3DPtr->getNX3()); - dataSetParamStr.nx[2][3] = static_cast<int>(AverageFluctArray3DPtr->getNX4()); - } - - std::shared_ptr< CbArray4D<LBMReal, IndexerX4X3X2X1> > AverageTripleArray3DPtr = block->getKernel()->getDataSet()->getAverageTriplecorrelations(); - if (AverageTripleArray3DPtr) - { - dataSetParamStr.nx[3][0] = static_cast<int>(AverageTripleArray3DPtr->getNX1()); - dataSetParamStr.nx[3][1] = static_cast<int>(AverageTripleArray3DPtr->getNX2()); - dataSetParamStr.nx[3][2] = static_cast<int>(AverageTripleArray3DPtr->getNX3()); - dataSetParamStr.nx[3][3] = static_cast<int>(AverageTripleArray3DPtr->getNX4()); - } - - std::shared_ptr< CbArray4D<LBMReal, IndexerX4X3X2X1> > ShearStressValArray3DPtr = block->getKernel()->getDataSet()->getShearStressValues(); - if (ShearStressValArray3DPtr) - { - dataSetParamStr.nx[4][0] = static_cast<int>(ShearStressValArray3DPtr->getNX1()); - dataSetParamStr.nx[4][1] = static_cast<int>(ShearStressValArray3DPtr->getNX2()); - dataSetParamStr.nx[4][2] = static_cast<int>(ShearStressValArray3DPtr->getNX3()); - dataSetParamStr.nx[4][3] = static_cast<int>(ShearStressValArray3DPtr->getNX4()); - } - - std::shared_ptr< CbArray3D<LBMReal, IndexerX3X2X1> > relaxationFactor3DPtr = block->getKernel()->getDataSet()->getRelaxationFactor(); - if (relaxationFactor3DPtr) - { - dataSetParamStr.nx[5][0] = static_cast<int>(relaxationFactor3DPtr->getNX1()); - dataSetParamStr.nx[5][1] = static_cast<int>(relaxationFactor3DPtr->getNX2()); - dataSetParamStr.nx[5][2] = static_cast<int>(relaxationFactor3DPtr->getNX3()); - dataSetParamStr.nx[5][3] = 1; - } - - std::shared_ptr< D3Q27EsoTwist3DSplittedVector > D3Q27EsoTwist3DSplittedVectorPtr = std::dynamic_pointer_cast<D3Q27EsoTwist3DSplittedVector>(block->getKernel()->getDataSet()->getFdistributions()); - CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr localDistributions = D3Q27EsoTwist3DSplittedVectorPtr->getLocalDistributions(); - if (localDistributions) - { - dataSetParamStr.nx[6][0] = static_cast<int>(localDistributions->getNX1()); - dataSetParamStr.nx[6][1] = static_cast<int>(localDistributions->getNX2()); - dataSetParamStr.nx[6][2] = static_cast<int>(localDistributions->getNX3()); - dataSetParamStr.nx[6][3] = static_cast<int>(localDistributions->getNX4()); - } - - CbArray4D <LBMReal, IndexerX4X3X2X1>::CbArray4DPtr nonLocalDistributions = D3Q27EsoTwist3DSplittedVectorPtr->getNonLocalDistributions(); - if (nonLocalDistributions) - { - dataSetParamStr.nx[7][0] = static_cast<int>(nonLocalDistributions->getNX1()); - dataSetParamStr.nx[7][1] = static_cast<int>(nonLocalDistributions->getNX2()); - dataSetParamStr.nx[7][2] = static_cast<int>(nonLocalDistributions->getNX3()); - dataSetParamStr.nx[7][3] = static_cast<int>(nonLocalDistributions->getNX4()); - } - - CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr zeroDistributions = D3Q27EsoTwist3DSplittedVectorPtr->getZeroDistributions(); - if (zeroDistributions) - { - dataSetParamStr.nx[8][0] = static_cast<int>(zeroDistributions->getNX1()); - dataSetParamStr.nx[8][1] = static_cast<int>(zeroDistributions->getNX2()); - dataSetParamStr.nx[8][2] = static_cast<int>(zeroDistributions->getNX3()); - dataSetParamStr.nx[8][3] = 1; - } - - // ... than save some parameters that are equal in all blocks - dataSetParamStr.nx1 = static_cast<int>(block->getKernel()->getDataSet()->getFdistributions()->getNX1()); - dataSetParamStr.nx2 = static_cast<int>(block->getKernel()->getDataSet()->getFdistributions()->getNX2()); - dataSetParamStr.nx3 = static_cast<int>(block->getKernel()->getDataSet()->getFdistributions()->getNX3()); - - firstBlock = false; - - // how many elements are in all arrays of DataSet (equal in all blocks) - int doubleCount = 0, temp; - for (int i = 0; i < 9; i++) // 9 arrays ( averageValues, averageVelocity, averageFluktuations, - { // averageTriplecorrelations, shearStressValues, relaxationFactor, 3 * fdistributions - temp = 1; - for (int ii = 0; ii < 4; ii++) // 4 values (nx1, nx2, nx3, nx4) - temp *= dataSetParamStr.nx[i][ii]; - doubleCount += temp; - } - dataSetParamStr.doubleCountInBlock = doubleCount; - } - - std::shared_ptr< CbArray4D<LBMReal, IndexerX4X3X2X1> > AverageValuesArray3DPtr = block->getKernel()->getDataSet()->getAverageValues(); - if (AverageValuesArray3DPtr&&(dataSetParamStr.nx[0][0]>0)&&(dataSetParamStr.nx[0][1]>0)&&(dataSetParamStr.nx[0][2]>0)&&(dataSetParamStr.nx[0][3]>0)) - doubleValuesArray.insert(doubleValuesArray.end(), AverageValuesArray3DPtr->getDataVector().begin(), AverageValuesArray3DPtr->getDataVector().end()); - - std::shared_ptr< CbArray4D<LBMReal, IndexerX4X3X2X1> > AverageVelocityArray3DPtr = block->getKernel()->getDataSet()->getAverageVelocity(); - if (AverageVelocityArray3DPtr&&(dataSetParamStr.nx[1][0]>0)&&(dataSetParamStr.nx[1][1]>0)&&(dataSetParamStr.nx[1][2]>0)&&(dataSetParamStr.nx[1][3]>0)) - doubleValuesArray.insert(doubleValuesArray.end(), AverageVelocityArray3DPtr->getDataVector().begin(), AverageVelocityArray3DPtr->getDataVector().end()); - - std::shared_ptr< CbArray4D<LBMReal, IndexerX4X3X2X1> > AverageFluctArray3DPtr = block->getKernel()->getDataSet()->getAverageFluctuations(); - if (AverageFluctArray3DPtr&&(dataSetParamStr.nx[2][0]>0)&&(dataSetParamStr.nx[2][1]>0)&&(dataSetParamStr.nx[2][2]>0)&&(dataSetParamStr.nx[2][3]>0)) - doubleValuesArray.insert(doubleValuesArray.end(), AverageFluctArray3DPtr->getDataVector().begin(), AverageFluctArray3DPtr->getDataVector().end()); - - std::shared_ptr< CbArray4D<LBMReal, IndexerX4X3X2X1> > AverageTripleArray3DPtr = block->getKernel()->getDataSet()->getAverageTriplecorrelations(); - if (AverageTripleArray3DPtr&&(dataSetParamStr.nx[3][0]>0)&&(dataSetParamStr.nx[3][1]>0)&&(dataSetParamStr.nx[3][2]>0)&&(dataSetParamStr.nx[3][3]>0)) - doubleValuesArray.insert(doubleValuesArray.end(), AverageTripleArray3DPtr->getDataVector().begin(), AverageTripleArray3DPtr->getDataVector().end()); - - std::shared_ptr< CbArray4D<LBMReal, IndexerX4X3X2X1> > ShearStressValArray3DPtr = block->getKernel()->getDataSet()->getShearStressValues(); - if (ShearStressValArray3DPtr&&(dataSetParamStr.nx[4][0]>0)&&(dataSetParamStr.nx[4][1]>0)&&(dataSetParamStr.nx[4][2]>0)&&(dataSetParamStr.nx[4][3]>0)) - doubleValuesArray.insert(doubleValuesArray.end(), ShearStressValArray3DPtr->getDataVector().begin(), ShearStressValArray3DPtr->getDataVector().end()); - - std::shared_ptr< CbArray3D<LBMReal, IndexerX3X2X1> > RelaxationFactor3DPtr = block->getKernel()->getDataSet()->getRelaxationFactor(); - if (RelaxationFactor3DPtr&&(dataSetParamStr.nx[5][0]>0)&&(dataSetParamStr.nx[5][1]>0)&&(dataSetParamStr.nx[5][2]>0)) - doubleValuesArray.insert(doubleValuesArray.end(), RelaxationFactor3DPtr->getDataVector().begin(), RelaxationFactor3DPtr->getDataVector().end()); - - std::shared_ptr< D3Q27EsoTwist3DSplittedVector > D3Q27EsoTwist3DSplittedVectorPtr = std::dynamic_pointer_cast<D3Q27EsoTwist3DSplittedVector>(block->getKernel()->getDataSet()->getFdistributions()); - CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr localDistributions = D3Q27EsoTwist3DSplittedVectorPtr->getLocalDistributions(); - if (localDistributions&&(dataSetParamStr.nx[6][0]>0)&&(dataSetParamStr.nx[6][1]>0)&&(dataSetParamStr.nx[6][2]>0)&&(dataSetParamStr.nx[6][3]>0)) - doubleValuesArray.insert(doubleValuesArray.end(), localDistributions->getDataVector().begin(), localDistributions->getDataVector().end()); - - CbArray4D <LBMReal, IndexerX4X3X2X1>::CbArray4DPtr nonLocalDistributions = D3Q27EsoTwist3DSplittedVectorPtr->getNonLocalDistributions(); - if (nonLocalDistributions&&(dataSetParamStr.nx[7][0]>0)&&(dataSetParamStr.nx[7][1]>0)&&(dataSetParamStr.nx[7][2]>0)&&(dataSetParamStr.nx[7][3]>0)) - doubleValuesArray.insert(doubleValuesArray.end(), nonLocalDistributions->getDataVector().begin(), nonLocalDistributions->getDataVector().end()); - - CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr zeroDistributions = D3Q27EsoTwist3DSplittedVectorPtr->getZeroDistributions(); - if (zeroDistributions&&(dataSetParamStr.nx[8][0]>0)&&(dataSetParamStr.nx[8][1]>0)&&(dataSetParamStr.nx[8][2]>0)) - doubleValuesArray.insert(doubleValuesArray.end(), zeroDistributions->getDataVector().begin(), zeroDistributions->getDataVector().end()); - - ic++; - } - } - - // register new MPI-type depending on the block-specific information - MPI_Type_contiguous(dataSetParamStr.doubleCountInBlock, MPI_DOUBLE, &dataSetDoubleType); - MPI_Type_commit(&dataSetDoubleType); - mpiTypeFreeFlag = true; - - if (comm->isRoot()) - { - UBLOG(logINFO, "MPIIORestart21CoProcessor::writeDataSet start MPI IO rank = "<<rank); - UBLOG(logINFO, "Physical Memory currently used by current process: "<<Utilities::getPhysMemUsedByMe()/1073741824.0<<" GB"); - } - - double start, finish; - if (comm->isRoot()) start = MPI_Wtime(); - - MPI_Info info = MPI_INFO_NULL; - //MPI_Info_create (&info); - //MPI_Info_set(info,"romio_cb_write","enable"); - //MPI_Info_set(info,"cb_buffer_size","4194304"); - //MPI_Info_set(info,"striping_unit","4194304"); - - // write to the file - MPI_File file_handler; - std::string filename = path+"/mpi_io_cp/mpi_io_cp_"+UbSystem::toString(step)+"/cpDataSet.bin"; - int rc = MPI_File_open(MPI_COMM_WORLD, filename.c_str(), MPI_MODE_CREATE|MPI_MODE_WRONLY, info, &file_handler); - if (rc!=MPI_SUCCESS) throw UbException(UB_EXARGS, "couldn't open file "+filename); - - size_t sizeofOneDataSet = sizeof(DataSet) + dataSetParamStr.doubleCountInBlock * sizeof(double); - MPI_Offset write_offset = 0; - - MPI_File_write_at(file_handler, write_offset, &dataSetParamStr, 1, dataSetParamType, MPI_STATUS_IGNORE); - - for (int nb = 0; nb < blocksCount; nb++) - { - write_offset = (MPI_Offset)(sizeof(dataSetParam) + dataSetArray[nb].globalID * sizeofOneDataSet); - MPI_File_write_at(file_handler, write_offset, &dataSetArray[nb], 1, dataSetType, MPI_STATUS_IGNORE); - MPI_File_write_at(file_handler, (MPI_Offset)(write_offset + sizeof(DataSet)), &doubleValuesArray[nb * dataSetParamStr.doubleCountInBlock], 1, dataSetDoubleType, MPI_STATUS_IGNORE); - } - - MPI_File_sync(file_handler); - MPI_File_close(&file_handler); - - if (comm->isRoot()) - { - finish = MPI_Wtime(); - UBLOG(logINFO, "MPIIORestart21CoProcessor::writeDataSet time: "<<finish-start<<" s"); - } - - delete[] dataSetArray; -} - -void MPIIORestart21CoProcessor::writeBoundaryConds(int step) -{ - int rank, size; - MPI_Comm_rank(MPI_COMM_WORLD, &rank); - MPI_Comm_size(MPI_COMM_WORLD, &size); - - if (comm->isRoot()) - { - UBLOG(logINFO, "MPIIORestart21CoProcessor::writeBoundaryConds start collect data rank = "<<rank); - UBLOG(logINFO, "Physical Memory currently used by current process: "<<Utilities::getPhysMemUsedByMe()/1073741824.0<<" GB"); - } - - int blocksCount = 0; // quantity of blocks, that belong to this process - size_t allBytesCount = 0; // quantity of bytes, that one process writes to the file - size_t count_boundCond = 0; // how many BoundaryConditions in all blocks - int count_indexContainer = 0; // how many indexContainer-values in all blocks - - std::vector<Block3DPtr> blocksVector[25]; - int minInitLevel = this->grid->getCoarsestInitializedLevel(); - int maxInitLevel = this->grid->getFinestInitializedLevel(); - for (int level = minInitLevel; level<=maxInitLevel; level++) - { - grid->getBlocks(level, rank, blocksVector[level]); - blocksCount += static_cast<int>(blocksVector[level].size()); - } - - BCAdd* bcAddArray = new BCAdd[blocksCount]; - size_t* bytesCount = new size_t[blocksCount]; // quantity of bytes, that each block writes to the file - std::vector<BoundaryCondition>* bcVector = new std::vector<BoundaryCondition>[blocksCount]; - std::vector<int>* bcindexmatrixVector = new std::vector<int>[blocksCount]; - std::vector<int>* indexContainerVector = new std::vector<int>[blocksCount]; - - bool bcindexmatrixCountNotInit = true; - int ic = 0; - for (int level = minInitLevel; level<=maxInitLevel; level++) - { - for(Block3DPtr block : blocksVector[level]) // all the blocks of the current level - { - BCArray3DPtr bcArr = block->getKernel()->getBCProcessor()->getBCArray(); - - bcAddArray[ic].globalID = block->getGlobalID(); // id of the block needed to find it while regenerating the grid - bcAddArray[ic].boundCond_count = 0; // how many BoundaryConditions in this block - bcAddArray[ic].indexContainer_count = 0; // how many indexContainer-values in this block - bytesCount[ic] = sizeof(BCAdd); - bcVector[ic].resize(0); - bcindexmatrixVector[ic].resize(0); - indexContainerVector[ic].resize(0); - - for (int bc = 0; bc<bcArr->getBCVectorSize(); bc++) - { - BoundaryCondition* bouCond = new BoundaryCondition(); - if (bcArr->bcvector[bc]==NULL) - { - memset(bouCond, 0, sizeof(BoundaryCondition)); - } - else - { - bouCond->noslipBoundaryFlags = bcArr->bcvector[bc]->getNoSlipBoundary(); - bouCond->slipBoundaryFlags = bcArr->bcvector[bc]->getSlipBoundary(); - bouCond->velocityBoundaryFlags = bcArr->bcvector[bc]->getVelocityBoundary(); - bouCond->densityBoundaryFlags = bcArr->bcvector[bc]->getDensityBoundary(); - bouCond->wallModelBoundaryFlags = bcArr->bcvector[bc]->getWallModelBoundary(); - bouCond->bcVelocityX1 = bcArr->bcvector[bc]->getBoundaryVelocityX1(); - bouCond->bcVelocityX2 = bcArr->bcvector[bc]->getBoundaryVelocityX2(); - bouCond->bcVelocityX3 = bcArr->bcvector[bc]->getBoundaryVelocityX3(); - bouCond->bcDensity = bcArr->bcvector[bc]->getBoundaryDensity(); - bouCond->bcLodiDensity = bcArr->bcvector[bc]->getDensityLodiDensity(); - bouCond->bcLodiVelocityX1 = bcArr->bcvector[bc]->getDensityLodiVelocityX1(); - bouCond->bcLodiVelocityX2 = bcArr->bcvector[bc]->getDensityLodiVelocityX2(); - bouCond->bcLodiVelocityX3 = bcArr->bcvector[bc]->getDensityLodiVelocityX3(); - bouCond->bcLodiLentgh = bcArr->bcvector[bc]->getDensityLodiLength(); - bouCond->nx1 = bcArr->bcvector[bc]->nx1; - bouCond->nx2 = bcArr->bcvector[bc]->nx2; - bouCond->nx3 = bcArr->bcvector[bc]->nx3; - for (int iq = 0; iq<26; iq++) - bouCond->q[iq] = bcArr->bcvector[bc]->getQ(iq); - bouCond->algorithmType = bcArr->bcvector[bc]->getBcAlgorithmType(); - } - - bcVector[ic].push_back(*bouCond); - bcAddArray[ic].boundCond_count++; - count_boundCond++; - bytesCount[ic] += sizeof(BoundaryCondition); - } - - if (bcindexmatrixCountNotInit) - { - boundCondParamStr.nx1 = static_cast<int>(bcArr->bcindexmatrix.getNX1()); - boundCondParamStr.nx2 = static_cast<int>(bcArr->bcindexmatrix.getNX2()); - boundCondParamStr.nx3 = static_cast<int>(bcArr->bcindexmatrix.getNX3()); - boundCondParamStr.bcindexmatrixCount = static_cast<int>(bcArr->bcindexmatrix.getDataVector().size()); - bcindexmatrixCountNotInit = false; - } - bcindexmatrixVector[ic].insert(bcindexmatrixVector[ic].begin(), bcArr->bcindexmatrix.getDataVector().begin(), bcArr->bcindexmatrix.getDataVector().end()); - bytesCount[ic] += boundCondParamStr.bcindexmatrixCount * sizeof(int); - - indexContainerVector[ic].insert(indexContainerVector[ic].begin(), bcArr->indexContainer.begin(), bcArr->indexContainer.end()); - bcAddArray[ic].indexContainer_count = static_cast<int>(bcArr->indexContainer.size()); - count_indexContainer += bcAddArray[ic].indexContainer_count; - bytesCount[ic] += bcAddArray[ic].indexContainer_count * sizeof(int); - - allBytesCount += bytesCount[ic]; - - ic++; - } - } - - MPI_Type_contiguous(boundCondParamStr.bcindexmatrixCount, MPI_INT, &bcindexmatrixType); - MPI_Type_commit(&bcindexmatrixType); - mpiTypeFreeFlag = true; - - if (comm->isRoot()) - { - UBLOG(logINFO, "MPIIORestart21CoProcessor::writeBoundaryConds start MPI IO rank = "<<rank); - UBLOG(logINFO, "Physical Memory currently used by current process: "<<Utilities::getPhysMemUsedByMe()/1073741824.0<<" GB"); - } - - double start, finish; - if (comm->isRoot()) start = MPI_Wtime(); - - MPI_Info info = MPI_INFO_NULL; - //MPI_Info_create (&info); - //MPI_Info_set(info,"romio_cb_write","enable"); - //MPI_Info_set(info,"cb_buffer_size","4194304"); - //MPI_Info_set(info,"striping_unit","4194304"); - - MPI_File file_handler; - std::string filename = path+"/mpi_io_cp/mpi_io_cp_"+UbSystem::toString(step)+"/cpBC.bin"; - int rc = MPI_File_open(MPI_COMM_WORLD, filename.c_str(), MPI_MODE_CREATE|MPI_MODE_WRONLY, info, &file_handler); - if (rc!=MPI_SUCCESS) throw UbException(UB_EXARGS, "couldn't open file "+filename); - - MPI_Offset write_offset = (MPI_Offset)(sizeof(boundCondParam) + grid->getNumberOfBlocks() * sizeof(size_t)); - size_t next_file_offset = 0; - if (size > 1) - { - if (rank == 0) - { - next_file_offset = write_offset + allBytesCount; - MPI_Send(&next_file_offset, 1, MPI_LONG_LONG_INT, 1, 5, MPI_COMM_WORLD); - } - else - { - MPI_Recv(&write_offset, 1, MPI_LONG_LONG_INT, rank - 1, 5, MPI_COMM_WORLD, MPI_STATUS_IGNORE); - next_file_offset = write_offset + allBytesCount; - if (rank < size - 1) - MPI_Send(&next_file_offset, 1, MPI_LONG_LONG_INT, rank + 1, 5, MPI_COMM_WORLD); - } - } - - MPI_File_write_at(file_handler, 0, &boundCondParamStr, 1, boundCondParamType, MPI_STATUS_IGNORE); - - MPI_Offset write_offsetIndex; - - for (int nb = 0; nb < blocksCount; nb++) - { - write_offsetIndex = (MPI_Offset)(sizeof(boundCondParam) + bcAddArray[nb].globalID * sizeof(size_t)); - MPI_File_write_at(file_handler, write_offsetIndex, &write_offset, 1, MPI_LONG_LONG_INT, MPI_STATUS_IGNORE); - - MPI_File_write_at(file_handler, write_offset, &bcAddArray[nb], 1, boundCondTypeAdd, MPI_STATUS_IGNORE); - if (bcVector[nb].size() > 0) - MPI_File_write_at(file_handler, (MPI_Offset)(write_offset + sizeof(BCAdd)), &bcVector[nb][0], bcAddArray[nb].boundCond_count, boundCondType, MPI_STATUS_IGNORE); - - if (bcindexmatrixVector[nb].size() > 0) - MPI_File_write_at(file_handler, (MPI_Offset)(write_offset + sizeof(BCAdd) + bcAddArray[nb].boundCond_count * sizeof(BoundaryCondition)), - &bcindexmatrixVector[nb][0], 1, bcindexmatrixType, MPI_STATUS_IGNORE); - - if (indexContainerVector[nb].size() > 0) - MPI_File_write_at(file_handler, (MPI_Offset)(write_offset + sizeof(BCAdd) + bcAddArray[nb].boundCond_count * sizeof(BoundaryCondition) + boundCondParamStr.bcindexmatrixCount * sizeof(int)), - &indexContainerVector[nb][0], bcAddArray[nb].indexContainer_count, MPI_INT, MPI_STATUS_IGNORE); - - write_offset += bytesCount[nb]; - } - - MPI_File_sync(file_handler); - MPI_File_close(&file_handler); - - if (comm->isRoot()) - { - finish = MPI_Wtime(); - UBLOG(logINFO, "MPIIORestart21CoProcessor::writeBoundaryConds time: "<<finish-start<<" s"); - } - - delete[] bcAddArray; - delete[] bytesCount; - delete[] bcVector; - delete[] bcindexmatrixVector; - delete[] indexContainerVector; -} - -//------------------------------------------- READ ----------------------------------------------- -void MPIIORestart21CoProcessor::restart(int step) -{ - if (comm->isRoot()) UBLOG(logINFO, "MPIIORestart21CoProcessor restart step: "<<step); - if (comm->isRoot()) UBLOG(logINFO, "Load check point - start"); - readBlocks(step); - readDataSet(step); - readBoundaryConds(step); - if (comm->isRoot()) UBLOG(logINFO, "Load check point - end"); - this->reconnect(grid); -} - -void MPIIORestart21CoProcessor::readBlocks(int step) -{ - int rank, size; - MPI_Comm_rank(MPI_COMM_WORLD, &rank); - //MPI_Comm_size(MPI_COMM_WORLD, &size); - size = 1; - - if (comm->isRoot()) - { - UBLOG(logINFO, "MPIIORestart21CoProcessor::readBlocks start MPI IO rank = "<<rank); - UBLOG(logINFO, "Physical Memory currently used by current process: "<<Utilities::getPhysMemUsedByMe()/1073741824.0<<" GB"); - } - - double start, finish; - if (comm->isRoot()) start = MPI_Wtime(); - - MPI_File file_handler; - std::string filename = path+"/mpi_io_cp/mpi_io_cp_"+UbSystem::toString(step)+"/cpBlocks.bin"; - int rc = MPI_File_open(MPI_COMM_WORLD, filename.c_str(), MPI_MODE_RDONLY, MPI_INFO_NULL, &file_handler); - if (rc!=MPI_SUCCESS) throw UbException(UB_EXARGS, "couldn't open file "+filename); - - // read count of blocks - int blocksCount = 0; - //MPI_File_read_at(file_handler, rank*sizeof(int), &blocksCount, 1, MPI_INT, MPI_STATUS_IGNORE); - MPI_File_read_at(file_handler, 0, &blocksCount, 1, MPI_INT, MPI_STATUS_IGNORE); - Block3d* block3dArray = new Block3d[blocksCount]; - - GridParam* gridParameters = new GridParam; - - // calculate the read offset - MPI_Offset read_offset = (MPI_Offset)(size*sizeof(int)); - - // read parameters of the grid - MPI_File_read_at(file_handler, read_offset, gridParameters, 1, gridParamType, MPI_STATUS_IGNORE); - // read all the blocks - MPI_File_read_at(file_handler, (MPI_Offset)(read_offset+sizeof(GridParam)), &block3dArray[0], blocksCount, block3dType, MPI_STATUS_IGNORE); - - MPI_File_close(&file_handler); - - if (comm->isRoot()) - { - finish = MPI_Wtime(); - UBLOG(logINFO, "MPIIORestart21CoProcessor::readBlocks time: "<<finish-start<<" s"); - } - - if (comm->isRoot()) - { - UBLOG(logINFO, "MPIIORestart21CoProcessor::readBlocks start of restore of data, rank = "<<rank); - UBLOG(logINFO, "Physical Memory currently used by current process: "<<Utilities::getPhysMemUsedByMe()/1073741824.0<<" GB"); - } - - // clear the grid - std::vector<Block3DPtr> blocksVector; - grid->getBlocks(0, blocksVector); - int del = 0; - for(Block3DPtr block : blocksVector) - { - grid->deleteBlock(block); - del++; - } - - // restore the grid - CoordinateTransformation3DPtr trafo(new CoordinateTransformation3D()); - trafo->Tx1 = gridParameters->trafoParams[0]; - trafo->Tx2 = gridParameters->trafoParams[1]; - trafo->Tx3 = gridParameters->trafoParams[2]; - trafo->Sx1 = gridParameters->trafoParams[3]; - trafo->Sx2 = gridParameters->trafoParams[4]; - trafo->Sx3 = gridParameters->trafoParams[5]; - trafo->alpha = gridParameters->trafoParams[6]; - trafo->beta = gridParameters->trafoParams[7]; - trafo->gamma = gridParameters->trafoParams[8]; - - trafo->toX1factorX1 = gridParameters->trafoParams[9]; - trafo->toX1factorX2 = gridParameters->trafoParams[10]; - trafo->toX1factorX3 = gridParameters->trafoParams[11]; - trafo->toX1delta = gridParameters->trafoParams[12]; - trafo->toX2factorX1 = gridParameters->trafoParams[13]; - trafo->toX2factorX2 = gridParameters->trafoParams[14]; - trafo->toX2factorX3 = gridParameters->trafoParams[15]; - trafo->toX2delta = gridParameters->trafoParams[16]; - trafo->toX3factorX1 = gridParameters->trafoParams[17]; - trafo->toX3factorX2 = gridParameters->trafoParams[18]; - trafo->toX3factorX3 = gridParameters->trafoParams[19]; - trafo->toX3delta = gridParameters->trafoParams[20]; - - trafo->fromX1factorX1 = gridParameters->trafoParams[21]; - trafo->fromX1factorX2 = gridParameters->trafoParams[22]; - trafo->fromX1factorX3 = gridParameters->trafoParams[23]; - trafo->fromX1delta = gridParameters->trafoParams[24]; - trafo->fromX2factorX1 = gridParameters->trafoParams[25]; - trafo->fromX2factorX2 = gridParameters->trafoParams[26]; - trafo->fromX2factorX3 = gridParameters->trafoParams[27]; - trafo->fromX2delta = gridParameters->trafoParams[28]; - trafo->fromX3factorX1 = gridParameters->trafoParams[29]; - trafo->fromX3factorX2 = gridParameters->trafoParams[30]; - trafo->fromX3factorX3 = gridParameters->trafoParams[31]; - trafo->fromX3delta = gridParameters->trafoParams[32]; - - trafo->active = gridParameters->active; - trafo->transformation = gridParameters->transformation; - - grid->setCoordinateTransformator(trafo); - - grid->setDeltaX(gridParameters->deltaX); - grid->setBlockNX(gridParameters->blockNx1, gridParameters->blockNx2, gridParameters->blockNx3); - grid->setNX1(gridParameters->nx1); - grid->setNX2(gridParameters->nx2); - grid->setNX3(gridParameters->nx3); - grid->setPeriodicX1(gridParameters->periodicX1); - grid->setPeriodicX2(gridParameters->periodicX2); - grid->setPeriodicX3(gridParameters->periodicX3); - - // regenerate blocks - for (int n = 0; n<blocksCount; n++) - { - Block3DPtr block(new Block3D(block3dArray[n].x1, block3dArray[n].x2, block3dArray[n].x3, block3dArray[n].level)); - block->setActive(block3dArray[n].active); - block->setBundle(block3dArray[n].bundle); - block->setRank(block3dArray[n].rank); - block->setLocalRank(block3dArray[n].lrank); - block->setGlobalID(block3dArray[n].globalID); - block->setLocalID(block3dArray[n].localID); - block->setPart(block3dArray[n].part); - block->setLevel(block3dArray[n].level); - block->interpolationFlagCF = block3dArray[n].interpolationFlagCF; - block->interpolationFlagFC = block3dArray[n].interpolationFlagFC; - - grid->addBlock(block); - } - - delete gridParameters; - delete[] block3dArray; - - if (comm->isRoot()) - { - UBLOG(logINFO, "MPIIORestart21CoProcessor::readBlocks end of restore of data, rank = "<<rank); - UBLOG(logINFO, "Physical Memory currently used by current process: "<<Utilities::getPhysMemUsedByMe()/1073741824.0<<" GB"); - } -} - -void MPIIORestart21CoProcessor::readDataSet(int step) -{ - int rank, size; - MPI_Comm_rank(MPI_COMM_WORLD, &rank); - MPI_Comm_size(MPI_COMM_WORLD, &size); - - if (comm->isRoot()) - { - UBLOG(logINFO, "MPIIORestart21CoProcessor::readDataSet start MPI IO rank = "<<rank); - UBLOG(logINFO, "Physical Memory currently used by current process: "<<Utilities::getPhysMemUsedByMe()/1073741824.0<<" GB"); - } - double start, finish; - if (comm->isRoot()) start = MPI_Wtime(); - - int blocksCount = 0; // quantity of the blocks, that belong to this process - - // read from the grid the blocks, that belong to this process - std::vector<Block3DPtr> blocksVector[25]; - int minInitLevel = this->grid->getCoarsestInitializedLevel(); - int maxInitLevel = this->grid->getFinestInitializedLevel(); - for (int level = minInitLevel; level <= maxInitLevel; level++) - { - grid->getBlocks(level, rank, blocksVector[level]); - blocksCount += static_cast<int>(blocksVector[level].size()); - } - - DataSet* dataSetArray = new DataSet[blocksCount]; - - MPI_File file_handler; - std::string filename = path+"/mpi_io_cp/mpi_io_cp_"+UbSystem::toString(step)+"/cpDataSet.bin"; - int rc = MPI_File_open(MPI_COMM_WORLD, filename.c_str(), MPI_MODE_RDONLY, MPI_INFO_NULL, &file_handler); - if (rc!=MPI_SUCCESS) throw UbException(UB_EXARGS, "couldn't open file "+filename); - - MPI_File_read_at(file_handler, (MPI_Offset)0, &dataSetParamStr, 1, dataSetParamType, MPI_STATUS_IGNORE); - - std::vector<double> doubleValuesArray(blocksCount * dataSetParamStr.doubleCountInBlock); // double-values in all blocks - - // define MPI_types depending on the block-specific information - MPI_Type_contiguous(dataSetParamStr.doubleCountInBlock, MPI_DOUBLE, &dataSetDoubleType); - MPI_Type_commit(&dataSetDoubleType); - mpiTypeFreeFlag = true; - - int ic = 0; - MPI_Offset read_offset; - size_t sizeofOneDataSet = size_t(sizeof(DataSet) + dataSetParamStr.doubleCountInBlock * sizeof(double)); - for (int level = minInitLevel; level <= maxInitLevel; level++) - { - for(Block3DPtr block : blocksVector[level]) // blocks of the current level - { - read_offset = (MPI_Offset)(sizeof(dataSetParam) + block->getGlobalID() * sizeofOneDataSet); - MPI_File_read_at(file_handler, read_offset, &dataSetArray[ic], 1, dataSetType, MPI_STATUS_IGNORE); - MPI_File_read_at(file_handler, (MPI_Offset)(read_offset + sizeof(DataSet)), &doubleValuesArray[ic * dataSetParamStr.doubleCountInBlock], 1, dataSetDoubleType, MPI_STATUS_IGNORE); - ic++; - } - } - - MPI_File_close(&file_handler); - - if (comm->isRoot()) - { - finish = MPI_Wtime(); - UBLOG(logINFO, "MPIIORestart21CoProcessor::readDataSet time: "<<finish-start<<" s"); - UBLOG(logINFO, "MPIIORestart21CoProcessor::readDataSet start of restore of data, rank = "<<rank); - UBLOG(logINFO, "Physical Memory currently used by current process: "<<Utilities::getPhysMemUsedByMe()/1073741824.0<<" GB"); - } - - size_t index = 0, nextVectorSize = 0; - std::vector<double> vectorsOfValues[9]; - for (int n = 0; n<blocksCount; n++) - { - for (int b = 0; b<9; b++) // assign approciate vectors to 9 dataSet arrays - { - nextVectorSize = dataSetParamStr.nx[b][0]* dataSetParamStr.nx[b][1]* dataSetParamStr.nx[b][2]* dataSetParamStr.nx[b][3]; - vectorsOfValues[b].assign(doubleValuesArray.data()+index, doubleValuesArray.data()+index+nextVectorSize); - index += nextVectorSize; - } - - // fill dataSet arrays - AverageValuesArray3DPtr mAverageValues; - if ((dataSetParamStr.nx[0][0]==0)&&(dataSetParamStr.nx[0][1]==0)&&(dataSetParamStr.nx[0][2]==0)&&(dataSetParamStr.nx[0][3]==0)) - mAverageValues = CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr(); - else - mAverageValues = CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr(new CbArray4D<LBMReal, IndexerX4X3X2X1>(vectorsOfValues[0], dataSetParamStr.nx[0][0], dataSetParamStr.nx[0][1], dataSetParamStr.nx[0][2], dataSetParamStr.nx[0][3])); - - AverageValuesArray3DPtr mAverageVelocity; - if ((dataSetParamStr.nx[1][0]==0)&&(dataSetParamStr.nx[1][1]==0)&&(dataSetParamStr.nx[1][2]==0)&&(dataSetParamStr.nx[1][3]==0)) - mAverageVelocity = CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr(); - else - mAverageVelocity = CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr(new CbArray4D<LBMReal, IndexerX4X3X2X1>(vectorsOfValues[1], dataSetParamStr.nx[1][0], dataSetParamStr.nx[1][1], dataSetParamStr.nx[1][2], dataSetParamStr.nx[1][3])); - - AverageValuesArray3DPtr mAverageFluktuations; - if ((dataSetParamStr.nx[2][0]==0)&&(dataSetParamStr.nx[2][1]==0)&&(dataSetParamStr.nx[2][2]==0)&&(dataSetParamStr.nx[2][3]==0)) - mAverageFluktuations = CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr(); - else - mAverageFluktuations = CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr(new CbArray4D<LBMReal, IndexerX4X3X2X1>(vectorsOfValues[2], dataSetParamStr.nx[2][0], dataSetParamStr.nx[2][1], dataSetParamStr.nx[2][2], dataSetParamStr.nx[2][3])); - - AverageValuesArray3DPtr mAverageTriplecorrelations; - if ((dataSetParamStr.nx[3][0]==0)&&(dataSetParamStr.nx[3][1]==0)&&(dataSetParamStr.nx[3][2]==0)&&(dataSetParamStr.nx[3][3]==0)) - mAverageTriplecorrelations = CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr(); - else - mAverageTriplecorrelations = CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr(new CbArray4D<LBMReal, IndexerX4X3X2X1>(vectorsOfValues[3], dataSetParamStr.nx[3][0], dataSetParamStr.nx[3][1], dataSetParamStr.nx[3][2], dataSetParamStr.nx[3][3])); - - ShearStressValuesArray3DPtr mShearStressValues; - if ((dataSetParamStr.nx[4][0]==0)&&(dataSetParamStr.nx[4][1]==0)&&(dataSetParamStr.nx[4][2]==0)&&(dataSetParamStr.nx[4][3]==0)) - mShearStressValues = CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr(); - else - mShearStressValues = CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr(new CbArray4D<LBMReal, IndexerX4X3X2X1>(vectorsOfValues[4], dataSetParamStr.nx[4][0], dataSetParamStr.nx[4][1], dataSetParamStr.nx[4][2], dataSetParamStr.nx[4][3])); - - RelaxationFactorArray3DPtr mRelaxationFactor; - if ((dataSetParamStr.nx[5][0]==0)&&(dataSetParamStr.nx[5][1]==0)&&(dataSetParamStr.nx[5][2]==0)) - mRelaxationFactor = CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr(); - else - mRelaxationFactor = CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<LBMReal, IndexerX3X2X1>(vectorsOfValues[5], dataSetParamStr.nx[5][0], dataSetParamStr.nx[5][1], dataSetParamStr.nx[5][2])); - - DistributionArray3DPtr mFdistributions(new D3Q27EsoTwist3DSplittedVector()); - - std::dynamic_pointer_cast<D3Q27EsoTwist3DSplittedVector>(mFdistributions)->setLocalDistributions(CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr(new CbArray4D<LBMReal, IndexerX4X3X2X1>(vectorsOfValues[6], dataSetParamStr.nx[6][0], dataSetParamStr.nx[6][1], dataSetParamStr.nx[6][2], dataSetParamStr.nx[6][3]))); - std::dynamic_pointer_cast<D3Q27EsoTwist3DSplittedVector>(mFdistributions)->setNonLocalDistributions(CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr(new CbArray4D<LBMReal, IndexerX4X3X2X1>(vectorsOfValues[7], dataSetParamStr.nx[7][0], dataSetParamStr.nx[7][1], dataSetParamStr.nx[7][2], dataSetParamStr.nx[7][3]))); - std::dynamic_pointer_cast<D3Q27EsoTwist3DSplittedVector>(mFdistributions)->setZeroDistributions(CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<LBMReal, IndexerX3X2X1>(vectorsOfValues[8], dataSetParamStr.nx[8][0], dataSetParamStr.nx[8][1], dataSetParamStr.nx[8][2]))); - - std::dynamic_pointer_cast<D3Q27EsoTwist3DSplittedVector>(mFdistributions)->setNX1(dataSetParamStr.nx1); - std::dynamic_pointer_cast<D3Q27EsoTwist3DSplittedVector>(mFdistributions)->setNX2(dataSetParamStr.nx2); - std::dynamic_pointer_cast<D3Q27EsoTwist3DSplittedVector>(mFdistributions)->setNX3(dataSetParamStr.nx3); - - DataSet3DPtr dataSetPtr = DataSet3DPtr(new DataSet3D()); - dataSetPtr->setAverageValues(mAverageValues); - dataSetPtr->setAverageVelocity(mAverageVelocity); - dataSetPtr->setAverageFluctuations(mAverageFluktuations); - dataSetPtr->setAverageTriplecorrelations(mAverageTriplecorrelations); - dataSetPtr->setShearStressValues(mShearStressValues); - dataSetPtr->setRelaxationFactor(mRelaxationFactor); - dataSetPtr->setFdistributions(mFdistributions); - - // find the nesessary block and fill it - Block3DPtr block = grid->getBlock(dataSetArray[n].globalID); - //LBMKernelPtr kernel(new CompressibleCumulantLBMKernel(0, 0, 0, CompressibleCumulantLBMKernel::NORMAL)); - LBMKernelPtr kernel = this->lbmKernel->clone(); - kernel->setGhostLayerWidth(dataSetArray[n].ghostLayerWidth); - kernel->setCollisionFactor(dataSetArray[n].collFactor); - kernel->setDeltaT(dataSetArray[n].deltaT); - kernel->setCompressible(dataSetArray[n].compressible); - kernel->setWithForcing(dataSetArray[n].withForcing); - kernel->setDataSet(dataSetPtr); - block->setKernel(kernel); - } - - delete[] dataSetArray; - - if (comm->isRoot()) - { - UBLOG(logINFO, "MPIIORestart21CoProcessor::readDataSet end of restore of data, rank = "<<rank); - UBLOG(logINFO, "Physical Memory currently used by current process: "<<Utilities::getPhysMemUsedByMe()/1073741824.0<<" GB"); - } -} - -void MPIIORestart21CoProcessor::readBoundaryConds(int step) -{ - int rank, size; - MPI_Comm_rank(MPI_COMM_WORLD, &rank); - MPI_Comm_size(MPI_COMM_WORLD, &size); - - if (comm->isRoot()) - { - UBLOG(logINFO, "MPIIORestart21CoProcessor::readBoundaryConds start MPI IO rank = "<<rank); - UBLOG(logINFO, "Physical Memory currently used by current process: "<<Utilities::getPhysMemUsedByMe()/1073741824.0<<" GB"); - } - - double start, finish; - if (comm->isRoot()) start = MPI_Wtime(); - - MPI_File file_handler; - std::string filename = path+"/mpi_io_cp/mpi_io_cp_"+UbSystem::toString(step)+"/cpBC.bin"; - int rc = MPI_File_open(MPI_COMM_WORLD, filename.c_str(), MPI_MODE_RDONLY, MPI_INFO_NULL, &file_handler); - if (rc!=MPI_SUCCESS) throw UbException(UB_EXARGS, "couldn't open file "+filename); - - int blocksCount = 0; // quantity of the blocks, that belong to this process - - // read from the grid the blocks, that belong to this process - std::vector<Block3DPtr> blocksVector[25]; - int minInitLevel = this->grid->getCoarsestInitializedLevel(); - int maxInitLevel = this->grid->getFinestInitializedLevel(); - for (int level = minInitLevel; level <= maxInitLevel; level++) - { - grid->getBlocks(level, rank, blocksVector[level]); - blocksCount += static_cast<int>(blocksVector[level].size()); - } - - BCAdd* bcAddArray = new BCAdd[blocksCount]; - BoundaryCondition* nullBouCond = new BoundaryCondition(); - memset(nullBouCond, 0, sizeof(BoundaryCondition)); - BoundaryCondition* bcArray; - int* intArray1; - int* intArray2; - std::vector<BoundaryConditionsPtr> bcVector; - std::vector<int> bcindexmatrixV; - std::vector<int> indexContainerV; - - if (comm->isRoot()) - { - finish = MPI_Wtime(); - UBLOG(logINFO, "MPIIORestart21CoProcessor::readBoundaryConds time: " << finish - start << " s"); - UBLOG(logINFO, "MPIIORestart21CoProcessor::readBoundaryConds start of restore of data, rank = " << rank); - UBLOG(logINFO, "Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe() / 1073741824.0 << " GB"); - } - - MPI_File_read_at(file_handler, (MPI_Offset)0, &boundCondParamStr, 1, boundCondParamType, MPI_STATUS_IGNORE); - MPI_Type_contiguous(boundCondParamStr.bcindexmatrixCount, MPI_INT, &bcindexmatrixType); - MPI_Type_commit(&bcindexmatrixType); - mpiTypeFreeFlag = true; - - int ic = 0; - MPI_Offset read_offset1, read_offset2; - for (int level = minInitLevel; level <= maxInitLevel; level++) - { - for(Block3DPtr block : blocksVector[level]) // blocks of the current level - { - read_offset1 = (MPI_Offset)(sizeof(boundCondParam) + block->getGlobalID() * sizeof(size_t)); - - MPI_File_read_at(file_handler, read_offset1, &read_offset2, 1, MPI_LONG_LONG_INT, MPI_STATUS_IGNORE); - MPI_File_read_at(file_handler, read_offset2, &bcAddArray[ic], 1, boundCondTypeAdd, MPI_STATUS_IGNORE); - - bcArray = new BoundaryCondition[bcAddArray[ic].boundCond_count]; - intArray1 = new int[boundCondParamStr.bcindexmatrixCount]; - intArray2 = new int[bcAddArray[ic].indexContainer_count]; - - if (bcAddArray[ic].boundCond_count > 0) - { - MPI_File_read_at(file_handler, (MPI_Offset)(read_offset2 + sizeof(BCAdd)), &bcArray[0], bcAddArray[ic].boundCond_count, boundCondType, MPI_STATUS_IGNORE); - } - MPI_File_read_at(file_handler, (MPI_Offset)(read_offset2 + sizeof(BCAdd) + bcAddArray[ic].boundCond_count * sizeof(BoundaryCondition)), - &intArray1[0], 1, bcindexmatrixType, MPI_STATUS_IGNORE); - if (bcAddArray[ic].indexContainer_count > 0) - { - MPI_File_read_at(file_handler, (MPI_Offset)(read_offset2 + sizeof(BCAdd) + bcAddArray[ic].boundCond_count * sizeof(BoundaryCondition) + boundCondParamStr.bcindexmatrixCount * sizeof(int)), - &intArray2[0], bcAddArray[ic].indexContainer_count, MPI_INT, MPI_STATUS_IGNORE); - } - - bcindexmatrixV.resize(0); - indexContainerV.resize(0); - bcVector.resize(0); - - for (size_t ibc = 0; ibc<bcAddArray[ic].boundCond_count; ibc++) - { - BoundaryConditionsPtr bc; - if (memcmp(&bcArray[ibc], nullBouCond, sizeof(BoundaryCondition))==0) - bc = BoundaryConditionsPtr(); - else - { - bc = BoundaryConditionsPtr(new BoundaryConditions); - bc->noslipBoundaryFlags = bcArray[ibc].noslipBoundaryFlags; - bc->slipBoundaryFlags = bcArray[ibc].slipBoundaryFlags; - bc->densityBoundaryFlags = bcArray[ibc].densityBoundaryFlags; - bc->velocityBoundaryFlags = bcArray[ibc].velocityBoundaryFlags; - bc->wallModelBoundaryFlags = bcArray[ibc].wallModelBoundaryFlags; - bc->bcVelocityX1 = bcArray[ibc].bcVelocityX1; - bc->bcVelocityX2 = bcArray[ibc].bcVelocityX2; - bc->bcVelocityX3 = bcArray[ibc].bcVelocityX3; - bc->bcDensity = bcArray[ibc].bcDensity; - bc->bcLodiDensity = bcArray[ibc].bcLodiDensity; - bc->bcLodiVelocityX1 = bcArray[ibc].bcLodiVelocityX1; - bc->bcLodiVelocityX2 = bcArray[ibc].bcLodiVelocityX2; - bc->bcLodiVelocityX3 = bcArray[ibc].bcLodiVelocityX3; - bc->bcLodiLentgh = bcArray[ibc].bcLodiLentgh; - - bc->nx1 = bcArray[ibc].nx1; - bc->nx2 = bcArray[ibc].nx2; - bc->nx3 = bcArray[ibc].nx3; - for (int iq = 0; iq<26; iq++) - bc->setQ(bcArray[ibc].q[iq], iq); - bc->setBcAlgorithmType(bcArray[ibc].algorithmType); - } - - bcVector.push_back(bc); - } - - for (int b1 = 0; b1 < boundCondParamStr.bcindexmatrixCount; b1++) - bcindexmatrixV.push_back(intArray1[b1]); - - for (int b2 = 0; b2 < bcAddArray[ic].indexContainer_count; b2++) - indexContainerV.push_back(intArray2[b2]); - - CbArray3D<int, IndexerX3X2X1> bcim(bcindexmatrixV, boundCondParamStr.nx1, boundCondParamStr.nx2, boundCondParamStr.nx3); - Block3DPtr block1 = grid->getBlock(bcAddArray[ic].globalID); - - //BCProcessorPtr bcProc(new BCProcessor()); - BCProcessorPtr bcProc = bcProcessor->clone(block1->getKernel()); - //BCArray3DPtr bcArr = bcProc->getBCArray(); - BCArray3DPtr bcArr(new BCArray3D()); - bcArr->bcindexmatrix = bcim; - bcArr->bcvector = bcVector; - bcArr->indexContainer = indexContainerV; - bcProc->setBCArray(bcArr); - - block1->getKernel()->setBCProcessor(bcProc); - - delete bcArray; - delete intArray1; - delete intArray2; - - ic++; - } - } - MPI_File_close(&file_handler); - - delete nullBouCond; - - if (comm->isRoot()) - { - UBLOG(logINFO, "MPIIORestart21CoProcessor::readBoundaryConds end of restore of data, rank = "<<rank); - UBLOG(logINFO, "Physical Memory currently used by current process: "<<Utilities::getPhysMemUsedByMe()/1073741824.0<<" GB"); - } -} - -void MPIIORestart21CoProcessor::setChunk(int val) -{ - chunk = val; -} -////////////////////////////////////////////////////////////////////////// -void MPIIORestart21CoProcessor::setLBMKernel(LBMKernelPtr kernel) -{ - this->lbmKernel = kernel; -} -////////////////////////////////////////////////////////////////////////// -void MPIIORestart21CoProcessor::setBCProcessor(BCProcessorPtr bcProcessor) -{ - this->bcProcessor = bcProcessor; -} - diff --git a/src/VirtualFluids/CoProcessors/MPIIORestart21CoProcessor.h b/src/VirtualFluids/CoProcessors/MPIIORestart21CoProcessor.h deleted file mode 100644 index 9592ad283..000000000 --- a/src/VirtualFluids/CoProcessors/MPIIORestart21CoProcessor.h +++ /dev/null @@ -1,188 +0,0 @@ -#ifndef _MPIIORestart21CoProcessor_H_ -#define _MPIIORestart21CoProcessor_H_ - -#include "mpi.h" - -#include "CoProcessor.h" -#include "Communicator.h" -#include "WbWriter.h" - -#include <boost/shared_ptr.hpp> -#include "UbScheduler.h" -#include "LBMKernel.h" -#include "BCProcessor.h" - -class MPIIORestart21CoProcessor; -typedef std::shared_ptr<MPIIORestart21CoProcessor> MPIIORestart21CoProcessorPtr; - -//! \class MPIWriteBlocksCoProcessor -//! \brief Writes the grid each timestep into the files and reads the grip from the files before regenerating -class MPIIORestart21CoProcessor: public CoProcessor -{ - //! \struct GridParam - //! \brief Structure describes parameters of the grid - //! \details The structure is nessasary to restore the grid correctly - struct GridParam - { - double trafoParams[33]; - double deltaX; - int blockNx1; - int blockNx2; - int blockNx3; - int nx1; - int nx2; - int nx3; - bool periodicX1; - bool periodicX2; - bool periodicX3; - bool active; - bool transformation; - }; - - //! \struct Block3d - //! \brief Structure contains information of the block - //! \details The structure is used to write the data describing the block in the grid when saving the grid - //! and to read it when restoring the grid - struct Block3d - { - int x1; - int x2; - int x3; - int bundle; - int rank; - int lrank; - int part; - int globalID; - int localID; - int level; - int interpolationFlagCF; - int interpolationFlagFC; - int counter; - bool active; - }; - - //! \struct dataSetParam - //! \brief Structure describes parameters of the dataSet that are equal in all blocks - //! \details The structure used to store some parameters needed to restore dataSet arrays - struct dataSetParam - { - int nx1; - int nx2; - int nx3; - int nx[9][4]; // 9 arrays x (nx1, nx2, nx3, nx4) - int doubleCountInBlock; // how many double-values are in all arrays dataSet in one (any) block - }; - - //! \struct dataSet - //! \brief Structure containes information identifying the block - //! \details The structure is used to find the needed block in the grid when restoring a dataSet - struct DataSet - { - double collFactor; - double deltaT; - int globalID; - int ghostLayerWidth; - bool compressible; - bool withForcing; - }; - - //! \struct BoundaryCondition - //! \brief Structure containes information about boundary conditions of the block - //! \details The structure is used to write data describing boundary conditions of the blocks when saving the grid - //! and to read it when restoring the grid - struct BoundaryCondition - { - long long noslipBoundaryFlags; // MPI_LONG_LONG - long long slipBoundaryFlags; - long long velocityBoundaryFlags; - long long densityBoundaryFlags; - long long wallModelBoundaryFlags; - - float bcVelocityX1; - float bcVelocityX2; - float bcVelocityX3; - float bcDensity; - - float bcLodiDensity; - float bcLodiVelocityX1; - float bcLodiVelocityX2; - float bcLodiVelocityX3; - float bcLodiLentgh; - - float nx1,nx2,nx3; - float q[26]; // MPI_FLOAT - - char algorithmType; - }; - - //! \struct boundCondParam - //! \brief Structure describes parameters of the boundaryConditions that are equal in all blocks - //! \details The structure used to store some parameters needed to restore boundaryConditions arrays - struct boundCondParam - { - int nx1; - int nx2; - int nx3; - int bcindexmatrixCount; // how many bcindexmatrix-values in one (any) block - }; - - //! \struct BCAdd - //! \brief Structure containes information identifying the block - //! and some parameters of the arrays of boundary conditions that are equal in all blocks - //! \details The structure is used to find the needed block in the grid when restoring a dataSet - //! and to set common parameters - struct BCAdd - { - int globalID; - //int x1; // to find the right block - //int x2; - //int x3; - //int level; - int boundCond_count; // how many BoundaryCondition-structures are in this block - int indexContainer_count; // how many indexContainer-values are in this block - }; - -public: - MPIIORestart21CoProcessor(Grid3DPtr grid, UbSchedulerPtr s, const std::string& path, CommunicatorPtr comm); - virtual ~MPIIORestart21CoProcessor(); - //! Each timestep writes the grid into the files - void process(double step); - //! Reads the grid from the files before grid reconstruction - void restart(int step); - //! Writes the blocks of the grid into the file outputBlocks.bin - void writeBlocks(int step); - //! Writes the datasets of the blocks into the file outputDataSet.bin - void writeDataSet(int step); - //! Writes the boundary conditions of the blocks into the file outputBoundCond.bin - void writeBoundaryConds(int step); - //! Reads the blocks of the grid from the file outputBlocks.bin - void readBlocks(int step); - //! Reads the datasets of the blocks from the file outputDataSet.bin - void readDataSet(int step); - //! Reads the boundary conditions of the blocks from the file outputBoundCond.bin - void readBoundaryConds(int step); - //! The function sets number of ranks that read simultaneously - void setChunk(int val); - //! The function sets LBMKernel - void setLBMKernel(LBMKernelPtr kernel); - //!The function sets BCProcessor - void setBCProcessor(BCProcessorPtr bcProcessor); - //!The function truncates the data files - void clearAllFiles(int step); - -protected: - std::string path; - CommunicatorPtr comm; - bool mpiTypeFreeFlag; - -private: - MPI_Datatype gridParamType, block3dType, dataSetParamType, dataSetType, dataSetDoubleType, boundCondParamType, boundCondType, boundCondTypeAdd, bcindexmatrixType; - dataSetParam dataSetParamStr; - boundCondParam boundCondParamStr; - int chunk; - LBMKernelPtr lbmKernel; - BCProcessorPtr bcProcessor; - -}; - -#endif diff --git a/src/VirtualFluids/CoProcessors/MPIIORestart2CoProcessor.cpp b/src/VirtualFluids/CoProcessors/MPIIORestart2CoProcessor.cpp deleted file mode 100644 index dd778b2b0..000000000 --- a/src/VirtualFluids/CoProcessors/MPIIORestart2CoProcessor.cpp +++ /dev/null @@ -1,1285 +0,0 @@ -#include "MPIIORestart2CoProcessor.h" - -#include "CompressibleCumulantLBMKernel.h" -#include "D3Q27EsoTwist3DSplittedVector.h" -#include <UbSystem.h> -#include <MemoryUtil.h> -#include "MetisPartitioningGridVisitor.h" - -#include "DataSet3D.h" -#include "CoordinateTransformation3D.h" -#include "Block3D.h" -#include "Communicator.h" -#include "UbScheduler.h" -#include "Grid3D.h" -#include "LBMKernel.h" -#include "BCProcessor.h" -#include "BCArray3D.h" - -MPIIORestart2CoProcessor::MPIIORestart2CoProcessor(Grid3DPtr grid, UbSchedulerPtr s, - const std::string& path, - CommunicatorPtr comm) : - CoProcessor(grid, s), - path(path), - comm(comm), - mpiTypeFreeFlag(false) -{ - UbSystem::makeDirectory(path + "/mpi_io_cp"); - - memset(&blockParamStr, 0, sizeof(blockParamStr)); - - //------------------------- define MPI types --------------------------------- - - MPI_Datatype typesGP[3] = { MPI_DOUBLE, MPI_INT, MPI_CHAR }; - int blocksGP[3] = { 34, 6, 5 }; - MPI_Aint offsetsGP[3], lbGP, extentGP; - - offsetsGP[0] = 0; - MPI_Type_get_extent(MPI_DOUBLE, &lbGP, &extentGP); - offsetsGP[1] = blocksGP[0] * extentGP; - - MPI_Type_get_extent(MPI_INT, &lbGP, &extentGP); - offsetsGP[2] = offsetsGP[1] + blocksGP[1] * extentGP; - - MPI_Type_create_struct(3, blocksGP, offsetsGP, typesGP, &gridParamType); - MPI_Type_commit(&gridParamType); - - //----------------------------------------------------------------------- - - MPI_Type_contiguous(41, MPI_INT, &blockParamType); - MPI_Type_commit(&blockParamType); - - //----------------------------------------------------------------------- - - MPI_Datatype typesBlock[2] = { MPI_INT, MPI_CHAR }; - int blocksBlock[2] = { 13, 1 }; - MPI_Aint offsetsBlock[2], lbBlock, extentBlock; - - offsetsBlock[0] = 0; - MPI_Type_get_extent(MPI_INT, &lbBlock, &extentBlock); - offsetsBlock[1] = blocksBlock[0] * extentBlock; - - MPI_Type_create_struct(2, blocksBlock, offsetsBlock, typesBlock, &block3dType); - MPI_Type_commit(&block3dType); - - //----------------------------------------------------------------------- - - MPI_Datatype typesDataSet[3] = { MPI_DOUBLE, MPI_INT, MPI_CHAR }; - int blocksDataSet[3] = { 2, 2, 2 }; - MPI_Aint offsetsDatatSet[3], lbDataSet, extentDataSet; - - offsetsDatatSet[0] = 0; - MPI_Type_get_extent(MPI_DOUBLE, &lbDataSet, &extentDataSet); - offsetsDatatSet[1] = blocksDataSet[0] * extentDataSet; - - MPI_Type_get_extent(MPI_INT, &lbDataSet, &extentDataSet); - offsetsDatatSet[2] = offsetsDatatSet[1] + blocksDataSet[1] * extentDataSet; - - MPI_Type_create_struct(3, blocksDataSet, offsetsDatatSet, typesDataSet, &dataSetType); - MPI_Type_commit(&dataSetType); - - //----------------------------------------------------------------------- - - MPI_Datatype typesBC[3] = { MPI_LONG_LONG_INT, MPI_FLOAT, MPI_CHAR }; - int blocksBC[3] = { 5, 39, 1 }; - MPI_Aint offsetsBC[3], lbBC, extentBC; - - offsetsBC[0] = 0; - MPI_Type_get_extent(MPI_LONG_LONG_INT, &lbBC, &extentBC); - offsetsBC[1] = blocksBC[0] * extentBC; - - MPI_Type_get_extent(MPI_FLOAT, &lbBC, &extentBC); - offsetsBC[2] = offsetsBC[1] + blocksBC[1] * extentBC; - - MPI_Type_create_struct(3, blocksBC, offsetsBC, typesBC, &boundCondType); - MPI_Type_commit(&boundCondType); - - //--------------------------------------- - - MPI_Type_contiguous(3, MPI_INT, &boundCondTypeAdd); - MPI_Type_commit(&boundCondTypeAdd); - -} -////////////////////////////////////////////////////////////////////////// -MPIIORestart2CoProcessor::~MPIIORestart2CoProcessor() -{ - MPI_Type_free(&gridParamType); - MPI_Type_free(&blockParamType); - MPI_Type_free(&block3dType); - MPI_Type_free(&dataSetType); - MPI_Type_free(&boundCondType); - MPI_Type_free(&boundCondTypeAdd); - - if (mpiTypeFreeFlag) - { - MPI_Type_free(&dataSetDoubleType); - MPI_Type_free(&bcindexmatrixType); - } -} - -////////////////////////////////////////////////////////////////////////// -void MPIIORestart2CoProcessor::process(double step) -{ - if (scheduler->isDue(step)) - { - if (comm->isRoot()) UBLOG(logINFO, "MPIIORestart2CoProcessor save step: " << step); - if (comm->isRoot()) UBLOG(logINFO, "Save check point - start"); - /*if (comm->isRoot())*/ clearAllFiles((int)step); - writeBlocks((int)step); - writeDataSet((int)step); - writeBoundaryConds((int)step); - - - //MPI_Barrier(MPI_COMM_WORLD); - - if (comm->isRoot()) UBLOG(logINFO, "Save check point - end"); - - - //readDataSet((int)step); - - } -} -////////////////////////////////////////////////////////////////////////// -void MPIIORestart2CoProcessor::clearAllFiles(int step) -{ - MPI_File file_handler1, file_handler2, file_handler3; - MPI_Info info = MPI_INFO_NULL; - MPI_Offset new_size = 0; - - UbSystem::makeDirectory(path + "/mpi_io_cp/mpi_io_cp_" + UbSystem::toString(step)); - std::string filename1 = path + "/mpi_io_cp/mpi_io_cp_" + UbSystem::toString(step) + "/cpBlocks.bin"; - //MPI_File_delete(filename1.c_str(), info); - int rc1 = MPI_File_open(MPI_COMM_WORLD, filename1.c_str(), MPI_MODE_CREATE | MPI_MODE_WRONLY, MPI_INFO_NULL, &file_handler1); - if (rc1 != MPI_SUCCESS) throw UbException(UB_EXARGS, "couldn't open file " + filename1); - MPI_File_set_size(file_handler1, new_size); - //MPI_File_sync(file_handler1); - MPI_File_close(&file_handler1); - - std::string filename2 = path + "/mpi_io_cp/mpi_io_cp_" + UbSystem::toString(step) + "/cpDataSet.bin"; - //MPI_File_delete(filename2.c_str(), info); - int rc2 = MPI_File_open(MPI_COMM_WORLD, filename2.c_str(), MPI_MODE_CREATE | MPI_MODE_WRONLY, info, &file_handler2); - if (rc2 != MPI_SUCCESS) throw UbException(UB_EXARGS, "couldn't open file " + filename2); - MPI_File_set_size(file_handler2, new_size); - //MPI_File_sync(file_handler2); - MPI_File_close(&file_handler2); - - std::string filename3 = path + "/mpi_io_cp/mpi_io_cp_" + UbSystem::toString(step) + "/cpBC.bin"; - //MPI_File_delete(filename3.c_str(), info); - int rc3 = MPI_File_open(MPI_COMM_WORLD, filename3.c_str(), MPI_MODE_CREATE | MPI_MODE_WRONLY, info, &file_handler3); - if (rc3 != MPI_SUCCESS) throw UbException(UB_EXARGS, "couldn't open file " + filename3); - MPI_File_set_size(file_handler3, new_size); - //MPI_File_sync(file_handler3); - MPI_File_close(&file_handler3); -} -////////////////////////////////////////////////////////////////////////// -void MPIIORestart2CoProcessor::writeBlocks(int step) -{ - int rank, size; - MPI_Comm_rank(MPI_COMM_WORLD, &rank); - //MPI_Comm_size(MPI_COMM_WORLD, &size); - size = 1; - - - //if (comm->isRoot()) - { - //grid->deleteBlockIDs(); - //RenumberBlockVisitor renumber; - //grid->accept(renumber); - grid->renumberBlockIDs(); - } - //grid->updateDistributedBlocks(comm); - - //UBLOG(logINFO, "MPIIORestart2CoProcessor::writeBlocks BlockIDs size = "<<grid->getBlockIDs().size()<<" rank = "<<rank); - - if (comm->isRoot()) - { - UBLOG(logINFO, "MPIIORestart2CoProcessor::writeBlocks start collect data rank = " << rank); - UBLOG(logINFO, "Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe() / 1073741824.0 << " GB"); - } - - int blocksCount = 0; // quantity of all the blocks in the grid, max 2147483648 blocks! - int minInitLevel = this->grid->getCoarsestInitializedLevel(); - int maxInitLevel = this->grid->getFinestInitializedLevel(); - - std::vector<Block3DPtr> blocksVector[25]; // max 25 levels - for (int level = minInitLevel; level <= maxInitLevel; level++) - { - //grid->getBlocks(level, rank, blockVector[level]); - grid->getBlocks(level, blocksVector[level]); - blocksCount += static_cast<int>(blocksVector[level].size()); - } - - GridParam* gridParameters = new GridParam; - gridParameters->trafoParams[0] = grid->getCoordinateTransformator()->Tx1; - gridParameters->trafoParams[1] = grid->getCoordinateTransformator()->Tx2; - gridParameters->trafoParams[2] = grid->getCoordinateTransformator()->Tx3; - gridParameters->trafoParams[3] = grid->getCoordinateTransformator()->Sx1; - gridParameters->trafoParams[4] = grid->getCoordinateTransformator()->Sx2; - gridParameters->trafoParams[5] = grid->getCoordinateTransformator()->Sx3; - gridParameters->trafoParams[6] = grid->getCoordinateTransformator()->alpha; - gridParameters->trafoParams[7] = grid->getCoordinateTransformator()->beta; - gridParameters->trafoParams[8] = grid->getCoordinateTransformator()->gamma; - - gridParameters->trafoParams[9] = grid->getCoordinateTransformator()->toX1factorX1; - gridParameters->trafoParams[10] = grid->getCoordinateTransformator()->toX1factorX2; - gridParameters->trafoParams[11] = grid->getCoordinateTransformator()->toX1factorX3; - gridParameters->trafoParams[12] = grid->getCoordinateTransformator()->toX1delta; - gridParameters->trafoParams[13] = grid->getCoordinateTransformator()->toX2factorX1; - gridParameters->trafoParams[14] = grid->getCoordinateTransformator()->toX2factorX2; - gridParameters->trafoParams[15] = grid->getCoordinateTransformator()->toX2factorX3; - gridParameters->trafoParams[16] = grid->getCoordinateTransformator()->toX2delta; - gridParameters->trafoParams[17] = grid->getCoordinateTransformator()->toX3factorX1; - gridParameters->trafoParams[18] = grid->getCoordinateTransformator()->toX3factorX2; - gridParameters->trafoParams[19] = grid->getCoordinateTransformator()->toX3factorX3; - gridParameters->trafoParams[20] = grid->getCoordinateTransformator()->toX3delta; - - gridParameters->trafoParams[21] = grid->getCoordinateTransformator()->fromX1factorX1; - gridParameters->trafoParams[22] = grid->getCoordinateTransformator()->fromX1factorX2; - gridParameters->trafoParams[23] = grid->getCoordinateTransformator()->fromX1factorX3; - gridParameters->trafoParams[24] = grid->getCoordinateTransformator()->fromX1delta; - gridParameters->trafoParams[25] = grid->getCoordinateTransformator()->fromX2factorX1; - gridParameters->trafoParams[26] = grid->getCoordinateTransformator()->fromX2factorX2; - gridParameters->trafoParams[27] = grid->getCoordinateTransformator()->fromX2factorX3; - gridParameters->trafoParams[28] = grid->getCoordinateTransformator()->fromX2delta; - gridParameters->trafoParams[29] = grid->getCoordinateTransformator()->fromX3factorX1; - gridParameters->trafoParams[30] = grid->getCoordinateTransformator()->fromX3factorX2; - gridParameters->trafoParams[31] = grid->getCoordinateTransformator()->fromX3factorX3; - gridParameters->trafoParams[32] = grid->getCoordinateTransformator()->fromX3delta; - - gridParameters->active = grid->getCoordinateTransformator()->active; - gridParameters->transformation = grid->getCoordinateTransformator()->transformation; - - gridParameters->deltaX = grid->getDeltaX(minInitLevel); - UbTupleInt3 blocknx = grid->getBlockNX(); - gridParameters->blockNx1 = val<1>(blocknx); - gridParameters->blockNx2 = val<2>(blocknx); - gridParameters->blockNx3 = val<3>(blocknx); - gridParameters->nx1 = grid->getNX1(); - gridParameters->nx2 = grid->getNX2(); - gridParameters->nx3 = grid->getNX3(); - gridParameters->periodicX1 = grid->isPeriodicX1(); - gridParameters->periodicX2 = grid->isPeriodicX2(); - gridParameters->periodicX3 = grid->isPeriodicX3(); - - //---------------------------------------------------------------------- - - Block3d* block3dArray = new Block3d[blocksCount]; - bool firstBlock = true; - int ic = 0; - for (int level = minInitLevel; level <= maxInitLevel; level++) - { - for(Block3DPtr block : blocksVector[level]) // all the blocks of the current level - { - if (firstBlock && block->getKernel()) // when first (any) valid block... - { - std::shared_ptr< CbArray4D<LBMReal, IndexerX4X3X2X1> > AverageValuesArray3DPtr = block->getKernel()->getDataSet()->getAverageValues(); - if (AverageValuesArray3DPtr) - { - blockParamStr.nx[0][0] = static_cast<int>(AverageValuesArray3DPtr->getNX1()); - blockParamStr.nx[0][1] = static_cast<int>(AverageValuesArray3DPtr->getNX2()); - blockParamStr.nx[0][2] = static_cast<int>(AverageValuesArray3DPtr->getNX3()); - blockParamStr.nx[0][3] = static_cast<int>(AverageValuesArray3DPtr->getNX4()); - } - - std::shared_ptr< CbArray4D<LBMReal, IndexerX4X3X2X1> > AverageVelocityArray3DPtr = block->getKernel()->getDataSet()->getAverageVelocity(); - if (AverageVelocityArray3DPtr) - { - blockParamStr.nx[1][0] = static_cast<int>(AverageVelocityArray3DPtr->getNX1()); - blockParamStr.nx[1][1] = static_cast<int>(AverageVelocityArray3DPtr->getNX2()); - blockParamStr.nx[1][2] = static_cast<int>(AverageVelocityArray3DPtr->getNX3()); - blockParamStr.nx[1][3] = static_cast<int>(AverageVelocityArray3DPtr->getNX4()); - } - - std::shared_ptr< CbArray4D<LBMReal, IndexerX4X3X2X1> > AverageFluctArray3DPtr = block->getKernel()->getDataSet()->getAverageFluctuations(); - if (AverageFluctArray3DPtr) - { - blockParamStr.nx[2][0] = static_cast<int>(AverageFluctArray3DPtr->getNX1()); - blockParamStr.nx[2][1] = static_cast<int>(AverageFluctArray3DPtr->getNX2()); - blockParamStr.nx[2][2] = static_cast<int>(AverageFluctArray3DPtr->getNX3()); - blockParamStr.nx[2][3] = static_cast<int>(AverageFluctArray3DPtr->getNX4()); - } - - std::shared_ptr< CbArray4D<LBMReal, IndexerX4X3X2X1> > AverageTripleArray3DPtr = block->getKernel()->getDataSet()->getAverageTriplecorrelations(); - if (AverageTripleArray3DPtr) - { - blockParamStr.nx[3][0] = static_cast<int>(AverageTripleArray3DPtr->getNX1()); - blockParamStr.nx[3][1] = static_cast<int>(AverageTripleArray3DPtr->getNX2()); - blockParamStr.nx[3][2] = static_cast<int>(AverageTripleArray3DPtr->getNX3()); - blockParamStr.nx[3][3] = static_cast<int>(AverageTripleArray3DPtr->getNX4()); - } - - std::shared_ptr< CbArray4D<LBMReal, IndexerX4X3X2X1> > ShearStressValArray3DPtr = block->getKernel()->getDataSet()->getShearStressValues(); - if (ShearStressValArray3DPtr) - { - blockParamStr.nx[4][0] = static_cast<int>(ShearStressValArray3DPtr->getNX1()); - blockParamStr.nx[4][1] = static_cast<int>(ShearStressValArray3DPtr->getNX2()); - blockParamStr.nx[4][2] = static_cast<int>(ShearStressValArray3DPtr->getNX3()); - blockParamStr.nx[4][3] = static_cast<int>(ShearStressValArray3DPtr->getNX4()); - } - - std::shared_ptr< CbArray3D<LBMReal, IndexerX3X2X1> > relaxationFactor3DPtr = block->getKernel()->getDataSet()->getRelaxationFactor(); - if (relaxationFactor3DPtr) - { - blockParamStr.nx[5][0] = static_cast<int>(relaxationFactor3DPtr->getNX1()); - blockParamStr.nx[5][1] = static_cast<int>(relaxationFactor3DPtr->getNX2()); - blockParamStr.nx[5][2] = static_cast<int>(relaxationFactor3DPtr->getNX3()); - blockParamStr.nx[5][3] = 1; - } - - std::shared_ptr< D3Q27EsoTwist3DSplittedVector > D3Q27EsoTwist3DSplittedVectorPtr = std::dynamic_pointer_cast<D3Q27EsoTwist3DSplittedVector>(block->getKernel()->getDataSet()->getFdistributions()); - CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr localDistributions = D3Q27EsoTwist3DSplittedVectorPtr->getLocalDistributions(); - if (localDistributions) - { - blockParamStr.nx[6][0] = static_cast<int>(localDistributions->getNX1()); - blockParamStr.nx[6][1] = static_cast<int>(localDistributions->getNX2()); - blockParamStr.nx[6][2] = static_cast<int>(localDistributions->getNX3()); - blockParamStr.nx[6][3] = static_cast<int>(localDistributions->getNX4()); - } - - CbArray4D <LBMReal, IndexerX4X3X2X1>::CbArray4DPtr nonLocalDistributions = D3Q27EsoTwist3DSplittedVectorPtr->getNonLocalDistributions(); - if (nonLocalDistributions) - { - blockParamStr.nx[7][0] = static_cast<int>(nonLocalDistributions->getNX1()); - blockParamStr.nx[7][1] = static_cast<int>(nonLocalDistributions->getNX2()); - blockParamStr.nx[7][2] = static_cast<int>(nonLocalDistributions->getNX3()); - blockParamStr.nx[7][3] = static_cast<int>(nonLocalDistributions->getNX4()); - } - - CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr zeroDistributions = D3Q27EsoTwist3DSplittedVectorPtr->getZeroDistributions(); - if (zeroDistributions) - { - blockParamStr.nx[8][0] = static_cast<int>(zeroDistributions->getNX1()); - blockParamStr.nx[8][1] = static_cast<int>(zeroDistributions->getNX2()); - blockParamStr.nx[8][2] = static_cast<int>(zeroDistributions->getNX3()); - blockParamStr.nx[8][3] = 1; - } - - // ... than save some parameters that are equal in all blocks - blockParamStr.nx1 = static_cast<int>(block->getKernel()->getDataSet()->getFdistributions()->getNX1()); - blockParamStr.nx2 = static_cast<int>(block->getKernel()->getDataSet()->getFdistributions()->getNX2()); - blockParamStr.nx3 = static_cast<int>(block->getKernel()->getDataSet()->getFdistributions()->getNX3()); - - firstBlock = false; - - // how many elements are in all arrays of DataSet (equal in all blocks) - int doubleCount = 0, temp; - for (int i = 0; i < 9; i++) // 9 arrays ( averageValues, averageVelocity, averageFluktuations, - { // averageTriplecorrelations, shearStressValues, relaxationFactor, 3 * fdistributions - temp = 1; - for (int ii = 0; ii < 4; ii++) // 4 values (nx1, nx2, nx3, nx4) - temp *= blockParamStr.nx[i][ii]; - doubleCount += temp; - } - blockParamStr.doubleCountInBlock = doubleCount; - - // the quantity of elements in the bcindexmatrix array (CbArray3D<int, IndexerX3X2X1>) in bcArray(BCArray3D) is always equal, - // this will be the size of the "write-read-block" in MPI_write_.../MPI_read-functions when writing/reading BoundConds - BCArray3DPtr bcArr = block->getKernel()->getBCProcessor()->getBCArray(); - blockParamStr.bcindexmatrix_count = static_cast<int>(bcArr->bcindexmatrix.getDataVector().size()); - } - - // save data describing the block - block3dArray[ic].x1 = block->getX1(); - block3dArray[ic].x2 = block->getX2(); - block3dArray[ic].x3 = block->getX3(); - block3dArray[ic].bundle = block->getBundle(); - block3dArray[ic].rank = block->getRank(); - block3dArray[ic].lrank = block->getLocalRank(); - block3dArray[ic].part = block->getPart(); - block3dArray[ic].globalID = block->getGlobalID(); - block3dArray[ic].localID = block->getLocalID(); - block3dArray[ic].level = block->getLevel(); - block3dArray[ic].interpolationFlagCF = block->getInterpolationFlagCF(); - block3dArray[ic].interpolationFlagFC = block->getInterpolationFlagFC(); - block3dArray[ic].counter = block->getMaxGlobalID(); - block3dArray[ic].active = block->isActive(); - - ic++; - } - } - - if (comm->isRoot()) - { - UBLOG(logINFO, "MPIIORestart2CoProcessor::writeBlocks start MPI IO rank = " << rank); - UBLOG(logINFO, "Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe() / 1073741824.0 << " GB"); - } - - // write to the file - MPI_File file_handler; - MPI_Info info = MPI_INFO_NULL; - //MPI_Info_create (&info); - //MPI_Info_set(info,"romio_cb_write","enable"); - //MPI_Info_set(info,"cb_buffer_size","4194304"); - //MPI_Info_set(info,"striping_unit","4194304"); - - // if (comm->isRoot()) - // { - UbSystem::makeDirectory(path + "/mpi_io_cp/mpi_io_cp_" + UbSystem::toString(step)); - std::string filename = path + "/mpi_io_cp/mpi_io_cp_" + UbSystem::toString(step) + "/cpBlocks.bin"; - int rc = MPI_File_open(MPI_COMM_WORLD, filename.c_str(), MPI_MODE_CREATE | MPI_MODE_WRONLY, MPI_INFO_NULL, &file_handler); - if (rc != MPI_SUCCESS) throw UbException(UB_EXARGS, "couldn't open file " + filename); - // } - - double start, finish; - MPI_Offset write_offset = (MPI_Offset)(size * sizeof(int)); - //MPI_Offset new_size = 0; - //MPI_File_set_size(file_handler, new_size); - - if (comm->isRoot()) - { - start = MPI_Wtime(); - - // each process writes the quantity of it's blocks - MPI_File_write_at(file_handler, 0/*rank*sizeof(int)*/, &blocksCount, 1, MPI_INT, MPI_STATUS_IGNORE); - // each process writes parameters of the grid - MPI_File_write_at(file_handler, write_offset, gridParameters, 1, gridParamType, MPI_STATUS_IGNORE); - // each process writes common parameters of a block - MPI_File_write_at(file_handler, (MPI_Offset)(write_offset + sizeof(GridParam)), &blockParamStr, 1, blockParamType, MPI_STATUS_IGNORE); - // each process writes it's blocks - MPI_File_write_at(file_handler, (MPI_Offset)(write_offset + sizeof(GridParam) + sizeof(BlockParam)), &block3dArray[0], blocksCount, block3dType, MPI_STATUS_IGNORE); - //MPI_File_sync(file_handler); - } - MPI_File_close(&file_handler); - - if (comm->isRoot()) - { - finish = MPI_Wtime(); - UBLOG(logINFO, "MPIIORestart2CoProcessor::writeBlocks time: " << finish - start << " s"); - } - - // register new MPI-types depending on the block-specific information - MPI_Type_contiguous(blockParamStr.doubleCountInBlock, MPI_DOUBLE, &dataSetDoubleType); - MPI_Type_commit(&dataSetDoubleType); - - MPI_Type_contiguous(blockParamStr.bcindexmatrix_count, MPI_INT, &bcindexmatrixType); - MPI_Type_commit(&bcindexmatrixType); - - mpiTypeFreeFlag = true; - - delete[] block3dArray; - delete gridParameters; -} - -void MPIIORestart2CoProcessor::writeDataSet(int step) -{ - int rank, size; - MPI_Comm_rank(MPI_COMM_WORLD, &rank); - MPI_Comm_size(MPI_COMM_WORLD, &size); - - int blocksCount = 0; // quantity of blocks, that belong to this process - - std::vector<Block3DPtr> blocksVector[25]; - int minInitLevel = this->grid->getCoarsestInitializedLevel(); - int maxInitLevel = this->grid->getFinestInitializedLevel(); - for (int level = minInitLevel; level <= maxInitLevel; level++) - { - grid->getBlocks(level, rank, blocksVector[level]); - blocksCount += static_cast<int>(blocksVector[level].size()); - } - - DataSet* dataSetArray = new DataSet[blocksCount]; - std::vector<double> doubleValuesArray; // double-values (arrays of f's) in all blocks - - //dataSetArrayTest = new DataSet[blocksCount]; - - if (comm->isRoot()) - { - UBLOG(logINFO, "MPIIORestart2CoProcessor::writeDataSet start collect data rank = " << rank); - UBLOG(logINFO, "Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe() / 1073741824.0 << " GB"); - } - - //UBLOG(logINFO, "MPIIORestart2CoProcessor::writeDataSet minInitLevel="<<minInitLevel<<" maxInitLevel="<<maxInitLevel<<" blocksCount="<<blocksCount<<" rank = "<<rank); - - int ic = 0; - for (int level = minInitLevel; level <= maxInitLevel; level++) - { - for(Block3DPtr block : blocksVector[level]) // blocks of the current level - { - dataSetArray[ic].globalID = block->getGlobalID(); // id of the block needed to find it while regenerating the grid - //UBLOG(logINFO, "MPIIORestart2CoProcessor::writeDataSet dataSetArray[n].globalID: "<<dataSetArray[ic].globalID<< " rank = "<<rank<<" ic = "<<ic); - dataSetArray[ic].ghostLayerWidth = block->getKernel()->getGhostLayerWidth(); - dataSetArray[ic].collFactor = block->getKernel()->getCollisionFactor(); - dataSetArray[ic].deltaT = block->getKernel()->getDeltaT(); - dataSetArray[ic].compressible = block->getKernel()->getCompressible(); - dataSetArray[ic].withForcing = block->getKernel()->getWithForcing(); - - //dataSetArrayTest[ic].globalID = block->getGlobalID(); // id of the block needed to find it while regenerating the grid - //dataSetArrayTest[ic].ghostLayerWidth = block->getKernel()->getGhostLayerWidth(); - //dataSetArrayTest[ic].collFactor = block->getKernel()->getCollisionFactor(); - //dataSetArrayTest[ic].deltaT = block->getKernel()->getDeltaT(); - //dataSetArrayTest[ic].compressible = block->getKernel()->getCompressible(); - //dataSetArrayTest[ic].withForcing = block->getKernel()->getWithForcing(); - - std::shared_ptr< CbArray4D<LBMReal, IndexerX4X3X2X1> > AverageValuesArray3DPtr = block->getKernel()->getDataSet()->getAverageValues(); - if (AverageValuesArray3DPtr && (blockParamStr.nx[0][0]>0) && (blockParamStr.nx[0][1]>0) && (blockParamStr.nx[0][2]>0) && (blockParamStr.nx[0][3]>0)) - doubleValuesArray.insert(doubleValuesArray.end(), AverageValuesArray3DPtr->getDataVector().begin(), AverageValuesArray3DPtr->getDataVector().end()); - - std::shared_ptr< CbArray4D<LBMReal, IndexerX4X3X2X1> > AverageVelocityArray3DPtr = block->getKernel()->getDataSet()->getAverageVelocity(); - if (AverageVelocityArray3DPtr && (blockParamStr.nx[1][0]>0) && (blockParamStr.nx[1][1]>0) && (blockParamStr.nx[1][2]>0) && (blockParamStr.nx[1][3]>0)) - doubleValuesArray.insert(doubleValuesArray.end(), AverageVelocityArray3DPtr->getDataVector().begin(), AverageVelocityArray3DPtr->getDataVector().end()); - - std::shared_ptr< CbArray4D<LBMReal, IndexerX4X3X2X1> > AverageFluctArray3DPtr = block->getKernel()->getDataSet()->getAverageFluctuations(); - if (AverageFluctArray3DPtr && (blockParamStr.nx[2][0]>0) && (blockParamStr.nx[2][1]>0) && (blockParamStr.nx[2][2]>0) && (blockParamStr.nx[2][3]>0)) - doubleValuesArray.insert(doubleValuesArray.end(), AverageFluctArray3DPtr->getDataVector().begin(), AverageFluctArray3DPtr->getDataVector().end()); - - std::shared_ptr< CbArray4D<LBMReal, IndexerX4X3X2X1> > AverageTripleArray3DPtr = block->getKernel()->getDataSet()->getAverageTriplecorrelations(); - if (AverageTripleArray3DPtr && (blockParamStr.nx[3][0]>0) && (blockParamStr.nx[3][1]>0) && (blockParamStr.nx[3][2]>0) && (blockParamStr.nx[3][3]>0)) - doubleValuesArray.insert(doubleValuesArray.end(), AverageTripleArray3DPtr->getDataVector().begin(), AverageTripleArray3DPtr->getDataVector().end()); - - std::shared_ptr< CbArray4D<LBMReal, IndexerX4X3X2X1> > ShearStressValArray3DPtr = block->getKernel()->getDataSet()->getShearStressValues(); - if (ShearStressValArray3DPtr && (blockParamStr.nx[4][0]>0) && (blockParamStr.nx[4][1]>0) && (blockParamStr.nx[4][2]>0) && (blockParamStr.nx[4][3]>0)) - doubleValuesArray.insert(doubleValuesArray.end(), ShearStressValArray3DPtr->getDataVector().begin(), ShearStressValArray3DPtr->getDataVector().end()); - - std::shared_ptr< CbArray3D<LBMReal, IndexerX3X2X1> > RelaxationFactor3DPtr = block->getKernel()->getDataSet()->getRelaxationFactor(); - if (RelaxationFactor3DPtr && (blockParamStr.nx[5][0]>0) && (blockParamStr.nx[5][1]>0) && (blockParamStr.nx[5][2]>0)) - doubleValuesArray.insert(doubleValuesArray.end(), RelaxationFactor3DPtr->getDataVector().begin(), RelaxationFactor3DPtr->getDataVector().end()); - - std::shared_ptr< D3Q27EsoTwist3DSplittedVector > D3Q27EsoTwist3DSplittedVectorPtr = std::dynamic_pointer_cast<D3Q27EsoTwist3DSplittedVector>(block->getKernel()->getDataSet()->getFdistributions()); - CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr localDistributions = D3Q27EsoTwist3DSplittedVectorPtr->getLocalDistributions(); - if (localDistributions && (blockParamStr.nx[6][0]>0) && (blockParamStr.nx[6][1]>0) && (blockParamStr.nx[6][2]>0) && (blockParamStr.nx[6][3]>0)) - doubleValuesArray.insert(doubleValuesArray.end(), localDistributions->getDataVector().begin(), localDistributions->getDataVector().end()); - - CbArray4D <LBMReal, IndexerX4X3X2X1>::CbArray4DPtr nonLocalDistributions = D3Q27EsoTwist3DSplittedVectorPtr->getNonLocalDistributions(); - if (nonLocalDistributions && (blockParamStr.nx[7][0]>0) && (blockParamStr.nx[7][1]>0) && (blockParamStr.nx[7][2]>0) && (blockParamStr.nx[7][3]>0)) - doubleValuesArray.insert(doubleValuesArray.end(), nonLocalDistributions->getDataVector().begin(), nonLocalDistributions->getDataVector().end()); - - CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr zeroDistributions = D3Q27EsoTwist3DSplittedVectorPtr->getZeroDistributions(); - if (zeroDistributions && (blockParamStr.nx[8][0]>0) && (blockParamStr.nx[8][1]>0) && (blockParamStr.nx[8][2]>0)) - doubleValuesArray.insert(doubleValuesArray.end(), zeroDistributions->getDataVector().begin(), zeroDistributions->getDataVector().end()); - - ic++; - } - } - - if (comm->isRoot()) - { - UBLOG(logINFO, "MPIIORestart2CoProcessor::writeDataSet start MPI IO rank = " << rank); - UBLOG(logINFO, "Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe() / 1073741824.0 << " GB"); - } - - double start, finish; - if (comm->isRoot()) start = MPI_Wtime(); - - MPI_Info info = MPI_INFO_NULL; - //MPI_Info_create (&info); - //MPI_Info_set(info,"romio_cb_write","enable"); - //MPI_Info_set(info,"cb_buffer_size","4194304"); - //MPI_Info_set(info,"striping_unit","4194304"); - - // write to the file - MPI_File file_handler; - std::string filename = path + "/mpi_io_cp/mpi_io_cp_" + UbSystem::toString(step) + "/cpDataSet.bin"; - int rc = MPI_File_open(MPI_COMM_WORLD, filename.c_str(), MPI_MODE_CREATE | MPI_MODE_WRONLY, info, &file_handler); - if (rc != MPI_SUCCESS) throw UbException(UB_EXARGS, "couldn't open file " + filename); - - //MPI_Offset new_size = 0; - //MPI_File_set_size(file_handler, new_size); - - size_t sizeofOneDataSet = sizeof(DataSet) + blockParamStr.doubleCountInBlock * sizeof(double); - MPI_Offset write_offset; - for (int nb = 0; nb < blocksCount; nb++) - { - write_offset = (MPI_Offset)(dataSetArray[nb].globalID * sizeofOneDataSet); - MPI_File_write_at(file_handler, write_offset, &dataSetArray[nb], 1, dataSetType, MPI_STATUS_IGNORE); - MPI_File_write_at(file_handler, (MPI_Offset)(write_offset + sizeof(DataSet)), &doubleValuesArray[nb * blockParamStr.doubleCountInBlock], 1, dataSetDoubleType, MPI_STATUS_IGNORE); - } - - MPI_File_sync(file_handler); - MPI_File_close(&file_handler); - - if (comm->isRoot()) - { - finish = MPI_Wtime(); - UBLOG(logINFO, "MPIIORestart2CoProcessor::writeDataSet time: " << finish - start << " s"); - } - - delete[] dataSetArray; -} - -void MPIIORestart2CoProcessor::writeBoundaryConds(int step) -{ - int rank, size; - MPI_Comm_rank(MPI_COMM_WORLD, &rank); - MPI_Comm_size(MPI_COMM_WORLD, &size); - - if (comm->isRoot()) - { - UBLOG(logINFO, "MPIIORestart2CoProcessor::writeBoundaryConds start collect data rank = " << rank); - UBLOG(logINFO, "Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe() / 1073741824.0 << " GB"); - } - - int blocksCount = 0; // quantity of blocks, that belong to this process - size_t allBytesCount = 0; // quantity of bytes, that one process writes to the file - size_t count_boundCond = 0; // how many BoundaryConditions in all blocks - int count_indexContainer = 0; // how many indexContainer-values in all blocks - - std::vector<Block3DPtr> blocksVector[25]; - int minInitLevel = this->grid->getCoarsestInitializedLevel(); - int maxInitLevel = this->grid->getFinestInitializedLevel(); - for (int level = minInitLevel; level <= maxInitLevel; level++) - { - grid->getBlocks(level, rank, blocksVector[level]); - blocksCount += static_cast<int>(blocksVector[level].size()); - } - - BCAdd* bcAddArray = new BCAdd[blocksCount]; - size_t* bytesCount = new size_t[blocksCount]; // quantity of bytes, that each block writes to the file - std::vector<BoundaryCondition>* bcVector = new std::vector<BoundaryCondition>[blocksCount]; - std::vector<int>* bcindexmatrixVector = new std::vector<int>[blocksCount]; - std::vector<int>* indexContainerVector = new std::vector<int>[blocksCount]; - - int ic = 0; - for (int level = minInitLevel; level <= maxInitLevel; level++) - { - for(Block3DPtr block : blocksVector[level]) // all the blocks of the current level - { - BCArray3DPtr bcArr = block->getKernel()->getBCProcessor()->getBCArray(); - - bcAddArray[ic].globalID = block->getGlobalID(); // id of the block needed to find it while regenerating the grid - bcAddArray[ic].boundCond_count = 0; // how many BoundaryConditions in this block - bcAddArray[ic].indexContainer_count = 0; // how many indexContainer-values in this block - bytesCount[ic] = sizeof(BCAdd); - bcVector[ic].resize(0); - bcindexmatrixVector[ic].resize(0); - indexContainerVector[ic].resize(0); - - for (int bc = 0; bc<bcArr->getBCVectorSize(); bc++) - { - BoundaryCondition* bouCond = new BoundaryCondition(); - if (bcArr->bcvector[bc] == NULL) - { - memset(bouCond, 0, sizeof(BoundaryCondition)); - } - else - { - bouCond->noslipBoundaryFlags = bcArr->bcvector[bc]->getNoSlipBoundary(); - bouCond->slipBoundaryFlags = bcArr->bcvector[bc]->getSlipBoundary(); - bouCond->velocityBoundaryFlags = bcArr->bcvector[bc]->getVelocityBoundary(); - bouCond->densityBoundaryFlags = bcArr->bcvector[bc]->getDensityBoundary(); - bouCond->wallModelBoundaryFlags = bcArr->bcvector[bc]->getWallModelBoundary(); - bouCond->bcVelocityX1 = bcArr->bcvector[bc]->getBoundaryVelocityX1(); - bouCond->bcVelocityX2 = bcArr->bcvector[bc]->getBoundaryVelocityX2(); - bouCond->bcVelocityX3 = bcArr->bcvector[bc]->getBoundaryVelocityX3(); - bouCond->bcDensity = bcArr->bcvector[bc]->getBoundaryDensity(); - bouCond->bcLodiDensity = bcArr->bcvector[bc]->getDensityLodiDensity(); - bouCond->bcLodiVelocityX1 = bcArr->bcvector[bc]->getDensityLodiVelocityX1(); - bouCond->bcLodiVelocityX2 = bcArr->bcvector[bc]->getDensityLodiVelocityX2(); - bouCond->bcLodiVelocityX3 = bcArr->bcvector[bc]->getDensityLodiVelocityX3(); - bouCond->bcLodiLentgh = bcArr->bcvector[bc]->getDensityLodiLength(); - bouCond->nx1 = bcArr->bcvector[bc]->nx1; - bouCond->nx2 = bcArr->bcvector[bc]->nx2; - bouCond->nx3 = bcArr->bcvector[bc]->nx3; - for (int iq = 0; iq<26; iq++) - bouCond->q[iq] = bcArr->bcvector[bc]->getQ(iq); - bouCond->algorithmType = bcArr->bcvector[bc]->getBcAlgorithmType(); - } - - bcVector[ic].push_back(*bouCond); - bcAddArray[ic].boundCond_count++; - count_boundCond++; - bytesCount[ic] += sizeof(BoundaryCondition); - } - - bcindexmatrixVector[ic].insert(bcindexmatrixVector[ic].begin(), bcArr->bcindexmatrix.getDataVector().begin(), bcArr->bcindexmatrix.getDataVector().end()); - bytesCount[ic] += blockParamStr.bcindexmatrix_count * sizeof(int); - - indexContainerVector[ic].insert(indexContainerVector[ic].begin(), bcArr->indexContainer.begin(), bcArr->indexContainer.end()); - bcAddArray[ic].indexContainer_count = static_cast<int>(bcArr->indexContainer.size()); - count_indexContainer += bcAddArray[ic].indexContainer_count; - bytesCount[ic] += bcAddArray[ic].indexContainer_count * sizeof(int); - - allBytesCount += bytesCount[ic]; - - ic++; - } - } - - if (comm->isRoot()) - { - UBLOG(logINFO, "MPIIORestart2CoProcessor::writeBoundaryConds start MPI IO rank = " << rank); - UBLOG(logINFO, "Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe() / 1073741824.0 << " GB"); - } - - double start, finish; - if (comm->isRoot()) start = MPI_Wtime(); - - MPI_Info info = MPI_INFO_NULL; - //MPI_Info_create (&info); - //MPI_Info_set(info,"romio_cb_write","enable"); - //MPI_Info_set(info,"cb_buffer_size","4194304"); - //MPI_Info_set(info,"striping_unit","4194304"); - - MPI_File file_handler; - std::string filename = path + "/mpi_io_cp/mpi_io_cp_" + UbSystem::toString(step) + "/cpBC.bin"; - int rc = MPI_File_open(MPI_COMM_WORLD, filename.c_str(), MPI_MODE_CREATE | MPI_MODE_WRONLY, info, &file_handler); - if (rc != MPI_SUCCESS) throw UbException(UB_EXARGS, "couldn't open file " + filename); - - //MPI_Offset new_size = 0; - //MPI_File_set_size(file_handler, new_size); - - MPI_Offset write_offset = (MPI_Offset)(grid->getNumberOfBlocks() * sizeof(size_t)); - size_t next_file_offset = 0; - if (size > 1) - { - if (rank == 0) - { - next_file_offset = write_offset + allBytesCount; - MPI_Send(&next_file_offset, 1, MPI_LONG_LONG_INT, 1, 5, MPI_COMM_WORLD); - } - else - { - MPI_Recv(&write_offset, 1, MPI_LONG_LONG_INT, rank - 1, 5, MPI_COMM_WORLD, MPI_STATUS_IGNORE); - next_file_offset = write_offset + allBytesCount; - if (rank < size - 1) - MPI_Send(&next_file_offset, 1, MPI_LONG_LONG_INT, rank + 1, 5, MPI_COMM_WORLD); - } - } - - MPI_Offset write_offsetIndex = 0; - - for (int nb = 0; nb < blocksCount; nb++) - { - write_offsetIndex = (MPI_Offset)(bcAddArray[nb].globalID * sizeof(size_t)); - MPI_File_write_at(file_handler, write_offsetIndex, &write_offset, 1, MPI_LONG_LONG_INT, MPI_STATUS_IGNORE); - - MPI_File_write_at(file_handler, write_offset, &bcAddArray[nb], 1, boundCondTypeAdd, MPI_STATUS_IGNORE); - if (bcVector[nb].size() > 0) - MPI_File_write_at(file_handler, (MPI_Offset)(write_offset + sizeof(BCAdd)), &bcVector[nb][0], bcAddArray[nb].boundCond_count, boundCondType, MPI_STATUS_IGNORE); - - if (bcindexmatrixVector[nb].size() > 0) - MPI_File_write_at(file_handler, (MPI_Offset)(write_offset + sizeof(BCAdd) + bcAddArray[nb].boundCond_count * sizeof(BoundaryCondition)), - &bcindexmatrixVector[nb][0], 1, bcindexmatrixType, MPI_STATUS_IGNORE); - - if (indexContainerVector[nb].size() > 0) - MPI_File_write_at(file_handler, (MPI_Offset)(write_offset + sizeof(BCAdd) + bcAddArray[nb].boundCond_count * sizeof(BoundaryCondition) + blockParamStr.bcindexmatrix_count * sizeof(int)), - &indexContainerVector[nb][0], bcAddArray[nb].indexContainer_count, MPI_INT, MPI_STATUS_IGNORE); - - write_offset += bytesCount[nb]; - } - - MPI_File_sync(file_handler); - MPI_File_close(&file_handler); - - if (comm->isRoot()) - { - finish = MPI_Wtime(); - UBLOG(logINFO, "MPIIORestart2CoProcessor::writeBoundaryConds time: " << finish - start << " s"); - } - - delete[] bcAddArray; - delete[] bytesCount; - delete[] bcVector; - delete[] bcindexmatrixVector; - delete[] indexContainerVector; -} - -//------------------------------------------- READ ----------------------------------------------- -void MPIIORestart2CoProcessor::restart(int step) -{ - if (comm->isRoot()) UBLOG(logINFO, "MPIIORestart2CoProcessor restart step: " << step); - if (comm->isRoot()) UBLOG(logINFO, "Load check point - start"); - readBlocks(step); - - Grid3DVisitorPtr metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::BSW, MetisPartitioner::KWAY)); - grid->accept(metisVisitor); - - readDataSet(step); - readBoundaryConds(step); - if (comm->isRoot()) UBLOG(logINFO, "Load check point - end"); - this->reconnect(grid); -} - - -void MPIIORestart2CoProcessor::readBlocks(int step) -{ - int rank, size; - MPI_Comm_rank(MPI_COMM_WORLD, &rank); - //MPI_Comm_size(MPI_COMM_WORLD, &size); - size = 1; - - if (comm->isRoot()) - { - UBLOG(logINFO, "MPIIORestart2CoProcessor::readBlocks start MPI IO rank = " << rank); - UBLOG(logINFO, "Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe() / 1073741824.0 << " GB"); - } - - double start, finish; - if (comm->isRoot()) start = MPI_Wtime(); - - MPI_File file_handler; - std::string filename = path + "/mpi_io_cp/mpi_io_cp_" + UbSystem::toString(step) + "/cpBlocks.bin"; - int rc = MPI_File_open(MPI_COMM_WORLD, filename.c_str(), MPI_MODE_RDONLY, MPI_INFO_NULL, &file_handler); - if (rc != MPI_SUCCESS) throw UbException(UB_EXARGS, "couldn't open file " + filename); - - // read count of blocks - int blocksCount = 0; - //MPI_File_read_at(file_handler, rank*sizeof(int), &blocksCount, 1, MPI_INT, MPI_STATUS_IGNORE); - MPI_File_read_at(file_handler, 0, &blocksCount, 1, MPI_INT, MPI_STATUS_IGNORE); - Block3d* block3dArray = new Block3d[blocksCount]; - - GridParam* gridParameters = new GridParam; - - // calculate the read offset - MPI_Offset read_offset = (MPI_Offset)(size * sizeof(int)); - - // read parameters of the grid - MPI_File_read_at(file_handler, read_offset, gridParameters, 1, gridParamType, MPI_STATUS_IGNORE); - // read parameters of a block - MPI_File_read_at(file_handler, (MPI_Offset)(read_offset + sizeof(GridParam)), &blockParamStr, 1, blockParamType, MPI_STATUS_IGNORE); - // read all the blocks - MPI_File_read_at(file_handler, (MPI_Offset)(read_offset + sizeof(GridParam) + sizeof(BlockParam)), &block3dArray[0], blocksCount, block3dType, MPI_STATUS_IGNORE); - //MPI_File_sync(file_handler); - - MPI_File_close(&file_handler); - - if (comm->isRoot()) - { - finish = MPI_Wtime(); - UBLOG(logINFO, "MPIIORestart2CoProcessor::readBlocks time: " << finish - start << " s"); - } - - if (comm->isRoot()) - { - UBLOG(logINFO, "MPIIORestart2CoProcessor::readBlocks start of restore of data, rank = " << rank); - UBLOG(logINFO, "Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe() / 1073741824.0 << " GB"); - } - - // clear the grid - std::vector<Block3DPtr> blocksVector; - grid->getBlocks(0, blocksVector); - int del = 0; - for(Block3DPtr block : blocksVector) - { - grid->deleteBlock(block); - del++; - } - - // restore the grid - CoordinateTransformation3DPtr trafo(new CoordinateTransformation3D()); - trafo->Tx1 = gridParameters->trafoParams[0]; - trafo->Tx2 = gridParameters->trafoParams[1]; - trafo->Tx3 = gridParameters->trafoParams[2]; - trafo->Sx1 = gridParameters->trafoParams[3]; - trafo->Sx2 = gridParameters->trafoParams[4]; - trafo->Sx3 = gridParameters->trafoParams[5]; - trafo->alpha = gridParameters->trafoParams[6]; - trafo->beta = gridParameters->trafoParams[7]; - trafo->gamma = gridParameters->trafoParams[8]; - - trafo->toX1factorX1 = gridParameters->trafoParams[9]; - trafo->toX1factorX2 = gridParameters->trafoParams[10]; - trafo->toX1factorX3 = gridParameters->trafoParams[11]; - trafo->toX1delta = gridParameters->trafoParams[12]; - trafo->toX2factorX1 = gridParameters->trafoParams[13]; - trafo->toX2factorX2 = gridParameters->trafoParams[14]; - trafo->toX2factorX3 = gridParameters->trafoParams[15]; - trafo->toX2delta = gridParameters->trafoParams[16]; - trafo->toX3factorX1 = gridParameters->trafoParams[17]; - trafo->toX3factorX2 = gridParameters->trafoParams[18]; - trafo->toX3factorX3 = gridParameters->trafoParams[19]; - trafo->toX3delta = gridParameters->trafoParams[20]; - - trafo->fromX1factorX1 = gridParameters->trafoParams[21]; - trafo->fromX1factorX2 = gridParameters->trafoParams[22]; - trafo->fromX1factorX3 = gridParameters->trafoParams[23]; - trafo->fromX1delta = gridParameters->trafoParams[24]; - trafo->fromX2factorX1 = gridParameters->trafoParams[25]; - trafo->fromX2factorX2 = gridParameters->trafoParams[26]; - trafo->fromX2factorX3 = gridParameters->trafoParams[27]; - trafo->fromX2delta = gridParameters->trafoParams[28]; - trafo->fromX3factorX1 = gridParameters->trafoParams[29]; - trafo->fromX3factorX2 = gridParameters->trafoParams[30]; - trafo->fromX3factorX3 = gridParameters->trafoParams[31]; - trafo->fromX3delta = gridParameters->trafoParams[32]; - - trafo->active = gridParameters->active; - trafo->transformation = gridParameters->transformation; - - grid->setCoordinateTransformator(trafo); - - grid->setDeltaX(gridParameters->deltaX); - grid->setBlockNX(gridParameters->blockNx1, gridParameters->blockNx2, gridParameters->blockNx3); - grid->setNX1(gridParameters->nx1); - grid->setNX2(gridParameters->nx2); - grid->setNX3(gridParameters->nx3); - grid->setPeriodicX1(gridParameters->periodicX1); - grid->setPeriodicX2(gridParameters->periodicX2); - grid->setPeriodicX3(gridParameters->periodicX3); - - // regenerate blocks - for (int n = 0; n<blocksCount; n++) - { - Block3DPtr block(new Block3D(block3dArray[n].x1, block3dArray[n].x2, block3dArray[n].x3, block3dArray[n].level)); - block->setActive(block3dArray[n].active); - block->setBundle(block3dArray[n].bundle); - block->setRank(block3dArray[n].rank); - block->setLocalRank(block3dArray[n].lrank); - block->setGlobalID(block3dArray[n].globalID); - block->setLocalID(block3dArray[n].localID); - block->setPart(block3dArray[n].part); - block->setLevel(block3dArray[n].level); - block->interpolationFlagCF = block3dArray[n].interpolationFlagCF; - block->interpolationFlagFC = block3dArray[n].interpolationFlagFC; - - grid->addBlock(block); - } - - // define MPI_types depending on the block-specific information - MPI_Type_contiguous(blockParamStr.doubleCountInBlock, MPI_DOUBLE, &dataSetDoubleType); - MPI_Type_commit(&dataSetDoubleType); - - MPI_Type_contiguous(blockParamStr.bcindexmatrix_count, MPI_INT, &bcindexmatrixType); - MPI_Type_commit(&bcindexmatrixType); - - mpiTypeFreeFlag = true; - - delete gridParameters; - delete[] block3dArray; - - if (comm->isRoot()) - { - UBLOG(logINFO, "MPIIORestart2CoProcessor::readBlocks end of restore of data, rank = " << rank); - UBLOG(logINFO, "Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe() / 1073741824.0 << " GB"); - } -} - -void MPIIORestart2CoProcessor::readDataSet(int step) -{ - int rank, size; - MPI_Comm_rank(MPI_COMM_WORLD, &rank); - MPI_Comm_size(MPI_COMM_WORLD, &size); - - if (comm->isRoot()) - { - UBLOG(logINFO, "MPIIORestart2CoProcessor::readDataSet start MPI IO rank = " << rank); - UBLOG(logINFO, "Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe() / 1073741824.0 << " GB"); - } - double start, finish; - if (comm->isRoot()) start = MPI_Wtime(); - - int blocksCount = 0; // quantity of the blocks, that belong to this process - - // read from the grid the blocks, that belong to this process - std::vector<Block3DPtr> blocksVector[25]; - int minInitLevel = this->grid->getCoarsestInitializedLevel(); - int maxInitLevel = this->grid->getFinestInitializedLevel(); - for (int level = minInitLevel; level <= maxInitLevel; level++) - { - grid->getBlocks(level, rank, blocksVector[level]); - blocksCount += static_cast<int>(blocksVector[level].size()); - } - - DataSet* dataSetArray = new DataSet[blocksCount]; - std::vector<double> doubleValuesArray(blocksCount * blockParamStr.doubleCountInBlock); // double-values in all blocks - - MPI_File file_handler; - std::string filename = path + "/mpi_io_cp/mpi_io_cp_" + UbSystem::toString(step) + "/cpDataSet.bin"; - int rc = MPI_File_open(MPI_COMM_WORLD, filename.c_str(), MPI_MODE_RDONLY, MPI_INFO_NULL, &file_handler); - if (rc != MPI_SUCCESS) throw UbException(UB_EXARGS, "couldn't open file " + filename); - - int ic = 0; - MPI_Offset read_offset; - size_t sizeofOneDataSet = size_t(sizeof(DataSet) + blockParamStr.doubleCountInBlock * sizeof(double)); - for (int level = minInitLevel; level <= maxInitLevel; level++) - { - for(Block3DPtr block : blocksVector[level]) // blocks of the current level - { - read_offset = (MPI_Offset)(block->getGlobalID() * sizeofOneDataSet); - //UBLOG(logINFO, "MPIIORestart2CoProcessor::readDataSet read_offset="<<read_offset<<" sizeofOneDataSet="<<sizeofOneDataSet<<" GlobalID="<<block->getGlobalID()<< " rank="<<rank); - MPI_File_read_at(file_handler, read_offset, &dataSetArray[ic], 1, dataSetType, MPI_STATUS_IGNORE); - MPI_File_read_at(file_handler, (MPI_Offset)(read_offset + sizeof(DataSet)), &doubleValuesArray[ic*blockParamStr.doubleCountInBlock], 1, dataSetDoubleType, MPI_STATUS_IGNORE); - ic++; - } - } - - MPI_File_close(&file_handler); - - - if (comm->isRoot()) - { - finish = MPI_Wtime(); - UBLOG(logINFO, "MPIIORestart2CoProcessor::readDataSet time: " << finish - start << " s"); - UBLOG(logINFO, "MPIIORestart2CoProcessor::readDataSet start of restore of data, rank = " << rank); - UBLOG(logINFO, "Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe() / 1073741824.0 << " GB"); - } - - //for (int n = 0; n<blocksCount; n++) - //{ - //if(dataSetArray[n].globalID != dataSetArrayTest[n].globalID) - //{ - //UBLOG(logINFO, "MPIIORestart2CoProcessor::readDataSet dataSetArray[n].globalID: "<<dataSetArray[n].globalID<< " rank = "<<rank<<" n = "<<n); - ////UBLOG(logINFO, "MPIIORestart2CoProcessor::readDataSet dataSetArray[n].globalID: "<<dataSetArray[n].globalID); - ////UBLOG(logINFO, "MPIIORestart2CoProcessor::readDataSet SetArrayTest[n].globalID: "<<dataSetArrayTest[n].globalID); - //} - //} - - //UBLOG(logINFO, "MPIIORestart2CoProcessor::readDataSet grid size 1: "<<grid->getNumberOfBlocks()<<" rank = "<<rank); - //UBLOG(logINFO, "MPIIORestart2CoProcessor::readDataSet BlockIDs size 1: "<<grid->getBlockIDs().size()<<" rank = "<<rank); - - size_t index = 0, nextVectorSize = 0; - std::vector<double> vectorsOfValues[9]; - for (int n = 0; n<blocksCount; n++) - { - for (int b = 0; b<9; b++) // assign approciate vectors to 9 dataSet arrays - { - nextVectorSize = blockParamStr.nx[b][0] * blockParamStr.nx[b][1] * blockParamStr.nx[b][2] * blockParamStr.nx[b][3]; - vectorsOfValues[b].assign(doubleValuesArray.data() + index, doubleValuesArray.data() + index + nextVectorSize); - index += nextVectorSize; - } - - // fill dataSet arrays - AverageValuesArray3DPtr mAverageValues; - if ((blockParamStr.nx[0][0] == 0) && (blockParamStr.nx[0][1] == 0) && (blockParamStr.nx[0][2] == 0) && (blockParamStr.nx[0][3] == 0)) - mAverageValues = CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr(); - else - mAverageValues = CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr(new CbArray4D<LBMReal, IndexerX4X3X2X1>(vectorsOfValues[0], blockParamStr.nx[0][0], blockParamStr.nx[0][1], blockParamStr.nx[0][2], blockParamStr.nx[0][3])); - - AverageValuesArray3DPtr mAverageVelocity; - if ((blockParamStr.nx[1][0] == 0) && (blockParamStr.nx[1][1] == 0) && (blockParamStr.nx[1][2] == 0) && (blockParamStr.nx[1][3] == 0)) - mAverageVelocity = CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr(); - else - mAverageVelocity = CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr(new CbArray4D<LBMReal, IndexerX4X3X2X1>(vectorsOfValues[1], blockParamStr.nx[1][0], blockParamStr.nx[1][1], blockParamStr.nx[1][2], blockParamStr.nx[1][3])); - - AverageValuesArray3DPtr mAverageFluktuations; - if ((blockParamStr.nx[2][0] == 0) && (blockParamStr.nx[2][1] == 0) && (blockParamStr.nx[2][2] == 0) && (blockParamStr.nx[2][3] == 0)) - mAverageFluktuations = CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr(); - else - mAverageFluktuations = CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr(new CbArray4D<LBMReal, IndexerX4X3X2X1>(vectorsOfValues[2], blockParamStr.nx[2][0], blockParamStr.nx[2][1], blockParamStr.nx[2][2], blockParamStr.nx[2][3])); - - AverageValuesArray3DPtr mAverageTriplecorrelations; - if ((blockParamStr.nx[3][0] == 0) && (blockParamStr.nx[3][1] == 0) && (blockParamStr.nx[3][2] == 0) && (blockParamStr.nx[3][3] == 0)) - mAverageTriplecorrelations = CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr(); - else - mAverageTriplecorrelations = CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr(new CbArray4D<LBMReal, IndexerX4X3X2X1>(vectorsOfValues[3], blockParamStr.nx[3][0], blockParamStr.nx[3][1], blockParamStr.nx[3][2], blockParamStr.nx[3][3])); - - ShearStressValuesArray3DPtr mShearStressValues; - if ((blockParamStr.nx[4][0] == 0) && (blockParamStr.nx[4][1] == 0) && (blockParamStr.nx[4][2] == 0) && (blockParamStr.nx[4][3] == 0)) - mShearStressValues = CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr(); - else - mShearStressValues = CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr(new CbArray4D<LBMReal, IndexerX4X3X2X1>(vectorsOfValues[4], blockParamStr.nx[4][0], blockParamStr.nx[4][1], blockParamStr.nx[4][2], blockParamStr.nx[4][3])); - - RelaxationFactorArray3DPtr mRelaxationFactor; - if ((blockParamStr.nx[5][0] == 0) && (blockParamStr.nx[5][1] == 0) && (blockParamStr.nx[5][2] == 0)) - mRelaxationFactor = CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr(); - else - mRelaxationFactor = CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<LBMReal, IndexerX3X2X1>(vectorsOfValues[5], blockParamStr.nx[5][0], blockParamStr.nx[5][1], blockParamStr.nx[5][2])); - - //DistributionArray3DPtr mFdistributions(new D3Q27EsoTwist3DSplittedVector(blockParamStr.nx1, blockParamStr.nx2, blockParamStr.nx3, -999.0)); - DistributionArray3DPtr mFdistributions(new D3Q27EsoTwist3DSplittedVector()); - - std::dynamic_pointer_cast<D3Q27EsoTwist3DSplittedVector>(mFdistributions)->setLocalDistributions(CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr(new CbArray4D<LBMReal, IndexerX4X3X2X1>(vectorsOfValues[6], blockParamStr.nx[6][0], blockParamStr.nx[6][1], blockParamStr.nx[6][2], blockParamStr.nx[6][3]))); - std::dynamic_pointer_cast<D3Q27EsoTwist3DSplittedVector>(mFdistributions)->setNonLocalDistributions(CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr(new CbArray4D<LBMReal, IndexerX4X3X2X1>(vectorsOfValues[7], blockParamStr.nx[7][0], blockParamStr.nx[7][1], blockParamStr.nx[7][2], blockParamStr.nx[7][3]))); - std::dynamic_pointer_cast<D3Q27EsoTwist3DSplittedVector>(mFdistributions)->setZeroDistributions(CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<LBMReal, IndexerX3X2X1>(vectorsOfValues[8], blockParamStr.nx[8][0], blockParamStr.nx[8][1], blockParamStr.nx[8][2]))); - - std::dynamic_pointer_cast<D3Q27EsoTwist3DSplittedVector>(mFdistributions)->setNX1(blockParamStr.nx1); - std::dynamic_pointer_cast<D3Q27EsoTwist3DSplittedVector>(mFdistributions)->setNX2(blockParamStr.nx2); - std::dynamic_pointer_cast<D3Q27EsoTwist3DSplittedVector>(mFdistributions)->setNX3(blockParamStr.nx3); - - DataSet3DPtr dataSetPtr = DataSet3DPtr(new DataSet3D()); - dataSetPtr->setAverageValues(mAverageValues); - dataSetPtr->setAverageVelocity(mAverageVelocity); - dataSetPtr->setAverageFluctuations(mAverageFluktuations); - dataSetPtr->setAverageTriplecorrelations(mAverageTriplecorrelations); - dataSetPtr->setShearStressValues(mShearStressValues); - dataSetPtr->setRelaxationFactor(mRelaxationFactor); - dataSetPtr->setFdistributions(mFdistributions); - - // find the nesessary block and fill it - Block3DPtr block = grid->getBlock(dataSetArray[n].globalID); - //Block3DPtr block = grid->getBlock(2); - if (!block) - { - UBLOG(logINFO, "MPIIORestart2CoProcessor::readDataSet don't find block dataSetArray[n].globalID: " << dataSetArray[n].globalID << " rank = " << rank << " n = " << n); - UBLOG(logINFO, "MPIIORestart2CoProcessor::readDataSet grid size 2: " << grid->getNumberOfBlocks() << " rank = " << rank); - } - ////LBMKernelPtr kernel(new CompressibleCumulantLBMKernel(0, 0, 0, CompressibleCumulantLBMKernel::NORMAL)); - LBMKernelPtr kernel = this->lbmKernel->clone(); - kernel->setGhostLayerWidth(dataSetArray[n].ghostLayerWidth); - kernel->setCollisionFactor(dataSetArray[n].collFactor); - kernel->setDeltaT(dataSetArray[n].deltaT); - kernel->setCompressible(dataSetArray[n].compressible); - kernel->setWithForcing(dataSetArray[n].withForcing); - kernel->setDataSet(dataSetPtr); - block->setKernel(kernel); - } - - delete[] dataSetArray; - - if (comm->isRoot()) - { - UBLOG(logINFO, "MPIIORestart2CoProcessor::readDataSet end of restore of data, rank = " << rank); - UBLOG(logINFO, "Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe() / 1073741824.0 << " GB"); - } -} - -void MPIIORestart2CoProcessor::readBoundaryConds(int step) -{ - int rank, size; - MPI_Comm_rank(MPI_COMM_WORLD, &rank); - MPI_Comm_size(MPI_COMM_WORLD, &size); - - if (comm->isRoot()) - { - UBLOG(logINFO, "MPIIORestart2CoProcessor::readBoundaryConds start MPI IO rank = " << rank); - UBLOG(logINFO, "Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe() / 1073741824.0 << " GB"); - } - - double start, finish; - if (comm->isRoot()) start = MPI_Wtime(); - - MPI_File file_handler; - std::string filename = path + "/mpi_io_cp/mpi_io_cp_" + UbSystem::toString(step) + "/cpBC.bin"; - int rc = MPI_File_open(MPI_COMM_WORLD, filename.c_str(), MPI_MODE_RDONLY, MPI_INFO_NULL, &file_handler); - if (rc != MPI_SUCCESS) throw UbException(UB_EXARGS, "couldn't open file " + filename); - - int blocksCount = 0; // quantity of the blocks, that belong to this process - - // read from the grid the blocks, that belong to this process - std::vector<Block3DPtr> blocksVector[25]; - int minInitLevel = this->grid->getCoarsestInitializedLevel(); - int maxInitLevel = this->grid->getFinestInitializedLevel(); - for (int level = minInitLevel; level <= maxInitLevel; level++) - { - grid->getBlocks(level, rank, blocksVector[level]); - blocksCount += static_cast<int>(blocksVector[level].size()); - } - - BCAdd* bcAddArray = new BCAdd[blocksCount]; - BoundaryCondition* nullBouCond = new BoundaryCondition(); - memset(nullBouCond, 0, sizeof(BoundaryCondition)); - BoundaryCondition* bcArray; - int* intArray1; - int* intArray2; - std::vector<BoundaryConditionsPtr> bcVector; - std::vector<int> bcindexmatrixV; - std::vector<int> indexContainerV; - - if (comm->isRoot()) - { - //finish = MPI_Wtime(); - //UBLOG(logINFO, "MPIIORestart2CoProcessor::readBoundaryConds time: " << finish - start << " s"); - UBLOG(logINFO, "MPIIORestart2CoProcessor::readBoundaryConds start of restore of data, rank = " << rank); - UBLOG(logINFO, "Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe() / 1073741824.0 << " GB"); - } - - int ic = 0; - MPI_Offset read_offset1, read_offset2; - for (int level = minInitLevel; level <= maxInitLevel; level++) - { - for(Block3DPtr block : blocksVector[level]) // blocks of the current level - { - read_offset1 = (MPI_Offset)(block->getGlobalID() * sizeof(size_t)); - - MPI_File_read_at(file_handler, read_offset1, &read_offset2, 1, MPI_LONG_LONG_INT, MPI_STATUS_IGNORE); - MPI_File_read_at(file_handler, read_offset2, &bcAddArray[ic], 1, boundCondTypeAdd, MPI_STATUS_IGNORE); - - bcArray = new BoundaryCondition[bcAddArray[ic].boundCond_count]; - intArray1 = new int[blockParamStr.bcindexmatrix_count]; - intArray2 = new int[bcAddArray[ic].indexContainer_count]; - - if (bcAddArray[ic].boundCond_count > 0) - { - MPI_File_read_at(file_handler, (MPI_Offset)(read_offset2 + sizeof(BCAdd)), &bcArray[0], bcAddArray[ic].boundCond_count, boundCondType, MPI_STATUS_IGNORE); - } - MPI_File_read_at(file_handler, (MPI_Offset)(read_offset2 + sizeof(BCAdd) + bcAddArray[ic].boundCond_count * sizeof(BoundaryCondition)), - &intArray1[0], 1, bcindexmatrixType, MPI_STATUS_IGNORE); - if (bcAddArray[ic].indexContainer_count > 0) - { - MPI_File_read_at(file_handler, (MPI_Offset)(read_offset2 + sizeof(BCAdd) + bcAddArray[ic].boundCond_count * sizeof(BoundaryCondition) + blockParamStr.bcindexmatrix_count * sizeof(int)), - &intArray2[0], bcAddArray[ic].indexContainer_count, MPI_INT, MPI_STATUS_IGNORE); - } - - bcindexmatrixV.resize(0); - indexContainerV.resize(0); - bcVector.resize(0); - - for (size_t ibc = 0; ibc<bcAddArray[ic].boundCond_count; ibc++) - { - BoundaryConditionsPtr bc; - if (memcmp(&bcArray[ibc], nullBouCond, sizeof(BoundaryCondition)) == 0) - bc = BoundaryConditionsPtr(); - else - { - bc = BoundaryConditionsPtr(new BoundaryConditions); - bc->noslipBoundaryFlags = bcArray[ibc].noslipBoundaryFlags; - bc->slipBoundaryFlags = bcArray[ibc].slipBoundaryFlags; - bc->densityBoundaryFlags = bcArray[ibc].densityBoundaryFlags; - bc->velocityBoundaryFlags = bcArray[ibc].velocityBoundaryFlags; - bc->wallModelBoundaryFlags = bcArray[ibc].wallModelBoundaryFlags; - bc->bcVelocityX1 = bcArray[ibc].bcVelocityX1; - bc->bcVelocityX2 = bcArray[ibc].bcVelocityX2; - bc->bcVelocityX3 = bcArray[ibc].bcVelocityX3; - bc->bcDensity = bcArray[ibc].bcDensity; - bc->bcLodiDensity = bcArray[ibc].bcLodiDensity; - bc->bcLodiVelocityX1 = bcArray[ibc].bcLodiVelocityX1; - bc->bcLodiVelocityX2 = bcArray[ibc].bcLodiVelocityX2; - bc->bcLodiVelocityX3 = bcArray[ibc].bcLodiVelocityX3; - bc->bcLodiLentgh = bcArray[ibc].bcLodiLentgh; - - bc->nx1 = bcArray[ibc].nx1; - bc->nx2 = bcArray[ibc].nx2; - bc->nx3 = bcArray[ibc].nx3; - for (int iq = 0; iq<26; iq++) - bc->setQ(bcArray[ibc].q[iq], iq); - bc->setBcAlgorithmType(bcArray[ibc].algorithmType); - } - - bcVector.push_back(bc); - } - - - for (int b1 = 0; b1 < blockParamStr.bcindexmatrix_count; b1++) - bcindexmatrixV.push_back(intArray1[b1]); - - for (int b2 = 0; b2 < bcAddArray[ic].indexContainer_count; b2++) - indexContainerV.push_back(intArray2[b2]); - - CbArray3D<int, IndexerX3X2X1> bcim(bcindexmatrixV, blockParamStr.nx1, blockParamStr.nx2, blockParamStr.nx3); - Block3DPtr block1 = grid->getBlock(bcAddArray[ic].globalID); - - //BCProcessorPtr bcProc(new BCProcessor()); - BCProcessorPtr bcProc = bcProcessor->clone(block1->getKernel()); - //BCArray3DPtr bcArr = bcProc->getBCArray(); - BCArray3DPtr bcArr(new BCArray3D()); - bcArr->bcindexmatrix = bcim; - bcArr->bcvector = bcVector; - bcArr->indexContainer = indexContainerV; - bcProc->setBCArray(bcArr); - - block1->getKernel()->setBCProcessor(bcProc); - - delete bcArray; - delete intArray1; - delete intArray2; - - ic++; - } - } - MPI_File_close(&file_handler); - - delete nullBouCond; - - if (comm->isRoot()) - { - UBLOG(logINFO, "MPIIORestart2CoProcessor::readBoundaryConds end of restore of data, rank = " << rank); - finish = MPI_Wtime(); - UBLOG(logINFO, "MPIIORestart2CoProcessor::readBoundaryConds time: " << finish - start << " s"); - UBLOG(logINFO, "Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe() / 1073741824.0 << " GB"); - } -} - -void MPIIORestart2CoProcessor::setChunk(int val) -{ - chunk = val; -} -////////////////////////////////////////////////////////////////////////// -void MPIIORestart2CoProcessor::setLBMKernel(LBMKernelPtr kernel) -{ - this->lbmKernel = kernel; -} -////////////////////////////////////////////////////////////////////////// -void MPIIORestart2CoProcessor::setBCProcessor(BCProcessorPtr bcProcessor) -{ - this->bcProcessor = bcProcessor; -} - diff --git a/src/VirtualFluids/CoProcessors/MPIIORestart2CoProcessor.h b/src/VirtualFluids/CoProcessors/MPIIORestart2CoProcessor.h deleted file mode 100644 index 5fed488f5..000000000 --- a/src/VirtualFluids/CoProcessors/MPIIORestart2CoProcessor.h +++ /dev/null @@ -1,181 +0,0 @@ -#ifndef _MPIIORestart2CoProcessor_H_ -#define _MPIIORestart2CoProcessor_H_ - -#include <memory> -#include <string> - -#include "mpi.h" - -#include "CoProcessor.h" - -class Communicator; -class Grid3D; -class UbScheduler; -class LBMKernel; -class BCProcessor; - -class MPIIORestart2CoProcessor; -typedef std::shared_ptr<MPIIORestart2CoProcessor> MPIIORestart2CoProcessorPtr; - -//! \class MPIWriteBlocksCoProcessor -//! \brief Writes the grid each timestep into the files and reads the grip from the files before regenerating -class MPIIORestart2CoProcessor: public CoProcessor -{ - //! \struct GridParam - //! \brief Structure describes parameters of the grid - //! \details The structure is nessasary to restore the grid correctly - struct GridParam - { - double trafoParams[33]; - double deltaX; - int blockNx1; - int blockNx2; - int blockNx3; - int nx1; - int nx2; - int nx3; - bool periodicX1; - bool periodicX2; - bool periodicX3; - bool active; - bool transformation; - }; - - //! \struct blockParam - //! \brief Structure describes parameters of the block that are equal in all blocks - //! \details The structure used to store some parameters needed to restore dataSet arrays - struct BlockParam - { - int nx1; // to find the right block - int nx2; - int nx3; - int nx[9][4]; // 9 arrays x (nx1, nx2, nx3, nx4) - int doubleCountInBlock; // how many double-values are in all arrays dataSet in one (any) block - int bcindexmatrix_count; // how many bcindexmatrix-values are in one (any) block - }; - - //! \struct Block3d - //! \brief Structure contains information of the block - //! \details The structure is used to write the data describing the block in the grid when saving the grid - //! and to read it when restoring the grid - struct Block3d - { - int x1; - int x2; - int x3; - int bundle; - int rank; - int lrank; - int part; - int globalID; - int localID; - int level; - int interpolationFlagCF; - int interpolationFlagFC; - int counter; - bool active; - }; - - //! \struct dataSet - //! \brief Structure containes information identifying the block - //! \details The structure is used to find the needed block in the grid when restoring a dataSet - struct DataSet - { - double collFactor; - double deltaT; - int globalID; - int ghostLayerWidth; - bool compressible; - bool withForcing; - }; - - //! \struct BoundaryCondition - //! \brief Structure containes information about boundary conditions of the block - //! \details The structure is used to write data describing boundary conditions of the blocks when saving the grid - //! and to read it when restoring the grid - struct BoundaryCondition - { - long long noslipBoundaryFlags; // MPI_LONG_LONG - long long slipBoundaryFlags; - long long velocityBoundaryFlags; - long long densityBoundaryFlags; - long long wallModelBoundaryFlags; - - float bcVelocityX1; - float bcVelocityX2; - float bcVelocityX3; - float bcDensity; - - float bcLodiDensity; - float bcLodiVelocityX1; - float bcLodiVelocityX2; - float bcLodiVelocityX3; - float bcLodiLentgh; - - float nx1,nx2,nx3; - float q[26]; // MPI_FLOAT - - char algorithmType; - }; - - //! \struct BCAdd - //! \brief Structure containes information identifying the block - //! and some parameters of the arrays of boundary conditions that are equal in all blocks - //! \details The structure is used to find the needed block in the grid when restoring a dataSet - //! and to set common parameters - struct BCAdd - { - int globalID; - //int x1; // to find the right block - //int x2; - //int x3; - //int level; - int boundCond_count; // how many BoundaryCondition-structures are in this block - int indexContainer_count; // how many indexContainer-values are in this block - }; - -public: - MPIIORestart2CoProcessor(std::shared_ptr<Grid3D> grid, std::shared_ptr<UbScheduler> s, const std::string& path, std::shared_ptr<Communicator> comm); - virtual ~MPIIORestart2CoProcessor(); - //! Each timestep writes the grid into the files - void process(double step); - //! Reads the grid from the files before grid reconstruction - void restart(int step); - //! Writes the blocks of the grid into the file outputBlocks.bin - void writeBlocks(int step); - //! Writes the datasets of the blocks into the file outputDataSet.bin - void writeDataSet(int step); - //! Writes the boundary conditions of the blocks into the file outputBoundCond.bin - void writeBoundaryConds(int step); - //! Reads the blocks of the grid from the file outputBlocks.bin - void readBlocks(int step); - //! Reads the datasets of the blocks from the file outputDataSet.bin - void readDataSet(int step); - //! Reads the boundary conditions of the blocks from the file outputBoundCond.bin - void readBoundaryConds(int step); - //! The function sets number of ranks that read simultaneously - void setChunk(int val); - //! The function sets LBMKernel - void setLBMKernel(std::shared_ptr<LBMKernel> kernel); - //!The function sets BCProcessor - void setBCProcessor(std::shared_ptr<BCProcessor> bcProcessor); - //!The function truncates the data files - void clearAllFiles(int step); - -protected: - std::string path; - std::shared_ptr<Communicator> comm; - bool mpiTypeFreeFlag; - -private: - MPI_Datatype gridParamType, blockParamType, block3dType, dataSetType, dataSetDoubleType, boundCondType, boundCondType1000, boundCondTypeAdd, bcindexmatrixType; - BlockParam blockParamStr; - int chunk; - std::shared_ptr<LBMKernel> lbmKernel; - std::shared_ptr<BCProcessor> bcProcessor; - - DataSet* dataSetArrayTest; - -}; - -#endif diff --git a/src/VirtualFluids/CoProcessors/NUPSCounterCoProcessor.cpp b/src/VirtualFluids/CoProcessors/NUPSCounterCoProcessor.cpp deleted file mode 100644 index 6f5f1a3aa..000000000 --- a/src/VirtualFluids/CoProcessors/NUPSCounterCoProcessor.cpp +++ /dev/null @@ -1,77 +0,0 @@ -#include "NUPSCounterCoProcessor.h" - -#include "Communicator.h" -#include "UbScheduler.h" -#include "Grid3D.h" - -NUPSCounterCoProcessor::NUPSCounterCoProcessor(Grid3DPtr grid, UbSchedulerPtr s, int numOfThreads, CommunicatorPtr comm) - : CoProcessor(grid, s), - numOfThreads(numOfThreads), - comm(comm), - nup(0), - nup_t(0), - nupsStep(0.0) -{ - if (comm->getProcessID() == comm->getRoot()) - { - timer.resetAndStart(); - - double nop = comm->getNumberOfProcesses(); - int minInitLevel = grid->getCoarsestInitializedLevel(); - int maxInitLevel = grid->getFinestInitializedLevel(); - int gl = 2; - UbTupleInt3 blocknx = grid->getBlockNX(); - //double nod = (val<1>(blocknx)+gl) * (val<2>(blocknx)+gl) * (val<3>(blocknx)+gl); - double nod = (double)(val<1>(blocknx)) * (double)(val<2>(blocknx)) * (double)(val<3>(blocknx)); - nup = 0; - - for(int level = minInitLevel; level<=maxInitLevel; level++) - { - int nob = grid->getNumberOfBlocks(level); - nup_t += (double)(1<<level) * nob * nod; - } - nup = nup_t / nop; - } -} -////////////////////////////////////////////////////////////////////////// -NUPSCounterCoProcessor::~NUPSCounterCoProcessor() -{ -} -////////////////////////////////////////////////////////////////////////// -void NUPSCounterCoProcessor::process(double step) -{ - if(scheduler->isDue(step) ) - collectData(step); -} -////////////////////////////////////////////////////////////////////////// -void NUPSCounterCoProcessor::collectData(double step) -{ - if (comm->getProcessID() == comm->getRoot()) - { - double time = timer.stop(); - //double time = timer.elapsed(); - //std::ofstream ostr; - //std::string fname = path; - //ostr.open(fname.c_str(), std::ios_base::out | std::ios_base::app); - //if(!ostr) - //{ - // ostr.clear(); - // std::string path = UbSystem::getPathFromString(fname); - // if(path.size()>0){ UbSystem::makeDirectory(path); ostr.open(fname.c_str(), std::ios_base::out | std::ios_base::app);} - // if(!ostr) throw UbException(UB_EXARGS,"couldn't open file "+fname); - //} - double nups_t = nup_t*(step-nupsStep)/time; - double nups = nup*(step-nupsStep)/time;//timer.getTotalTime(); - double tnups = nups/(double)numOfThreads; - //ostr << nups << std::endl; - //ostr.close(); - UBLOG(logINFO, "Calculation step = "<<step); - UBLOG(logINFO, "Total performance = "<<nups_t<<" NUPS"); - UBLOG(logINFO, "Performance per process = "<<nups<<" NUPS"); - UBLOG(logINFO, "Performance per thread = "<<tnups<<" NUPS"); - UBLOG(logINFO, "Time for " << step-nupsStep <<" steps = "<< time <<" s"); - //timer.restart(); - nupsStep = step; - timer.resetAndStart(); - } -} diff --git a/src/VirtualFluids/CoProcessors/NUPSCounterCoProcessor.h b/src/VirtualFluids/CoProcessors/NUPSCounterCoProcessor.h deleted file mode 100644 index 71b8f8bae..000000000 --- a/src/VirtualFluids/CoProcessors/NUPSCounterCoProcessor.h +++ /dev/null @@ -1,42 +0,0 @@ -/* -* NUPSCounterCoProcessor.h -* -* Created on: 03.05.2011 -* Author: K. Kucher -*/ - -#ifndef NUPSCOUNTERCoProcessor_H_ -#define NUPSCOUNTERCoProcessor_H_ - -#include <memory> - -#include "CoProcessor.h" -#include "basics/utilities/UbTiming.h" - -class Communicator; -class Grid3D; -class UbScheduler; - -class NUPSCounterCoProcessor: public CoProcessor -{ -public: - NUPSCounterCoProcessor(std::shared_ptr<Grid3D> grid, std::shared_ptr<UbScheduler> s, int numOfThreads, std::shared_ptr<Communicator> comm); - virtual ~NUPSCounterCoProcessor(); - - void process(double step)override; - -protected: - void collectData(double step); - UbTimer timer; - //boost::timer timer; - int numOfThreads; - double numberOfNodes; - double numberOfBlocks; - double nup; - double nup_t; - double nupsStep; - std::shared_ptr<Communicator> comm; -}; - - -#endif diff --git a/src/VirtualFluids/CoProcessors/PressureCoefficientCoProcessor.cpp b/src/VirtualFluids/CoProcessors/PressureCoefficientCoProcessor.cpp deleted file mode 100644 index 9962ffd03..000000000 --- a/src/VirtualFluids/CoProcessors/PressureCoefficientCoProcessor.cpp +++ /dev/null @@ -1,223 +0,0 @@ -#include "PressureCoefficientCoProcessor.h" -#include <WbWriterVtkXmlASCII.h> - -#include "LBMKernel.h" -#include "BCProcessor.h" -#include "DataSet3D.h" -#include "Block3D.h" -#include "UbScheduler.h" -#include "Grid3D.h" -#include "Communicator.h" -#include "GbCuboid3D.h" -#include "D3Q27Interactor.h" -#include "BCArray3D.h" - -PressureCoefficientCoProcessor::PressureCoefficientCoProcessor(Grid3DPtr grid, UbSchedulerPtr s, - GbCuboid3DPtr plane, - const std::string& path, CommunicatorPtr comm) - : CoProcessor(grid, s), - plane(plane), - path(path), - comm(comm) -{ - maxStep = scheduler->getMaxEnd(); - numberOfSteps = int(maxStep - scheduler->getMinBegin()); -} -////////////////////////////////////////////////////////////////////////// -PressureCoefficientCoProcessor::~PressureCoefficientCoProcessor() -{ - -} -////////////////////////////////////////////////////////////////////////// -void PressureCoefficientCoProcessor::process(double step) -{ - if (scheduler->isDue(step)) - collectData(step); - - UBLOG(logDEBUG3, "D3Q27ForcesCoProcessor::update:" << step); -} -////////////////////////////////////////////////////////////////////////// -void PressureCoefficientCoProcessor::collectData(double step) -{ - calculateRho(); - - if (step == maxStep) - { - writeValues((int)step); - } -} -////////////////////////////////////////////////////////////////////////// -void PressureCoefficientCoProcessor::calculateRho() -{ - double f[D3Q27System::ENDF+1]; - double vx1, vx2, vx3, rho; - std::vector<double> values; - std::vector<double> rvalues; - - for(D3Q27InteractorPtr interactor : interactors) - { - typedef std::map<Block3DPtr, std::set< std::vector<int> > > TransNodeIndicesMap; - for(TransNodeIndicesMap::value_type t : interactor->getBcNodeIndicesMap()) - { - Block3DPtr block = t.first; - std::set< std::vector<int> >& bcNodeIndicesSet = t.second; - - ILBMKernelPtr kernel = block->getKernel(); - BCArray3DPtr bcArray = kernel->getBCProcessor()->getBCArray(); - DistributionArray3DPtr distributions = kernel->getDataSet()->getFdistributions(); - - UbTupleDouble3 org = grid->getBlockWorldCoordinates(block); - UbTupleDouble3 blockLengths = grid->getBlockLengths(block); - UbTupleDouble3 nodeOffset = grid->getNodeOffset(block); - double dx = grid->getDeltaX(block); - - if (kernel->getCompressible()) - { - calcMacros = &D3Q27System::calcCompMacroscopicValues; - } - else - { - calcMacros = &D3Q27System::calcIncompMacroscopicValues; - } - - int ghostLayerWidth = kernel->getGhostLayerWidth(); - int minX1 = ghostLayerWidth; - int maxX1 = (int)bcArray->getNX1() - 1 - ghostLayerWidth; - int minX2 = ghostLayerWidth; - int maxX2 = (int)bcArray->getNX2() - 1 - ghostLayerWidth; - int minX3 = ghostLayerWidth; - int maxX3 = (int)bcArray->getNX3() - 1 - ghostLayerWidth; - - for(std::vector<int> node : bcNodeIndicesSet) - { - int x1 = node[0]; - int x2 = node[1]; - int x3 = node[2]; - - //without ghost nodes - if (x1 < minX1 || x1 > maxX1 || x2 < minX2 || x2 > maxX2 ||x3 < minX3 || x3 > maxX3) continue; - - if (bcArray->isFluid(x1, x2, x3)) //es kann sein, dass der node von einem anderen interactor z.B. als solid gemarkt wurde!!! - { - double cx1 = val<1>(org) - val<1>(nodeOffset) + x1*dx; - double cx2 = val<2>(org) - val<2>(nodeOffset) + x2*dx; - double cx3 = val<3>(org) - val<3>(nodeOffset) + x3*dx; - if (plane->isPointInGbObject3D(cx1, cx2, cx3)) - { - distributions->getDistribution(f, x1, x2, x3); - calcMacros(f, rho, vx1, vx2, vx3); - values.push_back(cx1); - values.push_back(cx2); - values.push_back(cx3); - values.push_back(rho); - } - } - } - - } - } - - comm->allGather(values, rvalues); - if (comm->getProcessID() == comm->getRoot()) - { - if (outValues.size() == 0) - { - outValues.resize(rvalues.size()); - } - int size = (int)rvalues.size(); - for (int i = 0; i < size; i+=4) - { - outValues[i] = rvalues[i]; - outValues[i+1] = rvalues[i+1]; - outValues[i+2] = rvalues[i+2]; - outValues[i+3] += rvalues[i+3]; - } - } - -} -////////////////////////////////////////////////////////////////////////// -void PressureCoefficientCoProcessor::writeValues(int step) -{ - if (comm->getProcessID() == comm->getRoot()) - { - datanames.resize(0); - datanames.push_back("rho"); - data.resize(datanames.size()); - - std::ofstream ostr; - std::string fname = path+UbSystem::toString(step)+".csv"; - ostr.open(fname.c_str(), std::ios_base::out); - if (!ostr) - { - ostr.clear(); - std::string path = UbSystem::getPathFromString(fname); - if (path.size()>0) { UbSystem::makeDirectory(path); ostr.open(fname.c_str(), std::ios_base::out); } - if (!ostr) throw UbException(UB_EXARGS, "couldn't open file "+fname); - } - - ostr << "x1;x2;x3;rho\n"; - - int size = (int)outValues.size(); - for (int i = 0; i < size; i+=4) - { - ostr << outValues[i] << ";" << outValues[i+1] <<";" << outValues[i+2] << ";" << outValues[i+3]/numberOfSteps << std::endl; - - int index = 0; - nodes.push_back(makeUbTuple(float(outValues[i]), - float(outValues[i+1]), - float(outValues[i+2]))); - - data[index++].push_back(outValues[i+3]/numberOfSteps); - } - - ostr.close(); - - WbWriterVtkXmlASCII::getInstance()->writeNodesWithNodeData(path+UbSystem::toString(step), nodes, datanames, data); - - fname = path+UbSystem::toString(step)+".bin"; - std::ofstream out(fname.c_str(), std::ios::out | std::ios::binary); - if (!out) - { - out.clear(); //flags ruecksetzen (ansonsten liefert utern if(!out) weiterhin true!!! - std::string path = UbSystem::getPathFromString(fname); - if (path.size()>0) { UbSystem::makeDirectory(path); out.open(fname.c_str(), std::ios::out | std::ios::binary); } - if (!out) throw UbException(UB_EXARGS, "couldn't open file "+fname); - } - - out.write((char*)&outValues[0], outValues.size()*sizeof(double)); - - out.close(); - - UBLOG(logINFO, "PressureCoefficientCoProcessor::writeValues() step: " << (int)step); - } -} -void PressureCoefficientCoProcessor::readValues(int step) -{ - if (comm->isRoot()) - { - std::string fname = path+UbSystem::toString(step)+".bin"; - std::ifstream in(fname.c_str(), std::ios::in | std::ios::binary); - if (!in) - { - throw UbException(UB_EXARGS, "couldn't open file "+fname); - } - - // get length of file: - in.seekg(0, in.end); - int length = (int)in.tellg(); - in.seekg(0, in.beg); - - outValues.resize(length/sizeof(double)); - - in.read((char*)&outValues[0], length); - - in.close(); - - UBLOG(logINFO, "PressureCoefficientCoProcessor::readValues() step: " << (int)step); - } -} -////////////////////////////////////////////////////////////////////////// -void PressureCoefficientCoProcessor::addInteractor(D3Q27InteractorPtr interactor) -{ - interactors.push_back(interactor); -} diff --git a/src/VirtualFluids/CoProcessors/PressureCoefficientCoProcessor.h b/src/VirtualFluids/CoProcessors/PressureCoefficientCoProcessor.h deleted file mode 100644 index bd9b2e1c7..000000000 --- a/src/VirtualFluids/CoProcessors/PressureCoefficientCoProcessor.h +++ /dev/null @@ -1,55 +0,0 @@ -#ifndef PressureCoefficientCoProcessor_h__ -#define PressureCoefficientCoProcessor_h__ - -#include <memory> -#include <string> -#include <vector> - -#include "CoProcessor.h" -#include "LBMSystem.h" - - -class GbCuboid3D; -class D3Q27Interactor; -class Communicator; -class Grid3D; -class UbScheduler; - -class PressureCoefficientCoProcessor: public CoProcessor -{ -public: - PressureCoefficientCoProcessor(std::shared_ptr<Grid3D> grid, std::shared_ptr<UbScheduler> s, - std::shared_ptr<GbCuboid3D> plane, const std::string& path, std::shared_ptr<Communicator> comm); - ~PressureCoefficientCoProcessor(); - - void process(double step) override; - - void addInteractor(std::shared_ptr<D3Q27Interactor> interactor); - void readValues(int step); - -protected: - void collectData(double step); - void calculateRho(); - void writeValues(int step); - -private: - std::shared_ptr<GbCuboid3D> plane; - std::string path; - std::shared_ptr<Communicator> comm; - std::vector<std::shared_ptr<D3Q27Interactor> > interactors; - int numberOfSteps; - double maxStep; - - std::vector<UbTupleFloat3> nodes; - std::vector<std::string> datanames; - std::vector<std::vector<double> > data; - - std::vector<double> outValues; - - typedef void(*CalcMacrosFct)(const LBMReal* const& /*feq[27]*/, LBMReal& /*(d)rho*/, LBMReal& /*vx1*/, LBMReal& /*vx2*/, LBMReal& /*vx3*/); - CalcMacrosFct calcMacros; -}; - -#endif // PressureDistributionCoProcessor_h__ - - diff --git a/src/VirtualFluids/CoProcessors/PressureDifferenceCoProcessor.cpp b/src/VirtualFluids/CoProcessors/PressureDifferenceCoProcessor.cpp deleted file mode 100644 index 1e73300ef..000000000 --- a/src/VirtualFluids/CoProcessors/PressureDifferenceCoProcessor.cpp +++ /dev/null @@ -1,102 +0,0 @@ -/* - * D3Q27RhoCoProcessor.cpp - * - * Created on: 28.12.2010 - * Author: kucher - */ - -#include "PressureDifferenceCoProcessor.h" - -#include <fstream> - -#include "IntegrateValuesHelper.h" -#include "LBMUnitConverter.h" -#include "Communicator.h" -#include "UbScheduler.h" -#include "Grid3D.h" - - -PressureDifferenceCoProcessor::PressureDifferenceCoProcessor(Grid3DPtr grid, UbSchedulerPtr s, const std::string& path, - IntegrateValuesHelperPtr h1, IntegrateValuesHelperPtr h2, - LBMReal rhoReal, LBMReal uReal, LBMReal uLB, - CommunicatorPtr comm) - - : CoProcessor(grid, s) - , path(path) - , h1(h1) - , h2(h2) - ,comm(comm) -{ - if (comm->getProcessID() == comm->getRoot()) - { - std::ofstream ostr; - std::string fname = path; - ostr.open(fname.c_str(), std::ios_base::out); - if(!ostr) - { - ostr.clear(); - std::string path = UbSystem::getPathFromString(fname); - if(path.size()>0){ UbSystem::makeDirectory(path); ostr.open(fname.c_str(), std::ios_base::out);} - if(!ostr) throw UbException(UB_EXARGS,"couldn't open file "+fname); - } - ostr << "step" << "\t" << "nodes1" << "\t" << "nodes2" << "\t"; - ostr << "sRho1" << "\t" << "p1_1" << "\t" << "sRho2" << "\t" << "p1_2" << "\t" << "deltaP1"<< "\t"; - ostr << "sPress1" << "\t" << "p2_1" << "\t" << "sPress2" << "\t" << "p2_2" << "\t" << "deltaP2"; - ostr << std::endl; - ostr.close(); - - factor1 = (1.0/3.0)*rhoReal*(uReal/uLB)*(uReal/uLB); - factor2 = rhoReal*(uReal/uLB)*(uReal/uLB); - } -} -////////////////////////////////////////////////////////////////////////// -PressureDifferenceCoProcessor::~PressureDifferenceCoProcessor() -{ -} -////////////////////////////////////////////////////////////////////////// -void PressureDifferenceCoProcessor::process(double step) -{ - if(scheduler->isDue(step) ) - collectData(step); -} -////////////////////////////////////////////////////////////////////////// -void PressureDifferenceCoProcessor::collectData(double step) -{ - h1->calculateMQ(); - h2->calculateMQ(); - - if (comm->getProcessID() == comm->getRoot()) - { - int istep = static_cast<int>(step); - std::ofstream ostr; - double nn1 = h1->getNumberOfFluidsNodes(); - double nn2 = h2->getNumberOfFluidsNodes(); - double rho1 = h1->getRho(); - double rho2 = h2->getRho(); - double p1_1 = (rho1/nn1) * factor1; - double p1_2 = (rho2/nn2) * factor1; - double dp1 = p1_1 - p1_2; - - //double press1 = h1->getPress(); - //double press2 = h2->getPress(); - //double p2_1 = (press1/nn1) * factor2; - //double p2_2 = (press2/nn2) * factor2; - //double dp2 = p2_1 - p2_2; - - std::string fname = path; - ostr.open(fname.c_str(), std::ios_base::out | std::ios_base::app); - if(!ostr) - { - ostr.clear(); - std::string path = UbSystem::getPathFromString(fname); - if(path.size()>0){ UbSystem::makeDirectory(path); ostr.open(fname.c_str(), std::ios_base::out | std::ios_base::app);} - if(!ostr) throw UbException(UB_EXARGS,"couldn't open file "+fname); - } - - ostr << istep << "\t" << nn1 << "\t" << nn2 << "\t"; - ostr << rho1 << "\t" << p1_1 << "\t" << rho2 << "\t" << p1_2 << "\t" << dp1 << "\t"; - //ostr << press1 << "\t" << p2_1 << "\t" << press2 << "\t" << p2_2 << "\t" << dp2; - ostr << std::endl; - ostr.close(); - } -} diff --git a/src/VirtualFluids/CoProcessors/PressureDifferenceCoProcessor.h b/src/VirtualFluids/CoProcessors/PressureDifferenceCoProcessor.h deleted file mode 100644 index bb830aeae..000000000 --- a/src/VirtualFluids/CoProcessors/PressureDifferenceCoProcessor.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * D3Q27PressureDifferenceCoProcessor.h - * - * Created on: 28.12.2010 - * Author: kucher - */ - -#ifndef D3Q27PRESSUREDIFFERENCECoProcessor_H -#define D3Q27PRESSUREDIFFERENCECoProcessor_H - -#include <memory> -#include <string> - -#include "CoProcessor.h" -#include "LBMSystem.h" - -class Communicator; -class Grid3D; -class UbScheduler; -class LBMUnitConverter; -class IntegrateValuesHelper; - -class PressureDifferenceCoProcessor: public CoProcessor { -public: - PressureDifferenceCoProcessor(std::shared_ptr<Grid3D> grid, std::shared_ptr<UbScheduler> s, const std::string& path, - std::shared_ptr<IntegrateValuesHelper> h1, std::shared_ptr<IntegrateValuesHelper> h2, - LBMReal rhoReal, LBMReal uReal, LBMReal uLB, - /*const LBMUnitConverterPtr conv,*/ std::shared_ptr<Communicator> comm); - virtual ~PressureDifferenceCoProcessor(); - - void process(double step) override; - -protected: - std::shared_ptr<IntegrateValuesHelper> h1, h2; - std::string path; - std::shared_ptr<LBMUnitConverter> conv; - void collectData(double step); - std::shared_ptr<Communicator> comm; - LBMReal factor1; //= (1/3)*rhoReal*(uReal/uLB)^2 for calculation pReal = rhoLB * (1/3)*rhoReal*(uReal/uLB)^2, rhoReal and uReal in SI - LBMReal factor2; //= rhoReal*(uReal/uLB)^2 for calculation pReal = press * rhoReal*(uReal/uLB)^2, rhoReal and uReal in SI -}; - - -#endif /* D3Q27RHODIFFERENCECoProcessor_H_ */ diff --git a/src/VirtualFluids/CoProcessors/QCriterionCoProcessor.cpp b/src/VirtualFluids/CoProcessors/QCriterionCoProcessor.cpp deleted file mode 100644 index 80c7f57ec..000000000 --- a/src/VirtualFluids/CoProcessors/QCriterionCoProcessor.cpp +++ /dev/null @@ -1,389 +0,0 @@ -#include "QCriterionCoProcessor.h" -#include "LBMKernel.h" -#include "BCProcessor.h" -#include "basics/writer/WbWriterVtkXmlASCII.h" -#include "DataSet3D.h" -#include "Grid3D.h" -#include "Block3D.h" - -#include "Communicator.h" -#include "UbScheduler.h" -#include "BCArray3D.h" - - -QCriterionCoProcessor::QCriterionCoProcessor(Grid3DPtr grid, const std::string& path, - WbWriter* const writer, - UbSchedulerPtr s, CommunicatorPtr comm) - : CoProcessor(grid, s), - path(path), - comm(comm), - writer(writer) -{ - init(); -} -////////////////////////////////////////////////////////////////////////// -void QCriterionCoProcessor::init() -{ - gridRank = comm->getProcessID(); - minInitLevel = this->grid->getCoarsestInitializedLevel(); - maxInitLevel = this->grid->getFinestInitializedLevel(); - - blockVector.resize(maxInitLevel+1); - - for(int level = minInitLevel; level<=maxInitLevel;level++) - { - grid->getBlocks(level, gridRank, true, blockVector[level]); //grid: private variable in CoProcessor. Initialized by filling with blocks - } -} -////////////////////////////////////////////////////////////////////////// -void QCriterionCoProcessor::process(double step) -{ - if(scheduler->isDue(step) ) - collectData(step); - - UBLOG(logDEBUG3, "QCriterionCoProcessor::update:" << step); -} -////////////////////////////////////////////////////////////////////////// -void QCriterionCoProcessor::collectData(double step) -{ - int istep = static_cast<int>(step); - - for(int level = minInitLevel; level<=maxInitLevel;level++) - { - for(Block3DPtr block : blockVector[level]) - { - if (block) - { - addData(block); - - } - } - } - - std::string partName = writer->writeOctsWithNodeData(path+ UbSystem::toString(gridRank)+ "_" + UbSystem::toString(istep),nodes,cells,datanames,data); - size_t found=partName.find_last_of("//"); - std::string piece = partName.substr(found+1); - - std::vector<std::string> cellDataNames; - - //distributed writing as in MacroscopicValuesCoProcessor.cpp - std::vector<std::string> pieces = comm->gather(piece); //comm: MPI-Wrapper - if (comm->getProcessID() == comm->getRoot()) - { - std::string pname = WbWriterVtkXmlASCII::getInstance()->writeParallelFile(path+"_"+UbSystem::toString(istep),pieces,datanames,cellDataNames); - - std::vector<std::string> filenames; - filenames.push_back(pname); - if (step == CoProcessor::scheduler->getMinBegin()) //first time in timeseries - { - WbWriterVtkXmlASCII::getInstance()->writeCollection(path+"_collection",filenames,istep,false); - } - else - { - WbWriterVtkXmlASCII::getInstance()->addFilesToCollection(path+"_collection",filenames,istep,false); - } - UBLOG(logINFO,"QCriterionCoProcessor step: " << istep); - } - - clearData(); - - -} -////////////////////////////////////////////////////////////////////////// -void QCriterionCoProcessor::clearData() -{ - nodes.clear(); - cells.clear(); - datanames.clear(); - data.clear(); -} -////////////////////////////////////////////////////////////////////////// -void QCriterionCoProcessor::addData(const Block3DPtr block) -{ - UbTupleDouble3 org = grid->getBlockWorldCoordinates(block); - UbTupleDouble3 blockLengths = grid->getBlockLengths(block); - UbTupleDouble3 nodeOffset = grid->getNodeOffset(block); - double dx = grid->getDeltaX(block); - - //Diese Daten werden geschrieben: - datanames.resize(0); - datanames.push_back("q"); - datanames.push_back("scaleFactor"); - data.resize(datanames.size()); - - - ILBMKernelPtr kernel = block->getKernel(); - BCArray3DPtr bcArray = kernel->getBCProcessor()->getBCArray(); - DistributionArray3DPtr distributions = kernel->getDataSet()->getFdistributions(); - - int SWB,SEB,NEB,NWB,SWT,SET,NET,NWT; - - int minX1 = 0; - int minX2 = 0; - int minX3 = 0; - - int maxX1 = (int)(distributions->getNX1()); - int maxX2 = (int)(distributions->getNX2()); - int maxX3 = (int)(distributions->getNX3()); - - int currentLevel = block->getLevel(); - //nummern vergeben und node std::vector erstellen + daten sammeln - CbArray3D<int> nodeNumbers((int)maxX1, (int)maxX2, (int)maxX3,-1); - maxX1 -= 2; //-2 wegen ghost layer: - maxX2 -= 2; //0-maxXi-1 ist arraygroesse. - maxX3 -= 2; //ueberlapp 1 in +,- Richtung. zum schreiben werden statt feldern von 1 bis (max-2) felder von 0 bis max-3 verwendet! - - - int nr = (int)nodes.size(); - - for(int ix3=minX3; ix3<=maxX3; ix3++) - { - for(int ix2=minX2; ix2<=maxX2; ix2++) - { - for(int ix1=minX1; ix1<=maxX1; ix1++) - { - if(!bcArray->isUndefined(ix1,ix2,ix3) && !bcArray->isSolid(ix1,ix2,ix3)) - { - //nodeNumbers-vektor wird mit koordinaten befuellt - int index = 0; - nodeNumbers(ix1,ix2,ix3) = nr++; - nodes.push_back( makeUbTuple(float(val<1>(org) - val<1>(nodeOffset) + ix1*dx), - float(val<2>(org) - val<2>(nodeOffset) + ix2*dx), - float(val<3>(org) - val<3>(nodeOffset) + ix3*dx)) ); - - ///////////////////////////// - // Geschwindigkeitsvektoren - LBMReal vE[3]; - LBMReal vW[3]; - LBMReal vN[3]; - LBMReal vS[3]; - LBMReal vT[3]; - LBMReal vB[3]; - //hole geschwindigkeiten an nachbarknoten - getNeighborVelocities(1,0,0, ix1, ix2, ix3, block, vE, vW); - getNeighborVelocities(0,1,0, ix1, ix2, ix3, block, vN, vS); - getNeighborVelocities(0,0,1, ix1, ix2, ix3, block, vT, vB); - ////////////////////////////////// - //derivatives - LBMReal duxdy=(vN[xdir]-vS[xdir])*0.5; - LBMReal duydx=(vE[ydir]-vW[ydir])*0.5; - LBMReal duxdz=(vT[xdir]-vB[xdir])*0.5; - LBMReal duzdx=(vE[zdir]-vW[zdir])*0.5; - LBMReal duydz=(vT[ydir]-vB[ydir])*0.5; - LBMReal duzdy=(vN[zdir]-vS[zdir])*0.5; - - LBMReal duxdx=(vE[xdir]-vW[xdir])*0.5; - LBMReal duydy=(vN[ydir]-vS[ydir])*0.5; - LBMReal duzdz=(vT[zdir]-vB[zdir])*0.5; - - LBMReal scaleFactor=(double)(1<<(currentLevel-minInitLevel));//pow(2.0,(double)(currentLevel-minInitLevel));//finer grid -> current level higher. coarsest grid: currentLevel=minInitLevel=0 - // Q=-0.5*(S_ij S_ij - Omega_ij Omega_ij) => regions where vorticity is larger than strain rate - LBMReal q=-(duxdy*duydx+duxdz*duzdx+duydz*duzdy+duxdx*duxdx+duydy*duydy+duzdz*duzdz)*scaleFactor; - - data[index++].push_back( q ); - data[index++].push_back( scaleFactor ); - - } - } - } - } - maxX1 -= 1; - maxX2 -= 1; - maxX3 -= 1; - //cell vector erstellen - for(int ix3=minX3; ix3<=maxX3; ix3++) - { - for(int ix2=minX2; ix2<=maxX2; ix2++) - { - for(int ix1=minX1; ix1<=maxX1; ix1++) - { - if( (SWB=nodeNumbers( ix1 , ix2, ix3 )) >= 0 - && (SEB=nodeNumbers( ix1+1, ix2, ix3 )) >= 0 - && (NEB=nodeNumbers( ix1+1, ix2+1, ix3 )) >= 0 - && (NWB=nodeNumbers( ix1 , ix2+1, ix3 )) >= 0 - && (SWT=nodeNumbers( ix1 , ix2, ix3+1 )) >= 0 - && (SET=nodeNumbers( ix1+1, ix2, ix3+1 )) >= 0 - && (NET=nodeNumbers( ix1+1, ix2+1, ix3+1 )) >= 0 - && (NWT=nodeNumbers( ix1 , ix2+1, ix3+1 )) >= 0 ) - { - // for valid points: neighbors are added to cells-vector - cells.push_back( makeUbTuple(SWB,SEB,NEB,NWB,SWT,SET,NET,NWT) ); - } - } - } - } - -} -///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - -void QCriterionCoProcessor::getNeighborVelocities(int offx, int offy, int offz, int ix1, int ix2, int ix3, const Block3DPtr block, LBMReal* vE, LBMReal* vW) -{ - ILBMKernelPtr kernel = block->getKernel(); - BCArray3DPtr bcArray = kernel->getBCProcessor()->getBCArray(); - DistributionArray3DPtr distributions = kernel->getDataSet()->getFdistributions(); - - bool compressible = block->getKernel()->getCompressible(); - - int minX1 = 0; - int minX2 = 0; - int minX3 = 0; - - int maxX1 = (int)(distributions->getNX1()); - int maxX2 = (int)(distributions->getNX2()); - int maxX3 = (int)(distributions->getNX3()); - if (maxX1<3) throw UbException(UB_EXARGS,"QCriterionCoProcessor: NX1 too small for FD stencils!"); - maxX1 -= 2; - maxX2 -= 2; - maxX3 -= 2; - bool checkInterpolation=true; - bool neighNodeIsBC=false; - BoundaryConditionsPtr bcPtr; - - int rankSelf= block->getRank(); - if (!(offx+offy+offz)==1) throw UbException(UB_EXARGS,"getNeighborVelocities called for diagonal directions!"); - //////get neighbor nodes, if existent - if ((ix1==0 && offx==1) || (ix2==0 && offy==1) || (ix3==0 && offz==1)) - { - int RankNeighborW; - Vector3D orgNodeRW = grid->getNodeCoordinates(block, ix1, ix2, ix3); - double xp000= orgNodeRW[0]; - double yp000= orgNodeRW[1]; - double zp000= orgNodeRW[2]; - - int currentLevel = block->getLevel(); - UbTupleInt3 blockIndexes = grid->getBlockIndexes(xp000,yp000, zp000,currentLevel); - Block3DPtr blockNeighW; - - if ((val<1>(blockIndexes)!=0 && offx==1) || (val<2>(blockIndexes)!=0 && offy==1) || (val<3>(blockIndexes)!=0 && offz==1)) - { - - blockNeighW = grid->getBlock(val<1>(blockIndexes)-offx, val<2>(blockIndexes)-offy, val<3>(blockIndexes)-offz, currentLevel); - - } - else if (offx==1 && grid->isPeriodicX1()) - { - blockNeighW = grid->getBlock((grid->getNX1()-1), val<2>(blockIndexes), val<3>(blockIndexes), currentLevel); - } - else if (offy==1 && grid->isPeriodicX1()) - { - blockNeighW = grid->getBlock(val<1>(blockIndexes),(grid->getNX2()-1), val<3>(blockIndexes), currentLevel); - } - else if (offz==1 && grid->isPeriodicX1()) - { - blockNeighW = grid->getBlock( val<1>(blockIndexes), val<2>(blockIndexes),(grid->getNX3()-1), currentLevel); - } - else neighNodeIsBC; - - if(blockNeighW && blockNeighW->isActive()) - { - RankNeighborW= blockNeighW->getRank(); - } - else - { - - blockNeighW = block; - RankNeighborW= blockNeighW->getRank(); - checkInterpolation=false; - } - if (RankNeighborW!=rankSelf) - { - - blockNeighW = block; - RankNeighborW= blockNeighW->getRank(); - checkInterpolation=false; - } - - /////////////////////////////////////// - ////compute distribution at neighboring nodes from neighboring blocks - - if (checkInterpolation==false || neighNodeIsBC) - { - ILBMKernelPtr kernelW = blockNeighW->getKernel(); - BCArray3DPtr bcArrayW = kernelW->getBCProcessor()->getBCArray(); - DistributionArray3DPtr distributionsW = kernelW->getDataSet()->getFdistributions(); - LBMReal fW2[27]; - LBMReal fW[27]; - LBMReal f0[27]; - LBMReal fE[27]; - LBMReal v0[3]; - LBMReal vW2[3]; - //distributionsW->getDistribution(fW2, std::max(ix1+2*offx,1), std::max(ix2+2*offy,1), std::max(ix3+2*offz,1)); - //distributionsW->getDistribution(fW, std::max(ix1+offx,1), std::max(ix2+offy,1), std::max(ix3+offz,1)); - //distributionsW->getDistribution(f0, std::max(ix1 ,1), std::max(ix2 ,1), std::max(ix3 ,1)); - //distributions->getDistribution(fE, std::max(ix1+offx ,1), std::max(ix2+offy ,1), std::max(ix3+offz ,1)); //E:= plus 1 - distributionsW->getDistribution(fW2, std::max(ix1+2*offx,0), std::max(ix2+2*offy,0), std::max(ix3+2*offz,0)); - distributionsW->getDistribution(fW, std::max(ix1+offx,0), std::max(ix2+offy,0), std::max(ix3+offz,0)); - distributionsW->getDistribution(f0, std::max(ix1 ,0), std::max(ix2 ,0), std::max(ix3 ,0)); - distributions->getDistribution(fE, std::max(ix1+offx ,0), std::max(ix2+offy ,0), std::max(ix3+offz ,0)); //E:= plus 1 - - computeVelocity(fE,vE,compressible); - computeVelocity(fW,vW,compressible); - computeVelocity(fW2,vW2,compressible); - computeVelocity(f0,v0,compressible); - //second order non-symetric interpolation - vW[0]=v0[0]*1.5-vW[0]+0.5*vW2[0]; - vW[1]=v0[1]*1.5-vW[1]+0.5*vW2[1]; - vW[2]=v0[2]*1.5-vW[2]+0.5*vW2[2]; - //throw UbException(UB_EXARGS,"Parallel or Non-Uniform Simulation -- not yet implemented"); - } - else - { - ILBMKernelPtr kernelW = blockNeighW->getKernel(); - BCArray3DPtr bcArrayW = kernelW->getBCProcessor()->getBCArray(); - DistributionArray3DPtr distributionsW = kernelW->getDataSet()->getFdistributions(); - LBMReal fW[27]; - - if (offx==1) - { - distributionsW->getDistribution(fW, (distributions->getNX1())-1, ix2, ix3); //moved one block backward, now get last entry - } - else if (offy==1) - { - distributionsW->getDistribution(fW, ix1,(distributions->getNX2())-1, ix3); - - } - else if (offz==1) - { - distributionsW->getDistribution(fW, ix1,ix2,distributions->getNX3()-1); - } - computeVelocity(fW,vW,compressible); - } - - - } - else - { - //data available in current block: - LBMReal fW[27]; - distributions->getDistribution(fW, ix1-offx, ix2-offy, ix3-offz); - computeVelocity(fW,vW,compressible); - - } - if (checkInterpolation==true) - { - //in plus-direction data is available in current block because of ghost layers - LBMReal fE[27]; - distributions->getDistribution(fE, ix1+offx, ix2+offy, ix3+offz); //E:= plus 1 - computeVelocity(fE,vE,compressible); - } -} -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - -void QCriterionCoProcessor::computeVelocity(LBMReal* f, LBMReal* v, bool compressible) -{ - ////////////////////////////////////////////////////////////////////////// - //compute x,y,z-velocity components from distribution - ////////////////////////////////////////////////////////////////////////// - if (compressible) - { - v[xdir] = D3Q27System::getCompVelocityX1(f); - v[ydir] = D3Q27System::getCompVelocityX2(f); - v[zdir] = D3Q27System::getCompVelocityX3(f); - } - else - { - v[xdir] = D3Q27System::getIncompVelocityX1(f); - v[ydir] = D3Q27System::getIncompVelocityX2(f); - v[zdir] = D3Q27System::getIncompVelocityX3(f); - } -} diff --git a/src/VirtualFluids/CoProcessors/QCriterionCoProcessor.h b/src/VirtualFluids/CoProcessors/QCriterionCoProcessor.h deleted file mode 100644 index 4514a2885..000000000 --- a/src/VirtualFluids/CoProcessors/QCriterionCoProcessor.h +++ /dev/null @@ -1,69 +0,0 @@ -//! \file QCriterionCoProcessor.h -//! \brief Created on: 25.08.2013 -//! \author: Sonja Uphoff - - -#ifndef QCriterionCoProcessor_H -#define QCriterionCoProcessor_H - -#include <memory> -#include <string> -#include <vector> - -#include "CoProcessor.h" -#include "LBMSystem.h" - -class Communicator; -class Grid3D; -class UbScheduler; -class WbWriter; -class Block3D; - -class QCriterionCoProcessor; -typedef std::shared_ptr<QCriterionCoProcessor> QCriterionCoProcessorPtr; - -//! \brief Computes the value Q with which vortices can be visualized as isocontours to Q=0, writes to .vtk, For uniform, serial setups only! -//! \details writes at given time intervals specified in scheduler (s) -//! Processing: paraview, take isolines of entry for Q-criterion vortex detection -//! Q-Criterion: Visualize Vorteces as regions where Vorticity is larger than strain rate (Hunt, 1988) -//! \author Sonja Uphoff - -class QCriterionCoProcessor : public CoProcessor -{ -public: - QCriterionCoProcessor(std::shared_ptr<Grid3D> grid, const std::string& path, WbWriter* const writer, - std::shared_ptr<UbScheduler> s, std::shared_ptr<Communicator> comm); - //! Make update if timestep is write-timestep specified in UbSchedulerPtr s - void process(double step) override; - -protected: - //! Prepare data and write in .vtk file - void collectData(double step); - //! Q is computed for all points in a block. Data for writing is added to data and cell vectors. - void addData(const std::shared_ptr<Block3D> block); - //! After writing to .vtk-file, all vectors are reset - void clearData(); - //! Computes macroscopic velocities - void computeVelocity(LBMReal* f, LBMReal* v, bool compressible); - //! Computes average and RMS values of macroscopic quantities - void getNeighborVelocities(int offx, int offy, int offz, int ix1, int ix2, int ix3,const std::shared_ptr<Block3D> block, LBMReal* vE,LBMReal* vW); - -private: - void init(); - std::vector<UbTupleFloat3> nodes; - std::vector<UbTupleInt8> cells; - std::vector<std::string> datanames; //only one entry for QKrit-CoProcessor: Q - std::vector<std::vector<double> > data; - std::vector<std::vector<std::shared_ptr<Block3D> > > blockVector; - int minInitLevel; //go through all levels for block vector of current process from minInitLevel to maxInitLevel - int maxInitLevel; - int gridRank; //comm-Rank des aktuellen prozesses - std::string path; - WbWriter* writer; - std::shared_ptr<Communicator> comm; - enum Values{xdir = 0, ydir = 1, zdir = 2}; //labels for the different components -}; - -#endif - - diff --git a/src/VirtualFluids/CoProcessors/RestartCoProcessor.cpp b/src/VirtualFluids/CoProcessors/RestartCoProcessor.cpp deleted file mode 100644 index a7f6caae6..000000000 --- a/src/VirtualFluids/CoProcessors/RestartCoProcessor.cpp +++ /dev/null @@ -1,380 +0,0 @@ -#include "RestartCoProcessor.h" -#include <boost/archive/binary_oarchive.hpp> -#include <boost/archive/binary_iarchive.hpp> - -#include <boost/archive/text_oarchive.hpp> -#include <boost/archive/text_iarchive.hpp> - -#include <basics/utilities/UbFileOutputASCII.h> -#include <basics/utilities/UbFileInputASCII.h> - -#include <boost/serialization/map.hpp> - -#include "MetisPartitioningGridVisitor.h" -#include "BCArray3D.h" -#include "CoordinateTransformation3D.h" -#include "BoostSerializationClassExportHelper.h" - -#include <MemoryUtil.h> - - -#include "Grid3D.h" -#include "Grid3DVisitor.h" -#include "Block3DVisitor.h" -#include "Communicator.h" -#include "UbScheduler.h" -#include "Block3D.h" - - -RestartCoProcessor::RestartCoProcessor(Grid3DPtr& grid, UbSchedulerPtr s, CommunicatorPtr comm, const std::string& path, ArchiveType type) : - CoProcessor(grid, s), - grid(grid), - path(path), - archiveType(type), - comm(comm) -{ - restartStep = 0; - this->path = path + "/checkpoints"; - metafile = this->path + "/LastCP.txt"; - if (comm->getProcessID() == comm->getRoot()) - { - checkMetafile(); - } - comm->barrier(); - grid = restart(); -} -////////////////////////////////////////////////////////////////////////// -RestartCoProcessor::RestartCoProcessor(Grid3DPtr& grid, UbSchedulerPtr s, CommunicatorPtr comm, const std::string& path, int restartStep, ArchiveType type) : -CoProcessor(grid, s), -grid(grid), -path(path), -archiveType(type), -comm(comm), -restartStep(restartStep) -{ - this->path = path + "/checkpoints"; - metafile = this->path + "/LastCP.txt"; - if (comm->getProcessID() == comm->getRoot()) - { - writeMetafile(restartStep); - } - comm->barrier(); - grid = restart(); -} -////////////////////////////////////////////////////////////////////////// -RestartCoProcessor::~RestartCoProcessor() -{ - -} -////////////////////////////////////////////////////////////////////////// -void RestartCoProcessor::process(double step) -{ - if(scheduler->isDue(step) && step != restartStep) - { - doCheckPoint(int(step)); - - if(comm->getProcessID() == comm->getRoot()) UBLOG(logINFO,"RestartCoProcessor save step: " << step); - - UBLOG(logDEBUG3, "RestartCoProcessor::update:" << step); - } -} -////////////////////////////////////////////////////////////////////////// -void RestartCoProcessor::addCoProcessor( CoProcessorPtr p ) -{ - CoProcessors.push_back(p); -} -////////////////////////////////////////////////////////////////////////// -CoProcessorPtr RestartCoProcessor::getCoProcessor(int index) -{ - return CoProcessors[index]; -} -////////////////////////////////////////////////////////////////////////// -std::vector<CoProcessorPtr> RestartCoProcessor::getCoProcessors() -{ - return CoProcessors; -} -////////////////////////////////////////////////////////////////////////// -void RestartCoProcessor::doCheckPoint(int step) -{ - UBLOG(logDEBUG3,"Save check point - start"); - - int pid = comm->getProcessID(); - std::string filename = path + "/checkpoint" + UbSystem::toString(step) + "/checkpoint" + UbSystem::toString(pid) + "_" + UbSystem::toString(step); - - if (archiveType == TXT) - { - saveTxtArchive(filename + ".txt", grid); - } - else if(archiveType == BINARY) - { - saveBinArchive(filename + ".bin", grid); - } - - comm->barrier(); - - if (comm->getProcessID() == comm->getRoot()) - { - writeMetafile(step); - } - - UBLOG(logDEBUG3,"Save check point - end"); -} -////////////////////////////////////////////////////////////////////////// -Grid3DPtr RestartCoProcessor::restart() -{ - restartStep = readMetafile(); - - comm->barrier(); - - if (restartStep > 0) - { - if(comm->getProcessID() == comm->getRoot()) UBLOG(logINFO,"Load check point - start"); - int pid = comm->getProcessID(); - std::string filename = path + "/checkpoint" + UbSystem::toString(restartStep) + "/checkpoint" + UbSystem::toString(pid) + "_" + UbSystem::toString(restartStep); - - if (archiveType == TXT) - { - loadTxtArchive(filename + ".txt"); - } - else if(archiveType == BINARY) - { - loadBinArchive(filename + ".bin"); - } - - this->reconnect(grid); - if(comm->getProcessID() == comm->getRoot()) UBLOG(logINFO,"Load check point - end"); - - if(comm->getProcessID() == comm->getRoot()) UBLOG(logINFO,"RestartCoProcessor restart step: " << restartStep); - - return grid; - } - else - { - return grid; - } - -} -////////////////////////////////////////////////////////////////////////// -void RestartCoProcessor::acceptGridVisitors() -{ - for(Grid3DVisitorPtr v : gridVisitors) - { - grid->accept(*(v.get())); - } -} -////////////////////////////////////////////////////////////////////////// -void RestartCoProcessor::acceptBlockVisitors() -{ - for(Block3DVisitorPtr v : blockVisitors) - { - grid->accept(*(v.get())); - } -} -////////////////////////////////////////////////////////////////////////// -void RestartCoProcessor::addGridVisitor( Grid3DVisitorPtr v ) -{ - gridVisitors.push_back(v); -} -////////////////////////////////////////////////////////////////////////// -void RestartCoProcessor::addBlockVisitor( Block3DVisitorPtr v ) -{ - blockVisitors.push_back(v); -} -////////////////////////////////////////////////////////////////////////// -void RestartCoProcessor::saveTxtArchive( std::string filename, Grid3DPtr grid ) -{ - std::ofstream file(filename.c_str()); - if(!file) - { - file.clear(); - std::string path = UbSystem::getPathFromString(filename); - if(path.size()>0){ UbSystem::makeDirectory(path); file.open(filename.c_str());} - if(!file) throw UbException(UB_EXARGS,"couldn't open file "+filename); - } - boost::archive::text_oarchive oa(file); - oa.register_type<Grid3D>(); - oa << grid; - - int psize = (int)CoProcessors.size(); - oa << psize; - - oa.register_type<CoProcessorPtr>(); - for(CoProcessorPtr pp : CoProcessors) - { - oa << pp; - } - file.close(); -} -////////////////////////////////////////////////////////////////////////// -void RestartCoProcessor::loadTxtArchive( std::string filename ) -{ - std::ifstream file(filename.c_str()); - if (!file.is_open()) UB_THROW( UbException(UB_EXARGS,"Can not open check point file \"" + filename + "\"")); - boost::archive::text_iarchive ia(file); - ia.register_type<Grid3D>(); - ia >> grid; - - int psize; - ia >> psize; - - ia.register_type<CoProcessorPtr>(); - for (int i = 0; i < psize; i++) - { - CoProcessorPtr pp; - ia >> pp; - pp->reconnect(grid); - CoProcessors.push_back(pp); - } - file.close(); -} -////////////////////////////////////////////////////////////////////////// -void RestartCoProcessor::saveBinArchive( std::string filename, Grid3DPtr grid ) -{ - //impotent for binary archive add std::ios::binary - std::ofstream file(filename.c_str(), std::ios::binary); - if(!file) - { - file.clear(); - std::string path = UbSystem::getPathFromString(filename); - if(path.size()>0){ UbSystem::makeDirectory(path); file.open(filename.c_str());} - if(!file) throw UbException(UB_EXARGS,"couldn't open file "+filename); - } - boost::archive::binary_oarchive oa(file); - oa.register_type<Grid3D>(); - oa << grid; - - int psize = (int)CoProcessors.size(); - oa << psize; - - oa.register_type<CoProcessorPtr>(); - for(CoProcessorPtr pp : CoProcessors) - { - oa << pp; - } - file.close(); -} -////////////////////////////////////////////////////////////////////////// -void RestartCoProcessor::loadBinArchive( std::string filename ) -{ - //impotent for binary archive add std::ios::binary - std::ifstream file(filename.c_str(), std::ios::binary); - if (!file.is_open()) UB_THROW( UbException(UB_EXARGS,"Can not open check point file \"" + filename + "\"")); - boost::archive::binary_iarchive ia(file); - ia.register_type<Grid3D>(); - ia >> grid; - - int psize; - ia >> psize; - - ia.register_type<CoProcessorPtr>(); - for (int i = 0; i < psize; i++) - { - CoProcessorPtr pp; - ia >> pp; - pp->reconnect(grid); - CoProcessors.push_back(pp); - } - file.close(); -} -////////////////////////////////////////////////////////////////////////// -void RestartCoProcessor::writeMetafile(int step ) -{ - UbFileOutputASCII out(metafile); - out.writeInteger(step); -} -////////////////////////////////////////////////////////////////////////// -int RestartCoProcessor::readMetafile() -{ - UbFileInputASCII in(metafile); - return in.readInteger(); -} -////////////////////////////////////////////////////////////////////////// -void RestartCoProcessor::checkMetafile() -{ - std::ifstream file(metafile.c_str()); - if (!file.is_open()) - { - writeMetafile(0); - return; - } - file.close(); -} -////////////////////////////////////////////////////////////////////////// -void RestartCoProcessor::writeDistributedGrid(Grid3DPtr sgrid, int numberOfProcesses) -{ - using namespace std; - - Grid3DVisitorPtr metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::BSW, MetisPartitioner::RECURSIVE)); - std::dynamic_pointer_cast<MetisPartitioningGridVisitor>(metisVisitor)->setNumberOfProcesses(numberOfProcesses); - sgrid->accept(metisVisitor); - - int minInitLevel = sgrid->getCoarsestInitializedLevel(); - int maxInitLevel = sgrid->getFinestInitializedLevel(); - - for (int i = 0; i<numberOfProcesses; i++) - { - UBLOG(logINFO, "Create dump file for rank " << i <<" - start"); - Grid3DPtr newGrid(new Grid3D()); - newGrid->setRank(i); - newGrid->setDeltaX(sgrid->getDeltaX(0)); - newGrid->setNX1(sgrid->getNX1()); - newGrid->setNX2(sgrid->getNX2()); - newGrid->setNX3(sgrid->getNX3()); - newGrid->setCoordinateTransformator(sgrid->getCoordinateTransformator()); - UbTupleInt3 blockNX = sgrid->getBlockNX(); - newGrid->setBlockNX(val<1>(blockNX), val<2>(blockNX), val<3>(blockNX)); - Grid3D::Interactor3DSet interactors = sgrid->getInteractors(); - for(int inter=0; inter < interactors.size(); inter++) - { - newGrid->addInteractor(interactors[inter]); - } - - for (int level = minInitLevel; level<=maxInitLevel; level++) - { - std::vector<Block3DPtr> blockVector; - grid->getBlocks(level, blockVector); - for(Block3DPtr block : blockVector) - { - if (block) - { - if (block->getRank() == i) - { - newGrid->addBlock(block); - } - else - { - Block3DPtr newBlock(new Block3D(block->getX1(), block->getX2(), block->getX3(), block->getLevel())); - newBlock->setRank(block->getRank()); - newGrid->addBlock(newBlock); - } - } - } - } - - std::string filename = path+"/checkpoint"+UbSystem::toString(1)+"/checkpoint"+UbSystem::toString(i)+"_"+UbSystem::toString(1); - - if (archiveType==TXT) - { - saveTxtArchive(filename+".txt", newGrid); - } - else if (archiveType==BINARY) - { - saveBinArchive(filename+".bin", newGrid); - } - - UBLOG(logINFO, "Create dump file for rank " << i <<" - end"); - } - writeMetafile(1); -} -////////////////////////////////////////////////////////////////////////// -void RestartCoProcessor::setArchiveType(ArchiveType type) -{ - archiveType = type; -} -////////////////////////////////////////////////////////////////////////// -RestartCoProcessor::ArchiveType RestartCoProcessor::getArchiveType() -{ - return archiveType; -} - - diff --git a/src/VirtualFluids/CoProcessors/RestartCoProcessor.h b/src/VirtualFluids/CoProcessors/RestartCoProcessor.h deleted file mode 100644 index d39bc49e9..000000000 --- a/src/VirtualFluids/CoProcessors/RestartCoProcessor.h +++ /dev/null @@ -1,63 +0,0 @@ -#ifndef RESTARTER_H -#define RESTARTER_H - -#include <memory> -#include <string> -#include <vector> - -#include "CoProcessor.h" - - -class Grid3D; -class Grid3DVisitor; -class Block3DVisitor; -class Communicator; -class UbScheduler; - -class RestartCoProcessor; -typedef std::shared_ptr<RestartCoProcessor> RestartCoProcessorPtr; - -class RestartCoProcessor : public CoProcessor -{ -public: - enum ArchiveType {TXT, BINARY}; -public: - RestartCoProcessor(std::shared_ptr<Grid3D>& grid, std::shared_ptr<UbScheduler> s, std::shared_ptr<Communicator> comm, const std::string& path, ArchiveType type = BINARY); - RestartCoProcessor(std::shared_ptr<Grid3D>& grid, std::shared_ptr<UbScheduler> s, std::shared_ptr<Communicator> comm, const std::string& path, int restartStep, ArchiveType type = BINARY); - ~RestartCoProcessor(); - void process(double step); - void addCoProcessor(CoProcessorPtr p); - CoProcessorPtr getCoProcessor(int index); - std::vector<CoProcessorPtr> getCoProcessors(); - void addGridVisitor(std::shared_ptr<Grid3DVisitor> v); - void addBlockVisitor(std::shared_ptr<Block3DVisitor> v); - void doCheckPoint(int step); - std::shared_ptr<Grid3D> restart(); - void writeDistributedGrid(std::shared_ptr<Grid3D> grid, int numberOfProcesses); - void setArchiveType(ArchiveType type); - ArchiveType getArchiveType(); - -protected: - void acceptGridVisitors(); - void acceptBlockVisitors(); - void saveTxtArchive(std::string filename, std::shared_ptr<Grid3D> grid); - void loadTxtArchive(std::string filename); - void saveBinArchive(std::string filename, std::shared_ptr<Grid3D> grid); - void loadBinArchive(std::string filename); - void writeMetafile(int step); - int readMetafile(); - void checkMetafile(); - -private: - std::vector<CoProcessorPtr> CoProcessors; - std::vector<std::shared_ptr<Grid3DVisitor> > gridVisitors; - std::vector<std::shared_ptr<Block3DVisitor>> blockVisitors; - std::shared_ptr<Grid3D> grid; - std::string path; - ArchiveType archiveType; - std::shared_ptr<Communicator> comm; - int restartStep; - std::string metafile; -}; - -#endif diff --git a/src/VirtualFluids/CoProcessors/ShearStressCoProcessor.cpp b/src/VirtualFluids/CoProcessors/ShearStressCoProcessor.cpp deleted file mode 100644 index 367ab8c97..000000000 --- a/src/VirtualFluids/CoProcessors/ShearStressCoProcessor.cpp +++ /dev/null @@ -1,701 +0,0 @@ -#include "ShearStressCoProcessor.h" -#include "BCProcessor.h" -#include "WbWriterVtkXmlASCII.h" - -#include "Block3D.h" -#include "DataSet3D.h" -#include "LBMKernel.h" -#include "Communicator.h" -#include "D3Q27Interactor.h" -#include "UbScheduler.h" -#include "BCArray3D.h" -#include "InterpolationProcessor.h" - -ShearStressCoProcessor::ShearStressCoProcessor(Grid3DPtr grid, const std::string& path, - WbWriter* const writer, - UbSchedulerPtr s,UbSchedulerPtr rs) - : CoProcessor(grid, s), - Resetscheduler(rs), - path(path), - writer(writer) -{ - CommunicatorPtr comm = Communicator::getInstance(); - normals.push_back(0); - normals.push_back(0); - normals.push_back(1); - gridRank = grid->getRank(); - minInitLevel = this->grid->getCoarsestInitializedLevel(); - maxInitLevel = this->grid->getFinestInitializedLevel(); - - blockVector.resize(maxInitLevel+1); - for(int level = minInitLevel; level<=maxInitLevel;level++) - { - grid->getBlocks(level, gridRank, true, blockVector[level]); - for(Block3DPtr block : blockVector[level]) - { - UbTupleInt3 nx = grid->getBlockNX(); - ShearStressValuesArray3DPtr shearStressValues = ShearStressValuesArray3DPtr(new ShearStressValuesArray3D(14, val<1>(nx)+1, val<2>(nx)+1, val<3>(nx)+1, 0.0)); - block->getKernel()->getDataSet()->setShearStressValues(shearStressValues); - } - } -} -////////////////////////////////////////////////////////////////////////// -ShearStressCoProcessor::~ShearStressCoProcessor() -{ - -} -////////////////////////////////////////////////////////////////////////// -void ShearStressCoProcessor::process( double step ) -{ - if (step==0) - { - initDistance(); - } - calculateShearStress(step); - if(scheduler->isDue(step) ) - collectData(step); - UBLOG(logDEBUG3, "D3Q27ShearStressCoProcessor::update:" << step); -} -////////////////////////////////////////////////////////////////////////// -void ShearStressCoProcessor::collectData(double step) -{ - using namespace std; - - int istep = int(step); - addData(); - - //string partName = writer->writeNodesWithNodeData(path+ UbSystem::toString(gridRank)+ "_" + UbSystem::toString(istep),nodes,datanames,data); - //size_t found=partName.find_last_of("//"); - //string piece = partName.substr(found+1); - - //vector<string> cellDataNames; - - //CommunicatorPtr comm = Communicator::getInstance(); - //vector<string> pieces = comm->gatherStrings(piece); - //if (comm->getProcessID() == comm->getRoot()) - //{ - // string pname = WbWriterVtkXmlASCII::getInstance()->writeParallelFile(path+"_"+UbSystem::toString(istep),pieces,datanames,cellDataNames); - - // vector<string> filenames; - // filenames.push_back(pname); - // if (step == CoProcessor::scheduler->getMinBegin()) - // { - // WbWriterVtkXmlASCII::getInstance()->writeCollection(path+"__Shear_collection",filenames,istep,false); - // } - // else - // { - // WbWriterVtkXmlASCII::getInstance()->addFilesToCollection(path+"__Shear_collection",filenames,istep,false); - // } - // UBLOG(logINFO,"D3Q27ShearStressCoProcessor step: " << istep); - //} - - string pfilePath, partPath, subfolder, cfilePath; - subfolder = "shs"+UbSystem::toString(istep); - pfilePath = path+"/shs/"+subfolder; - cfilePath = path+"/shs/shs_collection"; - partPath = pfilePath+"/shs"+UbSystem::toString(gridRank)+ "_" + UbSystem::toString(istep); - - string partName = writer->writeNodesWithNodeData(partPath,nodes,datanames,data); - size_t found=partName.find_last_of("/"); - string piece = partName.substr(found+1); - piece = subfolder + "/" + piece; - - vector<string> cellDataNames; - CommunicatorPtr comm = Communicator::getInstance(); - vector<string> pieces = comm->gather(piece); - if (comm->getProcessID() == comm->getRoot()) - { - string pname = WbWriterVtkXmlASCII::getInstance()->writeParallelFile(pfilePath,pieces,datanames,cellDataNames); - found=pname.find_last_of("/"); - piece = pname.substr(found+1); - - vector<string> filenames; - filenames.push_back(piece); - if (step == CoProcessor::scheduler->getMinBegin()) - { - WbWriterVtkXmlASCII::getInstance()->writeCollection(cfilePath,filenames,istep,false); - } - else - { - WbWriterVtkXmlASCII::getInstance()->addFilesToCollection(cfilePath,filenames,istep,false); - } - UBLOG(logINFO,"D3Q27ShearStressCoProcessor step: " << istep); - } - - clearData(); -} -////////////////////////////////////////////////////////////////////////// -void ShearStressCoProcessor::clearData() -{ - nodes.clear(); - datanames.clear(); - data.clear(); -} -////////////////////////////////////////////////////////////////////////// -void ShearStressCoProcessor::calculateShearStress(double timeStep) -{ - using namespace D3Q27System; - - LBMReal f[27]; - LBMReal vx, vy, vz, sxx, syy, szz, sxy, syz, sxz; - - for(D3Q27InteractorPtr interactor : interactors) - { - typedef std::map<Block3DPtr, std::set< std::vector<int> > > TransNodeIndicesMap; - for(TransNodeIndicesMap::value_type t : interactor->getBcNodeIndicesMap()) - { - Block3DPtr block = t.first; - std::set< std::vector<int> >& transNodeIndicesSet = t.second; - - ILBMKernelPtr kernel = block->getKernel(); - BCArray3DPtr bcArray = kernel->getBCProcessor()->getBCArray(); - DistributionArray3DPtr distributions = kernel->getDataSet()->getFdistributions(); - ShearStressValuesArray3DPtr ssv = kernel->getDataSet()->getShearStressValues(); - - int ghostLayer = kernel->getGhostLayerWidth(); - LBMReal collFactor = kernel->getCollisionFactor(); - - int minX1 = ghostLayer; - int maxX1 = (int)bcArray->getNX1() - 1 - ghostLayer; - int minX2 = ghostLayer; - int maxX2 = (int)bcArray->getNX2() - 1 - ghostLayer; - int minX3 = ghostLayer; - int maxX3 = (int)bcArray->getNX3() - 1 - ghostLayer; - - for(std::vector<int> node : transNodeIndicesSet) - { - int ix1 = node[0]; - int ix2 = node[1]; - int ix3 = node[2]; - - //without ghost nodes - if (ix1 < minX1 || ix1 > maxX1 || ix2 < minX2 || ix2 > maxX2 ||ix3 < minX3 || ix3 > maxX3 ) continue; - - if(bcArray->isFluid(ix1,ix2,ix3)) - { - double q=(*ssv)(normalq,ix1,ix2,ix3) ; - double numPoint=(*ssv)(numberOfPoint,ix1,ix2,ix3) ; - if (q==0||numPoint!=3)continue; - // if (q==0)continue; - ////////////////////////////////////////////////////////////////////////// - //read distribution - //////////////////////////////////////////////////////////////////////////// - distributions->getDistribution(f, ix1, ix2, ix3); - ////////////////////////////////////////////////////////////////////////// - //compute velocity - ////////////////////////////////////////////////////////////////////////// - vx = ((((f[TNE]-f[BSW]) + (f[TSE]-f[BNW])) + ((f[BSE]-f[TNW]) + (f[BNE]-f[TSW]))) + - (((f[BE]-f[TW]) + (f[TE]-f[BW])) + ((f[SE]-f[NW]) + (f[NE]-f[SW]))) + - (f[E]-f[W])); - - vy = ((((f[TNE]-f[BSW]) + (f[BNW]-f[TSE])) + ((f[TNW]-f[BSE]) + (f[BNE]-f[TSW]))) + - (((f[BN]-f[TS]) + (f[TN]-f[BS])) + ((f[NW]-f[SE]) + (f[NE]-f[SW]))) + - (f[N]-f[S])); - - vz = ((((f[TNE]-f[BSW]) + (f[TSE]-f[BNW])) + ((f[TNW]-f[BSE]) + (f[TSW]-f[BNE]))) + - (((f[TS]-f[BN]) + (f[TN]-f[BS])) + ((f[TW]-f[BE]) + (f[TE]-f[BW]))) + - (f[T]-f[B])); - - - sxy = 3.0 * collFactor/(collFactor - 1.0)* ( ((f[TNE] + f[BSW])-(f[TSE]+f[BNW]))+(-(f[BSE]+f[TNW])+ (f[TSW]+f[BNE])) - +(((f[NE] + f[SW]) - (f[SE] + f[NW]))) -vx*vy); - - sxz = 3.0 * collFactor/(collFactor-1.0)*(((f[TNE] + f[BSW])+(f[TSE]+f[BNW]))+(-(f[BSE]+f[TNW])- (f[TSW]+f[BNE])) - +((f[TE] + f[BW])-(f[BE]+ f[TW])) -vx*vz); - - syz = 3.0 * collFactor/(collFactor-1.0)*(((f[TNE] + f[BSW])-(f[TSE]+f[BNW]))+((f[BSE]+f[TNW])- (f[TSW]+f[BNE])) - +(-(f[BN] + f[TS]) + (f[TN] + f[BS])) -vy*vz); - - LBMReal dxxMyy =3.0/2.0 * collFactor/(collFactor-1.0)* (((f[TE] + f[BW])+(f[BE]+ f[TW])) - -((f[BN] + f[TS]) + (f[TN] + f[BS]))+((f[E] + f[W])-(f[N] + f[S]))-vx*vx+vy*vy); - - LBMReal dxxMzz =3.0/2.0 * collFactor/(collFactor-1.0)*((((f[NE] + f[SW]) + (f[SE] + f[NW])) - -((f[BN] + f[TS]) + (f[TN] + f[BS])))+((f[E] + f[W])-(f[T] + f[B])) -vx*vx +vz*vz); - - // LBMReal dyyMzz =3.0/2.0 *collFactor/(collFactor-1.0)*((((f[NE] + f[SW]) + (f[SE] + f[NW]))-((f[TE] + f[BW])+(f[BE]+ f[TW]))) - // +((f[N] + f[S])-(f[T] + f[B])) -vy*vy +vz*vz); - - sxx=(dxxMyy+dxxMzz)/3.0; // weil dxxPyyPzz=0 - - syy=(dxxMzz-2*dxxMyy)/3.0; - - szz=(dxxMyy-2*dxxMzz)/3.0; - - ////////////////////////////////////////////////////////////////////////// - //compute average values - ////////////////////////////////////////////////////////////////////////// - (*ssv)(AvVx,ix1,ix2,ix3) = ((*ssv)(AvVx,ix1,ix2,ix3)*timeStep + vx)/(timeStep+1.0); - (*ssv)(AvVy,ix1,ix2,ix3) = ((*ssv)(AvVy,ix1,ix2,ix3)*timeStep + vy)/(timeStep+1.0); - (*ssv)(AvVz,ix1,ix2,ix3) = ((*ssv)(AvVz,ix1,ix2,ix3)*timeStep + vz)/(timeStep+1.0); - - (*ssv)(AvSxx,ix1,ix2,ix3) = ((*ssv)(AvSxx,ix1,ix2,ix3)*timeStep + sxx)/(timeStep+1.0); - (*ssv)(AvSyy,ix1,ix2,ix3) = ((*ssv)(AvSyy,ix1,ix2,ix3)*timeStep + syy)/(timeStep+1.0); - (*ssv)(AvSzz,ix1,ix2,ix3) = ((*ssv)(AvSzz,ix1,ix2,ix3)*timeStep + szz)/(timeStep+1.0); - (*ssv)(AvSxy,ix1,ix2,ix3) = ((*ssv)(AvSxy,ix1,ix2,ix3)*timeStep + sxy)/(timeStep+1.0); - (*ssv)(AvSyz,ix1,ix2,ix3) = ((*ssv)(AvSyz,ix1,ix2,ix3)*timeStep + syz)/(timeStep+1.0); - (*ssv)(AvSxz,ix1,ix2,ix3) = ((*ssv)(AvSxz,ix1,ix2,ix3)*timeStep + sxz)/(timeStep+1.0); - } - } - - } - } -} -////////////////////////////////////////////////////////////////////////// -void ShearStressCoProcessor::addData() -{ - //Diese Daten werden geschrieben: - datanames.resize(0); - datanames.push_back("y^plus"); - datanames.push_back("u_tau"); - //datanames.push_back("yPlusFD"); - - data.resize(datanames.size()); - - for(D3Q27InteractorPtr interactor : interactors) - { - typedef std::map<Block3DPtr, std::set< std::vector<int> > > TransNodeIndicesMap; - for(TransNodeIndicesMap::value_type t : interactor->getBcNodeIndicesMap()) - { - Block3DPtr block = t.first; - std::set< std::vector<int> >& transNodeIndicesSet = t.second; - - UbTupleDouble3 org = grid->getBlockWorldCoordinates(block); - UbTupleDouble3 blockLengths = grid->getBlockLengths(block); - UbTupleDouble3 nodeOffset = grid->getNodeOffset(block); - double dx = grid->getDeltaX(block); - - ILBMKernelPtr kernel = block->getKernel(); - BCArray3DPtr bcArray = kernel->getBCProcessor()->getBCArray(); - DistributionArray3DPtr distributions = kernel->getDataSet()->getFdistributions(); - ShearStressValuesArray3DPtr ssv = kernel->getDataSet()->getShearStressValues(); - - int ghostLayer = kernel->getGhostLayerWidth(); - LBMReal collFactor = kernel->getCollisionFactor(); - - int minX1 = ghostLayer; - int maxX1 = (int)bcArray->getNX1() - 1 - ghostLayer; - int minX2 = ghostLayer; - int maxX2 = (int)bcArray->getNX2() - 1 - ghostLayer; - int minX3 = ghostLayer; - int maxX3 = (int)bcArray->getNX3() - 1 - ghostLayer; - - int level=block->getLevel(); - if(level==1) - { - int le=0; - } - for(std::vector<int> node : transNodeIndicesSet) - { - int ix1 = node[0]; - int ix2 = node[1]; - int ix3 = node[2]; - - //without ghost nodes - if (ix1 < minX1 || ix1 > maxX1 || ix2 < minX2 || ix2 > maxX2 ||ix3 < minX3 || ix3 > maxX3 ) continue; - - if(bcArray->isFluid(ix1,ix2,ix3)) - { - double q=(*ssv)(normalq,ix1,ix2,ix3) ; - double numPoint=(*ssv)(numberOfPoint,ix1,ix2,ix3) ; - if (q==0||numPoint!=3)continue; - // if (q==0)continue; - - int index = 0; - nodes.push_back( makeUbTuple(float(val<1>(org) - val<1>(nodeOffset) + ix1*dx), - float(val<2>(org) - val<2>(nodeOffset) + ix2*dx), - float(val<3>(org) - val<3>(nodeOffset) + ix3*dx)) ); - - //////get normal and distance////// - double A,B,C; - A= (*ssv)(normalX1,ix1,ix2,ix3) ; - B= (*ssv)(normalX2,ix1,ix2,ix3) ; - C= (*ssv)(normalX3,ix1,ix2,ix3) ; - - /////////// - //compute y plus - //double vtxSonja, vtySonja, vtzSonja; //tangent velocity - // double temp = (*av)(ix1,ix2,ix3,AvVx)*A+(*av)(ix1,ix2,ix3,AvVy)*B+(*av)(ix1,ix2,ix3,AvVz)*C; - // vtxSonja = (*av)(ix1,ix2,ix3,AvVx)-normals[0]*temp; - // vtySonja = (*av)(ix1,ix2,ix3,AvVy)-normals[1]*temp; - // vtzSonja = (*av)(ix1,ix2,ix3,AvVz)-normals[2]*temp; - - double vtx= (B*B*(*ssv)(AvVx,ix1,ix2,ix3) + C*C*(*ssv)(AvVx,ix1,ix2,ix3) - A*B*(*ssv)(AvVy,ix1,ix2,ix3) - A*C*(*ssv)(AvVy,ix1,ix2,ix3))/(A*A+B*B+C*C); - double vty=(-(A*B*(*ssv)(AvVx,ix1,ix2,ix3)) + A*A*(*ssv)(AvVy,ix1,ix2,ix3) + C*C*(*ssv)(AvVy,ix1,ix2,ix3) - B*C*(*ssv)(AvVz,ix1,ix2,ix3))/(A*A+B*B+C*C); - double vtz=(-(A*C*(*ssv)(AvVx,ix1,ix2,ix3)) - B*C*(*ssv)(AvVy,ix1,ix2,ix3) + A*A*(*ssv)(AvVz,ix1,ix2,ix3) + B*B*(*ssv)(AvVz,ix1,ix2,ix3))/(A*A+B*B+C*C); - - double normVt = sqrt(vtx*vtx+vty*vty+vtz*vtz)+1e-100; - double nvtx = vtx / normVt; - double nvty = vty / normVt; - double nvtz = vtz / normVt; - - double sx=0.5*((*ssv)(AvSxx,ix1,ix2,ix3)*nvtx+(*ssv)(AvSxy,ix1,ix2,ix3)*nvty+(*ssv)(AvSxz,ix1,ix2,ix3)*nvtz); - double sy=0.5*((*ssv)(AvSxy,ix1,ix2,ix3)*nvtx+(*ssv)(AvSyy,ix1,ix2,ix3)*nvty+(*ssv)(AvSyz,ix1,ix2,ix3)*nvtz); - double sz=0.5*((*ssv)(AvSxz,ix1,ix2,ix3)*nvtx+(*ssv)(AvSyz,ix1,ix2,ix3)*nvty+(*ssv)(AvSzz,ix1,ix2,ix3)*nvtz); - double sabs=sqrt(sx*sx+sy*sy+sz*sz); - - double viscosity = (1.0/3.0)*(1.0/collFactor-0.5); - double rho = 1.0; - double utau=sqrt(viscosity/rho*sabs); - - // double q=(*av)(ix1,ix2,ix3,normalq) ; - double yPlus = (utau*q)/viscosity; - - data[index++].push_back(yPlus); - data[index++].push_back(utau); - } - } - } - } - -} -////////////////////////////////////////////////////////////////////////// -void ShearStressCoProcessor::reset(double step) -{ - if(Resetscheduler->isDue(step) ) - resetData(step); - - UBLOG(logDEBUG3, "resetCoProcessor::update:" << step); -} -////////////////////////////////////////////////////////////////////////// -void ShearStressCoProcessor::resetData(double step) -{ - for(int level = minInitLevel; level<=maxInitLevel;level++) - { - for(Block3DPtr block : blockVector[level]) - { - if (block) - { - UbTupleDouble3 org = grid->getBlockWorldCoordinates(block); - UbTupleDouble3 blockLengths = grid->getBlockLengths(block); - UbTupleDouble3 nodeOffset = grid->getNodeOffset(block); - double dx = grid->getDeltaX(block); - - ILBMKernelPtr kernel = block->getKernel(); - BCArray3DPtr bcArray = kernel->getBCProcessor()->getBCArray(); - DistributionArray3DPtr distributions = kernel->getDataSet()->getFdistributions(); - ShearStressValuesArray3DPtr ssv = kernel->getDataSet()->getShearStressValues(); - - int minX1 = 0; - int minX2 = 0; - int minX3 = 0; - - int maxX1 = int(distributions->getNX1()); - int maxX2 = int(distributions->getNX2()); - int maxX3 = int(distributions->getNX3()); - - for(int ix3=minX3; ix3<maxX3-1; ix3++) - { - for(int ix2=minX2; ix2<maxX2-1; ix2++) - { - for(int ix1=minX1; ix1<maxX1-1; ix1++) - { - if(!bcArray->isUndefined(ix1,ix2,ix3) && !bcArray->isSolid(ix1,ix2,ix3)) - { - ////////////////////////////////////////////////////////////////////////// - //compute average values - ////////////////////////////////////////////////////////////////////////// - (*ssv)(AvVx,ix1,ix2,ix3) = 0.0; - (*ssv)(AvVy,ix1,ix2,ix3) = 0.0; - (*ssv)(AvVz,ix1,ix2,ix3) = 0.0; - - (*ssv)(AvSxx,ix1,ix2,ix3) = 0.0; - (*ssv)(AvSyy,ix1,ix2,ix3) = 0.0; - (*ssv)(AvSzz,ix1,ix2,ix3) = 0.0; - (*ssv)(AvSxy,ix1,ix2,ix3) = 0.0; - (*ssv)(AvSyz,ix1,ix2,ix3) = 0.0; - (*ssv)(AvSxz,ix1,ix2,ix3) = 0.0; - ////////////////////////////////////////////////////////////////////////// - } - } - } - } - } - } - } -} -////////////////////////////////////////////////////////////////////////// -void ShearStressCoProcessor::addInteractor( D3Q27InteractorPtr interactor ) -{ - interactors.push_back(interactor); -} -////////////////////////////////////////////////////////////////////////// -void ShearStressCoProcessor::findPlane(int ix1,int ix2,int ix3,Grid3DPtr grid,Block3DPtr block,double &A,double &B,double &C,double &D,double &ii) -{ - double x1plane=0.0,y1plane=0.0,z1plane=0.0; - double x2plane=0.0,y2plane=0.0,z2plane=0.0; - double x3plane=0.0,y3plane=0.0,z3plane=0.0; - BoundaryConditionsPtr bcPtr; - double dx = grid->getDeltaX(block); - ILBMKernelPtr kernel = block->getKernel(); - DistributionArray3DPtr distributions = kernel->getDataSet()->getFdistributions(); - BCArray3DPtr bcArray = kernel->getBCProcessor()->getBCArray(); - bcPtr=bcArray->getBC(ix1,ix2,ix3); - int x,y,z; - - - if(InterpolationProcessor::iCellHasSolid(bcArray, ix1, ix2, ix3)) { x = ix1;y = ix2;z = ix3;} - else if(InterpolationProcessor::iCellHasSolid(bcArray, ix1 , ix2-1, ix3 )) { x = ix1+0; y = ix2-1; z = ix3+0;}//S - else if(InterpolationProcessor::iCellHasSolid(bcArray, ix1 , ix2 , ix3-1)) { x = ix1+0; y = ix2+0; z = ix3-1;}//B - else if(InterpolationProcessor::iCellHasSolid(bcArray, ix1-1, ix2 , ix3 )) { x = ix1-1; y = ix2+0; z = ix3+0;}//w - else if(InterpolationProcessor::iCellHasSolid(bcArray, ix1 , ix2-1, ix3-1)) { x = ix1+0; y = ix2-1; z = ix3-1;}//BS - else if(InterpolationProcessor::iCellHasSolid(bcArray, ix1-1, ix2 , ix3-1)) { x = ix1-1; y = ix2+0; z = ix3-1;}//BW - else if(InterpolationProcessor::iCellHasSolid(bcArray, ix1-1, ix2-1, ix3 )) { x = ix1-1; y = ix2-1; z = ix3+0;}//SW - - else if(InterpolationProcessor::iCellHasSolid(bcArray, ix1-1, ix2-1, ix3-1)) { x = ix1-1; y = ix2-1; z = ix3-1;}//BSW - else if(InterpolationProcessor::iCellHasSolid(bcArray, ix1+1, ix2 , ix3 )) { x = ix1+1; y = ix2+0; z = ix3+0;}//E - else if(InterpolationProcessor::iCellHasSolid(bcArray, ix1 , ix2+1, ix3 )) { x = ix1+0; y = ix2+1; z = ix3+0;}//N - else if(InterpolationProcessor::iCellHasSolid(bcArray, ix1 , ix2 , ix3+1)) { x = ix1+0; y = ix2+0; z = ix3+1;}//T - else if(InterpolationProcessor::iCellHasSolid(bcArray, ix1+1, ix2+1, ix3 )) { x = ix1+1; y = ix2+1; z = ix3+0;}//NE - else if(InterpolationProcessor::iCellHasSolid(bcArray, ix1+1, ix2 , ix3+1)) { x = ix1+1; y = ix2+0; z = ix3+1;}//TE - else if(InterpolationProcessor::iCellHasSolid(bcArray, ix1 , ix2+1, ix3+1)) { x = ix1+0; y = ix2+1; z = ix3+1;}//TN - else if(InterpolationProcessor::iCellHasSolid(bcArray, ix1+1, ix2+1, ix3+1)) { x = ix1+1; y = ix2+1; z = ix3+1;}//TNE - - else if(InterpolationProcessor::iCellHasSolid(bcArray, ix1+1, ix2-1, ix3 )) { x = ix1+1; y = ix2-1; z = ix3+0;}//SE - else if(InterpolationProcessor::iCellHasSolid(bcArray, ix1-1, ix2+1, ix3 )) { x = ix1-1; y = ix2+1; z = ix3+0;}//NW - else if(InterpolationProcessor::iCellHasSolid(bcArray, ix1+1, ix2 , ix3-1)) { x = ix1+1; y = ix2+0; z = ix3-1;}//BE - else if(InterpolationProcessor::iCellHasSolid(bcArray, ix1-1, ix2 , ix3+1)) { x = ix1-1; y = ix2+0; z = ix3+1;}//TW - else if(InterpolationProcessor::iCellHasSolid(bcArray, ix1+0, ix2+1, ix3-1)) { x = ix1+0; y = ix2+1; z = ix3-1;}//BN - else if(InterpolationProcessor::iCellHasSolid(bcArray, ix1+0, ix2-1, ix3+1)) { x = ix1+0; y = ix2-1; z = ix3+1;}//TS - - else if(InterpolationProcessor::iCellHasSolid(bcArray, ix1-1, ix2+1, ix3+1)) { x = ix1-1; y = ix2+1; z = ix3+1;}//TNW - else if(InterpolationProcessor::iCellHasSolid(bcArray, ix1+1, ix2-1, ix3+1)) { x = ix1+1; y = ix2-1; z = ix3+1;}//TSE - else if(InterpolationProcessor::iCellHasSolid(bcArray, ix1-1, ix2-1, ix3+1)) { x = ix1-1; y = ix2-1; z = ix3+1;}//TSW - else if(InterpolationProcessor::iCellHasSolid(bcArray, ix1+1, ix2+1, ix3-1)) { x = ix1+1; y = ix2+1; z = ix3-1;}//BNE - else if(InterpolationProcessor::iCellHasSolid(bcArray, ix1-1, ix2+1, ix3-1)) { x = ix1-1; y = ix2+1; z = ix3-1;}//BNW - else if(InterpolationProcessor::iCellHasSolid(bcArray, ix1+1, ix2-1, ix3-1)) { x = ix1+1; y = ix2-1; z = ix3-1;}//BSE - - - else {{UB_THROW( UbException(UB_EXARGS,"there is no cell ix1="+UbSystem::toString(ix1)+"ix2="+UbSystem::toString(ix2)+"ix3="+UbSystem::toString(ix3)+"GlobalID="+UbSystem::toString(block->getGlobalID())+"dx="+UbSystem::toString(dx) - +"T="+UbSystem::toString(bcPtr->getQ(D3Q27System::T))+"B="+UbSystem::toString(bcPtr->getQ(D3Q27System::B)) - +"E="+UbSystem::toString(bcPtr->getQ(D3Q27System::E))+"W="+UbSystem::toString(bcPtr->getQ(D3Q27System::W))+"N="+UbSystem::toString(bcPtr->getQ(D3Q27System::N)) - +"S="+UbSystem::toString(bcPtr->getQ(D3Q27System::S))+"NE="+UbSystem::toString(bcPtr->getQ(D3Q27System::NE))+"SW="+UbSystem::toString(bcPtr->getQ(D3Q27System::SW)) - +"SE="+UbSystem::toString(bcPtr->getQ(D3Q27System::SE))+"NW="+UbSystem::toString(bcPtr->getQ(D3Q27System::NW)) - +"TE="+ - UbSystem::toString(bcPtr->getQ(D3Q27System::TE))+"BW="+UbSystem::toString(bcPtr->getQ(D3Q27System::BW))+"BE="+UbSystem::toString(bcPtr->getQ(D3Q27System::BE))+"TW="+ - UbSystem::toString(bcPtr->getQ(D3Q27System::TW))+"TN="+UbSystem::toString(bcPtr->getQ(D3Q27System::TN))+"BS="+UbSystem::toString(bcPtr->getQ(D3Q27System::BS))+"BN="+ - UbSystem::toString(bcPtr->getQ(D3Q27System::BN))+"TS="+UbSystem::toString(bcPtr->getQ(D3Q27System::TS))+"TNE="+UbSystem::toString(bcPtr->getQ(D3Q27System::TNE))+"TNW="+ - UbSystem::toString(bcPtr->getQ(D3Q27System::TNW))+"TSE="+UbSystem::toString(bcPtr->getQ(D3Q27System::TSE))+"TSW="+UbSystem::toString(bcPtr->getQ(D3Q27System::TSW))+"BNE="+ - UbSystem::toString(bcPtr->getQ(D3Q27System::BNE))+"BNW="+UbSystem::toString(bcPtr->getQ(D3Q27System::BNW))+"BSE="+UbSystem::toString(bcPtr->getQ(D3Q27System::BSE))+"BSW="+UbSystem::toString(bcPtr->getQ(D3Q27System::BSW)*dx) - ) ) ;}} - - - if(InterpolationProcessor::iCellHasSolid(bcArray, x, y, z)) - { - for(int i = x; i <= x + 1; i++){ - for(int j = y; j <= y + 1; j++){ - for (int k = z; k <= z + 1; k++) - { - Vector3D pointplane1 = grid->getNodeCoordinates(block, i, j, k); - - double iph=pointplane1[0]; - double jph=pointplane1[1]; - double kph=pointplane1[2]; - - if(!bcArray->isSolid(i, j, k)) - { - BoundaryConditionsPtr bcPtrIn=bcArray->getBC(i,j,k); - if(bcPtrIn) - { - for(int fdir=D3Q27System::FSTARTDIR; fdir<=D3Q27System::FENDDIR; fdir++) - { - if( ii<=2) - { - LBMReal q = bcPtrIn->getQ(fdir); - if (q!=999.00000) - { - if ( fdir==D3Q27System::E ) - { - //if(!bcArray->isSolid(i, j, k))continue; - if (i+q<=x+1) - { - if (ii==0) { x1plane=iph+q*dx; y1plane=jph; z1plane=kph; ii++; } - else if (ii==1) { x2plane=iph+q*dx; y2plane=jph; z2plane=kph; if (x1plane!=x2plane||y1plane!=y2plane||z1plane!=z2plane) ii++; } - else if(ii==2) { x3plane=iph+q*dx; y3plane=jph; z3plane=kph; if ((x3plane!=x1plane||y3plane!=y1plane||z3plane!=z1plane)&&(x2plane!=x3plane||y2plane!=y3plane||z2plane!=z3plane)) ii++;} - } - } - if ( fdir==D3Q27System::W ) - { - //if(!bcArray->isSolid(i, j, k))continue; - if (i-q>=x) - { - if (ii==0) { x1plane=iph-q*dx; y1plane=jph; z1plane=kph; ii++; } - else if (ii==1) { x2plane=iph-q*dx; y2plane=jph; z2plane=kph; if (x1plane!=x2plane||y1plane!=y2plane||z1plane!=z2plane) ii++; } - else if(ii==2) { x3plane=iph-q*dx; y3plane=jph; z3plane=kph; if ((x3plane!=x1plane||y3plane!=y1plane||z3plane!=z1plane)&&(x2plane!=x3plane||y2plane!=y3plane||z2plane!=z3plane)) ii++;} - } - } - if ( fdir==D3Q27System::N ) - { - //if(!bcArray->isSolid(i, j, k))continue; - if(j+q<=y+1) - { - if (ii==0) { x1plane=iph; y1plane=jph+q*dx; z1plane=kph; ii++; } - else if (ii==1) { x2plane=iph; y2plane=jph+q*dx; z2plane=kph; if (x1plane!=x2plane||y1plane!=y2plane||z1plane!=z2plane) ii++; } - else if (ii==2) { x3plane=iph; y3plane=jph+q*dx; z3plane=kph; if ((x3plane!=x1plane||y3plane!=y1plane||z3plane!=z1plane)&&(x2plane!=x3plane||y2plane!=y3plane||z2plane!=z3plane)) ii++;} - } - } - if ( fdir==D3Q27System::S ) - { - //if(!bcArray->isSolid(i, j, k))continue; - if (j-q>=y) - { - if (ii==0) { x1plane=iph; y1plane=jph-q*dx; z1plane=kph; ii++; } - else if (ii==1) { x2plane=iph; y2plane=jph-q*dx; z2plane=kph; if (x1plane!=x2plane||y1plane!=y2plane||z1plane!=z2plane) ii++; } - else if (ii==2) { x3plane=iph; y3plane=jph-q*dx; z3plane=kph; if ((x3plane!=x1plane||y3plane!=y1plane||z3plane!=z1plane)&&(x2plane!=x3plane||y2plane!=y3plane||z2plane!=z3plane)) ii++;} - } - } - - if ( fdir==D3Q27System::T ) - { - //if(!bcArray->isSolid(i, j, k))continue; - if(k+q<=z+1) - { - if (ii==0) { x1plane=iph; y1plane=jph; z1plane=kph+q*dx; ii++; } - else if (ii==1) { x2plane=iph; y2plane=jph; z2plane=kph+q*dx; if (x1plane!=x2plane||y1plane!=y2plane||z1plane!=z2plane) ii++; } - else if (ii==2) { x3plane=iph; y3plane=jph; z3plane=kph+q*dx; if ((x3plane!=x1plane||y3plane!=y1plane||z3plane!=z1plane)&&(x2plane!=x3plane||y2plane!=y3plane||z2plane!=z3plane)) ii++;} - } - } - if ( fdir==D3Q27System::B ) - { - //if(!bcArray->isSolid(i, j, k))continue; - if (k-q>=z) - { - if (ii==0) { x1plane=iph; y1plane=jph; z1plane=kph-q*dx; ii++; } - else if (ii==1) { x2plane=iph; y2plane=jph; z2plane=kph-q*dx; if (x1plane!=x2plane||y1plane!=y2plane||z1plane!=z2plane) ii++; } - else if (ii==2) { x3plane=iph; y3plane=jph; z3plane=kph-q*dx; if ((x3plane!=x1plane||y3plane!=y1plane||z3plane!=z1plane)&&(x2plane!=x3plane||y2plane!=y3plane||z2plane!=z3plane)) ii++;} - } - } - - } - } - } - } - } - } - } - } - - A = y1plane* (z2plane - z3plane) + y2plane*(z3plane - z1plane) + y3plane* (z1plane - z2plane); - B = z1plane* (x2plane - x3plane) + z2plane*(x3plane - x1plane) + z3plane* (x1plane - x2plane) ; - C = x1plane* (y2plane - y3plane) + x2plane*(y3plane - y1plane) + x3plane* (y1plane - y2plane) ; - D =-( x1plane*(y2plane*z3plane - y3plane*z2plane)+x2plane*(y3plane*z1plane - y1plane*z3plane) + x3plane* (y1plane* z2plane - y2plane* z1plane)); - } - if(ii!=3){ - - {{UB_THROW( UbException(UB_EXARGS,"ii is="+UbSystem::toString(ii)+" ix1="+UbSystem::toString(ix1)+" ix2="+UbSystem::toString(ix2)+" ix3="+UbSystem::toString(ix3)+" Block3D::GlobalID="+UbSystem::toString(block->getGlobalID())+" dx="+UbSystem::toString(dx) - +" T="+UbSystem::toString(bcPtr->getQ(D3Q27System::T))+" B="+UbSystem::toString(bcPtr->getQ(D3Q27System::B)) - +" E="+UbSystem::toString(bcPtr->getQ(D3Q27System::E))+" W="+UbSystem::toString(bcPtr->getQ(D3Q27System::W))+" N="+UbSystem::toString(bcPtr->getQ(D3Q27System::N)) - +" S="+UbSystem::toString(bcPtr->getQ(D3Q27System::S))+" NE="+UbSystem::toString(bcPtr->getQ(D3Q27System::NE))+" SW="+UbSystem::toString(bcPtr->getQ(D3Q27System::SW)) - +" SE="+UbSystem::toString(bcPtr->getQ(D3Q27System::SE))+" NW="+UbSystem::toString(bcPtr->getQ(D3Q27System::NW)) - +" TE="+ - UbSystem::toString(bcPtr->getQ(D3Q27System::TE))+" BW="+UbSystem::toString(bcPtr->getQ(D3Q27System::BW))+" BE="+UbSystem::toString(bcPtr->getQ(D3Q27System::BE))+" TW="+ - UbSystem::toString(bcPtr->getQ(D3Q27System::TW))+" TN="+UbSystem::toString(bcPtr->getQ(D3Q27System::TN))+" BS="+UbSystem::toString(bcPtr->getQ(D3Q27System::BS))+" BN="+ - UbSystem::toString(bcPtr->getQ(D3Q27System::BN))+" TS="+UbSystem::toString(bcPtr->getQ(D3Q27System::TS))+" TNE="+UbSystem::toString(bcPtr->getQ(D3Q27System::TNE))+" TNW="+ - UbSystem::toString(bcPtr->getQ(D3Q27System::TNW))+" TSE="+UbSystem::toString(bcPtr->getQ(D3Q27System::TSE))+" TSW="+UbSystem::toString(bcPtr->getQ(D3Q27System::TSW))+" BNE="+ - UbSystem::toString(bcPtr->getQ(D3Q27System::BNE))+" BNW="+UbSystem::toString(bcPtr->getQ(D3Q27System::BNW))+" BSE="+UbSystem::toString(bcPtr->getQ(D3Q27System::BSE))+" BSW="+UbSystem::toString(bcPtr->getQ(D3Q27System::BSW)) - ) ) ;}} - - } -} - -//////////////////////////////////////////////////////////////////////////////////////////////////////// -bool ShearStressCoProcessor::checkUndefindedNodes( BCArray3DPtr bcArray,int ix1,int ix2,int ix3) -{ - for(int i = ix1; i <= ix1 + 1; i++){ - for(int j = ix2; j <= ix2 + 1; j++){ - for (int k = ix3; k <= ix3 + 1; k++) - { - if(bcArray->isUndefined(i, j, k)) return true; - } - } - } - return false; -} -////////////////////////////////////////////////////////////////////////////////////// -void ShearStressCoProcessor::initDistance() -{ - for(D3Q27InteractorPtr interactor : interactors) - { - typedef std::map<Block3DPtr, std::set< std::vector<int> > > TransNodeIndicesMap; - for (TransNodeIndicesMap::value_type t : interactor->getBcNodeIndicesMap()) - { - Block3DPtr block = t.first; - std::set< std::vector<int> >& transNodeIndicesSet = t.second; - - UbTupleDouble3 org = grid->getBlockWorldCoordinates(block); - UbTupleDouble3 blockLengths = grid->getBlockLengths(block); - UbTupleDouble3 nodeOffset = grid->getNodeOffset(block); - double dx = grid->getDeltaX(block); - - ILBMKernelPtr kernel = block->getKernel(); - BCArray3DPtr bcArray = kernel->getBCProcessor()->getBCArray(); - DistributionArray3DPtr distributions = kernel->getDataSet()->getFdistributions(); - ShearStressValuesArray3DPtr ssv = kernel->getDataSet()->getShearStressValues(); - - int ghostLayer = kernel->getGhostLayerWidth(); - LBMReal collFactor = kernel->getCollisionFactor(); - - int minX1 = ghostLayer; - int maxX1 = (int)bcArray->getNX1() - 1 - ghostLayer; - int minX2 = ghostLayer; - int maxX2 = (int)bcArray->getNX2() - 1 - ghostLayer; - int minX3 = ghostLayer; - int maxX3 = (int)bcArray->getNX3() - 1 - ghostLayer; - - for(std::vector<int> node : transNodeIndicesSet) - { - int ix1 = node[0]; - int ix2 = node[1]; - int ix3 = node[2]; - - //without ghost nodes - if (ix1 < minX1 || ix1 > maxX1 || ix2 < minX2 || ix2 > maxX2 ||ix3 < minX3 || ix3 > maxX3 ) continue; - - if(bcArray->isFluid(ix1,ix2,ix3) ) - { - BoundaryConditionsPtr bc = bcArray->getBC(ix1,ix2,ix3); - if((bc->hasDensityBoundary()||bc->hasVelocityBoundary()))continue; - int numberOfCorner=0; - - if(bc->getQ(D3Q27System::T) !=999.000){ numberOfCorner++;} - if(bc->getQ(D3Q27System::B) !=999.000){ numberOfCorner++;} - if(bc->getQ(D3Q27System::E) !=999.000){ numberOfCorner++;} - if(bc->getQ(D3Q27System::W) !=999.000){ numberOfCorner++;} - if(bc->getQ(D3Q27System::N) !=999.000){ numberOfCorner++;} - if(bc->getQ(D3Q27System::S) !=999.000){ numberOfCorner++;} - // if(bc->hasVelocityBoundary()||bc->hasDensityBoundary())continue; - if(numberOfCorner>1)continue; - if(checkUndefindedNodes( bcArray, ix1,ix2,ix3))continue; - - - //////get normal and distance////// - double A,B,C,D,ii=0.0; - findPlane(ix1,ix2,ix3,grid,block,A,B,C,D,ii); - Vector3D pointplane1 = grid->getNodeCoordinates(block, ix1,ix2,ix3); - double ix1ph= pointplane1[0]; - double ix2ph= pointplane1[1]; - double ix3ph= pointplane1[2]; - double normalDis; - if(ii!=3) - { - UB_THROW( UbException(UB_EXARGS,"not enough points to create plane"+UbSystem::toString(ii))); - } - else - { - double s = A*ix1ph + B*ix2ph + C*ix3ph + D;//The sign of s = Ax + By + Cz + D determines which side the point (x,y,z) lies with respect to the plane. If s > 0 then the point lies on the same side as the normal (A,B,C). If s < 0 then it lies on the opposite side, if s = 0 then the point (x,y,z) lies on the plane. - if (s>0){s=1;} else if (s<0){s=-1;}else {s=0;} - - normalDis=((A*ix1ph + B*ix2ph + C*ix3ph + D)/sqrt(A*A+B*B+C*C));///distance point to plane xp-Xw=distance - normalDis*=s; - - (*ssv)(normalX1,ix1,ix2,ix3) = A; - (*ssv)(normalX2,ix1,ix2,ix3) = B; - (*ssv)(normalX3,ix1,ix2,ix3) = C; - (*ssv)(normalq,ix1,ix2,ix3) = normalDis; - (*ssv)(numberOfPoint,ix1,ix2,ix3) = ii; - - } - } - } - } - } -} diff --git a/src/VirtualFluids/CoProcessors/ShearStressCoProcessor.h b/src/VirtualFluids/CoProcessors/ShearStressCoProcessor.h deleted file mode 100644 index 95984fa9f..000000000 --- a/src/VirtualFluids/CoProcessors/ShearStressCoProcessor.h +++ /dev/null @@ -1,87 +0,0 @@ -#ifndef D3Q27ShearStressCoProcessor_H -#define D3Q27ShearStressCoProcessor_H - -#include <memory> -#include <vector> -#include <string> - -#include <VirtualFluidsBasics/basics/utilities/UbTuple.h> - -#include "CoProcessor.h" - -class ShearStressCoProcessor; -typedef std::shared_ptr<ShearStressCoProcessor> ShearStressCoProcessorPtr; - -class Block3D; -class Grid3D; -class UbScheduler; -class D3Q27Interactor; -class BCArray3D; -class WbWriter; - -//! \brief Computes the shear stress and y plus values and writes to parallel .vtk -//! \details writes at given time intervals specified in scheduler (s) and resets according to scheduler (rs). -//! Take root to obtain during post processing (paraview). -//! \author K. Kucher, S. Uphoff, M. Geier, E. Goraki Fard - -class ShearStressCoProcessor: public CoProcessor -{ -public: - //! Default constructor - ShearStressCoProcessor(){} - //! Constructor - ShearStressCoProcessor(std::shared_ptr<Grid3D> grid, const std::string& path, WbWriter* const writer, - std::shared_ptr<UbScheduler> s, std::shared_ptr<UbScheduler> rs); - virtual ~ShearStressCoProcessor(); - - void process(double step) override; - - void addInteractor(std::shared_ptr<D3Q27Interactor> interactor); -protected: - //! Computes average and shear stress values of macroscopic quantities - void calculateShearStress(double timeStep); - //! Prepare data and write in .vtk file - void collectData(double step); - //! Reset data - void resetData(double step); - //! prepare data - void addData(); - void clearData(); - void reset(double step); - void findPlane(int ix1,int ix2,int ix3, std::shared_ptr<Grid3D> grid, std::shared_ptr<Block3D> block,double &A,double &B,double &C,double &D,double &ii); - bool checkUndefindedNodes(std::shared_ptr<BCArray3D> bcArray,int ix1,int ix2,int ix3); - void initDistance(); - -private: - std::vector<UbTupleFloat3> nodes; - std::vector<std::string> datanames; - std::vector<std::vector<double> > data; - std::string path; - std::vector<std::shared_ptr<D3Q27Interactor> > interactors; - std::vector<double> normals; - int gridRank; - WbWriter* writer; - std::shared_ptr<UbScheduler> Resetscheduler; //additional scheduler to restart averaging after a given interval - int minInitLevel; //min init level - int maxInitLevel; - std::vector<std::vector<std::shared_ptr<Block3D> > > blockVector; - enum Values{AvVx = 0, AvVy = 1, AvVz = 2, AvSxx = 3, AvSyy = 4, AvSzz = 5, AvSxy = 6, AvSyz = 7, AvSxz = 8, normalX1 = 9, normalX2 = 10, normalX3 = 11, normalq = 12,numberOfPoint=13}; - - friend class boost::serialization::access; - template<class Archive> - void serialize(Archive & ar, const unsigned int version) - { - ar & boost::serialization::base_object<CoProcessor>(*this); - ar & path; - ar & normals; - ar & interactors; - ar & blockVector; - ar & minInitLevel; - ar & maxInitLevel; - ar & gridRank; - ar & writer; - } -}; - - -#endif /* D3Q27ShearStressCoProcessor_H */ diff --git a/src/VirtualFluids/CoProcessors/TimeAveragedValuesCoProcessor.cpp b/src/VirtualFluids/CoProcessors/TimeAveragedValuesCoProcessor.cpp deleted file mode 100644 index 79b43bc28..000000000 --- a/src/VirtualFluids/CoProcessors/TimeAveragedValuesCoProcessor.cpp +++ /dev/null @@ -1,757 +0,0 @@ -#include "TimeAveragedValuesCoProcessor.h" - - -#include "LBMKernel.h" -#include "BCProcessor.h" - -#include "basics/writer/WbWriterVtkXmlASCII.h" -#include "DataSet3D.h" -#include "Grid3D.h" -#include "Block3D.h" -#include "Communicator.h" -#include "UbScheduler.h" -#include "IntegrateValuesHelper.h" -#include "BCArray3D.h" - - -TimeAveragedValuesCoProcessor::TimeAveragedValuesCoProcessor() -{ - -} -////////////////////////////////////////////////////////////////////////// -TimeAveragedValuesCoProcessor::TimeAveragedValuesCoProcessor(Grid3DPtr grid, const std::string& path, WbWriter* const writer, - UbSchedulerPtr s, CommunicatorPtr comm, int options) - : CoProcessor(grid, s), - path(path), - writer(writer), - comm(comm), - options(options) -{ - init(s); - planarAveraging = false; - timeAveraging = true; -} -////////////////////////////////////////////////////////////////////////// -TimeAveragedValuesCoProcessor::TimeAveragedValuesCoProcessor(Grid3DPtr grid, const std::string& path, WbWriter* const writer, - UbSchedulerPtr s, CommunicatorPtr comm, int options, - std::vector<int> levels, std::vector<double>& levelCoords, std::vector<double>& bounds, bool timeAveraging) - : CoProcessor(grid, s), - path(path), - writer(writer), - comm(comm), - options(options), - levels(levels), - levelCoords(levelCoords), - bounds(bounds), - timeAveraging(timeAveraging) -{ - init(s); - planarAveraging = true; -} -////////////////////////////////////////////////////////////////////////// -void TimeAveragedValuesCoProcessor::init(UbSchedulerPtr s) -{ - root = comm->isRoot(); - gridRank = grid->getRank(); - minInitLevel = this->grid->getCoarsestInitializedLevel(); - maxInitLevel = this->grid->getFinestInitializedLevel(); - - blockVector.resize(maxInitLevel + 1); - - for (int level = minInitLevel; level <= maxInitLevel; level++) - { - grid->getBlocks(level, gridRank, true, blockVector[level]); - - if (blockVector[level].size() > 0) - compressible = blockVector[level][0]->getKernel()->getCompressible(); - - double begin = s->getMinBegin(); - double gridTimeStep = grid->getTimeStep(); - - if (gridTimeStep == begin || gridTimeStep == 0) - { - for(Block3DPtr block : blockVector[level]) - { - UbTupleInt3 nx = grid->getBlockNX(); - - if ((options&Density) == Density) - { - AverageValuesArray3DPtr ar = AverageValuesArray3DPtr(new AverageValuesArray3D(1, val<1>(nx) + 1, val<2>(nx) + 1, val<3>(nx) + 1, 0.0)); - block->getKernel()->getDataSet()->setAverageDencity(ar); - } - - if ((options&Velocity) == Velocity) - { - AverageValuesArray3DPtr av = AverageValuesArray3DPtr(new AverageValuesArray3D(3, val<1>(nx) + 1, val<2>(nx) + 1, val<3>(nx) + 1, 0.0)); - block->getKernel()->getDataSet()->setAverageVelocity(av); - } - - if ((options&Fluctuations) == Fluctuations) - { - AverageValuesArray3DPtr af = AverageValuesArray3DPtr(new AverageValuesArray3D(6, val<1>(nx) + 1, val<2>(nx) + 1, val<3>(nx) + 1, 0.0)); - block->getKernel()->getDataSet()->setAverageFluctuations(af); - } - - if ((options&Triplecorrelations) == Triplecorrelations) - { - AverageValuesArray3DPtr at = AverageValuesArray3DPtr(new AverageValuesArray3D(10, val<1>(nx) + 1, val<2>(nx) + 1, val<3>(nx) + 1, 0.0)); - block->getKernel()->getDataSet()->setAverageTriplecorrelations(at); - } - } - } - } - - //breakStep = scheduler->getMaxEnd() - scheduler->getMinBegin()+1; - //UBLOG(logINFO, "breakSteps = " << breakStep); - //breakStep = breakStep * (double)(1 << maxInitLevel); - //breakStep = scheduler->getMaxEnd()*(double)(1 << maxInitLevel); - //UBLOG(logINFO, "breakSteps = " << breakStep); - - withGhostLayer = false; - iMinC = 1; - - lcounter = 0; - - levelFactor = 1 << maxInitLevel; - maxStep = scheduler->getMaxEnd(); - numberOfFineSteps = int(maxStep - scheduler->getMinBegin()) * levelFactor; - numberOfSteps = int(maxStep - scheduler->getMinBegin()); - - //function pointer - using namespace D3Q27System; - calcMacros = NULL; - if (compressible) - { - calcMacros = &calcCompMacroscopicValues; - } - else - { - calcMacros = &calcIncompMacroscopicValues; - } -} -////////////////////////////////////////////////////////////////////////// -void TimeAveragedValuesCoProcessor::process(double step) -{ - calculateSubtotal(step); - - if (step == maxStep) - { - //DEBUG///////////////////// - //UBLOG(logINFO, "process::step = " << step << ", maxStep = " << maxStep << ", levelFactor = " << levelFactor << ", numberOfFineSteps = " << numberOfFineSteps); - //////////////////////////// - - //calculateAverageValues((double)numberOfFineSteps); - calculateAverageValues((double)numberOfSteps); - - if (timeAveraging) - { - collectData(step); - } - - if (planarAveraging) - { - planarAverage(step); - } - } - - UBLOG(logDEBUG3, "AverageValuesCoProcessor::update:" << step); -} -////////////////////////////////////////////////////////////////////////// -void TimeAveragedValuesCoProcessor::collectData(double step) -{ - int istep = int(step); - - for (int level = minInitLevel; level <= maxInitLevel; level++) - { - for(Block3DPtr block : blockVector[level]) - { - if (block) - { - addData(block); - } - } - } - - std::string pfilePath, partPath, subfolder, cfilePath; - subfolder = "tav" + UbSystem::toString(istep); - pfilePath = path + "/tav/" + subfolder; - partPath = pfilePath + "/tav" + UbSystem::toString(gridRank) + "_" + UbSystem::toString(istep); - - std::string partName = writer->writeOctsWithNodeData(partPath, nodes, cells, datanames, data); - size_t found = partName.find_last_of("/"); - std::string piece = partName.substr(found + 1); - piece = subfolder + "/" + piece; - - std::vector<std::string> cellDataNames; - std::vector<std::string> pieces = comm->gather(piece); - if (root) - { - std::string pname = WbWriterVtkXmlASCII::getInstance()->writeParallelFile(pfilePath, pieces, datanames, cellDataNames); - UBLOG(logINFO, "TimeAveragedValuesCoProcessor::collectData() step: " << istep); - } - - clearData(); -} -////////////////////////////////////////////////////////////////////////// -void TimeAveragedValuesCoProcessor::clearData() -{ - nodes.clear(); - cells.clear(); - datanames.clear(); - data.clear(); -} -////////////////////////////////////////////////////////////////////////// -void TimeAveragedValuesCoProcessor::addData(const Block3DPtr block) -{ - UbTupleDouble3 org = grid->getBlockWorldCoordinates(block); - UbTupleDouble3 blockLengths = grid->getBlockLengths(block); - UbTupleDouble3 nodeOffset = grid->getNodeOffset(block); - double dx = grid->getDeltaX(block); - int level = block->getLevel(); - - //Diese Daten werden geschrieben: - datanames.resize(0); - - datanames.push_back("level"); - datanames.push_back("Rho"); - - if ((options&Density) == Density) - { - datanames.push_back("taRho"); - } - - if ((options&Velocity) == Velocity) - { - datanames.push_back("taVx"); - datanames.push_back("taVy"); - datanames.push_back("taVz"); - } - - if ((options&Fluctuations) == Fluctuations) - { - datanames.push_back("taVxx"); - datanames.push_back("taVyy"); - datanames.push_back("taVzz"); - datanames.push_back("taVxy"); - datanames.push_back("taVxz"); - datanames.push_back("taVyz"); - } - - if ((options&Triplecorrelations) == Triplecorrelations) - { - datanames.push_back("taVxxx"); - datanames.push_back("taVxxy"); - datanames.push_back("taVxxz"); - datanames.push_back("taVyyy"); - datanames.push_back("taVyyx"); - datanames.push_back("taVyyz"); - datanames.push_back("taVzzz"); - datanames.push_back("taVzzx"); - datanames.push_back("taVzzy"); - datanames.push_back("taVxyz"); - } - - - //datanames.push_back("AvP"); - //datanames.push_back("AvPrms"); - - - data.resize(datanames.size()); - - ILBMKernelPtr kernel = block->getKernel(); - BCArray3DPtr bcArray = kernel->getBCProcessor()->getBCArray(); - DistributionArray3DPtr distributions = kernel->getDataSet()->getFdistributions(); - AverageValuesArray3DPtr ar = kernel->getDataSet()->getAverageDencity(); - AverageValuesArray3DPtr av = kernel->getDataSet()->getAverageVelocity(); - AverageValuesArray3DPtr af = kernel->getDataSet()->getAverageFluctuations(); - AverageValuesArray3DPtr at = kernel->getDataSet()->getAverageTriplecorrelations(); - //int ghostLayerWidth = kernel->getGhostLayerWidth(); - - //knotennummerierung faengt immer bei 0 an! - int SWB, SEB, NEB, NWB, SWT, SET, NET, NWT; - - int minX1 = iMinC; - int minX2 = iMinC; - int minX3 = iMinC; - - int maxX1 = int(distributions->getNX1()); - int maxX2 = int(distributions->getNX2()); - int maxX3 = int(distributions->getNX3()); - - //nummern vergeben und node vector erstellen + daten sammeln - CbArray3D<int> nodeNumbers((int)maxX1, (int)maxX2, (int)maxX3, -1); - - maxX1 -= 2; - maxX2 -= 2; - maxX3 -= 2; - - LBMReal f[D3Q27System::ENDF + 1]; - LBMReal vx1, vx2, vx3, rho; - - //D3Q27BoundaryConditionPtr bcPtr; - - int nr = (int)nodes.size(); - - for (int ix3 = minX3; ix3 <= maxX3; ix3++) - { - for (int ix2 = minX2; ix2 <= maxX2; ix2++) - { - for (int ix1 = minX1; ix1 <= maxX1; ix1++) - { - if (!bcArray->isUndefined(ix1, ix2, ix3) && !bcArray->isSolid(ix1, ix2, ix3)) - { - int index = 0; - nodeNumbers(ix1, ix2, ix3) = nr++; - nodes.push_back(makeUbTuple(float(val<1>(org) - val<1>(nodeOffset) + ix1*dx), - float(val<2>(org) - val<2>(nodeOffset) + ix2*dx), - float(val<3>(org) - val<3>(nodeOffset) + ix3*dx))); - - data[index++].push_back(level); - - distributions->getDistribution(f, ix1, ix2, ix3); - calcMacros(f, rho, vx1, vx2, vx3); - - data[index++].push_back(rho); - - - - if ((options&Density) == Density) - { - data[index++].push_back((*ar)(0, ix1, ix2, ix3)); - } - - if ((options&Velocity) == Velocity) - { - data[index++].push_back((*av)(Vx, ix1, ix2, ix3)); - data[index++].push_back((*av)(Vy, ix1, ix2, ix3)); - data[index++].push_back((*av)(Vz, ix1, ix2, ix3)); - } - - if ((options&Fluctuations) == Fluctuations) - { - data[index++].push_back((*af)(Vxx, ix1, ix2, ix3)); - data[index++].push_back((*af)(Vyy, ix1, ix2, ix3)); - data[index++].push_back((*af)(Vzz, ix1, ix2, ix3)); - data[index++].push_back((*af)(Vxy, ix1, ix2, ix3)); - data[index++].push_back((*af)(Vxz, ix1, ix2, ix3)); - data[index++].push_back((*af)(Vyz, ix1, ix2, ix3)); - } - - if ((options&Triplecorrelations) == Triplecorrelations) - { - data[index++].push_back((*at)(Vxxx, ix1, ix2, ix3)); - data[index++].push_back((*at)(Vxxy, ix1, ix2, ix3)); - data[index++].push_back((*at)(Vxxz, ix1, ix2, ix3)); - data[index++].push_back((*at)(Vyyy, ix1, ix2, ix3)); - data[index++].push_back((*at)(Vyyx, ix1, ix2, ix3)); - data[index++].push_back((*at)(Vyyz, ix1, ix2, ix3)); - data[index++].push_back((*at)(Vzzz, ix1, ix2, ix3)); - data[index++].push_back((*at)(Vzzx, ix1, ix2, ix3)); - data[index++].push_back((*at)(Vzzy, ix1, ix2, ix3)); - data[index++].push_back((*at)(Vxyz, ix1, ix2, ix3)); - } - } - } - } - } - - maxX1 -= 1; - maxX2 -= 1; - maxX3 -= 1; - - //cell vector erstellen - for (int ix3 = minX3; ix3 <= maxX3; ix3++) - { - for (int ix2 = minX2; ix2 <= maxX2; ix2++) - { - for (int ix1 = minX1; ix1 <= maxX1; ix1++) - { - if ((SWB = nodeNumbers(ix1, ix2, ix3)) >= 0 - && (SEB = nodeNumbers(ix1 + 1, ix2, ix3)) >= 0 - && (NEB = nodeNumbers(ix1 + 1, ix2 + 1, ix3)) >= 0 - && (NWB = nodeNumbers(ix1, ix2 + 1, ix3)) >= 0 - && (SWT = nodeNumbers(ix1, ix2, ix3 + 1)) >= 0 - && (SET = nodeNumbers(ix1 + 1, ix2, ix3 + 1)) >= 0 - && (NET = nodeNumbers(ix1 + 1, ix2 + 1, ix3 + 1)) >= 0 - && (NWT = nodeNumbers(ix1, ix2 + 1, ix3 + 1)) >= 0) - { - cells.push_back(makeUbTuple(SWB, SEB, NEB, NWB, SWT, SET, NET, NWT)); - } - } - } - } -} -////////////////////////////////////////////////////////////////////////// -void TimeAveragedValuesCoProcessor::calculateAverageValues(double timeSteps) -{ - for (int level = minInitLevel; level <= maxInitLevel; level++) - { - int i; - //#ifdef _OPENMP - // #pragma omp parallel for - //#endif - //for(Block3DPtr block : blockVector[level]) - for (i = 0; i < blockVector[level].size(); i++) - { - Block3DPtr block = blockVector[level][i]; - if (block) - { - ILBMKernelPtr kernel = block->getKernel(); - BCArray3DPtr bcArray = kernel->getBCProcessor()->getBCArray(); - DistributionArray3DPtr distributions = kernel->getDataSet()->getFdistributions(); - AverageValuesArray3DPtr ar = kernel->getDataSet()->getAverageDencity(); - AverageValuesArray3DPtr av = kernel->getDataSet()->getAverageVelocity(); - AverageValuesArray3DPtr af = kernel->getDataSet()->getAverageFluctuations(); - AverageValuesArray3DPtr at = kernel->getDataSet()->getAverageTriplecorrelations(); - - int minX1 = iMinC; - int minX2 = iMinC; - int minX3 = iMinC; - - int maxX1 = int(distributions->getNX1()); - int maxX2 = int(distributions->getNX2()); - int maxX3 = int(distributions->getNX3()); - - maxX1 -= 2; - maxX2 -= 2; - maxX3 -= 2; - - LBMReal rho, ux, uy, uz, uxx, uzz, uyy, uxy, uxz, uyz; - - for (int ix3 = minX3; ix3 <= maxX3; ix3++) - { - for (int ix2 = minX2; ix2 <= maxX2; ix2++) - { - for (int ix1 = minX1; ix1 <= maxX1; ix1++) - { - if (!bcArray->isUndefined(ix1, ix2, ix3) && !bcArray->isSolid(ix1, ix2, ix3)) - { - ////////////////////////////////////////////////////////////////////////// - //compute average values - ////////////////////////////////////////////////////////////////////////// - - //mean density - if ((options&Density) == Density) - { - rho = (*ar)(0, ix1, ix2, ix3) / timeSteps; - - (*ar)(0, ix1, ix2, ix3) = rho; - } - - //mean velocity - if ((options&Velocity) == Velocity) - { - ux = (*av)(Vx, ix1, ix2, ix3) / timeSteps; - uy = (*av)(Vy, ix1, ix2, ix3) / timeSteps; - uz = (*av)(Vz, ix1, ix2, ix3) / timeSteps; - - (*av)(Vx, ix1, ix2, ix3) = ux; - (*av)(Vy, ix1, ix2, ix3) = uy; - (*av)(Vz, ix1, ix2, ix3) = uz; - } - - //fluctuations - if ((options&Fluctuations) == Fluctuations) - { - uxx = (*af)(Vxx, ix1, ix2, ix3) / timeSteps; - uyy = (*af)(Vyy, ix1, ix2, ix3) / timeSteps; - uzz = (*af)(Vzz, ix1, ix2, ix3) / timeSteps; - uxy = (*af)(Vxy, ix1, ix2, ix3) / timeSteps; - uxz = (*af)(Vxz, ix1, ix2, ix3) / timeSteps; - uyz = (*af)(Vyz, ix1, ix2, ix3) / timeSteps; - - (*af)(Vxx, ix1, ix2, ix3) = uxx - ux*ux; - (*af)(Vyy, ix1, ix2, ix3) = uyy - uy*uy; - (*af)(Vzz, ix1, ix2, ix3) = uzz - uz*uz; - (*af)(Vxy, ix1, ix2, ix3) = uxy - ux*uy; - (*af)(Vxz, ix1, ix2, ix3) = uxz - ux*uz; - (*af)(Vyz, ix1, ix2, ix3) = uyz - uy*uz; - } - - if ((options&Triplecorrelations) == Triplecorrelations) - { - //triple-correlations - (*at)(Vxxx, ix1, ix2, ix3) = (*at)(Vxxx, ix1, ix2, ix3) / timeSteps - 3.0 * uxx*ux + 2.0 * ux*ux*ux; - (*at)(Vxxy, ix1, ix2, ix3) = (*at)(Vxxy, ix1, ix2, ix3) / timeSteps - 2.0 * uxy*ux - uxx*uy + 2.0 * ux*ux*uy; - (*at)(Vxxz, ix1, ix2, ix3) = (*at)(Vxxz, ix1, ix2, ix3) / timeSteps - 2.0 * uxz*ux - uxx*uz + 2.0 * ux*ux*uz; - (*at)(Vyyy, ix1, ix2, ix3) = (*at)(Vyyy, ix1, ix2, ix3) / timeSteps - 3.0 * uyy*uy + 2.0 * uy*uy*uy; - (*at)(Vyyx, ix1, ix2, ix3) = (*at)(Vyyx, ix1, ix2, ix3) / timeSteps - 2.0 * uxy*uy - uyy*ux + 2.0 * uy*uy*ux; - (*at)(Vyyz, ix1, ix2, ix3) = (*at)(Vyyz, ix1, ix2, ix3) / timeSteps - 2.0 * uyz*uy - uyy*uz + 2.0 * uy*uy*uz; - (*at)(Vzzz, ix1, ix2, ix3) = (*at)(Vzzz, ix1, ix2, ix3) / timeSteps - 3.0 * uzz*uz + 2.0 * uz*uz*uz; - (*at)(Vzzx, ix1, ix2, ix3) = (*at)(Vzzx, ix1, ix2, ix3) / timeSteps - 2.0 * uxz*uz - uzz*ux + 2.0 * uz*uz*ux; - (*at)(Vzzy, ix1, ix2, ix3) = (*at)(Vzzy, ix1, ix2, ix3) / timeSteps - 2.0 * uyz*uz - uzz*uy + 2.0 * uz*uz*uy; - (*at)(Vxyz, ix1, ix2, ix3) = (*at)(Vxyz, ix1, ix2, ix3) / timeSteps - uxy*uz - uxz*uy - uyz*ux + 2.0 * ux*uy*uz; - } - ////////////////////////////////////////////////////////////////////////// - } - } - } - } - } - } - } -} -////////////////////////////////////////////////////////////////////////// -void TimeAveragedValuesCoProcessor::calculateSubtotal(double step) -{ - if (scheduler->isDue(step)) - { - - //DEBUG///////////////////// - //UBLOG(logINFO, "calculateSubtotal::step = " << step); - //////////////////////////// - - LBMReal f[27]; - -#ifdef _OPENMP -#pragma omp parallel private (f) -#endif - { - for (int level = minInitLevel; level <= maxInitLevel; level++) - { - int i; -#ifdef _OPENMP -#pragma omp for schedule(dynamic) -#endif - //for(Block3DPtr block : blockVector[level]) - for (i = 0; i < blockVector[level].size(); i++) - { - Block3DPtr block = blockVector[level][i]; - if (block) - { - ILBMKernelPtr kernel = block->getKernel(); - BCArray3DPtr bcArray = kernel->getBCProcessor()->getBCArray(); - DistributionArray3DPtr distributions = kernel->getDataSet()->getFdistributions(); - AverageValuesArray3DPtr ar = kernel->getDataSet()->getAverageDencity(); - AverageValuesArray3DPtr av = kernel->getDataSet()->getAverageVelocity(); - AverageValuesArray3DPtr af = kernel->getDataSet()->getAverageFluctuations(); - AverageValuesArray3DPtr at = kernel->getDataSet()->getAverageTriplecorrelations(); - - int minX1 = iMinC; - int minX2 = iMinC; - int minX3 = iMinC; - - int maxX1 = int(distributions->getNX1()); - int maxX2 = int(distributions->getNX2()); - int maxX3 = int(distributions->getNX3()); - - maxX1 -= 2; - maxX2 -= 2; - maxX3 -= 2; - - for (int ix3 = minX3; ix3 <= maxX3; ix3++) - { - for (int ix2 = minX2; ix2 <= maxX2; ix2++) - { - for (int ix1 = minX1; ix1 <= maxX1; ix1++) - { - if (!bcArray->isUndefined(ix1, ix2, ix3) && !bcArray->isSolid(ix1, ix2, ix3)) - { - ////////////////////////////////////////////////////////////////////////// - //read distribution - //////////////////////////////////////////////////////////////////////////// - distributions->getDistribution(f, ix1, ix2, ix3); - ////////////////////////////////////////////////////////////////////////// - //compute velocity - ////////////////////////////////////////////////////////////////////////// - LBMReal vx, vy, vz, rho; - calcMacros(f, rho, vx, vy, vz); - //double press = D3Q27System::calcPress(f, rho, vx, vy, vz); - - ////////////////////////////////////////////////////////////////////////// - //compute subtotals - ////////////////////////////////////////////////////////////////////////// - - //mean density - if ((options&Density) == Density) - { - (*ar)(0, ix1, ix2, ix3) = (*ar)(0, ix1, ix2, ix3) + rho; - } - - //mean velocity - if ((options&Velocity) == Velocity) - { - (*av)(Vx, ix1, ix2, ix3) = (*av)(Vx, ix1, ix2, ix3) + vx; - (*av)(Vy, ix1, ix2, ix3) = (*av)(Vy, ix1, ix2, ix3) + vy; - (*av)(Vz, ix1, ix2, ix3) = (*av)(Vz, ix1, ix2, ix3) + vz; - } - - //fluctuations - if ((options&Fluctuations) == Fluctuations) - { - (*af)(Vxx, ix1, ix2, ix3) = (*af)(Vxx, ix1, ix2, ix3) + vx*vx; - (*af)(Vyy, ix1, ix2, ix3) = (*af)(Vyy, ix1, ix2, ix3) + vy*vy; - (*af)(Vzz, ix1, ix2, ix3) = (*af)(Vzz, ix1, ix2, ix3) + vz*vz; - (*af)(Vxy, ix1, ix2, ix3) = (*af)(Vxy, ix1, ix2, ix3) + vx*vy; - (*af)(Vxz, ix1, ix2, ix3) = (*af)(Vxz, ix1, ix2, ix3) + vx*vz; - (*af)(Vyz, ix1, ix2, ix3) = (*af)(Vyz, ix1, ix2, ix3) + vy*vz; - } - - //triple-correlations - if ((options&Triplecorrelations) == Triplecorrelations) - { - (*at)(Vxxx, ix1, ix2, ix3) = (*at)(Vxxx, ix1, ix2, ix3) + vx*vx*vx; - (*at)(Vxxy, ix1, ix2, ix3) = (*at)(Vxxy, ix1, ix2, ix3) + vx*vx*vy; - (*at)(Vxxz, ix1, ix2, ix3) = (*at)(Vxxz, ix1, ix2, ix3) + vx*vx*vz; - (*at)(Vyyy, ix1, ix2, ix3) = (*at)(Vyyy, ix1, ix2, ix3) + vy*vy*vy; - (*at)(Vyyx, ix1, ix2, ix3) = (*at)(Vyyx, ix1, ix2, ix3) + vy*vy*vx; - (*at)(Vyyz, ix1, ix2, ix3) = (*at)(Vyyz, ix1, ix2, ix3) + vy*vy*vz; - (*at)(Vzzz, ix1, ix2, ix3) = (*at)(Vzzz, ix1, ix2, ix3) + vz*vz*vz; - (*at)(Vzzx, ix1, ix2, ix3) = (*at)(Vzzx, ix1, ix2, ix3) + vz*vz*vx; - (*at)(Vzzy, ix1, ix2, ix3) = (*at)(Vzzy, ix1, ix2, ix3) + vz*vz*vy; - (*at)(Vxyz, ix1, ix2, ix3) = (*at)(Vxyz, ix1, ix2, ix3) + vx*vy*vz; - } - ////////////////////////////////////////////////////////////////////////// - } - } - } - } - } - } - } - } - } -} -////////////////////////////////////////////////////////////////////////// -void TimeAveragedValuesCoProcessor::planarAverage(double step) -{ - std::ofstream ostr; - - if (root) - { - int istep = int(step); - std::string fname = path + "/tav/" + "tav" + UbSystem::toString(istep) + ".csv"; - - - ostr.open(fname.c_str(), std::ios_base::out); - if (!ostr) - { - ostr.clear(); - std::string path = UbSystem::getPathFromString(fname); - if (path.size() > 0) { UbSystem::makeDirectory(path); ostr.open(fname.c_str(), std::ios_base::out); } - if (!ostr) throw UbException(UB_EXARGS, "couldn't open file " + fname); - } - ostr << "z;Vx;Vy;Vz;Vxx;Vyy;Vzz;Vxy;Vxz;Vyz;Vxxx;Vxxy;Vxxz;Vyyy;Vyyx;Vyyz;Vzzz;Vzzx;Vzzy;Vxyz\n"; - } - - int size = (int)levels.size(); - int sizeOfLevelCoords = (int)levelCoords.size(); - - if (2 * size != sizeOfLevelCoords) - { - UB_THROW(UbException(UB_EXARGS, "Number of levels coordinates don't match number of levels!")); - } - - int k = 0; - - for (int i = 0; i < size; i++) - { - int level = levels[i]; - double dx = grid->getDeltaX(level); - double start = levelCoords[k]; - double stop = levelCoords[k + 1]; - - for (double j = start; j <stop; j += dx) - { - IntegrateValuesHelper intValHelp(grid, comm, - bounds[0], bounds[1], j, - bounds[3], bounds[4], j + dx, level); - - intValHelp.calculateAV2(); - - if (root) - { - double numberOfFluidsNodes = intValHelp.getNumberOfFluidsNodes(); - if (numberOfFluidsNodes > 0) - { - ostr << j + 0.5*dx; - - ////mean density - //if ((options&Density) == Density) - //{ - // double rho = intValHelp.getARho() / numberOfFluidsNodes; - //} - - //mean velocity - if ((options&Velocity) == Velocity) - { - double Vx = intValHelp.getAVx() / numberOfFluidsNodes; - double Vy = intValHelp.getAVy() / numberOfFluidsNodes; - double Vz = intValHelp.getAVz() / numberOfFluidsNodes; - ostr << ";" << Vx << ";" << Vy << ";" << Vz; - } - //fluctuations - if ((options&Fluctuations) == Fluctuations) - { - double Vxx = intValHelp.getAVxx() / numberOfFluidsNodes; - double Vyy = intValHelp.getAVyy() / numberOfFluidsNodes; - double Vzz = intValHelp.getAVzz() / numberOfFluidsNodes; - double Vxy = intValHelp.getAVxy() / numberOfFluidsNodes; - double Vxz = intValHelp.getAVxz() / numberOfFluidsNodes; - double Vyz = intValHelp.getAVyz() / numberOfFluidsNodes; - ostr << ";" << Vxx << ";" << Vyy << ";" << Vzz << ";" << Vxy << ";" << Vxz << ";" << Vyz; - } - //triple-correlations - if ((options&Triplecorrelations) == Triplecorrelations) - { - double Vxxx = intValHelp.getAVxxx() / numberOfFluidsNodes; - double Vxxy = intValHelp.getAVxxy() / numberOfFluidsNodes; - double Vxxz = intValHelp.getAVxxz() / numberOfFluidsNodes; - double Vyyy = intValHelp.getAVyyy() / numberOfFluidsNodes; - double Vyyx = intValHelp.getAVyyx() / numberOfFluidsNodes; - double Vyyz = intValHelp.getAVyyz() / numberOfFluidsNodes; - double Vzzz = intValHelp.getAVzzz() / numberOfFluidsNodes; - double Vzzx = intValHelp.getAVzzx() / numberOfFluidsNodes; - double Vzzy = intValHelp.getAVzzy() / numberOfFluidsNodes; - double Vxyz = intValHelp.getAVxyz() / numberOfFluidsNodes; - ostr << ";" << Vxxx << ";" << Vxxy << ";" << Vxxz << ";" << Vyyy << ";" << Vyyx << ";" << Vyyz << ";" << Vzzz << ";" << Vzzx << ";" << Vzzy << ";" << Vxyz; - } - ostr << "\n"; - } - } - } - k += 2; - } - - if (root) - { - ostr.close(); - UBLOG(logINFO, "TimeAveragedValuesCoProcessor::planarAverage() step: " << (int)step); - } -} -////////////////////////////////////////////////////////////////////////// -void TimeAveragedValuesCoProcessor::reset() -{ - for (int level = minInitLevel; level <= maxInitLevel; level++) - { - for(Block3DPtr block : blockVector[level]) - { - if (block) - { - block->getKernel()->getDataSet()->getAverageVelocity()->reset(0.0); - block->getKernel()->getDataSet()->getAverageFluctuations()->reset(0.0); - block->getKernel()->getDataSet()->getAverageTriplecorrelations()->reset(0.0); - } - } - } -} -////////////////////////////////////////////////////////////////////////// -void TimeAveragedValuesCoProcessor::setWithGhostLayer(bool val) -{ - withGhostLayer = val; - - if (withGhostLayer) - { - iMinC = 0; - } - else - { - iMinC = 1; - } -} -////////////////////////////////////////////////////////////////////////// -bool TimeAveragedValuesCoProcessor::getWithGhostLayer() -{ - return withGhostLayer; -} - diff --git a/src/VirtualFluids/CoProcessors/TimeAveragedValuesCoProcessor.h b/src/VirtualFluids/CoProcessors/TimeAveragedValuesCoProcessor.h deleted file mode 100644 index 6ac67e8f3..000000000 --- a/src/VirtualFluids/CoProcessors/TimeAveragedValuesCoProcessor.h +++ /dev/null @@ -1,142 +0,0 @@ -#ifndef TimeAveragedValuesCoProcessor_H -#define TimeAveragedValuesCoProcessor_H - -#include <memory> -#include <string> -#include <vector> - -#include "CoProcessor.h" -#include "LBMSystem.h" - -class Communicator; -class Grid3D; -class UbScheduler; -class WbWriter; -class Block3D; - -class TimeAveragedValuesCoProcessor; -typedef std::shared_ptr<TimeAveragedValuesCoProcessor> TimeAveragedValuesCoProcessorPtr; - -//! \brief Computes the time averaged mean velocity and RMS values and writes to parallel .vtk -//! \details writes at given time intervals specified in scheduler (s), does averaging according to scheduler (Avs) and resets according to scheduler (rs). <br> -//! Computes the time averaged mean velocity \f$ u_{mean}=\frac{1}{N}\sum\limits_{i=1}^n u_{i} \f$ and RMS of fluctuations. You need to calculate a square root before plotting RMS. <br> -// -//! \author Konstantin Kutscher -// \f$ u_{mean}=\frac{1}{N}\sum\limits_{i=1}^n u_{i} \f$ - - -class TimeAveragedValuesCoProcessor : public CoProcessor -{ -public: - enum Options - { - Density = 1, - Velocity = 2, - Fluctuations = 4, - Triplecorrelations = 8, - - //Velocity = 1, - //Fluctuations = 2, - //Triplecorrelations = 4, - }; -public: - TimeAveragedValuesCoProcessor(); - TimeAveragedValuesCoProcessor(std::shared_ptr<Grid3D> grid, const std::string& path, WbWriter* const writer, - std::shared_ptr<UbScheduler> s, std::shared_ptr<Communicator> comm, int options); - TimeAveragedValuesCoProcessor(std::shared_ptr<Grid3D> grid, const std::string& path, WbWriter* const writer, - std::shared_ptr<UbScheduler> s, std::shared_ptr<Communicator> comm, int options, std::vector<int> levels, std::vector<double>& levelCoords, std::vector<double>& bounds, bool timeAveraging = true); - //! Make update - void process(double step); - //! Computes subtotal of velocity , fluctuations and triple correlations - void calculateSubtotal(double step); - void addLevelCoordinate(double c); - void reset(); - void setWithGhostLayer(bool val); - bool getWithGhostLayer(); - -protected: - //! Prepare data and write in .vtk file - void collectData(double step); - //! prepare data - void addData(const std::shared_ptr<Block3D> block); - void clearData(); - //! Computes average values of velocity , fluctuations and triple correlations - void calculateAverageValues(double timeStep); - - void init(std::shared_ptr<UbScheduler> s); - void planarAverage(double step); - -private: - std::shared_ptr<Communicator> comm; - std::vector<UbTupleFloat3> nodes; - std::vector<UbTupleInt8> cells; - std::vector<std::string> datanames; - std::vector<std::vector<double> > data; - std::vector<std::vector<std::shared_ptr<Block3D> > > blockVector; - bool root; - int minInitLevel; //min init level - int maxInitLevel; - int gridRank; - int resetStepRMS; - int resetStepMeans; - double averageInterval; - std::string path; - WbWriter* writer; - bool restart, compressible; - std::shared_ptr<UbScheduler> averageScheduler; //additional scheduler to averaging after a given interval - std::shared_ptr<UbScheduler> resetSchedulerRMS; //additional scheduler to restart averaging after a given interval - std::shared_ptr<UbScheduler> resetSchedulerMeans; //additional scheduler to restart averaging after a given interval - //labels for the different components, e.g. AvVxx for time averaged RMS: 1/n SUM((U-Umean)^2) - //you need to calculate a square root before plotting RMS - enum Velocity { Vx, Vy, Vz }; - enum Fluctuations { Vxx, Vyy, Vzz, Vxy, Vxz, Vyz }; - enum Triplecorrelations { Vxxx, Vxxy, Vxxz, Vyyy, Vyyx, Vyyz, Vzzz, Vzzx, Vzzy, Vxyz }; - //enum Pressure { P, Prms }; - - int options; - int lcounter; - int numberOfFineSteps; - int numberOfSteps; - int fineStep; - int minFineStep; - int maxFineStep; - int levelFactor; - double maxStep; - - int iMinX1, iMinX2, iMinX3; - //int iMaxX1, iMaxX2, iMaxX3; - int iMinC; - int iMaxC; - - typedef void(*CalcMacrosFct)(const LBMReal* const& /*feq[27]*/, LBMReal& /*(d)rho*/, LBMReal& /*vx1*/, LBMReal& /*vx2*/, LBMReal& /*vx3*/); - CalcMacrosFct calcMacros; - - bool planarAveraging; - bool timeAveraging; - std::vector<double> levelCoords; - std::vector<int> levels; - std::vector<double> bounds; - - bool withGhostLayer; - - //friend class boost::serialization::access; - //template<class Archive> - //void serialize(Archive & ar, const unsigned int version) - //{ - // ar & boost::serialization::base_object<CoProcessor>(*this); - // ar & path; - // ar & blockVector; - // ar & minInitLevel; - // ar & maxInitLevel; - // ar & gridRank; - // ar & writer; - // ar & resetStepRMS; - // ar & resetStepMeans; - // ar & AverageInterval; - // ar & averageScheduler; - // ar & resetSchedulerRMS; - // ar & resetSchedulerMeans; - // ar & compressible; - //} -}; -#endif diff --git a/src/VirtualFluids/CoProcessors/TimeDependentBCCoProcessor.cpp b/src/VirtualFluids/CoProcessors/TimeDependentBCCoProcessor.cpp deleted file mode 100644 index e070eb9cd..000000000 --- a/src/VirtualFluids/CoProcessors/TimeDependentBCCoProcessor.cpp +++ /dev/null @@ -1,31 +0,0 @@ -#include "TimeDependentBCCoProcessor.h" - -#include "Interactor3D.h" -#include "UbScheduler.h" -#include "Grid3D.h" - -TimeDependentBCCoProcessor::TimeDependentBCCoProcessor(Grid3DPtr grid) : CoProcessor(grid, UbSchedulerPtr(new UbScheduler(1))) -{ - -} -////////////////////////////////////////////////////////////////////////// -TimeDependentBCCoProcessor::~TimeDependentBCCoProcessor() -{ - -} -////////////////////////////////////////////////////////////////////////// -void TimeDependentBCCoProcessor::process(double step) -{ - for(Interactor3DPtr inter : interactors) - inter->updateInteractor( step ); - UBLOG(logDEBUG3, "TimeDependentBCCoProcessor::update:" << step); -} -////////////////////////////////////////////////////////////////////////// -void TimeDependentBCCoProcessor::addInteractor( Interactor3DPtr interactor ) -{ - interactors.push_back(interactor); -} - -////////////////////////////////////////////////////////////////////////// - - diff --git a/src/VirtualFluids/CoProcessors/TimeDependentBCCoProcessor.h b/src/VirtualFluids/CoProcessors/TimeDependentBCCoProcessor.h deleted file mode 100644 index 8a195bf68..000000000 --- a/src/VirtualFluids/CoProcessors/TimeDependentBCCoProcessor.h +++ /dev/null @@ -1,34 +0,0 @@ -#ifndef TimeDependentBCCoProcessor_H -#define TimeDependentBCCoProcessor_H - -#include <vector> -#include <memory> - -#include "CoProcessor.h" - -class Interactor3D; -class Grid3D; - -class TimeDependentBCCoProcessor; -typedef std::shared_ptr<TimeDependentBCCoProcessor> TimeDependentBCCoProcessorPtr; - -//! \brief The class update interactors depend of time step. -//! \details TimeDependentBCCoProcessor update every time step information in BCAdapters throw Interactors -//! \author Sonja Uphoff, Kostyantyn Kucher -class TimeDependentBCCoProcessor : public CoProcessor -{ -public: - TimeDependentBCCoProcessor(std::shared_ptr<Grid3D> grid); - virtual ~TimeDependentBCCoProcessor(); - - void process(double step) override; - - //! add interactors to CoProcessor - void addInteractor(std::shared_ptr<Interactor3D> interactor); - -private: - std::vector<std::shared_ptr<Interactor3D> > interactors; -}; - - -#endif /* TimeDependentBCCoProcessor_H */ diff --git a/src/VirtualFluids/CoProcessors/TimeseriesCoProcessor.cpp b/src/VirtualFluids/CoProcessors/TimeseriesCoProcessor.cpp deleted file mode 100644 index 522101269..000000000 --- a/src/VirtualFluids/CoProcessors/TimeseriesCoProcessor.cpp +++ /dev/null @@ -1,87 +0,0 @@ -/* -* TimeseriesWriterCoProcessor.h -* -* Created on: 08.05.2013 -* Author: uphoff -*/ - -#include "TimeseriesCoProcessor.h" - -#include <fstream> - -#include "IntegrateValuesHelper.h" -#include "LBMUnitConverter.h" -#include "Communicator.h" -#include "UbScheduler.h" -#include "Grid3D.h" - - -TimeseriesCoProcessor::TimeseriesCoProcessor(Grid3DPtr grid, UbSchedulerPtr s, - IntegrateValuesHelperPtr h1, - const std::string& path, CommunicatorPtr comm) - : CoProcessor(grid, s), - h1(h1), - path(path), - comm(comm) -{ - if (comm->getProcessID() == comm->getRoot()) - { - std::ofstream ostr; - //fname = path+"/timeseries/timeseries"+UbSystem::toString(grid->getTimeStep())+".csv"; - fname = path+".csv"; - UBLOG(logINFO, "TimeseriesWriterCoProcessor::fname:" << fname); - ostr.open(fname.c_str(), std::ios_base::out | std::ios_base::app); - if(!ostr) - { - ostr.clear(); - std::string path = UbSystem::getPathFromString(fname); - if (path.size()>0) { UbSystem::makeDirectory(path); ostr.open(fname.c_str(), std::ios_base::out | std::ios_base::app); } - if(!ostr) throw UbException(UB_EXARGS,"couldn't open file "+fname); - } - ostr << "step;rho;vx;vy;vz;volume\n"; - ostr.close(); - UBLOG(logINFO, "TimeseriesWriterCoProcessor::Constructor:end"); - } -} -////////////////////////////////////////////////////////////////////////// -TimeseriesCoProcessor::~TimeseriesCoProcessor() -{ -} -////////////////////////////////////////////////////////////////////////// -void TimeseriesCoProcessor::process(double step) -{ - if(scheduler->isDue(step) ) - collectData(step); -} -////////////////////////////////////////////////////////////////////////// -void TimeseriesCoProcessor::collectData(double step) -{ - h1->calculateMQ(); - - UBLOG(logDEBUG3, "TimeseriesWriterCoProcessor::update:" << step); - - if (comm->getProcessID() == comm->getRoot()) - { - int istep = static_cast<int>(step); - std::ofstream ostr; - double cellsVolume = h1->getCellsVolume(); - - double rho=(h1->getRho())/cellsVolume; - double vx= (h1->getVx1())/cellsVolume; - double vy= (h1->getVx2())/cellsVolume; - double vz= (h1->getVx3())/cellsVolume; - double volume = cellsVolume; - - ostr.open(fname.c_str(), std::ios_base::out | std::ios_base::app); - if(!ostr) - { - ostr.clear(); - std::string path = UbSystem::getPathFromString(fname); - if(path.size()>0){ UbSystem::makeDirectory(path); ostr.open(fname.c_str(), std::ios_base::out | std::ios_base::app);} - if(!ostr) throw UbException(UB_EXARGS,"couldn't open file "+fname); - } - - ostr << istep << ";" << rho <<";" << vx << ";" << vy << ";" << vz << ";" << volume << "\n"; - ostr.close(); - } -} diff --git a/src/VirtualFluids/CoProcessors/TimeseriesCoProcessor.h b/src/VirtualFluids/CoProcessors/TimeseriesCoProcessor.h deleted file mode 100644 index e69459adb..000000000 --- a/src/VirtualFluids/CoProcessors/TimeseriesCoProcessor.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * TimeseriesCoProcessor.h - * - * Created on: 08.05.2013 - * Author: uphoff - */ - -#ifndef TimeseriesCoProcessor_H -#define TimeseriesCoProcessor_H - -#include <memory> -#include <string> - -#include "CoProcessor.h" - -class Communicator; -class Grid3D; -class UbScheduler; -class IntegrateValuesHelper; - -class TimeseriesCoProcessor; -typedef std::shared_ptr<TimeseriesCoProcessor> TimeseriesCoProcessorPtr; - -//! \brief Writes timeseries of density and velocity to a file. -//! \details Uses Integrate values helper, scheduler must be set in testcase. -//! \author Sonja Uphoff -//! \date May 2013 - -class TimeseriesCoProcessor : public CoProcessor -{ -public: - TimeseriesCoProcessor(std::shared_ptr<Grid3D> grid, std::shared_ptr<UbScheduler> s, std::shared_ptr<IntegrateValuesHelper> h1, const std::string& path, std::shared_ptr<Communicator> comm); - virtual ~TimeseriesCoProcessor(); - - //! calls collectData. - void process(double step) override; - -protected: - void collectData(double step); - - //! object that can compute spacial average values in 3D-subdomain. - std::shared_ptr<IntegrateValuesHelper> h1; - std::shared_ptr<Communicator> comm; - -private: - std::string path; //! output filename, e.g. pathname + "/steps/timeseries" - std::string fname; -}; - - -#endif /* TimeseriesCoProcessor_H */ diff --git a/src/VirtualFluids/CoProcessors/TurbulenceIntensityCoProcessor.cpp b/src/VirtualFluids/CoProcessors/TurbulenceIntensityCoProcessor.cpp deleted file mode 100644 index ce275d58a..000000000 --- a/src/VirtualFluids/CoProcessors/TurbulenceIntensityCoProcessor.cpp +++ /dev/null @@ -1,268 +0,0 @@ -#include "TurbulenceIntensityCoProcessor.h" - -#include "LBMKernel.h" -#include "BCProcessor.h" -#include "basics/writer/WbWriterVtkXmlASCII.h" -#include "basics/utilities/UbMath.h" -#include "DataSet3D.h" -#include "Grid3D.h" -#include "Block3D.h" -#include "LBMUnitConverter.h" -#include "Communicator.h" -#include "UbScheduler.h" -#include "BCArray3D.h" - -TurbulenceIntensityCoProcessor::TurbulenceIntensityCoProcessor(Grid3DPtr grid, const std::string& path, - WbWriter* const writer, - UbSchedulerPtr s, CommunicatorPtr comm) - : CoProcessor(grid, s), - path(path), - comm(comm), - writer(writer) -{ - init(); -} -////////////////////////////////////////////////////////////////////////// -void TurbulenceIntensityCoProcessor::init() -{ - gridRank = grid->getRank(); - minInitLevel = this->grid->getCoarsestInitializedLevel(); - maxInitLevel = this->grid->getFinestInitializedLevel(); - - blockVector.resize(maxInitLevel+1); - - for(int level = minInitLevel; level<=maxInitLevel;level++) - { - grid->getBlocks(level, gridRank, true, blockVector[level]); - - for(Block3DPtr block : blockVector[level]) - { - UbTupleInt3 nx = grid->getBlockNX(); - AverageValuesArray3DPtr averageValues = AverageValuesArray3DPtr(new AverageValuesArray3D(val<1>(nx)+1, val<2>(nx)+1, val<3>(nx)+1, 4, 0.0)); - block->getKernel()->getDataSet()->setAverageValues(averageValues); - } - } -} -////////////////////////////////////////////////////////////////////////// -void TurbulenceIntensityCoProcessor::process(double step) -{ - calculateAverageValues(int(step)); - - if(scheduler->isDue(step) ) - collectData(step); - - UBLOG(logDEBUG3, "TurbulenceIntensityCoProcessor::update:" << step); -} -////////////////////////////////////////////////////////////////////////// -void TurbulenceIntensityCoProcessor::collectData(double step) -{ - int istep = int(step); - - for(int level = minInitLevel; level<=maxInitLevel;level++) - { - for(Block3DPtr block : blockVector[level]) - { - if (block) - { - addData(block); - } - } - } - - std::string partName = writer->writeOctsWithNodeData(path+ UbSystem::toString(gridRank)+ "_" + UbSystem::toString(istep),nodes,cells,datanames,data); - size_t found=partName.find_last_of("//"); - std::string piece = partName.substr(found+1); - - std::vector<std::string> cellDataNames; - - std::vector<std::string> pieces = comm->gather(piece); - if (comm->getProcessID() == comm->getRoot()) - { - std::string pname = WbWriterVtkXmlASCII::getInstance()->writeParallelFile(path+"_"+UbSystem::toString(istep),pieces,datanames,cellDataNames); - - std::vector<std::string> filenames; - filenames.push_back(pname); - if (step == CoProcessor::scheduler->getMinBegin()) - { - WbWriterVtkXmlASCII::getInstance()->writeCollection(path+"_collection",filenames,istep,false); - } - else - { - WbWriterVtkXmlASCII::getInstance()->addFilesToCollection(path+"_collection",filenames,istep,false); - } - UBLOG(logINFO,"TurbulenceIntensityCoProcessor step: " << istep); - } - - clearData(); -} -////////////////////////////////////////////////////////////////////////// -void TurbulenceIntensityCoProcessor::clearData() -{ - nodes.clear(); - cells.clear(); - datanames.clear(); - data.clear(); -} -////////////////////////////////////////////////////////////////////////// -void TurbulenceIntensityCoProcessor::addData(const Block3DPtr block) -{ - UbTupleDouble3 org = grid->getBlockWorldCoordinates(block); - UbTupleDouble3 blockLengths = grid->getBlockLengths(block); - UbTupleDouble3 nodeOffset = grid->getNodeOffset(block); - double dx = grid->getDeltaX(block); - - //Diese Daten werden geschrieben: - datanames.resize(0); - datanames.push_back("TI"); - - data.resize(datanames.size()); - - ILBMKernelPtr kernel = block->getKernel(); - BCArray3DPtr bcArray = kernel->getBCProcessor()->getBCArray(); - DistributionArray3DPtr distributions = kernel->getDataSet()->getFdistributions(); - AverageValuesArray3DPtr av = kernel->getDataSet()->getAverageValues(); - //int ghostLayerWidth = kernel->getGhostLayerWidth(); - - //knotennummerierung faengt immer bei 0 an! - int SWB,SEB,NEB,NWB,SWT,SET,NET,NWT; - - int minX1 = 0; - int minX2 = 0; - int minX3 = 0; - - int maxX1 = int(distributions->getNX1()); - int maxX2 = int(distributions->getNX2()); - int maxX3 = int(distributions->getNX3()); - - //nummern vergeben und node std::vector erstellen + daten sammeln - CbArray3D<int> nodeNumbers((int)maxX1, (int)maxX2, (int)maxX3,-1); - //D3Q27BoundaryConditionPtr bcPtr; - int nr = (int)nodes.size(); - - for(int ix3=minX3; ix3<maxX3-1; ix3++) - { - for(int ix2=minX2; ix2<maxX2-1; ix2++) - { - for(int ix1=minX1; ix1<maxX1-1; ix1++) - { - if(!bcArray->isUndefined(ix1,ix2,ix3) && !bcArray->isSolid(ix1,ix2,ix3)) - { - int index = 0; - nodeNumbers(ix1,ix2,ix3) = nr++; - nodes.push_back( makeUbTuple(float(val<1>(org) - val<1>(nodeOffset) + ix1*dx), - float(val<2>(org) - val<2>(nodeOffset) + ix2*dx), - float(val<3>(org) - val<3>(nodeOffset) + ix3*dx)) ); - - //compute turbulence intensity - double temp = (*av)(ix1,ix2,ix3,AvVxxyyzz)/ - ((*av)(ix1,ix2,ix3,AvVx)*(*av)(ix1,ix2,ix3,AvVx)+ - (*av)(ix1,ix2,ix3,AvVy)*(*av)(ix1,ix2,ix3,AvVy)+ - (*av)(ix1,ix2,ix3,AvVz)*(*av)(ix1,ix2,ix3,AvVz)); - - LBMReal ti = sqrt(temp); - - if (UbMath::isNaN(ti)) UB_THROW( UbException(UB_EXARGS,"TI is not a number (nan or -1.#IND), sqrt(temp), where temp = "+UbSystem::toString(temp)+", AvVx = "+UbSystem::toString((*av)(ix1,ix2,ix3,AvVx))+" AvVy = "+UbSystem::toString((*av)(ix1,ix2,ix3,AvVy))+" AvVz = "+UbSystem::toString((*av)(ix1,ix2,ix3,AvVz)))); - - data[index++].push_back(ti); - } - } - } - } - //cell std::vector erstellen - for(int ix3=minX3; ix3<maxX3-1; ix3++) - { - for(int ix2=minX2; ix2<maxX2-1; ix2++) - { - for(int ix1=minX1; ix1<maxX1-1; ix1++) - { - if( (SWB=nodeNumbers( ix1 , ix2, ix3 )) >= 0 - && (SEB=nodeNumbers( ix1+1, ix2, ix3 )) >= 0 - && (NEB=nodeNumbers( ix1+1, ix2+1, ix3 )) >= 0 - && (NWB=nodeNumbers( ix1 , ix2+1, ix3 )) >= 0 - && (SWT=nodeNumbers( ix1 , ix2, ix3+1 )) >= 0 - && (SET=nodeNumbers( ix1+1, ix2, ix3+1 )) >= 0 - && (NET=nodeNumbers( ix1+1, ix2+1, ix3+1 )) >= 0 - && (NWT=nodeNumbers( ix1 , ix2+1, ix3+1 )) >= 0 ) - { - cells.push_back( makeUbTuple(SWB,SEB,NEB,NWB,SWT,SET,NET,NWT) ); - } - } - } - } -} -////////////////////////////////////////////////////////////////////////// -void TurbulenceIntensityCoProcessor::calculateAverageValues(double timeStep) -{ - using namespace D3Q27System; - - int minInitLevel = this->grid->getCoarsestInitializedLevel(); - int maxInitLevel = this->grid->getFinestInitializedLevel(); - LBMReal f[27]; - LBMReal vx, vy, vz; - - for(int level = minInitLevel; level<=maxInitLevel;level++) - { - for(Block3DPtr block : blockVector[level]) - { - if (block) - { - ILBMKernelPtr kernel = block->getKernel(); - BCArray3DPtr bcArray = kernel->getBCProcessor()->getBCArray(); - DistributionArray3DPtr distributions = kernel->getDataSet()->getFdistributions(); - AverageValuesArray3DPtr av = kernel->getDataSet()->getAverageValues(); - - int minX1 = 0; - int minX2 = 0; - int minX3 = 0; - - int maxX1 = int(distributions->getNX1()); - int maxX2 = int(distributions->getNX2()); - int maxX3 = int(distributions->getNX3()); - - for(int ix3=minX3; ix3<maxX3-1; ix3++) - { - for(int ix2=minX2; ix2<maxX2-1; ix2++) - { - for(int ix1=minX1; ix1<maxX1-1; ix1++) - { - if(!bcArray->isUndefined(ix1,ix2,ix3) && !bcArray->isSolid(ix1,ix2,ix3)) - { - ////////////////////////////////////////////////////////////////////////// - //read distribution - //////////////////////////////////////////////////////////////////////////// - distributions->getDistribution(f, ix1, ix2, ix3); - ////////////////////////////////////////////////////////////////////////// - //compute velocity - ////////////////////////////////////////////////////////////////////////// - vx = f[E] - f[W] + f[NE] - f[SW] + f[SE] - f[NW] + f[TE] - f[BW] - + f[BE] - f[TW] + f[TNE] - f[TSW] + f[TSE] - f[TNW] + f[BNE] - f[BSW] - + f[BSE] - f[BNW]; - - vy = f[N] - f[S] + f[NE] - f[SW] - f[SE] + f[NW] + f[TN] - f[BS] + f[BN] - - f[TS] + f[TNE] - f[TSW] - f[TSE] + f[TNW] + f[BNE] - f[BSW] - f[BSE] - + f[BNW]; - - vz = f[T] - f[B] + f[TE] - f[BW] - f[BE] + f[TW] + f[TN] - f[BS] - f[BN] - + f[TS] + f[TNE] + f[TSW] + f[TSE] + f[TNW] - f[BNE] - f[BSW] - f[BSE] - - f[BNW]; - ////////////////////////////////////////////////////////////////////////// - //compute average values - ////////////////////////////////////////////////////////////////////////// - (*av)(ix1,ix2,ix3,AvVx) = ((*av)(ix1,ix2,ix3,AvVx)*timeStep + vx)/(timeStep+1.0); - (*av)(ix1,ix2,ix3,AvVy) = ((*av)(ix1,ix2,ix3,AvVy)*timeStep + vy)/(timeStep+1.0); - (*av)(ix1,ix2,ix3,AvVz) = ((*av)(ix1,ix2,ix3,AvVz)*timeStep + vz)/(timeStep+1.0); - - (*av)(ix1,ix2,ix3,AvVxxyyzz) = ((vx-(*av)(ix1,ix2,ix3,AvVx))*(vx-(*av)(ix1,ix2,ix3,AvVx)) + - (vy-(*av)(ix1,ix2,ix3,AvVy))*(vy-(*av)(ix1,ix2,ix3,AvVy)) + - (vz-(*av)(ix1,ix2,ix3,AvVz))*(vz-(*av)(ix1,ix2,ix3,AvVz)) + - (*av)(ix1,ix2,ix3,AvVxxyyzz)*timeStep)/(timeStep+1.0); - ////////////////////////////////////////////////////////////////////////// - } - } - } - } - } - } - } -} - diff --git a/src/VirtualFluids/CoProcessors/TurbulenceIntensityCoProcessor.h b/src/VirtualFluids/CoProcessors/TurbulenceIntensityCoProcessor.h deleted file mode 100644 index 13ace9401..000000000 --- a/src/VirtualFluids/CoProcessors/TurbulenceIntensityCoProcessor.h +++ /dev/null @@ -1,45 +0,0 @@ -#ifndef TurbulenceIntensityCoProcessor_H -#define TurbulenceIntensityCoProcessor_H - -#include <memory> -#include <string> -#include <string> - -#include "CoProcessor.h" - -class Communicator; -class Grid3D; -class UbScheduler; -class WbWriter; -class Block3D; - -class TurbulenceIntensityCoProcessor; -typedef std::shared_ptr<TurbulenceIntensityCoProcessor> TurbulenceIntensityCoProcessorPtr; - -class TurbulenceIntensityCoProcessor : public CoProcessor -{ -public: - TurbulenceIntensityCoProcessor(std::shared_ptr<Grid3D> grid, const std::string& path, WbWriter* const writer, - std::shared_ptr<UbScheduler> s, std::shared_ptr<Communicator> comm); - void process(double step); -protected: - void collectData(double step); - void addData(const std::shared_ptr<Block3D> block); - void clearData(); - void calculateAverageValues(double timeStep); -private: - void init(); - std::vector<UbTupleFloat3> nodes; - std::vector<UbTupleInt8> cells; - std::vector<std::string> datanames; - std::vector<std::vector<double> > data; - std::vector<std::vector<std::shared_ptr<Block3D> > > blockVector; - int minInitLevel; - int maxInitLevel; - int gridRank; - std::string path; - WbWriter* writer; - std::shared_ptr<Communicator> comm; - enum Values{AvVx = 0, AvVy = 1, AvVz = 2, AvVxxyyzz = 3}; -}; -#endif diff --git a/src/VirtualFluids/CoProcessors/WriteBlocksCoProcessor.cpp b/src/VirtualFluids/CoProcessors/WriteBlocksCoProcessor.cpp deleted file mode 100644 index 1dd21263d..000000000 --- a/src/VirtualFluids/CoProcessors/WriteBlocksCoProcessor.cpp +++ /dev/null @@ -1,153 +0,0 @@ -#include "WriteBlocksCoProcessor.h" -#include "basics/writer/WbWriterVtkXmlASCII.h" - -#include "D3Q27System.h" -#include "Block3D.h" -#include "UbScheduler.h" -#include "Communicator.h" -#include "Grid3D.h" - -WriteBlocksCoProcessor::WriteBlocksCoProcessor(Grid3DPtr grid, UbSchedulerPtr s, - const std::string& path, WbWriter* const writer, - CommunicatorPtr comm) : - CoProcessor(grid, s), - path(path), - writer(writer), - comm(comm) -{ - -} -////////////////////////////////////////////////////////////////////////// -WriteBlocksCoProcessor::~WriteBlocksCoProcessor() -{ -} -////////////////////////////////////////////////////////////////////////// -void WriteBlocksCoProcessor::process(double step) -{ - if(scheduler->isDue(step) ) - collectData(step); -} -////////////////////////////////////////////////////////////////////////// -void WriteBlocksCoProcessor::collectData(double step) -{ - if (comm->getProcessID() == comm->getRoot()) - { - int istep = int(step); - std::vector<std::string> filenames; - std::vector< UbTupleFloat3 > nodes; - std::vector< UbTupleInt8 > cells; - std::vector<std::string> celldatanames; - - celldatanames.push_back("isActive"); - celldatanames.push_back("rank"); - celldatanames.push_back("interface"); - celldatanames.push_back("ID"); - celldatanames.push_back("part"); - celldatanames.push_back("level"); - //celldatanames.push_back("connectorCF"); - //celldatanames.push_back("connectorFC"); -#if defined VF_FETOL - celldatanames.push_back("bundle"); -#endif - - std::vector< std::vector< double > > celldata(celldatanames.size()); - - int nr=0; - int minInitLevel = this->grid->getCoarsestInitializedLevel(); - int maxInitLevel = this->grid->getFinestInitializedLevel(); - - for(int level = minInitLevel; level<=maxInitLevel;level++) - { - std::vector<Block3DPtr> blockVector; - grid->getBlocks(level, blockVector); - for(Block3DPtr block : blockVector) - { - UbTupleDouble3 org = grid->getBlockWorldCoordinates(block); - UbTupleDouble3 blockLength = grid->getBlockLengths(block); - - nodes.push_back(makeUbTuple((float)(val<1>(org)), (float)(val<2>(org)), (float)(val<3>(org)))); - nodes.push_back(makeUbTuple((float)(val<1>(org)+val<1>(blockLength)), (float)(val<2>(org)), (float)(val<3>(org)))); - nodes.push_back(makeUbTuple((float)(val<1>(org)+val<1>(blockLength)), (float)(val<2>(org)+val<2>(blockLength)), (float)(val<3>(org)))); - nodes.push_back(makeUbTuple((float)(val<1>(org)), (float)(val<2>(org)+val<2>(blockLength)), (float)(val<3>(org)))); - nodes.push_back(makeUbTuple((float)(val<1>(org)), (float)(val<2>(org)), (float)(val<3>(org)+val<3>(blockLength)))); - nodes.push_back(makeUbTuple((float)(val<1>(org)+val<1>(blockLength)), (float)(val<2>(org)), (float)(val<3>(org)+val<3>(blockLength)))); - nodes.push_back(makeUbTuple((float)(val<1>(org)+val<1>(blockLength)), (float)(val<2>(org)+val<2>(blockLength)), (float)(val<3>(org)+val<3>(blockLength)))); - nodes.push_back(makeUbTuple((float)(val<1>(org)), (float)(val<2>(org)+val<2>(blockLength)), (float)(val<3>(org)+val<3>(blockLength)))); - cells.push_back(makeUbTuple(nr, nr+1, nr+2, nr+3, nr+4, nr+5, nr+6, nr+7)); - nr += 8; - - //data - celldata[0].push_back((double)block->isActive()); - celldata[1].push_back((double)block->getRank()); - celldata[2].push_back((double)block->hasInterpolationFlag()); - celldata[3].push_back((double)block->getGlobalID()); - celldata[4].push_back((double)block->getPart()); - celldata[5].push_back((double)block->getLevel()); - - //bool flag = false; - //std::vector<Block3DConnectorPtr> connectors; - - //block->pushBackLocalInterpolationConnectorsCF(connectors); - //for (std::size_t i = 0; i<connectors.size(); i++) - // if (connectors[i]) - // { - // if (connectors[i]->getSendDir() == D3Q27System::BS) - // { - - // flag = true; - // } - // } - - //if (flag) - //{ - // celldata[6].push_back(1); - // UBLOG(logINFO, "CF: "+block->toString()); - //} - //else - //{ - // celldata[6].push_back(0); - //} - - //flag = false; - //connectors.resize(0); - //block->pushBackLocalInterpolationConnectorsFC(connectors); - //for (std::size_t i = 0; i<connectors.size(); i++) - // if (connectors[i]) - // { - // if (connectors[i]->getSendDir() == D3Q27System::BS) - // { - - // flag = true; - // } - // } - - //if (flag) - //{ - // celldata[7].push_back(1); - // UBLOG(logINFO, "FC: "+block->toString()); - //} - //else - //{ - // celldata[7].push_back(0); - //} - -#ifdef VF_FETOL - celldata[6].push_back( (double)block->getBundle()); -#endif - } - } - - filenames.push_back(writer->writeOctsWithCellData(path+"/blocks/blocks_" + UbSystem::toString(grid->getRank()) + "_" + UbSystem::toString(istep),nodes,cells,celldatanames,celldata)); - - if (istep == CoProcessor::scheduler->getMinBegin()) - { - WbWriterVtkXmlASCII::getInstance()->writeCollection(path+"/blocks/blocks_collection",filenames,istep,false); - } - else - { - WbWriterVtkXmlASCII::getInstance()->addFilesToCollection(path + "/blocks/blocks_collection", filenames, istep, false); - } - - UBLOG(logINFO,"BlocksCoProcessor step: " << istep); - } -} diff --git a/src/VirtualFluids/CoProcessors/WriteBlocksCoProcessor.h b/src/VirtualFluids/CoProcessors/WriteBlocksCoProcessor.h deleted file mode 100644 index 4163005cd..000000000 --- a/src/VirtualFluids/CoProcessors/WriteBlocksCoProcessor.h +++ /dev/null @@ -1,41 +0,0 @@ -/* -* BlocksCoProcessor.h -* -* Created on: 24.09.2012 -* Author: K. Kucher -*/ - -#ifndef BlocksCoProcessor_H_ -#define BlocksCoProcessor_H_ - -#include <memory> -#include <string> - -#include "CoProcessor.h" - -class Communicator; -class Grid3D; -class UbScheduler; -class WbWriter; - -class WriteBlocksCoProcessor; -typedef std::shared_ptr<WriteBlocksCoProcessor> WriteBlocksCoProcessorPtr; - -class WriteBlocksCoProcessor: public CoProcessor -{ -public: - WriteBlocksCoProcessor(std::shared_ptr<Grid3D> grid, std::shared_ptr<UbScheduler> s, const std::string& path, WbWriter* const writer, std::shared_ptr<Communicator> comm); - virtual ~WriteBlocksCoProcessor(); - - void process(double step) override; - -protected: - void collectData(double step); - - std::string path; - WbWriter* writer; - std::shared_ptr<Communicator> comm; -}; - - -#endif diff --git a/src/VirtualFluids/CoProcessors/WriteBoundaryConditionsCoProcessor.cpp b/src/VirtualFluids/CoProcessors/WriteBoundaryConditionsCoProcessor.cpp deleted file mode 100644 index 1f2feafbe..000000000 --- a/src/VirtualFluids/CoProcessors/WriteBoundaryConditionsCoProcessor.cpp +++ /dev/null @@ -1,241 +0,0 @@ -#include "WriteBoundaryConditionsCoProcessor.h" -#include "LBMKernel.h" -#include "BCProcessor.h" -#include <vector> -#include <string> - -#include "basics/writer/WbWriterVtkXmlASCII.h" -#include "Grid3D.h" -#include "Block3D.h" -#include "LBMUnitConverter.h" -#include "Communicator.h" -#include "WbWriter.h" -#include "UbScheduler.h" -#include "CbArray3D.h" -#include "BCArray3D.h" - -using namespace std; - -WriteBoundaryConditionsCoProcessor::WriteBoundaryConditionsCoProcessor() -{ - -} -////////////////////////////////////////////////////////////////////////// -WriteBoundaryConditionsCoProcessor::WriteBoundaryConditionsCoProcessor(Grid3DPtr grid, UbSchedulerPtr s, - const std::string& path, WbWriter* const writer, - LBMUnitConverterPtr conv, CommunicatorPtr comm) - : CoProcessor(grid, s), - path(path), - writer(writer), - conv(conv), - comm(comm) -{ - gridRank = comm->getProcessID(); - minInitLevel = this->grid->getCoarsestInitializedLevel(); - maxInitLevel = this->grid->getFinestInitializedLevel(); - - blockVector.resize(maxInitLevel+1); - - for (int level = minInitLevel; level<=maxInitLevel; level++) - { - grid->getBlocks(level, gridRank, true, blockVector[level]); - } -} -////////////////////////////////////////////////////////////////////////// -void WriteBoundaryConditionsCoProcessor::process(double step) -{ - if (scheduler->isDue(step)) - collectData(step); - - UBLOG(logDEBUG3, "WriteBoundaryConditionsCoProcessor::update:"<<step); -} -////////////////////////////////////////////////////////////////////////// -void WriteBoundaryConditionsCoProcessor::collectData(double step) -{ - int istep = static_cast<int>(step); - - for (int level = minInitLevel; level<=maxInitLevel; level++) - { - for(Block3DPtr block : blockVector[level]) - { - if (block) - { - addDataGeo(block); - } - } - } - - string pfilePath, partPath, subfolder, cfilePath; - - subfolder = "bc"+UbSystem::toString(istep); - pfilePath = path+"/bc/"+subfolder; - cfilePath = path+"/bc/bc_collection"; - partPath = pfilePath+"/bc"+UbSystem::toString(gridRank)+"_"+UbSystem::toString(istep); - - - string partName = writer->writeOctsWithNodeData(partPath, nodes, cells, datanames, data); - size_t found = partName.find_last_of("/"); - string piece = partName.substr(found+1); - piece = subfolder+"/"+piece; - - vector<string> cellDataNames; - vector<string> pieces = comm->gather(piece); - if (comm->getProcessID()==comm->getRoot()) - { - string pname = WbWriterVtkXmlASCII::getInstance()->writeParallelFile(pfilePath, pieces, datanames, cellDataNames); - found = pname.find_last_of("/"); - piece = pname.substr(found+1); - - vector<string> filenames; - filenames.push_back(piece); - if (step==CoProcessor::scheduler->getMinBegin()) - { - WbWriterVtkXmlASCII::getInstance()->writeCollection(cfilePath, filenames, istep, false); - } - else - { - WbWriterVtkXmlASCII::getInstance()->addFilesToCollection(cfilePath, filenames, istep, false); - } - UBLOG(logINFO, "WriteBoundaryConditionsCoProcessor step: "<<istep); - } - - clearData(); -} -////////////////////////////////////////////////////////////////////////// -void WriteBoundaryConditionsCoProcessor::clearData() -{ - nodes.clear(); - cells.clear(); - datanames.clear(); - data.clear(); -} -////////////////////////////////////////////////////////////////////////// -void WriteBoundaryConditionsCoProcessor::addDataGeo(Block3DPtr block) -{ - UbTupleDouble3 org = grid->getBlockWorldCoordinates(block); - UbTupleDouble3 blockLengths = grid->getBlockLengths(block); - UbTupleDouble3 nodeOffset = grid->getNodeOffset(block); - double dx = grid->getDeltaX(block); - - double level = (double)block->getLevel(); - - //Diese Daten werden geschrieben: - datanames.resize(0); - datanames.push_back("Boundary Conditions"); - datanames.push_back("Geometry"); - datanames.push_back("Level"); - //datanames.push_back("Interface CF"); - - data.resize(datanames.size()); - - ILBMKernelPtr kernel = block->getKernel(); - BCArray3DPtr bcArray = kernel->getBCProcessor()->getBCArray(); - - //knotennummerierung faengt immer bei 0 an! - int SWB, SEB, NEB, NWB, SWT, SET, NET, NWT; - - int minX1 = 0; - int minX2 = 0; - int minX3 = 0; - - int maxX1 = (int)bcArray->getNX1(); - int maxX2 = (int)bcArray->getNX2(); - int maxX3 = (int)bcArray->getNX3(); - - //nummern vergeben und node vector erstellen + daten sammeln - CbArray3D<int> nodeNumbers((int)maxX1, (int)maxX2, (int)maxX3, -1); - //D3Q27BoundaryConditionPtr bcPtr; - int nr = (int)nodes.size(); - - maxX1 -= 1; - maxX2 -= 1; - maxX3 -= 1; - - int s=0; - - - - for (size_t ix3 = minX3; ix3<=maxX3; ix3++) - { - for (size_t ix2 = minX2; ix2<=maxX2; ix2++) - { - for (size_t ix1 = minX1; ix1<=maxX1; ix1++) - { - if (!bcArray->isUndefined(ix1, ix2, ix3)) - { - //int index = 0; - nodeNumbers(ix1, ix2, ix3) = nr++; - nodes.push_back(makeUbTuple(float(val<1>(org)-val<1>(nodeOffset)+ix1*dx), - float(val<2>(org)-val<2>(nodeOffset)+ix2*dx), - float(val<3>(org)-val<3>(nodeOffset)+ix3*dx))); - - - - if (!bcArray->hasBC(ix1, ix2, ix3)) - { - data[0].push_back(0.0); - } - else if (bcArray->getBC(ix1, ix2, ix3)->hasNoSlipBoundary()) - data[0].push_back(1.0); - else if (bcArray->getBC(ix1, ix2, ix3)->hasVelocityBoundary()) - data[0].push_back(2.0); - else if (bcArray->getBC(ix1, ix2, ix3)->hasDensityBoundary()) - data[0].push_back(3.0); - else if (bcArray->getBC(ix1, ix2, ix3)->hasSlipBoundary()) - data[0].push_back(4.0); - else - data[0].push_back(5.0); - - - if (bcArray->isSolid(ix1, ix2, ix3)) - { - data[1].push_back(1.0); - } - else - { - data[1].push_back(0.0); - } - - - data[2].push_back(level); - - //if (bcArray->isInterfaceCF(ix1, ix2, ix3)) - //{ - // data[3].push_back(1.0); - //} - //else - //{ - // data[3].push_back(0.0); - //} - - } - } - } - } - - maxX1 -= 1; - maxX2 -= 1; - maxX3 -= 1; - - //cell vector erstellen - for (int ix3 = minX3; ix3<=maxX3; ix3++) - { - for (int ix2 = minX2; ix2<=maxX2; ix2++) - { - for (int ix1 = minX1; ix1<=maxX1; ix1++) - { - if ((SWB = nodeNumbers(ix1, ix2, ix3))>=0 - &&(SEB = nodeNumbers(ix1+1, ix2, ix3))>=0 - &&(NEB = nodeNumbers(ix1+1, ix2+1, ix3))>=0 - &&(NWB = nodeNumbers(ix1, ix2+1, ix3))>=0 - &&(SWT = nodeNumbers(ix1, ix2, ix3+1))>=0 - &&(SET = nodeNumbers(ix1+1, ix2, ix3+1))>=0 - &&(NET = nodeNumbers(ix1+1, ix2+1, ix3+1))>=0 - &&(NWT = nodeNumbers(ix1, ix2+1, ix3+1))>=0) - { - cells.push_back(makeUbTuple(SWB, SEB, NEB, NWB, SWT, SET, NET, NWT)); - } - } - } - } -} diff --git a/src/VirtualFluids/CoProcessors/WriteBoundaryConditionsCoProcessor.h b/src/VirtualFluids/CoProcessors/WriteBoundaryConditionsCoProcessor.h deleted file mode 100644 index f4b872895..000000000 --- a/src/VirtualFluids/CoProcessors/WriteBoundaryConditionsCoProcessor.h +++ /dev/null @@ -1,66 +0,0 @@ -#ifndef WriteBoundaryConditionsCoProcessor_H -#define WriteBoundaryConditionsCoProcessor_H - -#include <memory> -#include <string> -#include <vector> - -#include "CoProcessor.h" - -class Communicator; -class Grid3D; -class UbScheduler; -class WbWriter; -class Block3D; -class LBMUnitConverter; - -class WriteBoundaryConditionsCoProcessor; -typedef std::shared_ptr<WriteBoundaryConditionsCoProcessor> WriteBoundaryConditionsCoProcessorPtr; - -class WriteBoundaryConditionsCoProcessor : public CoProcessor -{ -public: - WriteBoundaryConditionsCoProcessor(); - WriteBoundaryConditionsCoProcessor(std::shared_ptr<Grid3D> grid, std::shared_ptr<UbScheduler> s, - const std::string& path, WbWriter* const writer, - std::shared_ptr<LBMUnitConverter> conv, std::shared_ptr<Communicator> comm); - ~WriteBoundaryConditionsCoProcessor() {} - - void process(double step) override; - -protected: - void collectData(double step); - void addDataGeo(std::shared_ptr<Block3D> block); - void clearData(); - -private: - std::vector<UbTupleFloat3> nodes; - std::vector<UbTupleInt8> cells; - std::vector<std::string> datanames; - std::vector<std::vector<double> > data; - std::string path; - WbWriter* writer; - std::shared_ptr<LBMUnitConverter> conv; - bool bcInformation; - std::vector<std::vector<std::shared_ptr<Block3D> > > blockVector; - int minInitLevel; - int maxInitLevel; - int gridRank; - std::shared_ptr<Communicator> comm; - - friend class boost::serialization::access; - template<class Archive> - void serialize(Archive & ar, const unsigned int version) - { - ar & boost::serialization::base_object<CoProcessor>(*this); - ar & path; - ar & conv; - ar & bcInformation; - ar & blockVector; - ar & minInitLevel; - ar & maxInitLevel; - ar & gridRank; - ar & writer; - } -}; -#endif diff --git a/src/VirtualFluids/CoProcessors/WriteMacroscopicQuantitiesCoProcessor.cpp b/src/VirtualFluids/CoProcessors/WriteMacroscopicQuantitiesCoProcessor.cpp deleted file mode 100644 index b474de985..000000000 --- a/src/VirtualFluids/CoProcessors/WriteMacroscopicQuantitiesCoProcessor.cpp +++ /dev/null @@ -1,258 +0,0 @@ -#include "WriteMacroscopicQuantitiesCoProcessor.h" -#include "LBMKernel.h" -#include "BCProcessor.h" -#include <vector> -#include <string> - -#include "basics/writer/WbWriterVtkXmlASCII.h" -#include "DataSet3D.h" -#include "UbScheduler.h" -#include "Grid3D.h" -#include "Communicator.h" -#include "LBMUnitConverter.h" -#include "Block3D.h" -#include "BCArray3D.h" - -WriteMacroscopicQuantitiesCoProcessor::WriteMacroscopicQuantitiesCoProcessor() -{ - -} -////////////////////////////////////////////////////////////////////////// -WriteMacroscopicQuantitiesCoProcessor::WriteMacroscopicQuantitiesCoProcessor(Grid3DPtr grid, UbSchedulerPtr s, - const std::string& path, WbWriter* const writer, - LBMUnitConverterPtr conv, - CommunicatorPtr comm) - : CoProcessor(grid, s), - path(path), - writer(writer), - conv(conv), - comm(comm) -{ - gridRank = comm->getProcessID(); - minInitLevel = this->grid->getCoarsestInitializedLevel(); - maxInitLevel = this->grid->getFinestInitializedLevel(); - - blockVector.resize(maxInitLevel+1); - - for (int level = minInitLevel; level<=maxInitLevel; level++) - { - grid->getBlocks(level, gridRank, true, blockVector[level]); - } -} -////////////////////////////////////////////////////////////////////////// -void WriteMacroscopicQuantitiesCoProcessor::init() -{ - -} -////////////////////////////////////////////////////////////////////////// -void WriteMacroscopicQuantitiesCoProcessor::process(double step) -{ - if(scheduler->isDue(step) ) - collectData(step); - - UBLOG(logDEBUG3, "WriteMacroscopicQuantitiesCoProcessor::update:" << step); -} -////////////////////////////////////////////////////////////////////////// -void WriteMacroscopicQuantitiesCoProcessor::collectData(double step) -{ - int istep = static_cast<int>(step); - - for(int level = minInitLevel; level<=maxInitLevel;level++) - { - for(Block3DPtr block : blockVector[level]) - { - if (block) - { - addDataMQ(block); - } - } - } - - std::string pfilePath, partPath, subfolder, cfilePath; - - subfolder = "mq"+UbSystem::toString(istep); - pfilePath = path+"/mq/"+subfolder; - cfilePath = path+"/mq/mq_collection"; - partPath = pfilePath+"/mq"+UbSystem::toString(gridRank)+ "_" + UbSystem::toString(istep); - - - std::string partName = writer->writeOctsWithNodeData(partPath,nodes,cells,datanames,data); - size_t found=partName.find_last_of("/"); - std::string piece = partName.substr(found+1); - piece = subfolder + "/" + piece; - - std::vector<std::string> cellDataNames; - CommunicatorPtr comm = Communicator::getInstance(); - std::vector<std::string> pieces = comm->gather(piece); - if (comm->getProcessID() == comm->getRoot()) - { - std::string pname = WbWriterVtkXmlASCII::getInstance()->writeParallelFile(pfilePath,pieces,datanames,cellDataNames); - found=pname.find_last_of("/"); - piece = pname.substr(found+1); - - std::vector<std::string> filenames; - filenames.push_back(piece); - if (step == CoProcessor::scheduler->getMinBegin()) - { - WbWriterVtkXmlASCII::getInstance()->writeCollection(cfilePath,filenames,istep,false); - } - else - { - WbWriterVtkXmlASCII::getInstance()->addFilesToCollection(cfilePath,filenames,istep,false); - } - UBLOG(logINFO,"WriteMacroscopicQuantitiesCoProcessor step: " << istep); - } - - clearData(); -} -////////////////////////////////////////////////////////////////////////// -void WriteMacroscopicQuantitiesCoProcessor::clearData() -{ - nodes.clear(); - cells.clear(); - datanames.clear(); - data.clear(); -} -////////////////////////////////////////////////////////////////////////// -void WriteMacroscopicQuantitiesCoProcessor::addDataMQ(Block3DPtr block) -{ - double level = (double)block->getLevel(); - double blockID = (double)block->getGlobalID(); - - //Diese Daten werden geschrieben: - datanames.resize(0); - datanames.push_back("Rho"); - datanames.push_back("Vx"); - datanames.push_back("Vy"); - datanames.push_back("Vz"); - //datanames.push_back("Press"); - datanames.push_back("Level"); - //datanames.push_back("BlockID"); - - - - data.resize(datanames.size()); - - ILBMKernelPtr kernel = block->getKernel(); - BCArray3DPtr bcArray = kernel->getBCProcessor()->getBCArray(); - DistributionArray3DPtr distributions = kernel->getDataSet()->getFdistributions(); - LBMReal f[D3Q27System::ENDF+1]; - LBMReal vx1,vx2,vx3,rho; - - //knotennummerierung faengt immer bei 0 an! - int SWB,SEB,NEB,NWB,SWT,SET,NET,NWT; - - if(block->getKernel()->getCompressible()) - { - calcMacros = &D3Q27System::calcCompMacroscopicValues; - } - else - { - calcMacros = &D3Q27System::calcIncompMacroscopicValues; - } - - int minX1 = 0; - int minX2 = 0; - int minX3 = 0; - - int maxX1 = (int)(distributions->getNX1()); - int maxX2 = (int)(distributions->getNX2()); - int maxX3 = (int)(distributions->getNX3()); - - //int minX1 = 1; - //int minX2 = 1; - //int minX3 = 1; - - //int maxX1 = (int)(distributions->getNX1()); - //int maxX2 = (int)(distributions->getNX2()); - //int maxX3 = (int)(distributions->getNX3()); - - //nummern vergeben und node vector erstellen + daten sammeln - CbArray3D<int> nodeNumbers((int)maxX1, (int)maxX2, (int)maxX3,-1); - maxX1 -= 2; - maxX2 -= 2; - maxX3 -= 2; - - //D3Q27BoundaryConditionPtr bcPtr; - int nr = (int)nodes.size(); - - for(size_t ix3=minX3; ix3<=maxX3; ix3++) - { - for(size_t ix2=minX2; ix2<=maxX2; ix2++) - { - for(size_t ix1=minX1; ix1<=maxX1; ix1++) - { - if(!bcArray->isUndefined(ix1,ix2,ix3) && !bcArray->isSolid(ix1,ix2,ix3)) - { - int index = 0; - nodeNumbers(ix1,ix2,ix3) = nr++; - Vector3D worldCoordinates = grid->getNodeCoordinates(block, ix1, ix2, ix3); - nodes.push_back( UbTupleFloat3(float(worldCoordinates[0]), - float(worldCoordinates[1]), - float(worldCoordinates[2]) )); - - distributions->getDistribution(f, ix1, ix2, ix3); - calcMacros(f,rho,vx1,vx2,vx3); - //double press = D3Q27System::calcPress(f,rho,vx1,vx2,vx3); - - if (UbMath::isNaN(rho) || UbMath::isInfinity(rho)) - UB_THROW( UbException(UB_EXARGS,"rho is not a number (nan or -1.#IND) or infinity number -1.#INF in block="+block->toString()+ - ", node="+UbSystem::toString(ix1)+","+UbSystem::toString(ix2)+","+UbSystem::toString(ix3))); - //rho=999.0; - //if (UbMath::isNaN(press) || UbMath::isInfinity(press)) - // UB_THROW( UbException(UB_EXARGS,"press is not a number (nan or -1.#IND) or infinity number -1.#INF in block="+block->toString()+ - // ", node="+UbSystem::toString(ix1)+","+UbSystem::toString(ix2)+","+UbSystem::toString(ix3))); - //press=999.0; - if (UbMath::isNaN(vx1) || UbMath::isInfinity(vx1)) - UB_THROW( UbException(UB_EXARGS,"vx1 is not a number (nan or -1.#IND) or infinity number -1.#INF in block="+block->toString()+ - ", node="+UbSystem::toString(ix1)+","+UbSystem::toString(ix2)+","+UbSystem::toString(ix3))); - //vx1=999.0; - if (UbMath::isNaN(vx2) || UbMath::isInfinity(vx2)) - UB_THROW( UbException(UB_EXARGS,"vx2 is not a number (nan or -1.#IND) or infinity number -1.#INF in block="+block->toString()+ - ", node="+UbSystem::toString(ix1)+","+UbSystem::toString(ix2)+","+UbSystem::toString(ix3))); - //vx2=999.0; - if (UbMath::isNaN(vx3) || UbMath::isInfinity(vx3)) - UB_THROW( UbException(UB_EXARGS,"vx3 is not a number (nan or -1.#IND) or infinity number -1.#INF in block="+block->toString()+ - ", node="+UbSystem::toString(ix1)+","+UbSystem::toString(ix2)+","+UbSystem::toString(ix3))); - - data[index++].push_back(rho); - data[index++].push_back(vx1); - data[index++].push_back(vx2); - data[index++].push_back(vx3); - - //data[index++].push_back(rho * conv->getFactorDensityLbToW2() ); - //data[index++].push_back(vx1 * conv->getFactorVelocityLbToW2()); - //data[index++].push_back(vx2 * conv->getFactorVelocityLbToW2()); - //data[index++].push_back(vx3 * conv->getFactorVelocityLbToW2()); - //data[index++].push_back(press * conv->getFactorPressureLbToW2()); - data[index++].push_back(level); - //data[index++].push_back(blockID); - } - } - } - } - maxX1 -= 1; - maxX2 -= 1; - maxX3 -= 1; - //cell vector erstellen - for(int ix3=minX3; ix3<=maxX3; ix3++) - { - for(int ix2=minX2; ix2<=maxX2; ix2++) - { - for(int ix1=minX1; ix1<=maxX1; ix1++) - { - if( (SWB=nodeNumbers( ix1 , ix2, ix3 )) >= 0 - && (SEB=nodeNumbers( ix1+1, ix2, ix3 )) >= 0 - && (NEB=nodeNumbers( ix1+1, ix2+1, ix3 )) >= 0 - && (NWB=nodeNumbers( ix1 , ix2+1, ix3 )) >= 0 - && (SWT=nodeNumbers( ix1 , ix2, ix3+1 )) >= 0 - && (SET=nodeNumbers( ix1+1, ix2, ix3+1 )) >= 0 - && (NET=nodeNumbers( ix1+1, ix2+1, ix3+1 )) >= 0 - && (NWT=nodeNumbers( ix1 , ix2+1, ix3+1 )) >= 0 ) - { - cells.push_back( makeUbTuple(SWB,SEB,NEB,NWB,SWT,SET,NET,NWT) ); - } - } - } - } -} diff --git a/src/VirtualFluids/CoProcessors/WriteMacroscopicQuantitiesCoProcessor.h b/src/VirtualFluids/CoProcessors/WriteMacroscopicQuantitiesCoProcessor.h deleted file mode 100644 index a72a58cdb..000000000 --- a/src/VirtualFluids/CoProcessors/WriteMacroscopicQuantitiesCoProcessor.h +++ /dev/null @@ -1,73 +0,0 @@ -#ifndef D3Q27MACROSCOPICQUANTITIESCoProcessor_H -#define D3Q27MACROSCOPICQUANTITIESCoProcessor_H - -#include <memory> -#include <string> -#include <vector> - -#include "CoProcessor.h" - -#include "LBMSystem.h" - -class Communicator; -class Grid3D; -class UbScheduler; -class LBMUnitConverter; -class WbWriter; -class Block3D; - -class WriteMacroscopicQuantitiesCoProcessor; -typedef std::shared_ptr<WriteMacroscopicQuantitiesCoProcessor> MacroscopicQuantitiesCoProcessorPtr; - -class WriteMacroscopicQuantitiesCoProcessor : public CoProcessor -{ -public: - WriteMacroscopicQuantitiesCoProcessor(); - WriteMacroscopicQuantitiesCoProcessor(std::shared_ptr<Grid3D> grid, std::shared_ptr<UbScheduler> s, - const std::string& path, WbWriter* const writer, - std::shared_ptr<LBMUnitConverter> conv, std::shared_ptr<Communicator> comm); - ~WriteMacroscopicQuantitiesCoProcessor(){} - - void process(double step) override; - -protected: - void collectData(double step); - void addDataMQ(std::shared_ptr<Block3D> block); - void addDataGeo(std::shared_ptr<Block3D> block); - void clearData(); - -private: - void init(); - std::vector<UbTupleFloat3> nodes; - std::vector<UbTupleInt8> cells; - std::vector<std::string> datanames; - std::vector<std::vector<double> > data; - std::string path; - WbWriter* writer; - std::shared_ptr<LBMUnitConverter> conv; - bool bcInformation; - std::vector<std::vector<std::shared_ptr<Block3D> > > blockVector; - int minInitLevel; - int maxInitLevel; - int gridRank; - std::shared_ptr<Communicator> comm; - - typedef void(*CalcMacrosFct)(const LBMReal* const& /*feq[27]*/, LBMReal& /*(d)rho*/, LBMReal& /*vx1*/, LBMReal& /*vx2*/, LBMReal& /*vx3*/); - CalcMacrosFct calcMacros; - - //friend class boost::serialization::access; - //template<class Archive> - //void serialize(Archive & ar, const unsigned int version) - //{ - // ar & boost::serialization::base_object<CoProcessor>(*this); - // ar & path; - // ar & conv; - // ar & blockVector; - // ar & minInitLevel; - // ar & maxInitLevel; - // ar & gridRank; - // ar & writer; - //} -}; - -#endif diff --git a/src/VirtualFluids/CoProcessors/WriteObjectsCoProcessor.cpp b/src/VirtualFluids/CoProcessors/WriteObjectsCoProcessor.cpp deleted file mode 100644 index 337525ef1..000000000 --- a/src/VirtualFluids/CoProcessors/WriteObjectsCoProcessor.cpp +++ /dev/null @@ -1,52 +0,0 @@ -#include "WriteObjectsCoProcessor.h" -#include "LBMKernel.h" -#include "BCProcessor.h" - -#include "basics/writer/WbWriterVtkXmlBinary.h" -#include "basics/writer/WbWriterVtkXmlASCII.h" - -#include "GbSphere3D.h" -#include "Communicator.h" -#include "UbScheduler.h" -#include "Grid3D.h" - -WriteObjectsCoProcessor::WriteObjectsCoProcessor() -{ - -} -////////////////////////////////////////////////////////////////////////// -WriteObjectsCoProcessor::WriteObjectsCoProcessor(Grid3DPtr grid, UbSchedulerPtr s, - const std::string& path, CommunicatorPtr comm) - : CoProcessor(grid, s), - path(path), - comm(comm) -{ - this->path += "/geo/objects/sphere"; -} - - -void WriteObjectsCoProcessor::addGbObject(GbSphere3DPtr sphere) -{ - objects.push_back(sphere); -} - -void WriteObjectsCoProcessor::process(double step) -{ - if (scheduler->isDue(step)) - { - std::vector<UbTupleFloat3> nodes; - std::vector<UbTupleInt3> triangles; - - for (size_t i = 0; i < objects.size(); i++) - { - objects[i]->addSurfaceTriangleSet(nodes, triangles); - - - } - int stepInt = (int)step; - std::string outFilename = WbWriterVtkXmlBinary::getInstance()->writeTriangles(path + std::to_string(stepInt), nodes, triangles); - - } - - -} diff --git a/src/VirtualFluids/CoProcessors/WriteObjectsCoProcessor.h b/src/VirtualFluids/CoProcessors/WriteObjectsCoProcessor.h deleted file mode 100644 index cf7d3a84b..000000000 --- a/src/VirtualFluids/CoProcessors/WriteObjectsCoProcessor.h +++ /dev/null @@ -1,45 +0,0 @@ -/* -* Author: S. Peters -* mail: peters@irmb.tu-bs.de -*/ -#ifndef WriteObjectsCoProcessor_H -#define WriteObjectsCoProcessor_H - -#include <memory> -#include <string> -#include <memory> - -#include "CoProcessor.h" - -class GbSphere3D; -class Communicator; -class Grid3D; -class UbScheduler; - -class WriteObjectsCoProcessor; -typedef std::shared_ptr<WriteObjectsCoProcessor> WriteObjectsCoProcessorPtr; - -class WriteObjectsCoProcessor : public CoProcessor -{ -public: - WriteObjectsCoProcessor(); - WriteObjectsCoProcessor(std::shared_ptr<Grid3D> grid, std::shared_ptr<UbScheduler> s, const std::string& path, std::shared_ptr<Communicator> comm); - ~WriteObjectsCoProcessor() {} - void process(double step) override; - - void addGbObject(std::shared_ptr<GbSphere3D> sphere); - -private: - std::string path; - std::shared_ptr<Communicator> comm; - - std::vector<std::shared_ptr<GbSphere3D> > objects; - - friend class boost::serialization::access; - template<class Archive> - void serialize(Archive & ar, const unsigned int version) - { - - } -}; -#endif diff --git a/src/VirtualFluids/Connectors/Block3DConnector.h b/src/VirtualFluids/Connectors/Block3DConnector.h deleted file mode 100644 index 65326b669..000000000 --- a/src/VirtualFluids/Connectors/Block3DConnector.h +++ /dev/null @@ -1,101 +0,0 @@ -// _ ___ __ __________ _ __ -// | | / (_)____/ /___ ______ _/ / ____/ /_ __(_)___/ /____ -// | | / / / ___/ __/ / / / __ `/ / /_ / / / / / / __ / ___/ -// | |/ / / / / /_/ /_/ / /_/ / / __/ / / /_/ / / /_/ (__ ) -// |___/_/_/ \__/\__,_/\__,_/_/_/ /_/\__,_/_/\__,_/____/ -// -#ifndef BLOCK2DCONNECTOR_H -#define BLOCK2DCONNECTOR_H - -#include <vector> -#include <string> - -#include <basics/utilities/UbTuple.h> - -#include <memory> - -class Block3DConnector; -typedef std::shared_ptr<Block3DConnector> Block3DConnectorPtr; - -class Block3DConnector -{ - //FETOL -#ifdef VF_FETOL -public: - enum TransmitterType{NONE=0, MPI=1, BOND=2}; -#endif -public: - Block3DConnector() - : sendDir(-1) -#ifdef VF_FETOL - , ttype(NONE) -#endif - {} - - Block3DConnector(const int& sendDir) - : sendDir(sendDir) -#ifdef VF_FETOL - , ttype(NONE) -#endif - {} - - virtual ~Block3DConnector() {} - - virtual void init()=0; - - //for synchronize the send- and receive-bufferlength - virtual void sendTransmitterDataSize()=0; - virtual void receiveTransmitterDataSize()=0; - - //send operations (should be called in given order!!!) - virtual void prepareForSend()=0; - virtual void fillSendVectors()=0; - virtual void sendVectors()=0; - - //receive operations (should be called in given order!!!) - virtual void prepareForReceive()=0; - virtual void receiveVectors()=0; - virtual void distributeReceiveVectors()=0; - - //info section - virtual bool isLocalConnector() = 0; - virtual bool isRemoteConnector() = 0; - virtual bool isInterpolationConnectorCF() = 0; - virtual bool isInterpolationConnectorFC() = 0; - - //grid refinement - virtual int getSendDir() const { return sendDir; } - - //virtual double getSendRecieveTime() = 0; - - virtual void prepareForSendX1() = 0; - virtual void prepareForSendX2() = 0; - virtual void prepareForSendX3() = 0; - - virtual void sendVectorsX1() = 0; - virtual void sendVectorsX2() = 0; - virtual void sendVectorsX3() = 0; - - virtual void prepareForReceiveX1() = 0; - virtual void prepareForReceiveX2() = 0; - virtual void prepareForReceiveX3() = 0; - - virtual void receiveVectorsX1() = 0; - virtual void receiveVectorsX2() = 0; - virtual void receiveVectorsX3() = 0; - - //FETOL -#ifdef VF_FETOL - void setTransmitterType(TransmitterType ttype) { this->ttype=ttype;} - TransmitterType getTransmitterType() {return ttype;} -#endif - -protected: - int sendDir; - //FETOL -#ifdef VF_FETOL - TransmitterType ttype; -#endif -}; - -#endif //BLOCK2DCONNECTOR_H diff --git a/src/VirtualFluids/Connectors/Block3DConnectorFactory.cpp b/src/VirtualFluids/Connectors/Block3DConnectorFactory.cpp deleted file mode 100644 index 5f568da35..000000000 --- a/src/VirtualFluids/Connectors/Block3DConnectorFactory.cpp +++ /dev/null @@ -1,50 +0,0 @@ -#include "Block3DConnectorFactory.h" -#include "D3Q27ETFullDirectConnector.h" -#include "D3Q27ETFullVectorConnector.h" -#include "CoarseToFineNodeSetBlock3DConnector.h" -#include "FineToCoarseNodeSetBlock3DConnector.h" - -Block3DConnectorFactory::Block3DConnectorFactory() -{ -} -////////////////////////////////////////////////////////////////////////// -Block3DConnectorFactory::~Block3DConnectorFactory() -{ -} -////////////////////////////////////////////////////////////////////////// -Block3DConnectorPtr Block3DConnectorFactory::createSameLevelDirectConnector(Block3DPtr from, Block3DPtr to, int sendDir) -{ - return Block3DConnectorPtr(new D3Q27ETFullDirectConnector(from, to, sendDir)); -} -////////////////////////////////////////////////////////////////////////// -Block3DConnectorPtr Block3DConnectorFactory::createSameLevelVectorConnector(Block3DPtr block, - VectorTransmitterPtr sender, - VectorTransmitterPtr receiver, - int sendDir) -{ - return Block3DConnectorPtr(new D3Q27ETFullVectorConnector(block, sender, receiver, sendDir)); -} -////////////////////////////////////////////////////////////////////////// -Block3DConnectorPtr Block3DConnectorFactory::createCoarseToFineConnector(Block3DPtr block, - VectorTransmitterPtr sender00, VectorTransmitterPtr receiver00, - VectorTransmitterPtr sender01, VectorTransmitterPtr receiver01, - VectorTransmitterPtr sender10, VectorTransmitterPtr receiver10, - VectorTransmitterPtr sender11, VectorTransmitterPtr receiver11, - int sendDir, InterpolationProcessorPtr iprocessor) -{ - return Block3DConnectorPtr (new CoarseToFineNodeSetBlock3DConnector(block, - sender00, receiver00, sender01, receiver01, - sender10, receiver10, sender11, receiver11, - sendDir, iprocessor)); -} -////////////////////////////////////////////////////////////////////////// -Block3DConnectorPtr Block3DConnectorFactory::createFineToCoarseConnector(Block3DPtr block, - VectorTransmitterPtr sender, - VectorTransmitterPtr receiver, - int sendDir, - InterpolationProcessorPtr iprocessor, - FineToCoarseBlock3DConnector::CFconnectorType connType) -{ - return Block3DConnectorPtr(new FineToCoarseNodeSetBlock3DConnector(block, - sender, receiver, sendDir, iprocessor, connType)); -} diff --git a/src/VirtualFluids/Connectors/Block3DConnectorFactory.h b/src/VirtualFluids/Connectors/Block3DConnectorFactory.h deleted file mode 100644 index cd7874f31..000000000 --- a/src/VirtualFluids/Connectors/Block3DConnectorFactory.h +++ /dev/null @@ -1,41 +0,0 @@ -#ifndef Block3DConnectorFactory_h__ -#define Block3DConnectorFactory_h__ - -#include "ConnectorFactory.h" - -#include <memory> -class Block3DConnectorFactory; -typedef std::shared_ptr<Block3DConnectorFactory> Block3DConnectorFactoryPtr; - -class Block3DConnectorFactory : public ConnectorFactory -{ -public: - Block3DConnectorFactory(); - virtual ~Block3DConnectorFactory(); - - virtual Block3DConnectorPtr createSameLevelDirectConnector(Block3DPtr from, Block3DPtr to, int sendDir); - - virtual Block3DConnectorPtr createSameLevelVectorConnector(Block3DPtr block, - VectorTransmitterPtr sender, - VectorTransmitterPtr receiver, - int sendDir); - - virtual Block3DConnectorPtr createCoarseToFineConnector(Block3DPtr block, - VectorTransmitterPtr sender00, VectorTransmitterPtr receiver00, - VectorTransmitterPtr sender01, VectorTransmitterPtr receiver01, - VectorTransmitterPtr sender10, VectorTransmitterPtr receiver10, - VectorTransmitterPtr sender11, VectorTransmitterPtr receiver11, - int sendDir, InterpolationProcessorPtr iprocessor); - - virtual Block3DConnectorPtr createFineToCoarseConnector(Block3DPtr block, - VectorTransmitterPtr sender, - VectorTransmitterPtr receiver, - int sendDir, - InterpolationProcessorPtr iprocessor, - FineToCoarseBlock3DConnector::CFconnectorType connType); - -private: - -}; -#endif // Block3DConnectorFactory_h__ - diff --git a/src/VirtualFluids/Connectors/CMakePackage.txt b/src/VirtualFluids/Connectors/CMakePackage.txt deleted file mode 100644 index e3e3f9a38..000000000 --- a/src/VirtualFluids/Connectors/CMakePackage.txt +++ /dev/null @@ -1,2 +0,0 @@ -GET_FILENAME_COMPONENT( CURRENT_DIR ${CMAKE_CURRENT_LIST_FILE} PATH) -COLLECT_PACKAGE_DATA_WITH_OPTION(${CURRENT_DIR} ALL_SOURCES) \ No newline at end of file diff --git a/src/VirtualFluids/Connectors/CoarseToFineBlock3DConnector.cpp b/src/VirtualFluids/Connectors/CoarseToFineBlock3DConnector.cpp deleted file mode 100644 index 883f2c1a7..000000000 --- a/src/VirtualFluids/Connectors/CoarseToFineBlock3DConnector.cpp +++ /dev/null @@ -1,135 +0,0 @@ -#include "CoarseToFineBlock3DConnector.h" - - - -//////////////////////////////////////////////////////////////////////////// - -CoarseToFineBlock3DConnector::CoarseToFineBlock3DConnector(Block3DPtr block, - VectorTransmitterPtr sender00, VectorTransmitterPtr receiver00, - VectorTransmitterPtr sender01, VectorTransmitterPtr receiver01, - VectorTransmitterPtr sender10, VectorTransmitterPtr receiver10, - VectorTransmitterPtr sender11, VectorTransmitterPtr receiver11, - int sendDir, InterpolationProcessorPtr iprocessor) : Block3DConnector(sendDir) - , block(block) - , sender00(sender00) - , sender01(sender01) - , sender10(sender10) - , sender11(sender11) - , receiver00(receiver00) - , receiver01(receiver01) - , receiver10(receiver10) - , receiver11(receiver11) - , iprocessor(iprocessor) -{ - if (!(sendDir==D3Q27System::E || sendDir==D3Q27System::W || sendDir==D3Q27System::N || sendDir==D3Q27System::S || sendDir==D3Q27System::T || sendDir==D3Q27System::B - || sendDir==D3Q27System::NE || sendDir==D3Q27System::SW || sendDir==D3Q27System::SE || sendDir==D3Q27System::NW - || sendDir==D3Q27System::TE || sendDir==D3Q27System::BW || sendDir==D3Q27System::BE || sendDir==D3Q27System::TW - || sendDir==D3Q27System::TN || sendDir==D3Q27System::BS || sendDir==D3Q27System::BN || sendDir==D3Q27System::TS - || sendDir==D3Q27System::TNE || sendDir==D3Q27System::TNW || sendDir==D3Q27System::TSE || sendDir==D3Q27System::TSW - || sendDir==D3Q27System::BNE || sendDir==D3Q27System::BNW || sendDir==D3Q27System::BSE || sendDir==D3Q27System::BSW - )) - { - throw UbException(UB_EXARGS, "invalid constructor for this direction"); - } -} -////////////////////////////////////////////////////////////////////////// - -bool CoarseToFineBlock3DConnector::isLocalConnector() -{ - return !this->isRemoteConnector(); -} -////////////////////////////////////////////////////////////////////////// - -bool CoarseToFineBlock3DConnector::isRemoteConnector() -{ - return ((sender11 && sender11->isRemoteTransmitter()) || (receiver11 && receiver11->isRemoteTransmitter()) - || (sender00 && sender00->isRemoteTransmitter()) || (receiver00 && receiver00->isRemoteTransmitter()) - || (sender01 && sender01->isRemoteTransmitter()) || (receiver01 && receiver01->isRemoteTransmitter()) - || (sender10 && sender10->isRemoteTransmitter()) || (receiver10 && receiver10->isRemoteTransmitter())); -} -////////////////////////////////////////////////////////////////////////// - -void CoarseToFineBlock3DConnector::sendTransmitterDataSize() -{ - if (sender00) - { - UBLOG(logDEBUG5, "CoarseToFineBlock3DConnector<VectorTransmitter>::sendTransmitterDataSize()-sender00 "<<block.lock()->toString()<<" sendDir="<<sendDir); - sender00->sendDataSize(); - } - if (sender01) - { - UBLOG(logDEBUG5, "CoarseToFineBlock3DConnector<VectorTransmitter>::sendTransmitterDataSize()-sender01 "<<block.lock()->toString()<<"sendDir="<<sendDir); - sender01->sendDataSize(); - } - if (sender10) - { - UBLOG(logDEBUG5, "CoarseToFineBlock3DConnector<VectorTransmitter>::sendTransmitterDataSize()-sender10 "<<block.lock()->toString()+"sendDir="<<sendDir); - sender10->sendDataSize(); - } - if (sender11) - { - UBLOG(logDEBUG5, "CoarseToFineBlock3DConnector<VectorTransmitter>::sendTransmitterDataSize()-sender11 "<<block.lock()->toString()<<"sendDir="<<sendDir); - sender11->sendDataSize(); - } -} -////////////////////////////////////////////////////////////////////////// - -void CoarseToFineBlock3DConnector::receiveTransmitterDataSize() -{ - if (receiver00) - { - UBLOG(logDEBUG5, "CoarseToFineBlock3DConnector<VectorTransmitter>::receiveTransmitterDataSize()-receiver00 "<<block.lock()->toString()<<"sendDir="<<sendDir); - receiver00->receiveDataSize(); - } - if (receiver01) - { - UBLOG(logDEBUG5, "CoarseToFineBlock3DConnector<VectorTransmitter>::receiveTransmitterDataSize()-receiver01 "<<block.lock()->toString()<<"sendDir="<<sendDir); - receiver01->receiveDataSize(); - } - if (receiver10) - { - UBLOG(logDEBUG5, "CoarseToFineBlock3DConnector<VectorTransmitter>::receiveTransmitterDataSize()-receiver10 "<<block.lock()->toString()<<"sendDir="<<sendDir); - receiver10->receiveDataSize(); - } - if (receiver11) - { - UBLOG(logDEBUG5, "CoarseToFineBlock3DConnector<VectorTransmitter>::receiveTransmitterDataSize()-receiver11 "<<block.lock()->toString()<<"sendDir="<<sendDir); - receiver11->receiveDataSize(); - } -} -////////////////////////////////////////////////////////////////////////// - -void CoarseToFineBlock3DConnector::prepareForSend() -{ - if (sender00) sender00->prepareForSend(); - if (sender01) sender01->prepareForSend(); - if (sender10) sender10->prepareForSend(); - if (sender11) sender11->prepareForSend(); -} -////////////////////////////////////////////////////////////////////////// - -void CoarseToFineBlock3DConnector::sendVectors() -{ - if (sender00) sender00->sendData(); - if (sender01) sender01->sendData(); - if (sender10) sender10->sendData(); - if (sender11) sender11->sendData(); -} -////////////////////////////////////////////////////////////////////////// - -void CoarseToFineBlock3DConnector::prepareForReceive() -{ - if (receiver00) receiver00->prepareForReceive(); - if (receiver01) receiver01->prepareForReceive(); - if (receiver10) receiver10->prepareForReceive(); - if (receiver11) receiver11->prepareForReceive(); -} -////////////////////////////////////////////////////////////////////////// - -void CoarseToFineBlock3DConnector::receiveVectors() -{ - if (receiver00) receiver00->receiveData(); - if (receiver01) receiver01->receiveData(); - if (receiver10) receiver10->receiveData(); - if (receiver11) receiver11->receiveData(); -} diff --git a/src/VirtualFluids/Connectors/CoarseToFineBlock3DConnector.h b/src/VirtualFluids/Connectors/CoarseToFineBlock3DConnector.h deleted file mode 100644 index 43b642a26..000000000 --- a/src/VirtualFluids/Connectors/CoarseToFineBlock3DConnector.h +++ /dev/null @@ -1,105 +0,0 @@ -//! \file CoarseToFineBlock3DConnector.h -//! \brief Base class for connectors that interpolates and sends data from coarse level to fine. -//! \author Konstantin Kutscher -//! \date 18.05.2015 - -#ifndef CoarseToFineBlock3DConnector_H -#define CoarseToFineBlock3DConnector_H - -#include "TransmitterType.h" -#include "Block3DConnector.h" -#include "D3Q27System.h" -#include "Block3D.h" -#include "InterpolationProcessor.h" -#include <memory> - - -class Block3D; - -//! \class CoarseToFineBlock3DConnector -//! \brief Base class for connectors that interpolates and sends data from coarse level to fine. -//! \details The data is copied in a vector (this is located in the transmitter). -//! The vector is transmitted via transmitter. -//! The transmitter can be a local, MPI, RCG, CTL or whatever -//! which a transmitter that is derived from transmitter base class. -//! -//! four fine blocks inside a coarse block: -//! -//! | | | -//! |:--:|:---| -//! | 01 | 11 | -//! | 00 | 10 | -//! -//! send direction: -//! -//! |E<->W | N<->S | T<->B | -//! |--------|---------|--------| -//! | x3 | x3 | x2 | -//! | ^ | ^ | ^ | -//! | +->x2 | +->x1 | +->x1| - - -class CoarseToFineBlock3DConnector : public Block3DConnector -{ -public: - CoarseToFineBlock3DConnector(Block3DPtr block, - VectorTransmitterPtr sender00, VectorTransmitterPtr receiver00, - VectorTransmitterPtr sender01, VectorTransmitterPtr receiver01, - VectorTransmitterPtr sender10, VectorTransmitterPtr receiver10, - VectorTransmitterPtr sender11, VectorTransmitterPtr receiver11, - int sendDir, InterpolationProcessorPtr iprocessor); - - virtual ~CoarseToFineBlock3DConnector() {} - - bool isLocalConnector(); - bool isRemoteConnector(); - - virtual void init()=0; - - void sendTransmitterDataSize(); - void receiveTransmitterDataSize(); - - void prepareForSend(); - void sendVectors(); - - void prepareForReceive(); - void receiveVectors(); - - virtual void fillSendVectors()=0; - virtual void distributeReceiveVectors() = 0; - - bool isInterpolationConnectorCF() { return true; } - bool isInterpolationConnectorFC() { return false; } - - void prepareForSendX1() {} - void prepareForSendX2() {} - void prepareForSendX3() {} - - void sendVectorsX1() {} - void sendVectorsX2() {} - void sendVectorsX3() {} - - void prepareForReceiveX1() {} - void prepareForReceiveX2() {} - void prepareForReceiveX3() {} - - void receiveVectorsX1() {} - void receiveVectorsX2() {} - void receiveVectorsX3() {} - -protected: - std::weak_ptr<Block3D> block; //dieser nvd sendet daten und die empfangenen werden diesem nvd zugeordnet - VectorTransmitterPtr sender00, receiver00, - sender01, receiver01, - sender10, receiver10, - sender11, receiver11; - - InterpolationProcessorPtr iprocessor; - -}; - - - - -#endif - diff --git a/src/VirtualFluids/Connectors/CoarseToFineNodeSetBlock3DConnector.cpp b/src/VirtualFluids/Connectors/CoarseToFineNodeSetBlock3DConnector.cpp deleted file mode 100644 index ee77f3a77..000000000 --- a/src/VirtualFluids/Connectors/CoarseToFineNodeSetBlock3DConnector.cpp +++ /dev/null @@ -1,1384 +0,0 @@ -#include "CoarseToFineNodeSetBlock3DConnector.h" -#include "DataSet3D.h" - - -//////////////////////////////////////////////////////////////////////////// -CoarseToFineNodeSetBlock3DConnector::CoarseToFineNodeSetBlock3DConnector(Block3DPtr block, - VectorTransmitterPtr sender00, VectorTransmitterPtr receiver00, - VectorTransmitterPtr sender01, VectorTransmitterPtr receiver01, - VectorTransmitterPtr sender10, VectorTransmitterPtr receiver10, - VectorTransmitterPtr sender11, VectorTransmitterPtr receiver11, - int sendDir, InterpolationProcessorPtr iprocessor) : CoarseToFineBlock3DConnector(block, sender00, receiver00, - sender01, receiver01, - sender10, receiver10, - sender11, receiver11, - sendDir, iprocessor) -{ -} -////////////////////////////////////////////////////////////////////////// -void CoarseToFineNodeSetBlock3DConnector::init() -{ - bMaxX1 = (int)block.lock()->getKernel()->getDataSet()->getFdistributions()->getNX1(); - bMaxX2 = (int)block.lock()->getKernel()->getDataSet()->getFdistributions()->getNX2(); - bMaxX3 = (int)block.lock()->getKernel()->getDataSet()->getFdistributions()->getNX3(); - - minX1 = 0; - minX2 = 0; - minX3 = 0; - maxX1 = bMaxX1 - 1; - maxX2 = bMaxX2 - 1; - maxX3 = bMaxX3 - 1; - - minHalfX1 = 0; - minHalfX2 = 0; - minHalfX3 = 0; - - maxHalfX1 = 0; - maxHalfX2 = 0; - maxHalfX3 = 0; - - if (Utilities::isEven(bMaxX1)) - { - minHalfX1 = bMaxX1 / 2 - 1; - maxHalfX1 = bMaxX1 / 2 - 1; - } - else if (Utilities::isOdd(bMaxX1)) - { - minHalfX1 = bMaxX1 / 2; - maxHalfX1 = bMaxX1 / 2 - 1; - } - - if (Utilities::isEven(bMaxX2)) - { - minHalfX2 = bMaxX2 / 2 - 1; - maxHalfX2 = bMaxX2 / 2 - 1; - } - else if (Utilities::isOdd(bMaxX2)) - { - minHalfX2 = bMaxX2 / 2; - maxHalfX2 = bMaxX2 / 2 - 1; - } - - if (Utilities::isEven(bMaxX3)) - { - minHalfX3 = bMaxX3 / 2 - 1; - maxHalfX3 = bMaxX3 / 2 - 1; - } - else if (Utilities::isOdd(bMaxX3)) - { - minHalfX3 = bMaxX3 / 2; - maxHalfX3 = bMaxX3 / 2 - 1; - } - - //int sendSize = 0; - LBMReal initValue = -999.0; - - int sendDataPerNode = 27/*f*/; - int iCellSize = 8; //size of interpolation cell - - findCFCells(); - findFCCells(); - - ////////////////////////////////////////////////////// - //Debug - ////////////////////////////////////////////////////// - if (block.lock()->getGlobalID() == 2234) - { - int test = 0; - } - - if (sender00) sender00->getData().resize(iNodeSetSender00.size()*iCellSize*sendDataPerNode, initValue); - else sender00 = VectorTransmitterPtr(new TbLocalTransmitter< CbVector< LBMReal > >()); - if (sender01) sender01->getData().resize(iNodeSetSender01.size()*iCellSize*sendDataPerNode, initValue); - else sender01 = VectorTransmitterPtr(new TbLocalTransmitter< CbVector< LBMReal > >()); - if (sender10) sender10->getData().resize(iNodeSetSender10.size()*iCellSize*sendDataPerNode, initValue); - else sender10 = VectorTransmitterPtr(new TbLocalTransmitter< CbVector< LBMReal > >()); - if (sender11) sender11->getData().resize(iNodeSetSender11.size()*iCellSize*sendDataPerNode, initValue); - else sender11 = VectorTransmitterPtr(new TbLocalTransmitter< CbVector< LBMReal > >()); - - if (!receiver00) receiver00 = VectorTransmitterPtr(new TbLocalTransmitter< CbVector< LBMReal > >()); - if (!receiver01) receiver01 = VectorTransmitterPtr(new TbLocalTransmitter< CbVector< LBMReal > >()); - if (!receiver10) receiver10 = VectorTransmitterPtr(new TbLocalTransmitter< CbVector< LBMReal > >()); - if (!receiver11) receiver11 = VectorTransmitterPtr(new TbLocalTransmitter< CbVector< LBMReal > >()); -} -////////////////////////////////////////////////////////////////////////// - -void CoarseToFineNodeSetBlock3DConnector::findCFCells(int lMinX1, int lMinX2, int lMinX3, int lMaxX1, int lMaxX2, int lMaxX3, INodeSet &inodes) -{ - int ix1, ix2, ix3; - LBMReal x1off, x2off, x3off; - - DistributionArray3DPtr fFrom = block.lock()->getKernel()->getDataSet()->getFdistributions(); - BCArray3DPtr bcArray = block.lock()->getKernel()->getBCProcessor()->getBCArray(); - - for (ix3 = lMinX3; ix3<=lMaxX3; ix3++) - { - for (ix2 = lMinX2; ix2<=lMaxX2; ix2++) - { - for (ix1 = lMinX1; ix1<=lMaxX1; ix1++) - { - D3Q27ICell icellC; - - int howManySolids = iprocessor->iCellHowManySolids(bcArray, ix1, ix2, ix3); - - if (howManySolids == 0 || howManySolids == 8) - { - x1off = 0.0; - x2off = 0.0; - x3off = 0.0; - } - else - { - if (!iprocessor->findNeighborICell(bcArray, fFrom, icellC, bMaxX1, bMaxX2, bMaxX3, ix1, ix2, ix3, x1off, x2off, x3off)) - { - std::string err = "For "+block.lock()->toString()+" x1="+UbSystem::toString(ix1)+", x2=" + UbSystem::toString(ix2)+", x3=" + UbSystem::toString(ix3)+ - " interpolation is not implemented for other direction"+ - " by using in: "+(std::string)typeid(*this).name()+ - " or maybe you have a solid on the block boundary"; - UB_THROW(UbException(UB_EXARGS, err)); - } - } - - INodeVector inv; - inv.push_back(ix1 + (int)x1off); - inv.push_back(ix2 + (int)x2off); - inv.push_back(ix3 + (int)x3off); - inv.push_back((int)x1off); - inv.push_back((int)x2off); - inv.push_back((int)x3off); - //inodes.insert(inv); - inodes.push_back(inv); - } - } - } -} -////////////////////////////////////////////////////////////////////////// -//template< typename VectorTransmitter > -void CoarseToFineNodeSetBlock3DConnector::findCFCells() -{ - using namespace D3Q27System; - - int lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3; - - switch (sendDir) - { - //faces - case E: case W: - if (sendDir == E) - { - lMinX1 = maxX1 - 2; - lMaxX1 = lMinX1; - } - else if (sendDir == W) - { - lMinX1 = 1; - lMaxX1 = lMinX1; - } - - if (sender00) - { - lMinX2 = minX2; - lMaxX2 = maxHalfX2; - lMinX3 = minX3; - lMaxX3 = maxHalfX3; - findCFCells(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, iNodeSetSender00); - } - if (sender10) - { - lMinX2 = minHalfX2; - lMaxX2 = maxX2 - 1; - lMinX3 = minX3; - lMaxX3 = maxHalfX3; - findCFCells(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, iNodeSetSender10); - } - if (sender01) - { - lMinX2 = minX2; - lMaxX2 = maxHalfX2; - lMinX3 = minHalfX3; - lMaxX3 = maxX3 - 1; - findCFCells(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, iNodeSetSender01); - } - if (sender11) - { - lMinX2 = minHalfX2; - lMaxX2 = maxX2 - 1; - lMinX3 = minHalfX3; - lMaxX3 = maxX3 - 1; - findCFCells(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, iNodeSetSender11); - } - break; - case N: case S: - if (sendDir == N) - { - lMinX2 = maxX2 - 2; - lMaxX2 = lMinX2; - } - else if (sendDir == S) - { - lMinX2 = 1; - lMaxX2 = lMinX2; - } - - if (sender00) - { - lMinX1 = minX1; - lMaxX1 = maxHalfX1; - lMinX3 = minX3; - lMaxX3 = maxHalfX3; - findCFCells(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, iNodeSetSender00); - } - if (sender10) - { - lMinX1 = minHalfX1; - lMaxX1 = maxX1 - 1; - lMinX3 = minX3; - lMaxX3 = maxHalfX3; - findCFCells(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, iNodeSetSender10); - } - if (sender01) - { - lMinX1 = minX1; - lMaxX1 = maxHalfX1; - lMinX3 = minHalfX3; - lMaxX3 = maxX3 - 1; - findCFCells(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, iNodeSetSender01); - } - if (sender11) - { - lMinX1 = minHalfX1; - lMaxX1 = maxX1 - 1; - lMinX3 = minHalfX3; - lMaxX3 = maxX3 - 1; - findCFCells(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, iNodeSetSender11); - } - break; - case T: case B: - if (sendDir == T) - { - lMinX3 = maxX3 - 2; - lMaxX3 = lMinX3; - } - else if (sendDir == B) - { - lMinX3 = 1; - lMaxX3 = lMinX3; - } - - if (sender00) - { - lMinX1 = minX1; - lMaxX1 = maxHalfX1; - lMinX2 = minX2; - lMaxX2 = maxHalfX2; - findCFCells(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, iNodeSetSender00); - } - if (sender10) - { - lMinX1 = minHalfX1; - lMaxX1 = maxX1 - 1; - lMinX2 = minX2; - lMaxX2 = maxHalfX2; - findCFCells(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, iNodeSetSender10); - } - if (sender01) - { - lMinX1 = minX1; - lMaxX1 = maxHalfX1; - lMinX2 = minHalfX2; - lMaxX2 = maxX2 - 1; - findCFCells(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, iNodeSetSender01); - } - if (sender11) - { - lMinX1 = minHalfX1; - lMaxX1 = maxX1 - 1; - lMinX2 = minHalfX2; - lMaxX2 = maxX2 - 1; - findCFCells(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, iNodeSetSender11); - } - break; - //edges - //N-S-E-W - case NE: case SW: case SE: case NW: - if (sendDir == NE) - { - lMinX1 = maxX1 - 2; - lMaxX1 = lMinX1 + 1; - lMinX2 = maxX2 - 2; - lMaxX2 = lMinX2 + 1; - } - else if (sendDir == SW) - { - lMinX1 = 0; - lMaxX1 = lMinX1 + 1; - lMinX2 = 0; - lMaxX2 = lMinX2 + 1; - } - else if (sendDir == SE) - { - lMinX1 = maxX1 - 2; - lMaxX1 = lMinX1 + 1; - lMinX2 = 0; - lMaxX2 = lMinX2 + 1; - } - else if (sendDir == NW) - { - lMinX1 = 0; - lMaxX1 = lMinX1 + 1; - lMinX2 = maxX2 - 2; - lMaxX2 = lMinX2 + 1; - } - - if (sender00) - { - lMinX3 = minX3; - lMaxX3 = maxHalfX3; - findCFCells(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, iNodeSetSender00); - } - if (sender10) - { - lMinX3 = minHalfX3; - lMaxX3 = maxX3 - 1; - findCFCells(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, iNodeSetSender10); - } - break; - //T-B-E-W - case TE: case BW: case BE: case TW: - if (sendDir == TE) - { - lMinX1 = maxX1 - 2; - lMaxX1 = lMinX1 + 1; - lMinX3 = maxX3 - 2; - lMaxX3 = lMinX3 + 1; - } - else if (sendDir == BW) - { - lMinX1 = 0; - lMaxX1 = lMinX1 + 2; - lMinX3 = 0; - lMaxX3 = lMinX3 + 2; - } - else if (sendDir == BE) - { - lMinX1 = maxX1 - 2; - lMaxX1 = lMinX1 + 1; - lMinX3 = 0; - lMaxX3 = lMinX3 + 1; - } - else if (sendDir == TW) - { - lMinX1 = 0; - lMaxX1 = lMinX1 + 1; - lMinX3 = maxX3 - 2; - lMaxX3 = lMinX3 + 1; - } - - if (sender00) - { - lMinX2 = minX2; - lMaxX2 = maxHalfX2; - findCFCells(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, iNodeSetSender00); - } - if (sender10) - { - lMinX2 = minHalfX2; - lMaxX2 = maxX2 - 1; - findCFCells(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, iNodeSetSender10); - } - break; - //T-B-N-S - case TN: case BS: case BN: case TS: - if (sendDir == TN) - { - lMinX2 = maxX2 - 2; - lMaxX2 = lMinX2 + 1; - lMinX3 = maxX3 - 3; - lMaxX3 = lMinX3 + 1; - } - else if (sendDir == BS) - { - lMinX2 = 0; - lMaxX2 = lMinX2 + 1; - lMinX3 = 0; - lMaxX3 = lMinX3 + 1; - } - else if (sendDir == BN) - { - lMinX2 = maxX2 - 2; - lMaxX2 = lMinX2 + 1; - lMinX3 = 0; - lMaxX3 = lMinX3 + 1; - } - else if (sendDir == TS) - { - lMinX2 = 0; - lMaxX2 = lMinX2 + 1; - lMinX3 = maxX3 - 2; - lMaxX3 = lMinX3 + 1; - } - - if (sender00) - { - lMinX1 = minX1; - lMaxX1 = maxHalfX1; - findCFCells(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, iNodeSetSender00); - } - if (sender10) - { - lMinX1 = minHalfX1; - lMaxX1 = maxX1 - 1; - findCFCells(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, iNodeSetSender10); - } - break; - //corners - case TNE: case TNW: case TSE: case TSW: case BNE: case BNW: case BSE: case BSW: - if (sendDir == TNE) - { - lMinX1 = maxX1-2; - lMaxX1 = maxX1-1; - lMinX2 = maxX2-2; - lMaxX2 = maxX2-1; - lMinX3 = maxX3-2; - lMaxX3 = maxX3-1; - } - else if (sendDir == TNW) - { - lMinX1 = 0; - lMaxX1 = 1; - lMinX2 = maxX2-2; - lMaxX2 = maxX2-1; - lMinX3 = maxX3-2; - lMaxX3 = maxX3-1; - } - else if (sendDir == TSE) - { - lMinX1 = maxX1-2; - lMaxX1 = maxX1-1; - lMinX2 = 0; - lMaxX2 = 1; - lMinX3 = maxX3-2; - lMaxX3 = maxX3-1; - } - else if (sendDir == TSW) - { - lMinX1 = 0; - lMaxX1 = 1; - lMinX2 = 0; - lMaxX2 = 1; - lMinX3 = maxX3-2; - lMaxX3 = maxX3-1; - } - else if (sendDir == BNE) - { - lMinX1 = maxX1-2; - lMaxX1 = maxX1-1; - lMinX2 = maxX2-2; - lMaxX2 = maxX2-1; - lMinX3 = 0; - lMaxX3 = 1; - } - else if (sendDir == BNW) - { - lMinX1 = 0; - lMaxX1 = 1; - lMinX2 = maxX2-2; - lMaxX2 = maxX2-1; - lMinX3 = 0; - lMaxX3 = 1; - } - else if (sendDir == BSE) - { - lMinX1 = maxX1-2; - lMaxX1 = maxX1-1; - lMinX2 = 0; - lMaxX2 = 1; - lMinX3 = 0; - lMaxX3 = 1; - } - else if (sendDir == BSW) - { - lMinX1 = 0; - lMaxX1 = 1; - lMinX2 = 0; - lMaxX2 = 1; - lMinX3 = 0; - lMaxX3 = 1; - } - if (sender00) - { - findCFCells(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, iNodeSetSender00); - } - break; - } -} -////////////////////////////////////////////////////////////////////////// -//template< typename VectorTransmitter > -void CoarseToFineNodeSetBlock3DConnector::fillSendVectors() -{ - using namespace D3Q27System; - - DistributionArray3DPtr fFrom = block.lock()->getKernel()->getDataSet()->getFdistributions(); - - int index00 = 0; - int index01 = 0; - int index10 = 0; - int index11 = 0; - - vector_type& data00 = this->sender00->getData(); - vector_type& data01 = this->sender01->getData(); - vector_type& data10 = this->sender10->getData(); - vector_type& data11 = this->sender11->getData(); - - for(INodeVector inode : iNodeSetSender00) - { - D3Q27ICell icellC; - D3Q27ICell icellF; - iprocessor->readICell(fFrom, icellC, inode[0], inode[1], inode[2]); - iprocessor->interpolateCoarseToFine(icellC, icellF, inode[3], inode[4], inode[5]); - writeICellFtoData(data00, index00, icellF); - } - for(INodeVector inode : iNodeSetSender01) - { - D3Q27ICell icellC; - D3Q27ICell icellF; - iprocessor->readICell(fFrom, icellC, inode[0], inode[1], inode[2]); - iprocessor->interpolateCoarseToFine(icellC, icellF, inode[3], inode[4], inode[5]); - writeICellFtoData(data01, index01, icellF); - } - for(INodeVector inode : iNodeSetSender10) - { - D3Q27ICell icellC; - D3Q27ICell icellF; - iprocessor->readICell(fFrom, icellC, inode[0], inode[1], inode[2]); - iprocessor->interpolateCoarseToFine(icellC, icellF, inode[3], inode[4], inode[5]); - writeICellFtoData(data10, index10, icellF); - } - for(INodeVector inode : iNodeSetSender11) - { - D3Q27ICell icellC; - D3Q27ICell icellF; - iprocessor->readICell(fFrom, icellC, inode[0], inode[1], inode[2]); - iprocessor->interpolateCoarseToFine(icellC, icellF, inode[3], inode[4], inode[5]); - writeICellFtoData(data11, index11, icellF); - } -} -////////////////////////////////////////////////////////////////////////// - -void CoarseToFineNodeSetBlock3DConnector::writeICellFtoData(vector_type& data, int& index, D3Q27ICell& icellF) -{ - writeNodeToVector(data, index, icellF.BSW); - writeNodeToVector(data, index, icellF.BSE); - writeNodeToVector(data, index, icellF.BNW); - writeNodeToVector(data, index, icellF.BNE); - writeNodeToVector(data, index, icellF.TSW); - writeNodeToVector(data, index, icellF.TSE); - writeNodeToVector(data, index, icellF.TNW); - writeNodeToVector(data, index, icellF.TNE); -} -////////////////////////////////////////////////////////////////////////// - -void CoarseToFineNodeSetBlock3DConnector::writeNodeToVector(vector_type& data, int& index, LBMReal* inode) -{ - for (int i = D3Q27System::STARTF; i < D3Q27System::ENDF+1; i++) - { - data[index++] = inode[i]; - } -} -////////////////////////////////////////////////////////////////////////// - -void CoarseToFineNodeSetBlock3DConnector::findFCCells(int lMinX1, int lMinX2, int lMinX3, int lMaxX1, int lMaxX2, int lMaxX3, INodeSet &inodes) -{ - int ix1, ix2, ix3; - - for (ix3 = lMinX3; ix3<=lMaxX3; ix3++) - { - for (ix2 = lMinX2; ix2<=lMaxX2; ix2++) - { - for (ix1 = lMinX1; ix1<=lMaxX1; ix1++) - { - INodeVector inv; - inv.push_back(ix1); - inv.push_back(ix2); - inv.push_back(ix3); - //inodes.insert(inv); - inodes.push_back(inv); - } - } - } -} -////////////////////////////////////////////////////////////////////////// -//template< typename VectorTransmitter > -void CoarseToFineNodeSetBlock3DConnector::findFCCells() -{ - using namespace D3Q27System; - - int lMin1X1, lMin1X2, lMin1X3, lMax1X1, lMax1X2, lMax1X3; - int lMin2X1, lMin2X2, lMin2X3, lMax2X1, lMax2X2, lMax2X3; - int lMin3X1, lMin3X2, lMin3X3, lMax3X1, lMax3X2, lMax3X3; - int dummy; - - switch (sendDir) - { - - ////////////////////////////////////////////////////// - //Debug - ////////////////////////////////////////////////////// - if (block.lock()->getGlobalID() == 2234) - { - int test = 0; - } - - //faces - case E: case W: - if (sendDir == E) - { - lMin1X1 = maxX1 - 3; - lMax1X1 = lMin1X1; - } - else if (sendDir == W) - { - lMin1X1 = 3; - lMax1X1 = lMin1X1; - } - - //int TminX1 = lMinX1; int TminX2 = lMinX2; int TminX3 = lMinX3; int TmaxX1 = lMaxX1; int TmaxX2 = lMaxX2; int TmaxX3 = lMaxX3; - - //if (block.lock()->hasInterpolationFlagCF(E)) - //{ - // if (maxX1==TmaxX1) maxX1 -= 2; - //} - //if (block.lock()->hasInterpolationFlagCF(W)) - //{ - // if (minX1==TminX1) minX1 += 2; - //} - //if (block.lock()->hasInterpolationFlagCF(N)) - //{ - // if (maxX2==TmaxX2) maxX2 -= 2; - //} - //if (block.lock()->hasInterpolationFlagCF(S)) - //{ - // if (minX2==TminX2) minX2 += 2; - //} - //if (block.lock()->hasInterpolationFlagCF(T)) - //{ - // if (maxX3==TmaxX3) maxX3 -= 2; - //} - //if (block.lock()->hasInterpolationFlagCF(B)) - //{ - // if (minX3==TminX3) minX3 += 2; - //} - if (receiver00) - { - lMin1X2 = minX2; - lMax1X2 = maxHalfX2; - lMin1X3 = minX3; - lMax1X3 = maxHalfX3; - getLocalMinMax(dummy, lMin1X2, lMin1X3, dummy, dummy, dummy); - findFCCells(lMin1X1, lMin1X2, lMin1X3, lMax1X1, lMax1X2, lMax1X3, iNodeSetReceiver00); - } - if (receiver10) - { - lMin1X2 = minHalfX2; - lMax1X2 = maxX2 - 1; - lMin1X3 = minX3; - lMax1X3 = maxHalfX3; - getLocalMinMax(dummy, dummy, lMin1X3, dummy, lMax1X2, dummy); - findFCCells(lMin1X1, lMin1X2, lMin1X3, lMax1X1, lMax1X2, lMax1X3, iNodeSetReceiver10); - } - if (receiver01) - { - lMin1X2 = minX2; - lMax1X2 = maxHalfX2; - lMin1X3 = minHalfX3; - lMax1X3 = maxX3 - 1; - getLocalMinMax(dummy, lMin1X2, dummy, dummy, dummy, lMax1X3); - findFCCells(lMin1X1, lMin1X2, lMin1X3, lMax1X1, lMax1X2, lMax1X3, iNodeSetReceiver01); - } - if (receiver11) - { - lMin1X2 = minHalfX2; - lMax1X2 = maxX2 - 1; - lMin1X3 = minHalfX3; - lMax1X3 = maxX3 - 1; - getLocalMinMax(dummy, dummy, dummy, dummy, lMax1X2, lMax1X3); - findFCCells(lMin1X1, lMin1X2, lMin1X3, lMax1X1, lMax1X2, lMax1X3, iNodeSetReceiver11); - } - break; - case N: case S: - if (sendDir == N) - { - lMin1X2 = maxX2 - 3; - lMax1X2 = lMin1X2; - } - else if (sendDir == S) - { - lMin1X2 = 3; - lMax1X2 = lMin1X2; - } - - if (receiver00) - { - lMin1X1 = minX1; - lMax1X1 = maxHalfX1; - lMin1X3 = minX3; - lMax1X3 = maxHalfX3; - findFCCells(lMin1X1, lMin1X2, lMin1X3, lMax1X1, lMax1X2, lMax1X3, iNodeSetReceiver00); - } - if (receiver10) - { - lMin1X1 = minHalfX1; - lMax1X1 = maxX1 - 1; - lMin1X3 = minX3; - lMax1X3 = maxHalfX3; - findFCCells(lMin1X1, lMin1X2, lMin1X3, lMax1X1, lMax1X2, lMax1X3, iNodeSetReceiver10); - } - if (receiver01) - { - lMin1X1 = minX1; - lMax1X1 = maxHalfX1; - lMin1X3 = minHalfX3; - lMax1X3 = maxX3 - 1; - findFCCells(lMin1X1, lMin1X2, lMin1X3, lMax1X1, lMax1X2, lMax1X3, iNodeSetReceiver01); - } - if (receiver11) - { - lMin1X1 = minHalfX1; - lMax1X1 = maxX1 - 1; - lMin1X3 = minHalfX3; - lMax1X3 = maxX3 - 1; - findFCCells(lMin1X1, lMin1X2, lMin1X3, lMax1X1, lMax1X2, lMax1X3, iNodeSetReceiver11); - } - break; - case T: case B: - if (sendDir == T) - { - lMin1X3 = maxX3 - 3; - lMax1X3 = lMin1X3; - } - else if (sendDir == B) - { - lMin1X3 = 3; - lMax1X3 = lMin1X3; - } - - if (receiver00) - { - lMin1X1 = minX1; - lMax1X1 = maxHalfX1; - lMin1X2 = minX2; - lMax1X2 = maxHalfX2; - findFCCells(lMin1X1, lMin1X2, lMin1X3, lMax1X1, lMax1X2, lMax1X3, iNodeSetReceiver00); - } - if (receiver10) - { - lMin1X1 = minHalfX1; - lMax1X1 = maxX1 - 1; - lMin1X2 = minX2; - lMax1X2 = maxHalfX2; - findFCCells(lMin1X1, lMin1X2, lMin1X3, lMax1X1, lMax1X2, lMax1X3, iNodeSetReceiver10); - } - if (receiver01) - { - lMin1X1 = minX1; - lMax1X1 = maxHalfX1; - lMin1X2 = minHalfX2; - lMax1X2 = maxX2 - 1; - findFCCells(lMin1X1, lMin1X2, lMin1X3, lMax1X1, lMax1X2, lMax1X3, iNodeSetReceiver01); - } - if (receiver11) - { - lMin1X1 = minHalfX1; - lMax1X1 = maxX1 - 1; - lMin1X2 = minHalfX2; - lMax1X2 = maxX2 - 1; - findFCCells(lMin1X1, lMin1X2, lMin1X3, lMax1X1, lMax1X2, lMax1X3, iNodeSetReceiver11); - } - break; - //edges - //N-S-E-W - case NE: case SW: case SE: case NW: - if (sendDir == NE) - { - lMin1X1 = maxX1 - 3; - lMax1X1 = lMin1X1 + 2; - lMin1X2 = maxX2 - 3; - lMax1X2 = lMin1X2; - - lMin2X1 = maxX1 - 3; - lMax2X1 = lMin2X1; - lMin2X2 = maxX2 - 3; - lMax2X2 = lMin2X2 + 2; - } - else if (sendDir == SW) - { - lMin1X1 = 1; - lMax1X1 = lMin1X1 + 2; - lMin1X2 = 3; - lMax1X2 = lMin1X2; - - lMin2X1 = 3; - lMax2X1 = lMin2X1; - lMin2X2 = 1; - lMax2X2 = lMin2X2 + 2; - } - else if (sendDir == SE) - { - lMin1X1 = maxX1 - 3; - lMax1X1 = lMin1X1 + 2; - lMin1X2 = 3; - lMax1X2 = lMin1X2; - - lMin2X1 = maxX1 - 3; - lMax2X1 = lMin2X1; - lMin2X2 = 1; - lMax2X2 = lMin2X2 + 2; - } - else if (sendDir == NW) - { - lMin1X1 = 1; - lMax1X1 = lMin1X1 + 2; - lMin1X2 = maxX2 - 3; - lMax1X2 = lMin1X2; - - lMin2X1 = 3; - lMax2X1 = lMin2X1; - lMin2X2 = maxX2 - 3; - lMax2X2 = lMin2X2 + 2; - } - - if (receiver00) - { - lMin1X3 = minX3; - lMax1X3 = maxHalfX3; - findFCCells(lMin1X1, lMin1X2, lMin1X3, lMax1X1, lMax1X2, lMax1X3, iNodeSetReceiver00); - } - if (receiver10) - { - lMin1X3 = minHalfX3; - lMax1X3 = maxX3 - 1; - findFCCells(lMin1X1, lMin1X2, lMin1X3, lMax1X1, lMax1X2, lMax1X3, iNodeSetReceiver10); - } - - if (receiver00) - { - lMin2X3 = minX3; - lMax2X3 = maxHalfX3; - findFCCells(lMin2X1, lMin2X2, lMin2X3, lMax2X1, lMax2X2, lMax2X3, iNodeSetReceiver00); - } - if (receiver10) - { - lMin2X3 = minHalfX3; - lMax2X3 = maxX3 - 1; - findFCCells(lMin2X1, lMin2X2, lMin2X3, lMax2X1, lMax2X2, lMax2X3, iNodeSetReceiver10); - } - break; - //T-B-E-W - case TE: case BW: case BE: case TW: - if (sendDir == TE) - { - lMin1X1 = maxX1 - 3; - lMax1X1 = lMin1X1 + 2; - lMin1X3 = maxX3 - 3; - lMax1X3 = lMin1X3; - - lMin2X1 = maxX1 - 3; - lMax2X1 = lMin2X1; - lMin2X3 = maxX3 - 3; - lMax2X3 = lMin2X3 + 2; - } - else if (sendDir == BW) - { - lMin1X1 = 1; - lMax1X1 = lMin1X1 + 2; - lMin1X3 = 3; - lMax1X3 = lMin1X3; - - lMin2X1 = 3; - lMax2X1 = lMin2X1; - lMin2X3 = 1; - lMax2X3 = lMin2X3 + 2; - } - else if (sendDir == BE) - { - lMin1X1 = maxX1 - 3; - lMax1X1 = lMin1X1 + 2; - lMin1X3 = 3; - lMax1X3 = lMin1X3; - - - lMin2X1 = maxX1 - 3; - lMax2X1 = lMin2X1; - lMin2X3 = 1; - lMax2X3 = lMin2X3 + 2; - } - else if (sendDir == TW) - { - lMin1X1 = 1; - lMax1X1 = lMin1X1 + 2; - lMin1X3 = maxX3 - 3; - lMax1X3 = lMin1X3; - - lMin2X1 = 3; - lMax2X1 = lMin2X1; - lMin2X3 = maxX3 - 3; - lMax2X3 = lMin2X3 + 2; - } - - if (receiver00) - { - lMin1X2 = minX2; - lMax1X2 = maxHalfX2; - findFCCells(lMin1X1, lMin1X2, lMin1X3, lMax1X1, lMax1X2, lMax1X3, iNodeSetReceiver00); - } - if (receiver10) - { - lMin1X2 = minHalfX2; - lMax1X2 = maxX2 - 1; - findFCCells(lMin1X1, lMin1X2, lMin1X3, lMax1X1, lMax1X2, lMax1X3, iNodeSetReceiver10); - } - - if (receiver00) - { - lMin2X2 = minX2; - lMax2X2 = maxHalfX2; - findFCCells(lMin2X1, lMin2X2, lMin2X3, lMax2X1, lMax2X2, lMax2X3, iNodeSetReceiver00); - } - if (receiver10) - { - lMin2X2 = minHalfX2; - lMax2X2 = maxX2 - 1; - findFCCells(lMin2X1, lMin2X2, lMin2X3, lMax2X1, lMax2X2, lMax2X3, iNodeSetReceiver10); - } - break; - //T-B-N-S - case TN: case BS: case BN: case TS: - if (sendDir == TN) - { - lMin1X2 = maxX2 - 3; - lMax1X2 = lMin1X2 + 2; - lMin1X3 = maxX3 - 3; - lMax1X3 = lMin1X3; - - lMin2X2 = maxX2 - 3; - lMax2X2 = lMin2X2; - lMin2X3 = maxX3 - 3; - lMax2X3 = lMin2X3 + 2; - } - else if (sendDir == BS) - { - lMin1X2 = 1; - lMax1X2 = lMin1X2 + 2; - lMin1X3 = 3; - lMax1X3 = lMin1X3; - - lMin2X2 = 3; - lMax2X2 = lMin2X2; - lMin2X3 = 1; - lMax2X3 = lMin2X3 + 2; - } - else if (sendDir == BN) - { - lMin1X2 = maxX2 - 3; - lMax1X2 = lMin1X2 + 2; - lMin1X3 = 3; - lMax1X3 = lMin1X3; - - lMin2X2 = maxX2 - 3; - lMax2X2 = lMin2X2; - lMin2X3 = 1; - lMax2X3 = lMin2X3 + 2; - } - else if (sendDir == TS) - { - lMin1X2 = 1; - lMax1X2 = lMin1X2 + 2; - lMin1X3 = maxX3 - 3; - lMax1X3 = lMin1X3; - - lMin2X2 = 3; - lMax2X2 = lMin2X2; - lMin2X3 = maxX3 - 3; - lMax2X3 = lMin2X3 + 2; - } - - if (receiver00) - { - lMin1X1 = minX1; - lMax1X1 = maxHalfX1; - findFCCells(lMin1X1, lMin1X2, lMin1X3, lMax1X1, lMax1X2, lMax1X3, iNodeSetReceiver00); - } - if (receiver10) - { - lMin1X1 = minHalfX1; - lMax1X1 = maxX1 - 1; - findFCCells(lMin1X1, lMin1X2, lMin1X3, lMax1X1, lMax1X2, lMax1X3, iNodeSetReceiver10); - } - - if (receiver00) - { - lMin2X1 = minX1; - lMax2X1 = maxHalfX1; - findFCCells(lMin2X1, lMin2X2, lMin2X3, lMax2X1, lMax2X2, lMax2X3, iNodeSetReceiver00); - } - if (receiver10) - { - lMin2X1 = minHalfX1; - lMax2X1 = maxX1 - 1; - findFCCells(lMin2X1, lMin2X2, lMin2X3, lMax2X1, lMax2X2, lMax2X3, iNodeSetReceiver10); - } - break; - //corners - case TNE: case TNW: case TSE: case TSW: case BNE: case BNW: case BSE: case BSW: - if (sendDir == TNE) - { - lMin1X1 = maxX1 - 3; - lMax1X1 = maxX1 - 2; - lMin1X2 = maxX2 - 3; - lMax1X2 = maxX2 - 1; - lMin1X3 = maxX3 - 3; - lMax1X3 = maxX3 - 1; - - lMin2X1 = maxX1 - 3; - lMax2X1 = maxX1 - 1; - lMin2X2 = maxX2 - 3; - lMax2X2 = maxX2 - 2; - lMin2X3 = maxX3 - 3; - lMax2X3 = maxX3 - 1; - - lMin3X1 = maxX1 - 3; - lMax3X1 = maxX1 - 1; - lMin3X2 = maxX2 - 3; - lMax3X2 = maxX2 - 1; - lMin3X3 = maxX3 - 3; - lMax3X3 = maxX3 - 2; - } - else if (sendDir == TNW) - { - lMin1X1 = 3; - lMax1X1 = 3; - lMin1X2 = maxX2 - 3; - lMax1X2 = maxX2 - 1; - lMin1X3 = maxX3 - 3; - lMax1X3 = maxX3 - 1; - - lMin2X1 = 1; - lMax2X1 = 3; - lMin2X2 = maxX2 - 3; - lMax2X2 = maxX2 - 2; - lMin2X3 = maxX3 - 3; - lMax2X3 = maxX3; - - lMin3X1 = 1; - lMax3X1 = 3; - lMin3X2 = maxX2 - 3; - lMax3X2 = maxX2 - 1; - lMin3X3 = maxX3 - 3; - lMax3X3 = maxX3 - 2; - } - else if (sendDir == TSE) - { - lMin1X1 = maxX1 - 3; - lMax1X1 = maxX1 - 2; - lMin1X2 = 1; - lMax1X2 = 3; - lMin1X3 = maxX3 - 3; - lMax1X3 = maxX3; - - lMin2X1 = maxX1 - 3; - lMax2X1 = maxX1 - 1; - lMin2X2 = 3; - lMax2X2 = 3; - lMin2X3 = maxX3 - 3; - lMax2X3 = maxX3; - - lMin3X1 = maxX1 - 3; - lMax3X1 = maxX1 - 1; - lMin3X2 = 1; - lMax3X2 = 3; - lMin3X3 = maxX3 - 3; - lMax3X3 = maxX3 - 2; - } - else if (sendDir == TSW) - { - lMin1X1 = 3; - lMax1X1 = 3; - lMin1X2 = 1; - lMax1X2 = 3; - lMin1X3 = maxX3 - 3; - lMax1X3 = maxX3 - 1; - - lMin2X1 = 1; - lMax2X1 = 3; - lMin2X2 = 3; - lMax2X2 = 3; - lMin2X3 = maxX3 - 3; - lMax2X3 = maxX3 - 1; - - lMin3X1 = 1; - lMax3X1 = 3; - lMin3X2 = 1; - lMax3X2 = 3; - lMin3X3 = maxX3 - 3; - lMax3X3 = maxX3 - 2; - } - else if (sendDir == BNE) - { - lMin1X1 = maxX1 - 3; - lMax1X1 = maxX1 - 2; - lMin1X2 = maxX2 - 3; - lMax1X2 = maxX2 - 1; - lMin1X3 = 1; - lMax1X3 = 3; - - lMin2X1 = maxX1 - 3; - lMax2X1 = maxX1 - 1; - lMin2X2 = maxX2 - 3; - lMax2X2 = maxX2 - 2; - lMin2X3 = 1; - lMax2X3 = 3; - - lMin3X1 = maxX1 - 3; - lMax3X1 = maxX1 - 1; - lMin3X2 = maxX2 - 3; - lMax3X2 = maxX2 - 1; - lMin3X3 = 3; - lMax3X3 = 3; - } - else if (sendDir == BNW) - { - lMin1X1 = 3; - lMax1X1 = 3; - lMin1X2 = maxX2 - 3; - lMax1X2 = maxX2 - 1; - lMin1X3 = 1; - lMax1X3 = 3; - - lMin2X1 = 1; - lMax2X1 = 3; - lMin2X2 = maxX2 - 3; - lMax2X2 = maxX2 - 2; - lMin2X3 = 1; - lMax2X3 = 3; - - lMin3X1 = 1; - lMax3X1 = 3; - lMin3X2 = maxX2 - 3; - lMax3X2 = maxX2 - 1; - lMin3X3 = 3; - lMax3X3 = 3; - } - else if (sendDir == BSE) - { - lMin1X1 = maxX1 - 3; - lMax1X1 = maxX1 - 2; - lMin1X2 = 1; - lMax1X2 = 3; - lMin1X3 = 1; - lMax1X3 = 3; - - lMin2X1 = maxX1 - 3; - lMax2X1 = maxX1 - 1; - lMin2X2 = 3; - lMax2X2 = 3; - lMin2X3 = 1; - lMax2X3 = 3; - - lMin3X1 = maxX1 - 3; - lMax3X1 = maxX1 - 1; - lMin3X2 = 1; - lMax3X2 = 3; - lMin3X3 = 3; - lMax3X3 = 3; - } - else if (sendDir == BSW) - { - lMin1X1 = 3; - lMax1X1 = 3; - lMin1X2 = 1; - lMax1X2 = 3; - lMin1X3 = 1; - lMax1X3 = 3; - - lMin2X1 = 1; - lMax2X1 = 3; - lMin2X2 = 3; - lMax2X2 = 3; - lMin2X3 = 1; - lMax2X3 = 3; - - lMin3X1 = 1; - lMax3X1 = 3; - lMin3X2 = 1; - lMax3X2 = 3; - lMin3X3 = 3; - lMax3X3 = 3; - } - if (receiver00) - { - findFCCells(lMin1X1, lMin1X2, lMin1X3, lMax1X1, lMax1X2, lMax1X3, iNodeSetReceiver00); - } - if (receiver00) - { - findFCCells(lMin2X1, lMin2X2, lMin2X3, lMax2X1, lMax2X2, lMax2X3, iNodeSetReceiver00); - } - if (receiver00) - { - findFCCells(lMin3X1, lMin3X2, lMin3X3, lMax3X1, lMax3X2, lMax3X3, iNodeSetReceiver00); - } - break; - } -} -////////////////////////////////////////////////////////////////////////// -//template< typename VectorTransmitter > -void CoarseToFineNodeSetBlock3DConnector::distributeReceiveVectors() -{ - using namespace D3Q27System; - - DistributionArray3DPtr fTo = block.lock()->getKernel()->getDataSet()->getFdistributions(); - - int index00 = 0; - int index01 = 0; - int index10 = 0; - int index11 = 0; - - vector_type& data00 = this->receiver00->getData(); - vector_type& data01 = this->receiver01->getData(); - vector_type& data10 = this->receiver10->getData(); - vector_type& data11 = this->receiver11->getData(); - - for(INodeVector inode : iNodeSetReceiver00) - { - LBMReal icellC[27]; - this->readICellCfromData(data00, index00, icellC); - iprocessor->writeINodeInv(fTo, icellC, inode[0], inode[1], inode[2]); - } - for(INodeVector inode : iNodeSetReceiver01) - { - LBMReal icellC[27]; - this->readICellCfromData(data01, index01, icellC); - iprocessor->writeINodeInv(fTo, icellC, inode[0], inode[1], inode[2]); - } - for(INodeVector inode : iNodeSetReceiver10) - { - LBMReal icellC[27]; - this->readICellCfromData(data10, index10, icellC); - iprocessor->writeINodeInv(fTo, icellC, inode[0], inode[1], inode[2]); - } - for(INodeVector inode : iNodeSetReceiver11) - { - LBMReal icellC[27]; - this->readICellCfromData(data11, index11, icellC); - iprocessor->writeINodeInv(fTo, icellC, inode[0], inode[1], inode[2]); - } -} -////////////////////////////////////////////////////////////////////////// - -void CoarseToFineNodeSetBlock3DConnector::readICellCfromData(vector_type& data, int& index, LBMReal* icellC) -{ - for (int i = D3Q27System::STARTF; i < D3Q27System::ENDF+1; i++) - { - icellC[i] = data[index++]; - } -} -////////////////////////////////////////////////////////////////////////// - -void CoarseToFineNodeSetBlock3DConnector::getLocalMinMax(int& minX1, int& minX2, int& minX3, int& maxX1, int& maxX2, int& maxX3) -{ - using namespace D3Q27System; - int TminX1 = minX1; int TminX2 = minX2; int TminX3 = minX3; int TmaxX1 = maxX1; int TmaxX2 = maxX2; int TmaxX3 = maxX3; - - if (block.lock()->hasInterpolationFlagCF(E)) - { - if (maxX1==TmaxX1) maxX1 -= 2; - } - if (block.lock()->hasInterpolationFlagCF(W)) - { - if (minX1==TminX1) minX1 += 2; - } - if (block.lock()->hasInterpolationFlagCF(N)) - { - if (maxX2==TmaxX2) maxX2 -= 2; - } - if (block.lock()->hasInterpolationFlagCF(S)) - { - if (minX2==TminX2) minX2 += 2; - } - if (block.lock()->hasInterpolationFlagCF(T)) - { - if (maxX3==TmaxX3) maxX3 -= 2; - } - if (block.lock()->hasInterpolationFlagCF(B)) - { - if (minX3==TminX3) minX3 += 2; - } - - //E-W-N-S - if (block.lock()->hasInterpolationFlagCF(NE) && !block.lock()->hasInterpolationFlagCF(N) && !block.lock()->hasInterpolationFlagCF(E)) - { - if (maxX1==TmaxX1) maxX1 -= 2; - if (maxX2==TmaxX2) maxX2 -= 2; - } - if (block.lock()->hasInterpolationFlagCF(SW) && !block.lock()->hasInterpolationFlagCF(W) && !block.lock()->hasInterpolationFlagCF(S)) - { - if (minX1==TminX1) minX1 += 2; - if (minX2==TminX2) minX2 += 2; - } - if (block.lock()->hasInterpolationFlagCF(SE) && !block.lock()->hasInterpolationFlagCF(E) && !block.lock()->hasInterpolationFlagCF(S)) - { - if (maxX1==TmaxX1) maxX1 -= 2; - if (minX2==TminX2) minX2 += 2; - } - if (block.lock()->hasInterpolationFlagCF(NW) && !block.lock()->hasInterpolationFlagCF(N) && !block.lock()->hasInterpolationFlagCF(W)) - { - if (minX1==TminX1) minX1 += 2; - if (maxX2==TmaxX2) maxX2 -= 2; - } - - // ////T-B-E-W - if (block.lock()->hasInterpolationFlagCF(TE) && !block.lock()->hasInterpolationFlagCF(E) && !block.lock()->hasInterpolationFlagCF(T)) - { - if (maxX1==TmaxX1) maxX1 -= 2; - if (maxX3==TmaxX3) maxX3 -= 2; - } - if (block.lock()->hasInterpolationFlagCF(BW) && !block.lock()->hasInterpolationFlagCF(W) && !block.lock()->hasInterpolationFlagCF(B)) - { - if (minX1==TminX1) minX1 += 2; - if (minX3==TminX3) minX3 += 2; - } - if (block.lock()->hasInterpolationFlagCF(BE) && !block.lock()->hasInterpolationFlagCF(E) && !block.lock()->hasInterpolationFlagCF(B)) - { - if (maxX1==TmaxX1) maxX1 -= 2; - if (minX3==TminX3) minX3 += 2; - } - if (block.lock()->hasInterpolationFlagCF(TW) && !block.lock()->hasInterpolationFlagCF(W) && !block.lock()->hasInterpolationFlagCF(T)) - { - if (minX1==TminX1) minX1 += 2; - if (maxX3==TmaxX3) maxX3 -= 2; - } - - - ////T-B-N-S - if (block.lock()->hasInterpolationFlagCF(TN) && !block.lock()->hasInterpolationFlagCF(N) && !block.lock()->hasInterpolationFlagCF(T)) - { - if (maxX2==TmaxX2) maxX2 -= 2; - if (maxX3==TmaxX3) maxX3 -= 2; - } - if (block.lock()->hasInterpolationFlagCF(BS) && !block.lock()->hasInterpolationFlagCF(S) && !block.lock()->hasInterpolationFlagCF(B)) - { - if (minX2==TminX2) minX2 += 2; - if (minX3==TminX3) minX3 += 2; - } - if (block.lock()->hasInterpolationFlagCF(BN) && !block.lock()->hasInterpolationFlagCF(N) && !block.lock()->hasInterpolationFlagCF(B)) - { - if (maxX2==TmaxX2) maxX2 -= 2; - if (minX3==TminX3) minX3 += 2; - } - if (block.lock()->hasInterpolationFlagCF(TS) && !block.lock()->hasInterpolationFlagCF(S) && !block.lock()->hasInterpolationFlagCF(T)) - { - if (minX2==TminX2) minX2 += 2; - if (maxX3==TmaxX3) maxX3 -= 2; - } -} - - diff --git a/src/VirtualFluids/Connectors/CoarseToFineNodeSetBlock3DConnector.h b/src/VirtualFluids/Connectors/CoarseToFineNodeSetBlock3DConnector.h deleted file mode 100644 index add4f12a4..000000000 --- a/src/VirtualFluids/Connectors/CoarseToFineNodeSetBlock3DConnector.h +++ /dev/null @@ -1,103 +0,0 @@ -//! \file CoarseToFineNodeSetBlock3DConnector.h -//! \class CoarseToFineNodeSetBlock3DConnector -//! \brief Connector interpolates and sends data from coarse level to fine. -//! \author Konstantin Kutscher -//! \date 18.05.2015 - -#ifndef CoarseToFineNodeSetBlock3DConnector_H -#define CoarseToFineNodeSetBlock3DConnector_H - -#include <vector> -#include <set> - -//#include "basics/transmitter/TbTransmitter.h" -//#include "basics/transmitter/TbTransmitterLocal.h" -//#include "basics/container/CbVector.h" -#include "CoarseToFineBlock3DConnector.h" -#include "D3Q27System.h" -#include "Block3D.h" -#include "LBMKernel.h" -#include "BCProcessor.h" -#include "InterpolationProcessor.h" -#include "MathUtil.hpp" -#include "Grid3D.h" -#include <memory> - - -class Block3D; - -//daten werden in einen vector (dieser befindet sich im transmitter) kopiert -//der vector wird via transmitter uebertragen -//transmitter kann ein lokal, MPI, RCG, CTL oder was auch immer fuer ein -//transmitter sein, der von Transmitter abgeleitet ist ;-) - - -// send direction: E<->W N<->S T<->B -// --------- x3 x3 x2 -// | 01 | 11 | ^ ^ ^ -// |----+----| +-> x2 +->x1 +->x1 -// | 00 | 10 | -// --------- - - -class CoarseToFineNodeSetBlock3DConnector : public CoarseToFineBlock3DConnector -{ -public: - CoarseToFineNodeSetBlock3DConnector(Block3DPtr block, - VectorTransmitterPtr sender00, VectorTransmitterPtr receiver00, - VectorTransmitterPtr sender01, VectorTransmitterPtr receiver01, - VectorTransmitterPtr sender10, VectorTransmitterPtr receiver10, - VectorTransmitterPtr sender11, VectorTransmitterPtr receiver11, - int sendDir, InterpolationProcessorPtr iprocessor); - - void init(); - - void fillSendVectors(); - void distributeReceiveVectors(); - -protected: - typedef std::vector< int > INodeVector; - typedef std::vector < INodeVector > INodeSet; - INodeSet iNodeSetSender00; - INodeSet iNodeSetSender01; - INodeSet iNodeSetSender10; - INodeSet iNodeSetSender11; - INodeSet iNodeSetReceiver00; - INodeSet iNodeSetReceiver01; - INodeSet iNodeSetReceiver10; - INodeSet iNodeSetReceiver11; - - void writeICellFtoData(vector_type& data, int& index, D3Q27ICell& icellF); - void writeNodeToVector(vector_type& data, int& index, LBMReal* inode); - void readICellCfromData(vector_type& data, int& index, LBMReal* icellC); - - void findCFCells(); - void findCFCells(int lMinX1, int lMinX2, int lMinX3, int lMaxX1, int lMaxX2, int lMaxX3, INodeSet &inodes); - - void findFCCells(); - void findFCCells(int lMinX1, int lMinX2, int lMinX3, int lMaxX1, int lMaxX2, int lMaxX3, INodeSet &inodes); - - void getLocalMinMax(int& minX1, int& minX2, int& minX3, int& maxX1, int& maxX2, int& maxX3); - - int bMaxX1, bMaxX2, bMaxX3; - - int minX1; - int minX2; - int minX3; - - int maxX1; - int maxX2; - int maxX3; - - int minHalfX1; - int minHalfX2; - int minHalfX3; - - int maxHalfX1; - int maxHalfX2; - int maxHalfX3; -}; - - - -#endif diff --git a/src/VirtualFluids/Connectors/ConnectorFactory.h b/src/VirtualFluids/Connectors/ConnectorFactory.h deleted file mode 100644 index f62eab7dc..000000000 --- a/src/VirtualFluids/Connectors/ConnectorFactory.h +++ /dev/null @@ -1,40 +0,0 @@ -#ifndef ConnectorFactory_h__ -#define ConnectorFactory_h__ - -#include "Block3DConnector.h" -#include "TransmitterType.h" -#include "InterpolationProcessor.h" -#include "FineToCoarseBlock3DConnector.h" - -#include <memory> -class ConnectorFactory; -typedef std::shared_ptr<ConnectorFactory> ConnectorFactoryPtr; - -class ConnectorFactory -{ -public: - ConnectorFactory() {}; - virtual ~ConnectorFactory() {}; - - virtual Block3DConnectorPtr createSameLevelDirectConnector(Block3DPtr from, Block3DPtr to, int sendDir) = 0; - virtual Block3DConnectorPtr createSameLevelVectorConnector(Block3DPtr block, - VectorTransmitterPtr sender, - VectorTransmitterPtr receiver, - int sendDir) = 0; - virtual Block3DConnectorPtr createCoarseToFineConnector(Block3DPtr block, - VectorTransmitterPtr sender00, VectorTransmitterPtr receiver00, - VectorTransmitterPtr sender01, VectorTransmitterPtr receiver01, - VectorTransmitterPtr sender10, VectorTransmitterPtr receiver10, - VectorTransmitterPtr sender11, VectorTransmitterPtr receiver11, - int sendDir, InterpolationProcessorPtr iprocessor) = 0; - virtual Block3DConnectorPtr createFineToCoarseConnector(Block3DPtr block, - VectorTransmitterPtr sender, - VectorTransmitterPtr receiver, - int sendDir, - InterpolationProcessorPtr iprocessor, - FineToCoarseBlock3DConnector::CFconnectorType connType) = 0; - -protected: -private: -}; -#endif // ConnectorFactory_h__ diff --git a/src/VirtualFluids/Connectors/D3Q27ETCFOffVectorConnector.cpp b/src/VirtualFluids/Connectors/D3Q27ETCFOffVectorConnector.cpp deleted file mode 100644 index 710a8c14b..000000000 --- a/src/VirtualFluids/Connectors/D3Q27ETCFOffVectorConnector.cpp +++ /dev/null @@ -1 +0,0 @@ -#include "D3Q27ETCFOffVectorConnector.h" diff --git a/src/VirtualFluids/Connectors/D3Q27ETCFOffVectorConnector.h b/src/VirtualFluids/Connectors/D3Q27ETCFOffVectorConnector.h deleted file mode 100644 index 03e366d28..000000000 --- a/src/VirtualFluids/Connectors/D3Q27ETCFOffVectorConnector.h +++ /dev/null @@ -1,1940 +0,0 @@ -/** -* @file D3Q27ETCFOffVectorConnector.h -* @class D3Q27ETCFOffVectorConnector -* @brief Interpolation from coarse level to fine. -* @author Kostyantyn Kucher and Ehsan Fard -* @date 08.06.2011 -*/ -#ifndef D3Q27ETCFOffVectorConnector_H -#define D3Q27ETCFOffVectorConnector_H - -#include <vector> - -#include "basics/transmitter/TbTransmitter.h" -#include "basics/transmitter/TbTransmitterLocal.h" -#include "basics/container/CbVector.h" -#include "Block3DConnector.h" -#include "D3Q27System.h" -#include "Block3D.h" -#include "LBMKernel.h" -#include "InterpolationProcessor.h" -#include "MathUtil.hpp" -#include "Grid3D.h" -#include <memory> - -#include "D3Q27ETFCOffVectorConnector.h" -#include "BCProcessor.h" - -class Block3D; - -//daten werden in einen vector (dieser befindet sich im transmitter) kopiert -//der vector wird via transmitter uebertragen -//transmitter kann ein lokal, MPI, RCG, CTL oder was auch immer fuer ein -//transmitter sein, der von Transmitter abgeleitet ist ;-) - -//sendrichtung: E<->W N<->S T<->B -// --------- x3 x3 x2 -// | NW | NE | ^ ^ ^ -// |----+----| +-> x2 +->x1 +->x1 -// | SW | SE | -// --------- -// NW==even-odd, SW==even-even, SE==odd-even, NE==odd-odd - -template< typename VectorTransmitter > -class D3Q27ETCFOffVectorConnector : public Block3DConnector -{ -public: - typedef typename VectorTransmitter::value_type vector_type; - typedef std::shared_ptr< VectorTransmitter > VectorTransmitterPtr; -public: - D3Q27ETCFOffVectorConnector(Block3DPtr block, - VectorTransmitterPtr senderEvenEvenSW, VectorTransmitterPtr receiverEvenEvenSW, - VectorTransmitterPtr senderEvenOddNW, VectorTransmitterPtr receiverEvenOddNW, - VectorTransmitterPtr senderOddEvenSE, VectorTransmitterPtr receiverOddEvenSE, - VectorTransmitterPtr senderOddOddNE, VectorTransmitterPtr receiverOddOddNE, - int sendDir, InterpolationProcessorPtr iprocessor); - - bool isLocalConnector(); - bool isRemoteConnector(); - void init(); - - void sendTransmitterDataSize(); - void receiveTransmitterDataSize(); - - void prepareForSend(); - void sendVectors(); - - void prepareForReceive(); - void receiveVectors(); - - void fillSendVectors(); - void distributeReceiveVectors(); - - bool isInterpolationConnectorCF() { return true; } - bool isInterpolationConnectorFC() { return false; } - - double getSendRecieveTime(); - - void prepareForSendX1() {} - void prepareForSendX2() {} - void prepareForSendX3() {} - - void sendVectorsX1() {} - void sendVectorsX2() {} - void sendVectorsX3() {} - - void prepareForReceiveX1() {} - void prepareForReceiveX2() {} - void prepareForReceiveX3() {} - - void receiveVectorsX1() {} - void receiveVectorsX2() {} - void receiveVectorsX3() {} - -protected: - std::weak_ptr<Block3D> block; //dieser nvd sendet daten und die empfangenen werden diesem nvd zugeordnet - VectorTransmitterPtr senderEvenEvenSW, receiverEvenEvenSW, - senderEvenOddNW, receiverEvenOddNW, - senderOddEvenSE, receiverOddEvenSE, - senderOddOddNE, receiverOddOddNE; - - InterpolationProcessorPtr iprocessor; - - void writeICellFtoData(vector_type& data, int& index, D3Q27ICell& icellF); - void writeNodeToVector(vector_type& data, int& index, LBMReal* inode); - void getLocalMinMax(const int& gMin, const int& gMax, const bool& even, int& lMin, int& lMax, const bool& dataDistribution); - void getLocalMinMax(int& minX1, int& minX2, int& minX3, int& maxX1, int& maxX2, int& maxX3); - void getLocalMinMax(int& minX1, int& minX2, int& minX3, int& maxX1, int& maxX2, int& maxX3, CFconnectorType connType); - void fillSendVectorExt(DistributionArray3DPtr fFrom, const int& lMinX1, const int& lMinX2, const int& lMinX3, const int& lMaxX1, const int& lMaxX2, const int& lMaxX3, vector_type& data, int& index); - - void distributeReceiveVector(DistributionArray3DPtr fTo, const int& lMinX1, const int& lMinX2, const int& lMinX3, const int& lMaxX1, const int& lMaxX2, const int& lMaxX3, vector_type& data, int& index); - void readICellCfromData(vector_type& data, int& index, LBMReal* icellC); - - void findCFnodes(); - void findCFnodes(DistributionArray3DPtr fFrom, const int& lMinX1, const int& lMinX2, const int& lMinX3, const int& lMaxX1, const int& lMaxX2, const int& lMaxX3, vector_type& data, int& index); - - int bMaxX1, bMaxX2, bMaxX3; -}; - -//////////////////////////////////////////////////////////////////////////// -template< typename VectorTransmitter > -D3Q27ETCFOffVectorConnector<VectorTransmitter>::D3Q27ETCFOffVectorConnector(Block3DPtr block, - VectorTransmitterPtr senderEvenEvenSW, VectorTransmitterPtr receiverEvenEvenSW, - VectorTransmitterPtr senderEvenOddNW, VectorTransmitterPtr receiverEvenOddNW, - VectorTransmitterPtr senderOddEvenSE, VectorTransmitterPtr receiverOddEvenSE, - VectorTransmitterPtr senderOddOddNE, VectorTransmitterPtr receiverOddOddNE, - int sendDir, InterpolationProcessorPtr iprocessor) : Block3DConnector(sendDir) - , block(block) - , senderEvenEvenSW(senderEvenEvenSW) - , senderEvenOddNW(senderEvenOddNW) - , senderOddEvenSE(senderOddEvenSE) - , senderOddOddNE(senderOddOddNE) - , receiverEvenEvenSW(receiverEvenEvenSW) - , receiverEvenOddNW(receiverEvenOddNW) - , receiverOddEvenSE(receiverOddEvenSE) - , receiverOddOddNE(receiverOddOddNE) - , iprocessor(iprocessor) -{ - if (!(sendDir == D3Q27System::E || sendDir == D3Q27System::W || sendDir == D3Q27System::N || sendDir == D3Q27System::S || sendDir == D3Q27System::T || sendDir == D3Q27System::B - || sendDir == D3Q27System::NE || sendDir == D3Q27System::SW || sendDir == D3Q27System::SE || sendDir == D3Q27System::NW - || sendDir == D3Q27System::TE || sendDir == D3Q27System::BW || sendDir == D3Q27System::BE || sendDir == D3Q27System::TW - || sendDir == D3Q27System::TN || sendDir == D3Q27System::BS || sendDir == D3Q27System::BN || sendDir == D3Q27System::TS - || sendDir == D3Q27System::TNE || sendDir == D3Q27System::TNW || sendDir == D3Q27System::TSE || sendDir == D3Q27System::TSW - || sendDir == D3Q27System::BNE || sendDir == D3Q27System::BNW || sendDir == D3Q27System::BSE || sendDir == D3Q27System::BSW - )) - { - throw UbException(UB_EXARGS, "invalid constructor for this direction"); - } -} -////////////////////////////////////////////////////////////////////////// -template< typename VectorTransmitter > -bool D3Q27ETCFOffVectorConnector<VectorTransmitter>::isLocalConnector() -{ - return !this->isRemoteConnector(); -} -////////////////////////////////////////////////////////////////////////// -template< typename VectorTransmitter > -bool D3Q27ETCFOffVectorConnector<VectorTransmitter>::isRemoteConnector() -{ - return ((senderOddOddNE && senderOddOddNE->isRemoteTransmitter()) || (receiverOddOddNE && receiverOddOddNE->isRemoteTransmitter()) - || (senderEvenEvenSW && senderEvenEvenSW->isRemoteTransmitter()) || (receiverEvenEvenSW && receiverEvenEvenSW->isRemoteTransmitter()) - || (senderEvenOddNW && senderEvenOddNW->isRemoteTransmitter()) || (receiverEvenOddNW && receiverEvenOddNW->isRemoteTransmitter()) - || (senderOddEvenSE && senderOddEvenSE->isRemoteTransmitter()) || (receiverOddEvenSE && receiverOddEvenSE->isRemoteTransmitter())); -} -////////////////////////////////////////////////////////////////////////// -template< typename VectorTransmitter > -void D3Q27ETCFOffVectorConnector<VectorTransmitter>::sendTransmitterDataSize() -{ - if (senderEvenEvenSW) - { - UBLOG(logDEBUG5, "D3Q27ETCFOffVectorConnector<VectorTransmitter>::sendTransmitterDataSize()-senderEvenEvenSW " << block.lock()->toString() << " sendDir=" << sendDir); - senderEvenEvenSW->sendDataSize(); - } - if (senderEvenOddNW) - { - UBLOG(logDEBUG5, "D3Q27ETCFOffVectorConnector<VectorTransmitter>::sendTransmitterDataSize()-senderEvenOddNW " << block.lock()->toString() << "sendDir=" << sendDir); - senderEvenOddNW->sendDataSize(); - } - if (senderOddEvenSE) - { - UBLOG(logDEBUG5, "D3Q27ETCFOffVectorConnector<VectorTransmitter>::sendTransmitterDataSize()-senderOddEvenSE " << block.lock()->toString() + "sendDir=" << sendDir); - senderOddEvenSE->sendDataSize(); - } - if (senderOddOddNE) - { - UBLOG(logDEBUG5, "D3Q27ETCFOffVectorConnector<VectorTransmitter>::sendTransmitterDataSize()-senderOddOddNE " << block.lock()->toString() << "sendDir=" << sendDir); - senderOddOddNE->sendDataSize(); - } -} -////////////////////////////////////////////////////////////////////////// -template< typename VectorTransmitter > -void D3Q27ETCFOffVectorConnector<VectorTransmitter>::receiveTransmitterDataSize() -{ - if (receiverEvenEvenSW) - { - UBLOG(logDEBUG5, "D3Q27ETCFOffVectorConnector<VectorTransmitter>::receiveTransmitterDataSize()-receiverEvenEvenSW " << block.lock()->toString() << "sendDir=" << sendDir); - receiverEvenEvenSW->receiveDataSize(); - } - if (receiverEvenOddNW) - { - UBLOG(logDEBUG5, "D3Q27ETCFOffVectorConnector<VectorTransmitter>::receiveTransmitterDataSize()-receiverEvenOddNW " << block.lock()->toString() << "sendDir=" << sendDir); - receiverEvenOddNW->receiveDataSize(); - } - if (receiverOddEvenSE) - { - UBLOG(logDEBUG5, "D3Q27ETCFOffVectorConnector<VectorTransmitter>::receiveTransmitterDataSize()-receiverOddEvenSE " << block.lock()->toString() << "sendDir=" << sendDir); - receiverOddEvenSE->receiveDataSize(); - } - if (receiverOddOddNE) - { - UBLOG(logDEBUG5, "D3Q27ETCFOffVectorConnector<VectorTransmitter>::receiveTransmitterDataSize()-receiverOddOddNE " << block.lock()->toString() << "sendDir=" << sendDir); - receiverOddOddNE->receiveDataSize(); - } -} -////////////////////////////////////////////////////////////////////////// -template< typename VectorTransmitter > -void D3Q27ETCFOffVectorConnector<VectorTransmitter>::prepareForSend() -{ - if (senderEvenEvenSW) senderEvenEvenSW->prepareForSend(); - if (senderEvenOddNW) senderEvenOddNW->prepareForSend(); - if (senderOddEvenSE) senderOddEvenSE->prepareForSend(); - if (senderOddOddNE) senderOddOddNE->prepareForSend(); -} -////////////////////////////////////////////////////////////////////////// -template< typename VectorTransmitter > -void D3Q27ETCFOffVectorConnector<VectorTransmitter>::sendVectors() -{ - if (senderEvenEvenSW) senderEvenEvenSW->sendData(); - if (senderEvenOddNW) senderEvenOddNW->sendData(); - if (senderOddEvenSE) senderOddEvenSE->sendData(); - if (senderOddOddNE) senderOddOddNE->sendData(); -} -////////////////////////////////////////////////////////////////////////// -template< typename VectorTransmitter > -void D3Q27ETCFOffVectorConnector<VectorTransmitter>::prepareForReceive() -{ - if (receiverEvenEvenSW) receiverEvenEvenSW->prepareForReceive(); - if (receiverEvenOddNW) receiverEvenOddNW->prepareForReceive(); - if (receiverOddEvenSE) receiverOddEvenSE->prepareForReceive(); - if (receiverOddOddNE) receiverOddOddNE->prepareForReceive(); -} -////////////////////////////////////////////////////////////////////////// -template< typename VectorTransmitter > -void D3Q27ETCFOffVectorConnector<VectorTransmitter>::receiveVectors() -{ - if (receiverEvenEvenSW) receiverEvenEvenSW->receiveData(); - if (receiverEvenOddNW) receiverEvenOddNW->receiveData(); - if (receiverOddEvenSE) receiverOddEvenSE->receiveData(); - if (receiverOddOddNE) receiverOddOddNE->receiveData(); -} -////////////////////////////////////////////////////////////////////////// -template< typename VectorTransmitter > -void D3Q27ETCFOffVectorConnector<VectorTransmitter>::init() -{ - using namespace D3Q27System; - - bMaxX1 = (int)block.lock()->getKernel()->getDataSet()->getFdistributions()->getNX1(); - bMaxX2 = (int)block.lock()->getKernel()->getDataSet()->getFdistributions()->getNX2(); - bMaxX3 = (int)block.lock()->getKernel()->getDataSet()->getFdistributions()->getNX3(); - - int sendSize = 0; - LBMReal initValue = -999.0; - - int sendDataPerNode = 27/*f*/; - int iCellSize = 8; //size of interpolation cell - - switch (this->sendDir) - { - case E: case W: sendSize = bMaxX2*bMaxX3*sendDataPerNode*iCellSize; break; - case N: case S: sendSize = bMaxX1*bMaxX3*sendDataPerNode*iCellSize; break; - case T: case B: sendSize = bMaxX1*bMaxX2*sendDataPerNode*iCellSize; break; - case NE: case SW:case SE: case NW: sendSize = 2 * bMaxX3*sendDataPerNode*iCellSize; break; - case TE: case BW:case BE: case TW: sendSize = 2 * bMaxX2*sendDataPerNode*iCellSize; break; - case TN: case BS:case BN: case TS: sendSize = 2 * bMaxX1*sendDataPerNode*iCellSize; break; - case TNE: case TNW:case TSE: case TSW:case BNE: case BNW:case BSE: case BSW: sendSize = 6 * bMaxX1*sendDataPerNode*iCellSize; break; - default: throw UbException(UB_EXARGS, "direction not allowed in this constructor"); - } - if (senderEvenEvenSW) senderEvenEvenSW->getData().resize(sendSize, initValue); - else senderEvenEvenSW = VectorTransmitterPtr(new TbLocalTransmitter< CbVector< LBMReal > >()); - if (senderEvenOddNW) senderEvenOddNW->getData().resize(sendSize, initValue); - else senderEvenOddNW = VectorTransmitterPtr(new TbLocalTransmitter< CbVector< LBMReal > >()); - if (senderOddEvenSE) senderOddEvenSE->getData().resize(sendSize, initValue); - else senderOddEvenSE = VectorTransmitterPtr(new TbLocalTransmitter< CbVector< LBMReal > >()); - if (senderOddOddNE) senderOddOddNE->getData().resize(sendSize, initValue); - else senderOddOddNE = VectorTransmitterPtr(new TbLocalTransmitter< CbVector< LBMReal > >()); - - if (!receiverEvenEvenSW) receiverEvenEvenSW = VectorTransmitterPtr(new TbLocalTransmitter< CbVector< LBMReal > >()); - if (!receiverEvenOddNW) receiverEvenOddNW = VectorTransmitterPtr(new TbLocalTransmitter< CbVector< LBMReal > >()); - if (!receiverOddEvenSE) receiverOddEvenSE = VectorTransmitterPtr(new TbLocalTransmitter< CbVector< LBMReal > >()); - if (!receiverOddOddNE) receiverOddOddNE = VectorTransmitterPtr(new TbLocalTransmitter< CbVector< LBMReal > >()); - - //findCFnodes(); -} -////////////////////////////////////////////////////////////////////////// -template< typename VectorTransmitter > -void D3Q27ETCFOffVectorConnector< VectorTransmitter>::fillSendVectors() -{ - using namespace D3Q27System; - - DistributionArray3DPtr fFrom = block.lock()->getKernel()->getDataSet()->getFdistributions(); - int maxX1 = (int)fFrom->getNX1(); - int maxX2 = (int)fFrom->getNX2(); - int maxX3 = (int)fFrom->getNX3(); - int minX1 = 0; - int minX2 = 0; - int minX3 = 0; - - int indexEvEv = 0; - int indexEvOd = 0; - int indexOdEv = 0; - int indexOdOd = 0; - - vector_type& dataEvEv = this->senderEvenEvenSW->getData(); - vector_type& dataEvOd = this->senderEvenOddNW->getData(); - vector_type& dataOdEv = this->senderOddEvenSE->getData(); - vector_type& dataOdOd = this->senderOddOddNE->getData(); - - int lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3; - //int lMinX1_2, lMinX2_2, lMinX3_2, lMaxX1_2, lMaxX2_2, lMaxX3_2; - - //for coners - int lMinX1W = 1; - int lMaxX1W = 2; - - int lMinX1E = maxX1 - 3; - int lMaxX1E = maxX1 - 2; - - int lMinX2S = 1; - int lMaxX2S = 2; - - int lMinX2N = maxX2 - 3; - int lMaxX2N = maxX2 - 2; - - int lMinX3B = 1; - int lMaxX3B = 2; - - int lMinX3T = maxX3 - 3; - int lMaxX3T = maxX3 - 2; - - - switch (sendDir) - { - case E: - lMinX1 = maxX1 - 3; - lMaxX1 = lMinX1 + 1; - - getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, false); - getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, false); - fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); - - getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, false); - getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, false); - fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvOd, indexEvOd); - - getLocalMinMax(minX2, maxX2, false, lMinX2, lMaxX2, false); - getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, false); - fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv); - - getLocalMinMax(minX2, maxX2, false, lMinX2, lMaxX2, false); - getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, false); - fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdOd, indexOdOd); - break; - case W: - /////////////////////////////////////// - ///DEBUG - //if (block.lock()->getGlobalID() == 5780) - //{ - // int test = 0; - //} - ////////////// - lMinX1 = 1; - lMaxX1 = lMinX1 + 1; - - getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, false); - getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, false); - fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); - - getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, false); - getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, false); - fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvOd, indexEvOd); - - getLocalMinMax(minX2, maxX2, false, lMinX2, lMaxX2, false); - getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, false); - fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv); - - getLocalMinMax(minX2, maxX2, false, lMinX2, lMaxX2, false); - getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, false); - fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdOd, indexOdOd); - break; - case N: - lMinX2 = maxX2 - 3; - lMaxX2 = lMinX2 + 1; - - getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, false); - getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, false); - fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); - - getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, false); - getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, false); - fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvOd, indexEvOd); - - getLocalMinMax(minX1, maxX1, false, lMinX1, lMaxX1, false); - getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, false); - fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv); - - getLocalMinMax(minX1, maxX1, false, lMinX1, lMaxX1, false); - getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, false); - fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdOd, indexOdOd); - break; - case S: - lMinX2 = 1; - lMaxX2 = lMinX2 + 1; - - getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, false); - getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, false); - fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); - - getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, false); - getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, false); - fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvOd, indexEvOd); - - getLocalMinMax(minX1, maxX1, false, lMinX1, lMaxX1, false); - getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, false); - fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv); - - getLocalMinMax(minX1, maxX1, false, lMinX1, lMaxX1, false); - getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, false); - fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdOd, indexOdOd); - break; - case T: - lMinX3 = maxX3 - 3; - lMaxX3 = lMinX3 + 1; - - getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, false); - getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, false); - fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); - - getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, false); - getLocalMinMax(minX2, maxX2, false, lMinX2, lMaxX2, false); - fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvOd, indexEvOd); - - getLocalMinMax(minX1, maxX1, false, lMinX1, lMaxX1, false); - getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, false); - fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv); - - getLocalMinMax(minX1, maxX1, false, lMinX1, lMaxX1, false); - getLocalMinMax(minX2, maxX2, false, lMinX2, lMaxX2, false); - fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdOd, indexOdOd); - break; - case B: - lMinX3 = 1; - lMaxX3 = lMinX3 + 1; - - getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, false); - getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, false); - fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); - - getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, false); - getLocalMinMax(minX2, maxX2, false, lMinX2, lMaxX2, false); - fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvOd, indexEvOd); - - getLocalMinMax(minX1, maxX1, false, lMinX1, lMaxX1, false); - getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, false); - fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv); - - getLocalMinMax(minX1, maxX1, false, lMinX1, lMaxX1, false); - getLocalMinMax(minX2, maxX2, false, lMinX2, lMaxX2, false); - fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdOd, indexOdOd); - break; - ///N-S-E-W - case NE: - lMinX1 = maxX1 - 3; - lMaxX1 = lMinX1 + 2; - lMinX2 = maxX2 - 3; - lMaxX2 = lMinX2 + 2; - - getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, false); - fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); - - getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, false); - fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv); - - break; - - case SW: - lMinX1 = 0; - lMaxX1 = lMinX1 + 2; - lMinX2 = 0; - lMaxX2 = lMinX2 + 2; - - getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, false); - fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); - - getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, false); - fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv); - - break; - - case SE: - lMinX1 = maxX1 - 3; - lMaxX1 = lMinX1 + 2; - lMinX2 = 0; - lMaxX2 = lMinX2 + 2; - - getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, false); - fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); - - getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, false); - fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv); - - break; - - case NW: - lMinX1 = 0; - lMaxX1 = lMinX1 + 2; - lMinX2 = maxX2 - 3; - lMaxX2 = lMinX2 + 2; - - getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, false); - fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); - - getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, false); - fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv); - - break; - /////T-B-E-W - case TE: - lMinX1 = maxX1 - 3; - lMaxX1 = lMinX1 + 2; - lMinX3 = maxX3 - 3; - lMaxX3 = lMinX3 + 2; - - getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, false); - fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); - - getLocalMinMax(minX2, maxX2, false, lMinX2, lMaxX2, false); - fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv); - - break; - - case BW: - lMinX1 = 0; - lMaxX1 = lMinX1 + 2; - lMinX3 = 0; - lMaxX3 = lMinX3 + 2; - - getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, false); - fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); - - getLocalMinMax(minX2, maxX2, false, lMinX2, lMaxX2, false); - fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv); - - break; - - case BE: - lMinX1 = maxX1 - 3; - lMaxX1 = lMinX1 + 2; - lMinX3 = 0; - lMaxX3 = lMinX3 + 2; - - getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, false); - fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); - - getLocalMinMax(minX2, maxX2, false, lMinX2, lMaxX2, false); - fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv); - - break; - - case TW: - lMinX1 = 0; - lMaxX1 = lMinX1 + 2; - lMinX3 = maxX3 - 3; - lMaxX3 = lMinX3 + 2; - - getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, false); - fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); - - getLocalMinMax(minX2, maxX2, false, lMinX2, lMaxX2, false); - fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv); - - break; - //// - /////T-B-N-S - case TN: - lMinX2 = maxX2 - 3; - lMaxX2 = lMinX2 + 2; - lMinX3 = maxX3 - 3; - lMaxX3 = lMinX3 + 2; - - getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, false); - fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); - - getLocalMinMax(minX1, maxX1, false, lMinX1, lMaxX1, false); - fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv); - - break; - - case BS: - lMinX2 = 0; - lMaxX2 = lMinX2 + 2; - lMinX3 = 0; - lMaxX3 = lMinX3 + 2; - - getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, false); - fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); - - getLocalMinMax(minX1, maxX1, false, lMinX1, lMaxX1, false); - fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv); - - break; - - case BN: - lMinX2 = maxX2 - 3; - lMaxX2 = lMinX2 + 2; - lMinX3 = 0; - lMaxX3 = lMinX3 + 2; - - getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, false); - fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); - - getLocalMinMax(minX1, maxX1, false, lMinX1, lMaxX1, false); - fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv); - - break; - - case TS: - lMinX2 = 0; - lMaxX2 = lMinX2 + 2; - lMinX3 = maxX3 - 3; - lMaxX3 = lMinX3 + 2; - - getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, false); - fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); - - getLocalMinMax(minX1, maxX1, false, lMinX1, lMaxX1, false); - fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv); - - break; - - - //TNE - case TNE: - lMinX1 = maxX1 - 3; - lMaxX1 = maxX1 - 1; - lMinX2 = maxX2 - 3; - lMaxX2 = maxX2 - 1; - lMinX3 = maxX3 - 3; - lMaxX3 = maxX3 - 1; - - fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); - break; - // TNW - case TNW: - lMinX1 = 0; - lMaxX1 = 2; - lMinX2 = maxX2 - 3; - lMaxX2 = maxX2 - 1; - lMinX3 = maxX3 - 3; - lMaxX3 = maxX3 - 1; - - fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); - break; - // TSE - case TSE: - lMinX1 = maxX1 - 3; - lMaxX1 = maxX1 - 1; - lMinX2 = 0; - lMaxX2 = 2; - lMinX3 = maxX3 - 3; - lMaxX3 = maxX3 - 1; - - fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); - break; - // TSW - case TSW: - lMinX1 = 0; - lMaxX1 = 2; - lMinX2 = 0; - lMaxX2 = 2; - lMinX3 = maxX3 - 3; - lMaxX3 = maxX3 - 1; - - fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); - break; - // BNE - case BNE: - lMinX1 = maxX1 - 3; - lMaxX1 = maxX1 - 1; - lMinX2 = maxX2 - 3; - lMaxX2 = maxX2 - 1; - lMinX3 = 0; - lMaxX3 = 2; - - fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); - break; - // BNW - case BNW: - lMinX1 = 0; - lMaxX1 = 2; - lMinX2 = maxX2 - 3; - lMaxX2 = maxX2 - 1; - lMinX3 = 0; - lMaxX3 = 2; - - fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); - break; - // BSE - case BSE: - lMinX1 = maxX1 - 3; - lMaxX1 = maxX1 - 1; - lMinX2 = 0; - lMaxX2 = 2; - lMinX3 = 0; - lMaxX3 = 2; - - fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); - break; - // BSW - case BSW: - lMinX1 = 0; - lMaxX1 = 2; - lMinX2 = 0; - lMaxX2 = 2; - lMinX3 = 0; - lMaxX3 = 2; - - fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); - break; - } -} -////////////////////////////////////////////////////////////////////////// -template< typename VectorTransmitter > -void D3Q27ETCFOffVectorConnector< VectorTransmitter>::getLocalMinMax(const int& gMin, const int& gMax, const bool& even, int& lMin, int& lMax, const bool& dataDistribution) -{ - int halfEven = 0; - int halfOdd = 0; - int dCoef = 0; - - if (dataDistribution) - dCoef = 1; - - if (Utilities::isOdd(gMax)) - { - halfEven = gMax / 2; - halfOdd = gMax / 2; - } - if (Utilities::isEven(gMax)) - { - halfEven = gMax / 2; - halfOdd = gMax / 2 - 1 + dCoef; - } - - switch (even) - { - case true: - lMin = gMin + dCoef; - lMax = lMin + halfEven - dCoef; - break; - case false: - lMin = gMin + halfOdd; - lMax = gMax - 1; - break; - } -} -////////////////////////////////////////////////////////////////////////// -template< typename VectorTransmitter > -void D3Q27ETCFOffVectorConnector< VectorTransmitter>::fillSendVectorExt(DistributionArray3DPtr fFrom, const int& lMinX1, const int& lMinX2, const int& lMinX3, const int& lMaxX1, const int& lMaxX2, const int& lMaxX3, vector_type& data, int& index) -{ - if (data.size() == 0) return; - int ix1, ix2, ix3; - LBMReal xoff, yoff, zoff; - BCArray3DPtr bcArray = block.lock()->getKernel()->getBCProcessor()->getBCArray(); - - for (ix3 = lMinX3; ix3 < lMaxX3; ix3++) - { - for (ix2 = lMinX2; ix2 < lMaxX2; ix2++) - { - for (ix1 = lMinX1; ix1 < lMaxX1; ix1++) - { - D3Q27ICell icellC; - D3Q27ICell icellF; - - int howManySolids = iprocessor->iCellHowManySolids(bcArray, ix1, ix2, ix3); - - if (howManySolids == 0 || howManySolids == 8) - { - iprocessor->readICell(fFrom, icellC, ix1, ix2, ix3); - xoff = 0.0; - yoff = 0.0; - zoff = 0.0; - } - else - { - if (!iprocessor->findNeighborICell(bcArray, fFrom, icellC, bMaxX1, bMaxX2, bMaxX3, ix1, ix2, ix3, xoff, yoff, zoff)) - { - std::string err = "For " + block.lock()->toString() + " x1=" + UbSystem::toString(ix1) + ", x2=" + UbSystem::toString(ix2) + ", x3=" + UbSystem::toString(ix3) + - " interpolation is not implemented for other direction" + - " by using in: " + (std::string)typeid(*this).name() + - " or maybe you have a solid on the block boundary"; - UB_THROW(UbException(UB_EXARGS, err)); - } - } - - iprocessor->interpolateCoarseToFine(icellC, icellF, xoff, yoff, zoff); - this->writeICellFtoData(data, index, icellF); - } - } - } -} -////////////////////////////////////////////////////////////////////////// -template< typename VectorTransmitter > -void D3Q27ETCFOffVectorConnector< VectorTransmitter>::writeICellFtoData(vector_type& data, int& index, D3Q27ICell& icellF) -{ - writeNodeToVector(data, index, icellF.BSW); - writeNodeToVector(data, index, icellF.BSE); - writeNodeToVector(data, index, icellF.BNW); - writeNodeToVector(data, index, icellF.BNE); - writeNodeToVector(data, index, icellF.TSW); - writeNodeToVector(data, index, icellF.TSE); - writeNodeToVector(data, index, icellF.TNW); - writeNodeToVector(data, index, icellF.TNE); -} -////////////////////////////////////////////////////////////////////////// -template< typename VectorTransmitter > -void D3Q27ETCFOffVectorConnector< VectorTransmitter>::writeNodeToVector(vector_type& data, int& index, LBMReal* inode) -{ - for (int i = D3Q27System::STARTF; i < D3Q27System::ENDF + 1; i++) - { - data[index++] = inode[i]; - } -} -////////////////////////////////////////////////////////////////////////// -template< typename VectorTransmitter > -void D3Q27ETCFOffVectorConnector< VectorTransmitter>::distributeReceiveVectors() -{ - using namespace D3Q27System; - - DistributionArray3DPtr fTo = block.lock()->getKernel()->getDataSet()->getFdistributions(); - int maxX1 = (int)fTo->getNX1(); - int maxX2 = (int)fTo->getNX2(); - int maxX3 = (int)fTo->getNX3(); - int minX1 = 0; - int minX2 = 0; - int minX3 = 0; - - int indexEvEv = 0; - int indexEvOd = 0; - int indexOdEv = 0; - int indexOdOd = 0; - - vector_type& dataEvEv = this->receiverEvenEvenSW->getData(); - vector_type& dataEvOd = this->receiverEvenOddNW->getData(); - vector_type& dataOdEv = this->receiverOddEvenSE->getData(); - vector_type& dataOdOd = this->receiverOddOddNE->getData(); - - int lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3; - int dummy; - - //for coners - int lMinX1W = 3; - int lMaxX1W = 3; - - int lMinX1E = maxX1 - 3; - int lMaxX1E = maxX1 - 2; - - int lMinX2S = 1; - int lMaxX2S = 3; - - int lMinX2N = maxX2 - 3; - int lMaxX2N = maxX2 - 2; - - int lMinX3B = 1; - int lMaxX3B = 3; - - int lMinX3T = maxX3 - 3; - int lMaxX3T = maxX3 - 2; - - /////////////////////////////////////// - ///DEBUG - //if (block.lock()->getGlobalID() == 5780) - //{ - // int test = 0; - //} - ////////////// - - switch (sendDir) - { - case E: - lMinX1 = maxX1 - 4; - lMaxX1 = lMinX1 + 1; - getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, true); - getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, true); - getLocalMinMax(dummy, lMinX2, lMinX3, dummy, dummy, dummy); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); - - getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, true); - getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, true); - getLocalMinMax(dummy, lMinX2, dummy, dummy, dummy, lMaxX3); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvOd, indexEvOd); - - getLocalMinMax(minX2, maxX2, false, lMinX2, lMaxX2, true); - getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, true); - getLocalMinMax(dummy, dummy, lMinX3, dummy, lMaxX2, dummy); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv); - - getLocalMinMax(minX2, maxX2, false, lMinX2, lMaxX2, true); - getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, true); - getLocalMinMax(dummy, dummy, dummy, dummy, lMaxX2, lMaxX3); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdOd, indexOdOd); - break; - case W: - /////////////////////////////////////// - ///DEBUG - //if (block.lock()->getGlobalID() == 5780) - //{ - // int test = 0; - //} - ////////////// - lMinX1 = 3; - lMaxX1 = lMinX1 + 1; - getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, true); - getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, true); - getLocalMinMax(dummy, lMinX2, lMinX3, dummy, dummy, dummy); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); - - getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, true); - getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, true); - getLocalMinMax(dummy, lMinX2, dummy, dummy, dummy, lMaxX3); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvOd, indexEvOd); - - getLocalMinMax(minX2, maxX2, false, lMinX2, lMaxX2, true); - getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, true); - getLocalMinMax(dummy, dummy, lMinX3, dummy, lMaxX2, dummy); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv); - - getLocalMinMax(minX2, maxX2, false, lMinX2, lMaxX2, true); - getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, true); - getLocalMinMax(dummy, dummy, dummy, dummy, lMaxX2, lMaxX3); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdOd, indexOdOd); - break; - case N: - lMinX2 = maxX2 - 4; - lMaxX2 = lMinX2 + 1; - getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, true); - getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, true); - getLocalMinMax(lMinX1, dummy, lMinX3, dummy, dummy, dummy); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); - - getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, true); - getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, true); - getLocalMinMax(lMinX1, dummy, dummy, dummy, dummy, lMaxX3); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvOd, indexEvOd); - - getLocalMinMax(minX1, maxX1, false, lMinX1, lMaxX1, true); - getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, true); - getLocalMinMax(dummy, dummy, lMinX3, lMaxX1, dummy, dummy); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv); - - getLocalMinMax(minX1, maxX1, false, lMinX1, lMaxX1, true); - getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, true); - getLocalMinMax(dummy, dummy, dummy, lMaxX1, dummy, lMaxX3); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdOd, indexOdOd); - break; - case S: - lMinX2 = 3; - lMaxX2 = lMinX2 + 1; - getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, true); - getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, true); - getLocalMinMax(lMinX1, dummy, lMinX3, dummy, dummy, dummy); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); - - getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, true); - getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, true); - getLocalMinMax(lMinX1, dummy, dummy, dummy, dummy, lMaxX3); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvOd, indexEvOd); - - getLocalMinMax(minX1, maxX1, false, lMinX1, lMaxX1, true); - getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, true); - getLocalMinMax(dummy, dummy, lMinX3, lMaxX1, dummy, dummy); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv); - - getLocalMinMax(minX1, maxX1, false, lMinX1, lMaxX1, true); - getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, true); - getLocalMinMax(dummy, dummy, dummy, lMaxX1, dummy, lMaxX3); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdOd, indexOdOd); - break; - case T: - lMinX3 = maxX3 - 4; - lMaxX3 = lMinX3 + 1; - getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, true); - getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, true); - getLocalMinMax(lMinX1, lMinX2, dummy, dummy, dummy, dummy); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); - - getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, true); - getLocalMinMax(minX2, maxX2, false, lMinX2, lMaxX2, true); - getLocalMinMax(lMinX1, dummy, dummy, dummy, lMaxX2, dummy); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvOd, indexEvOd); - - getLocalMinMax(minX1, maxX1, false, lMinX1, lMaxX1, true); - getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, true); - getLocalMinMax(dummy, lMinX2, dummy, lMaxX1, dummy, dummy); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv); - - getLocalMinMax(minX1, maxX1, false, lMinX1, lMaxX1, true); - getLocalMinMax(minX2, maxX2, false, lMinX2, lMaxX2, true); - getLocalMinMax(dummy, dummy, dummy, lMaxX1, lMaxX2, dummy); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdOd, indexOdOd); - break; - case B: - lMinX3 = 3; - lMaxX3 = lMinX3 + 1; - getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, true); - getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, true); - getLocalMinMax(lMinX1, lMinX2, dummy, dummy, dummy, dummy); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); - - getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, true); - getLocalMinMax(minX2, maxX2, false, lMinX2, lMaxX2, true); - getLocalMinMax(lMinX1, dummy, dummy, dummy, lMaxX2, dummy); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvOd, indexEvOd); - - getLocalMinMax(minX1, maxX1, false, lMinX1, lMaxX1, true); - getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, true); - getLocalMinMax(dummy, lMinX2, dummy, lMaxX1, dummy, dummy); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv); - - getLocalMinMax(minX1, maxX1, false, lMinX1, lMaxX1, true); - getLocalMinMax(minX2, maxX2, false, lMinX2, lMaxX2, true); - getLocalMinMax(dummy, dummy, dummy, lMaxX1, lMaxX2, dummy); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdOd, indexOdOd); - break; - - // /////E-W-N-S - case NE: - lMinX1 = maxX1 - 4; - lMaxX1 = lMinX1 + 3; - lMinX2 = maxX2 - 4; - lMaxX2 = lMinX2 + 1; - getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, true); - getLocalMinMax(dummy, dummy, lMinX3, dummy, dummy, dummy); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); - - getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, true); - getLocalMinMax(dummy, dummy, dummy, dummy, dummy, lMaxX3); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv); - - lMinX1 = maxX1 - 4; - lMaxX1 = lMinX1 + 1; - lMinX2 = maxX2 - 4; - lMaxX2 = lMinX2 + 3; - getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, true); - getLocalMinMax(dummy, dummy, lMinX3, dummy, dummy, dummy); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); - - getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, true); - getLocalMinMax(dummy, dummy, dummy, dummy, dummy, lMaxX3); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv); - - break; - - case SW: - lMinX1 = 1; - lMaxX1 = lMinX1 + 3; - lMinX2 = 3; - lMaxX2 = lMinX2 + 1; - getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, true); - getLocalMinMax(dummy, dummy, lMinX3, dummy, dummy, dummy); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); - - getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, true); - getLocalMinMax(dummy, dummy, dummy, dummy, dummy, lMaxX3); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv); - - lMinX1 = 3; - lMaxX1 = lMinX1 + 1; - lMinX2 = 1; - lMaxX2 = lMinX2 + 3; - getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, true); - getLocalMinMax(dummy, dummy, lMinX3, dummy, dummy, dummy); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); - - getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, true); - getLocalMinMax(dummy, dummy, dummy, dummy, dummy, lMaxX3); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv); - - break; - - case SE: - lMinX1 = maxX1 - 4; - lMaxX1 = lMinX1 + 3; - lMinX2 = 3; - lMaxX2 = lMinX2 + 1; - getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, true); - getLocalMinMax(dummy, dummy, lMinX3, dummy, dummy, dummy); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); - - getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, true); - getLocalMinMax(dummy, dummy, dummy, dummy, dummy, lMaxX3); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv); - - lMinX1 = maxX1 - 4; - lMaxX1 = lMinX1 + 1; - lMinX2 = 1; - lMaxX2 = lMinX2 + 3; - getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, true); - getLocalMinMax(dummy, dummy, lMinX3, dummy, dummy, dummy); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); - - getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, true); - getLocalMinMax(dummy, dummy, dummy, dummy, dummy, lMaxX3); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv); - - break; - - case NW: - lMinX1 = 1; - lMaxX1 = lMinX1 + 3; - lMinX2 = maxX2 - 4; - lMaxX2 = lMinX2 + 1; - getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, true); - getLocalMinMax(dummy, dummy, lMinX3, dummy, dummy, dummy); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); - - getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, true); - getLocalMinMax(dummy, dummy, dummy, dummy, dummy, lMaxX3); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv); - - lMinX1 = 3; - lMaxX1 = lMinX1 + 1; - lMinX2 = maxX2 - 4; - lMaxX2 = lMinX2 + 3; - getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, true); - getLocalMinMax(dummy, dummy, lMinX3, dummy, dummy, dummy); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); - - getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, true); - getLocalMinMax(dummy, dummy, dummy, dummy, dummy, lMaxX3); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv); - - break; - // /////T-B-E-W - case TE: - lMinX1 = maxX1 - 4; - lMaxX1 = lMinX1 + 3; - lMinX3 = maxX3 - 4; - lMaxX3 = lMinX3 + 1; - getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, true); - getLocalMinMax(dummy, lMinX2, dummy, dummy, dummy, dummy); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); - - getLocalMinMax(minX2, maxX2, false, lMinX2, lMaxX2, true); - getLocalMinMax(dummy, dummy, dummy, dummy, lMaxX2, dummy); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv); - - lMinX1 = maxX1 - 4; - lMaxX1 = lMinX1 + 1; - lMinX3 = maxX3 - 4; - lMaxX3 = lMinX3 + 3; - getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, true); - getLocalMinMax(dummy, lMinX2, dummy, dummy, dummy, dummy); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); - - getLocalMinMax(minX2, maxX2, false, lMinX2, lMaxX2, true); - getLocalMinMax(dummy, dummy, dummy, dummy, lMaxX2, dummy); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv); - - break; - - case BW: - lMinX1 = 1; - lMaxX1 = lMinX1 + 3; - lMinX3 = 3; - lMaxX3 = lMinX3 + 1; - getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, true); - getLocalMinMax(dummy, lMinX2, dummy, dummy, dummy, dummy); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); - - getLocalMinMax(minX2, maxX2, false, lMinX2, lMaxX2, true); - getLocalMinMax(dummy, dummy, dummy, dummy, lMaxX2, dummy); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv); - - lMinX1 = 3; - lMaxX1 = lMinX1 + 1; - lMinX3 = 1; - lMaxX3 = lMinX3 + 3; - getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, true); - getLocalMinMax(dummy, lMinX2, dummy, dummy, dummy, dummy); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); - - getLocalMinMax(minX2, maxX2, false, lMinX2, lMaxX2, true); - getLocalMinMax(dummy, dummy, dummy, dummy, lMaxX2, dummy); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv); - - break; - - case BE: - lMinX1 = maxX1 - 4; - lMaxX1 = lMinX1 + 3; - lMinX3 = 3; - lMaxX3 = lMinX3 + 1; - getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, true); - getLocalMinMax(dummy, lMinX2, dummy, dummy, dummy, dummy); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); - - getLocalMinMax(minX2, maxX2, false, lMinX2, lMaxX2, true); - getLocalMinMax(dummy, dummy, dummy, dummy, lMaxX2, dummy); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv); - - lMinX1 = maxX1 - 4; - lMaxX1 = lMinX1 + 1; - lMinX3 = 1; - lMaxX3 = lMinX3 + 3; - getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, true); - getLocalMinMax(dummy, lMinX2, dummy, dummy, dummy, dummy); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); - - getLocalMinMax(minX2, maxX2, false, lMinX2, lMaxX2, true); - getLocalMinMax(dummy, dummy, dummy, dummy, lMaxX2, dummy); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv); - - break; - - case TW: - lMinX1 = 1; - lMaxX1 = lMinX1 + 3; - lMinX3 = maxX3 - 4; - lMaxX3 = lMinX3 + 1; - getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, true); - getLocalMinMax(dummy, lMinX2, dummy, dummy, dummy, dummy); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); - - getLocalMinMax(minX2, maxX2, false, lMinX2, lMaxX2, true); - getLocalMinMax(dummy, dummy, dummy, dummy, lMaxX2, dummy); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv); - - lMinX1 = 3; - lMaxX1 = lMinX1 + 1; - lMinX3 = maxX3 - 4; - lMaxX3 = lMinX3 + 3; - getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, true); - getLocalMinMax(dummy, lMinX2, dummy, dummy, dummy, dummy); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); - - getLocalMinMax(minX2, maxX2, false, lMinX2, lMaxX2, true); - getLocalMinMax(dummy, dummy, dummy, dummy, lMaxX2, dummy); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv); - - break; - - /////////////////////////T-N-B-S - case TN: - lMinX2 = maxX2 - 4; - lMaxX2 = lMinX2 + 3; - lMinX3 = maxX3 - 4; - lMaxX3 = lMinX3 + 1; - getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, true); - getLocalMinMax(lMinX1, dummy, dummy, dummy, dummy, dummy); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); - - getLocalMinMax(minX1, maxX1, false, lMinX1, lMaxX1, true); - getLocalMinMax(dummy, dummy, dummy, lMaxX1, dummy, dummy); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv); - - lMinX2 = maxX2 - 4; - lMaxX2 = lMinX2 + 1; - lMinX3 = maxX3 - 4; - lMaxX3 = lMinX3 + 3; - getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, true); - getLocalMinMax(lMinX1, dummy, dummy, dummy, dummy, dummy); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); - - getLocalMinMax(minX1, maxX1, false, lMinX1, lMaxX1, true); - getLocalMinMax(dummy, dummy, dummy, lMaxX1, dummy, dummy); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv); - - break; - - case BS: - lMinX2 = 1; - lMaxX2 = lMinX2 + 3; - lMinX3 = 3; - lMaxX3 = lMinX3 + 1; - getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, true); - getLocalMinMax(lMinX1, dummy, dummy, dummy, dummy, dummy); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); - - getLocalMinMax(minX1, maxX1, false, lMinX1, lMaxX1, true); - getLocalMinMax(dummy, dummy, dummy, lMaxX1, dummy, dummy); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv); - - lMinX2 = 3; - lMaxX2 = lMinX2 + 1; - lMinX3 = 1; - lMaxX3 = lMinX3 + 3; - getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, true); - getLocalMinMax(lMinX1, dummy, dummy, dummy, dummy, dummy); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); - - getLocalMinMax(minX1, maxX1, false, lMinX1, lMaxX1, true); - getLocalMinMax(dummy, dummy, dummy, lMaxX1, dummy, dummy); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv); - - break; - - - case BN: - lMinX2 = maxX2 - 4; - lMaxX2 = lMinX2 + 3; - lMinX3 = 3; - lMaxX3 = lMinX3 + 1; - getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, true); - getLocalMinMax(lMinX1, dummy, dummy, dummy, dummy, dummy); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); - - getLocalMinMax(minX1, maxX1, false, lMinX1, lMaxX1, true); - getLocalMinMax(dummy, dummy, dummy, lMaxX1, dummy, dummy); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv); - - lMinX2 = maxX2 - 4; - lMaxX2 = lMinX2 + 1; - lMinX3 = 1; - lMaxX3 = lMinX3 + 3; - getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, true); - getLocalMinMax(lMinX1, dummy, dummy, dummy, dummy, dummy); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); - - getLocalMinMax(minX1, maxX1, false, lMinX1, lMaxX1, true); - getLocalMinMax(dummy, dummy, dummy, lMaxX1, dummy, dummy); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv); - - break; - - case TS: - lMinX2 = 1; - lMaxX2 = lMinX2 + 3; - lMinX3 = maxX3 - 4; - lMaxX3 = lMinX3 + 1; - getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, true); - getLocalMinMax(lMinX1, dummy, dummy, dummy, dummy, dummy); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); - - getLocalMinMax(minX1, maxX1, false, lMinX1, lMaxX1, true); - getLocalMinMax(dummy, dummy, dummy, lMaxX1, dummy, dummy); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv); - - lMinX2 = 3; - lMaxX2 = lMinX2 + 1; - lMinX3 = maxX3 - 4; - lMaxX3 = lMinX3 + 3; - getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, true); - getLocalMinMax(lMinX1, dummy, dummy, dummy, dummy, dummy); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); - - getLocalMinMax(minX1, maxX1, false, lMinX1, lMaxX1, true); - getLocalMinMax(dummy, dummy, dummy, lMaxX1, dummy, dummy); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv); - - break; - - //TNE - case TNE: - lMinX1 = maxX1 - 4; - lMaxX1 = maxX1 - 3; - lMinX2 = maxX2 - 4; - lMaxX2 = maxX2 - 1; - lMinX3 = maxX3 - 4; - lMaxX3 = maxX3 - 1; - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); - - lMinX1 = maxX1 - 4; - lMaxX1 = maxX1 - 1; - lMinX2 = maxX2 - 4; - lMaxX2 = maxX2 - 3; - lMinX3 = maxX3 - 4; - lMaxX3 = maxX3 - 1; - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); - - lMinX1 = maxX1 - 4; - lMaxX1 = maxX1 - 1; - lMinX2 = maxX2 - 4; - lMaxX2 = maxX2 - 1; - lMinX3 = maxX3 - 4; - lMaxX3 = maxX3 - 3; - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); - - break; - // TNW - case TNW: - lMinX1 = 3; - lMaxX1 = 4; - lMinX2 = maxX2 - 4; - lMaxX2 = maxX2 - 1; - lMinX3 = maxX3 - 4; - lMaxX3 = maxX3 - 1; - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); - - lMinX1 = 1; - lMaxX1 = 4; - lMinX2 = maxX2 - 4; - lMaxX2 = maxX2 - 3; - lMinX3 = maxX3 - 4; - lMaxX3 = maxX3 - 1; - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); - - lMinX1 = 1; - lMaxX1 = 4; - lMinX2 = maxX2 - 4; - lMaxX2 = maxX2 - 1; - lMinX3 = maxX3 - 4; - lMaxX3 = maxX3 - 3; - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); - - break; - // TSE - case TSE: - lMinX1 = maxX1 - 4; - lMaxX1 = maxX1 - 3; - lMinX2 = 1; - lMaxX2 = 4; - lMinX3 = maxX3 - 4; - lMaxX3 = maxX3 - 1; - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); - - lMinX1 = maxX1 - 4; - lMaxX1 = maxX1 - 1; - lMinX2 = 3; - lMaxX2 = 4; - lMinX3 = maxX3 - 4; - lMaxX3 = maxX3 - 1; - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); - - lMinX1 = maxX1 - 4; - lMaxX1 = maxX1 - 1; - lMinX2 = 1; - lMaxX2 = 4; - lMinX3 = maxX3 - 4; - lMaxX3 = maxX3 - 3; - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); - break; - // TSW - case TSW: - lMinX1 = 3; - lMaxX1 = 4; - lMinX2 = 1; - lMaxX2 = 4; - lMinX3 = maxX3 - 4; - lMaxX3 = maxX3 - 1; - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); - - lMinX1 = 1; - lMaxX1 = 4; - lMinX2 = 3; - lMaxX2 = 4; - lMinX3 = maxX3 - 4; - lMaxX3 = maxX3 - 1; - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); - - lMinX1 = 1; - lMaxX1 = 4; - lMinX2 = 1; - lMaxX2 = 4; - lMinX3 = maxX3 - 4; - lMaxX3 = maxX3 - 3; - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); - break; - // BNE - case BNE: - lMinX1 = maxX1 - 4; - lMaxX1 = maxX1 - 3; - lMinX2 = maxX2 - 4; - lMaxX2 = maxX2 - 1; - lMinX3 = 1; - lMaxX3 = 4; - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); - - lMinX1 = maxX1 - 4; - lMaxX1 = maxX1 - 1; - lMinX2 = maxX2 - 4; - lMaxX2 = maxX2 - 3; - lMinX3 = 1; - lMaxX3 = 4; - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); - - lMinX1 = maxX1 - 4; - lMaxX1 = maxX1 - 1; - lMinX2 = maxX2 - 4; - lMaxX2 = maxX2 - 1; - lMinX3 = 3; - lMaxX3 = 4; - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); - - break; - // BNW - case BNW: - lMinX1 = 3; - lMaxX1 = 4; - lMinX2 = maxX2 - 4; - lMaxX2 = maxX2 - 1; - lMinX3 = 1; - lMaxX3 = 4; - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); - - lMinX1 = 1; - lMaxX1 = 4; - lMinX2 = maxX2 - 4; - lMaxX2 = maxX2 - 3; - lMinX3 = 1; - lMaxX3 = 4; - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); - - lMinX1 = 1; - lMaxX1 = 4; - lMinX2 = maxX2 - 4; - lMaxX2 = maxX2 - 1; - lMinX3 = 3; - lMaxX3 = 4; - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); - break; - // BSE - case BSE: - lMinX1 = maxX1 - 4; - lMaxX1 = maxX1 - 3; - lMinX2 = 1; - lMaxX2 = 4; - lMinX3 = 1; - lMaxX3 = 4; - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); - - lMinX1 = maxX1 - 4; - lMaxX1 = maxX1 - 1; - lMinX2 = 3; - lMaxX2 = 4; - lMinX3 = 1; - lMaxX3 = 4; - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); - - lMinX1 = maxX1 - 4; - lMaxX1 = maxX1 - 1; - lMinX2 = 1; - lMaxX2 = 4; - lMinX3 = 3; - lMaxX3 = 4; - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); - break; - // BSW - case BSW: - lMinX1 = 3; - lMaxX1 = 4; - lMinX2 = 1; - lMaxX2 = 4; - lMinX3 = 1; - lMaxX3 = 4; - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); - - lMinX1 = 1; - lMaxX1 = 4; - lMinX2 = 3; - lMaxX2 = 4; - lMinX3 = 1; - lMaxX3 = 4; - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); - - lMinX1 = 1; - lMaxX1 = 4; - lMinX2 = 1; - lMaxX2 = 4; - lMinX3 = 3; - lMaxX3 = 4; - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); - - break; - } -} -////////////////////////////////////////////////////////////////////////// -template< typename VectorTransmitter > -void D3Q27ETCFOffVectorConnector< VectorTransmitter>::distributeReceiveVector(DistributionArray3DPtr fTo, const int& lMinX1, const int& lMinX2, const int& lMinX3, const int& lMaxX1, const int& lMaxX2, const int& lMaxX3, vector_type& data, int& index) -{ - if (data.size() == 0) return; - - int ix1, ix2, ix3; - for (ix3 = lMinX3; ix3 < lMaxX3; ix3++) - { - for (ix2 = lMinX2; ix2 < lMaxX2; ix2++) - { - for (ix1 = lMinX1; ix1 < lMaxX1; ix1++) - { - LBMReal icellC[27]; - this->readICellCfromData(data, index, icellC); - iprocessor->writeINodeInv(fTo, icellC, ix1, ix2, ix3); - } - } - } -} -////////////////////////////////////////////////////////////////////////// -template< typename VectorTransmitter > -void D3Q27ETCFOffVectorConnector< VectorTransmitter>::readICellCfromData(vector_type& data, int& index, LBMReal* icellC) -{ - for (int i = D3Q27System::STARTF; i < D3Q27System::ENDF + 1; i++) - { - icellC[i] = data[index++]; - } -} -////////////////////////////////////////////////////////////////////////// -template< typename VectorTransmitter > -void D3Q27ETCFOffVectorConnector< VectorTransmitter>::getLocalMinMax(int& minX1, int& minX2, int& minX3, int& maxX1, int& maxX2, int& maxX3) -{ - using namespace D3Q27System; - int TminX1 = minX1; int TminX2 = minX2; int TminX3 = minX3; int TmaxX1 = maxX1; int TmaxX2 = maxX2; int TmaxX3 = maxX3; - - if (block.lock()->hasInterpolationFlagCF(E)) - { - if (maxX1 == TmaxX1) maxX1 -= 2; - } - if (block.lock()->hasInterpolationFlagCF(W)) - { - if (minX1 == TminX1) minX1 += 2; - } - if (block.lock()->hasInterpolationFlagCF(N)) - { - if (maxX2 == TmaxX2) maxX2 -= 2; - } - if (block.lock()->hasInterpolationFlagCF(S)) - { - if (minX2 == TminX2) minX2 += 2; - } - if (block.lock()->hasInterpolationFlagCF(T)) - { - if (maxX3 == TmaxX3) maxX3 -= 2; - } - if (block.lock()->hasInterpolationFlagCF(B)) - { - if (minX3 == TminX3) minX3 += 2; - } - - //E-W-N-S - if (block.lock()->hasInterpolationFlagCF(NE) && !block.lock()->hasInterpolationFlagCF(N) && !block.lock()->hasInterpolationFlagCF(E)) - { - if (maxX1 == TmaxX1) maxX1 -= 2; - if (maxX2 == TmaxX2) maxX2 -= 2; - } - if (block.lock()->hasInterpolationFlagCF(SW) && !block.lock()->hasInterpolationFlagCF(W) && !block.lock()->hasInterpolationFlagCF(S)) - { - if (minX1 == TminX1) minX1 += 2; - if (minX2 == TminX2) minX2 += 2; - } - if (block.lock()->hasInterpolationFlagCF(SE) && !block.lock()->hasInterpolationFlagCF(E) && !block.lock()->hasInterpolationFlagCF(S)) - { - if (maxX1 == TmaxX1) maxX1 -= 2; - if (minX2 == TminX2) minX2 += 2; - } - if (block.lock()->hasInterpolationFlagCF(NW) && !block.lock()->hasInterpolationFlagCF(N) && !block.lock()->hasInterpolationFlagCF(W)) - { - if (minX1 == TminX1) minX1 += 2; - if (maxX2 == TmaxX2) maxX2 -= 2; - } - - // ////T-B-E-W - if (block.lock()->hasInterpolationFlagCF(TE) && !block.lock()->hasInterpolationFlagCF(E) && !block.lock()->hasInterpolationFlagCF(T)) - { - if (maxX1 == TmaxX1) maxX1 -= 2; - if (maxX3 == TmaxX3) maxX3 -= 2; - } - if (block.lock()->hasInterpolationFlagCF(BW) && !block.lock()->hasInterpolationFlagCF(W) && !block.lock()->hasInterpolationFlagCF(B)) - { - if (minX1 == TminX1) minX1 += 2; - if (minX3 == TminX3) minX3 += 2; - } - if (block.lock()->hasInterpolationFlagCF(BE) && !block.lock()->hasInterpolationFlagCF(E) && !block.lock()->hasInterpolationFlagCF(B)) - { - if (maxX1 == TmaxX1) maxX1 -= 2; - if (minX3 == TminX3) minX3 += 2; - } - if (block.lock()->hasInterpolationFlagCF(TW) && !block.lock()->hasInterpolationFlagCF(W) && !block.lock()->hasInterpolationFlagCF(T)) - { - if (minX1 == TminX1) minX1 += 2; - if (maxX3 == TmaxX3) maxX3 -= 2; - } - - - ////T-B-N-S - if (block.lock()->hasInterpolationFlagCF(TN) && !block.lock()->hasInterpolationFlagCF(N) && !block.lock()->hasInterpolationFlagCF(T)) - { - if (maxX2 == TmaxX2) maxX2 -= 2; - if (maxX3 == TmaxX3) maxX3 -= 2; - } - if (block.lock()->hasInterpolationFlagCF(BS) && !block.lock()->hasInterpolationFlagCF(S) && !block.lock()->hasInterpolationFlagCF(B)) - { - if (minX2 == TminX2) minX2 += 2; - if (minX3 == TminX3) minX3 += 2; - } - if (block.lock()->hasInterpolationFlagCF(BN) && !block.lock()->hasInterpolationFlagCF(N) && !block.lock()->hasInterpolationFlagCF(B)) - { - if (maxX2 == TmaxX2) maxX2 -= 2; - if (minX3 == TminX3) minX3 += 2; - } - if (block.lock()->hasInterpolationFlagCF(TS) && !block.lock()->hasInterpolationFlagCF(S) && !block.lock()->hasInterpolationFlagCF(T)) - { - if (minX2 == TminX2) minX2 += 2; - if (maxX3 == TmaxX3) maxX3 -= 2; - } - - //if (block.lock()->hasInterpolationFlagCF(D3Q27System::TNE)&&!block.lock()->hasInterpolationFlagCF(D3Q27System::TE)&&!block.lock()->hasInterpolationFlagCF(D3Q27System::TN)&&!block.lock()->hasInterpolationFlagCF(D3Q27System::NE)&&!block.lock()->hasInterpolationFlagCF(D3Q27System::T)&&!block.lock()->hasInterpolationFlagCF(D3Q27System::N) && !block.lock()->hasInterpolationFlagCF(D3Q27System::E)) - //if (!block.lock()->hasInterpolationFlagCF(D3Q27System::TE)&&!block.lock()->hasInterpolationFlagCF(D3Q27System::T)&& !block.lock()->hasInterpolationFlagCF(D3Q27System::E)) - //{ - // if (maxX1==TmaxX1) maxX1 -= 2; - // if (maxX2==TmaxX2) maxX2 -= 2; - // if (maxX3==TmaxX3) maxX3 -= 2; - //} -} -////////////////////////////////////////////////////////////////////////// -template< typename VectorTransmitter > -void D3Q27ETCFOffVectorConnector< VectorTransmitter>::getLocalMinMax(int& minX1, int& minX2, int& minX3, int& maxX1, int& maxX2, int& maxX3, CFconnectorType connType) -{ - using namespace D3Q27System; - int TminX1 = minX1; int TminX2 = minX2; int TminX3 = minX3; int TmaxX1 = maxX1; int TmaxX2 = maxX2; int TmaxX3 = maxX3; - - if (block.lock()->hasInterpolationFlagCF(E)) - { - if (maxX1 == TmaxX1) maxX1 -= 2; - } - if (block.lock()->hasInterpolationFlagCF(W)) - { - if (minX1 == TminX1) minX1 += 2; - } - if (block.lock()->hasInterpolationFlagCF(N)) - { - if (maxX2 == TmaxX2) maxX2 -= 2; - } - if (block.lock()->hasInterpolationFlagCF(S)) - { - if (minX2 == TminX2) minX2 += 2; - } - if (block.lock()->hasInterpolationFlagCF(T)) - { - if (maxX3 == TmaxX3) maxX3 -= 2; - } - if (block.lock()->hasInterpolationFlagCF(B)) - { - if (minX3 == TminX3) minX3 += 2; - } - - //E-W-N-S - if (block.lock()->hasInterpolationFlagCF(NE) && !block.lock()->hasInterpolationFlagCF(N) && !block.lock()->hasInterpolationFlagCF(E)) - { - if (maxX1 == TmaxX1) maxX1 -= 2; - if (maxX2 == TmaxX2) maxX2 -= 2; - } - if (block.lock()->hasInterpolationFlagCF(SW) && !block.lock()->hasInterpolationFlagCF(W) && !block.lock()->hasInterpolationFlagCF(S)) - { - if (minX1 == TminX1) minX1 += 2; - if (minX2 == TminX2) minX2 += 2; - } - if (block.lock()->hasInterpolationFlagCF(SE) && !block.lock()->hasInterpolationFlagCF(E) && !block.lock()->hasInterpolationFlagCF(S)) - { - if (maxX1 == TmaxX1) maxX1 -= 2; - if (minX2 == TminX2) minX2 += 2; - } - if (block.lock()->hasInterpolationFlagCF(NW) && !block.lock()->hasInterpolationFlagCF(N) && !block.lock()->hasInterpolationFlagCF(W)) - { - if (minX1 == TminX1) minX1 += 2; - if (maxX2 == TmaxX2) maxX2 -= 2; - } - - // ////T-B-E-W - if (block.lock()->hasInterpolationFlagCF(TE) && !block.lock()->hasInterpolationFlagCF(E) && !block.lock()->hasInterpolationFlagCF(T)) - { - if (maxX1 == TmaxX1) maxX1 -= 2; - if (maxX3 == TmaxX3) maxX3 -= 2; - } - if (block.lock()->hasInterpolationFlagCF(BW) && !block.lock()->hasInterpolationFlagCF(W) && !block.lock()->hasInterpolationFlagCF(B)) - { - if (minX1 == TminX1) minX1 += 2; - if (minX3 == TminX3) minX3 += 2; - } - if (block.lock()->hasInterpolationFlagCF(BE) && !block.lock()->hasInterpolationFlagCF(E) && !block.lock()->hasInterpolationFlagCF(B)) - { - if (maxX1 == TmaxX1) maxX1 -= 2; - if (minX3 == TminX3) minX3 += 2; - } - if (block.lock()->hasInterpolationFlagCF(TW) && !block.lock()->hasInterpolationFlagCF(W) && !block.lock()->hasInterpolationFlagCF(T)) - { - if (minX1 == TminX1) minX1 += 2; - if (maxX3 == TmaxX3) maxX3 -= 2; - } - - - ////T-B-N-S - if (block.lock()->hasInterpolationFlagCF(TN) && !block.lock()->hasInterpolationFlagCF(N) && !block.lock()->hasInterpolationFlagCF(T)) - { - if (maxX2 == TmaxX2) maxX2 -= 2; - if (maxX3 == TmaxX3) maxX3 -= 2; - } - if (block.lock()->hasInterpolationFlagCF(BS) && !block.lock()->hasInterpolationFlagCF(S) && !block.lock()->hasInterpolationFlagCF(B)) - { - if (minX2 == TminX2) minX2 += 2; - if (minX3 == TminX3) minX3 += 2; - } - if (block.lock()->hasInterpolationFlagCF(BN) && !block.lock()->hasInterpolationFlagCF(N) && !block.lock()->hasInterpolationFlagCF(B)) - { - if (maxX2 == TmaxX2) maxX2 -= 2; - if (minX3 == TminX3) minX3 += 2; - } - if (block.lock()->hasInterpolationFlagCF(TS) && !block.lock()->hasInterpolationFlagCF(S) && !block.lock()->hasInterpolationFlagCF(T)) - { - if (minX2 == TminX2) minX2 += 2; - if (maxX3 == TmaxX3) maxX3 -= 2; - } - - //if (block.lock()->hasInterpolationFlagCF(D3Q27System::TNE)&&!block.lock()->hasInterpolationFlagCF(D3Q27System::TE)&&!block.lock()->hasInterpolationFlagCF(D3Q27System::TN)&&!block.lock()->hasInterpolationFlagCF(D3Q27System::NE)&&!block.lock()->hasInterpolationFlagCF(D3Q27System::T)&&!block.lock()->hasInterpolationFlagCF(D3Q27System::N) && !block.lock()->hasInterpolationFlagCF(D3Q27System::E)) - //{ - // if (maxX1==TmaxX1) maxX1 -= 2; - // if (maxX2==TmaxX2) maxX2 -= 2; - // if (maxX3==TmaxX3) maxX3 -= 2; - //} -} -////////////////////////////////////////////////////////////////////////// -template< typename VectorTransmitter > -void D3Q27ETCFOffVectorConnector< VectorTransmitter>::findCFnodes() -{ - DistributionArray3DPtr fFrom = block.lock()->getKernel()->getDataSet()->getFdistributions(); - int maxX1 = (int)fFrom->getNX1(); - int maxX2 = (int)fFrom->getNX2(); - int maxX3 = (int)fFrom->getNX3(); - int minX1 = 0; - int minX2 = 0; - int minX3 = 0; - - int indexEvEv = 0; - int indexEvOd = 0; - int indexOdEv = 0; - int indexOdOd = 0; - - vector_type& dataEvEv = this->senderEvenEvenSW->getData(); - vector_type& dataEvOd = this->senderEvenOddNW->getData(); - vector_type& dataOdEv = this->senderOddEvenSE->getData(); - vector_type& dataOdOd = this->senderOddOddNE->getData(); - - int lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3; - - using namespace D3Q27System; - if (block.lock()->hasInterpolationFlagCF(W)) - { - lMinX1 = 1; - lMaxX1 = lMinX1 + 1; - - getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, false); - getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, false); - findCFnodes(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); - - getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, false); - getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, false); - findCFnodes(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvOd, indexEvOd); - - getLocalMinMax(minX2, maxX2, false, lMinX2, lMaxX2, false); - getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, false); - findCFnodes(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv); - - getLocalMinMax(minX2, maxX2, false, lMinX2, lMaxX2, false); - getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, false); - findCFnodes(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdOd, indexOdOd); - } - if (block.lock()->hasInterpolationFlagCF(TN) && !block.lock()->hasInterpolationFlagCF(N) && !block.lock()->hasInterpolationFlagCF(T)) - { - lMinX2 = maxX2 - 3; - lMaxX2 = lMinX2 + 1; - lMinX3 = maxX3 - 3; - lMaxX3 = lMinX3 + 1; - - getLocalMinMax(minX1 + 1, maxX1, true, lMinX1, lMaxX1, false); - findCFnodes(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv); - - getLocalMinMax(minX1 + 1, maxX1, false, lMinX1, lMaxX1, false); - findCFnodes(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv); - } -} -////////////////////////////////////////////////////////////////////////// -template< typename VectorTransmitter > -void D3Q27ETCFOffVectorConnector< VectorTransmitter>::findCFnodes(DistributionArray3DPtr fFrom, const int& lMinX1, const int& lMinX2, const int& lMinX3, const int& lMaxX1, const int& lMaxX2, const int& lMaxX3, vector_type& data, int& index) -{ - if (data.size() == 0) return; - int ix1, ix2, ix3; - LBMReal xoff, yoff, zoff; - BCArray3DPtr bcArray = block.lock()->getKernel()->getBCProcessor()->getBCArray(); - - for (ix3 = lMinX3; ix3 < lMaxX3; ix3++) - { - for (ix2 = lMinX2; ix2 < lMaxX2; ix2++) - { - for (ix1 = lMinX1; ix1 < lMaxX1; ix1++) - { - D3Q27ICell icellC; - D3Q27ICell icellF; - - int howManySolids = iprocessor->iCellHowManySolids(bcArray, ix1, ix2, ix3); - - if (howManySolids == 0 || howManySolids == 8) - { - iprocessor->readICell(fFrom, icellC, ix1, ix2, ix3); - xoff = 0.0; - yoff = 0.0; - zoff = 0.0; - } - else - { - if (!iprocessor->findNeighborICell(bcArray, fFrom, icellC, bMaxX1, bMaxX2, bMaxX3, ix1, ix2, ix3, xoff, yoff, zoff)) - { - std::string err = "For " + block.lock()->toString() + " x1=" + UbSystem::toString(ix1) + ", x2=" + UbSystem::toString(ix2) + ", x3=" + UbSystem::toString(ix3) + - " interpolation is not implemented for other direction" + - " by using in: " + (std::string)typeid(*this).name() + - " or maybe you have a solid on the block boundary"; - //UBLOG(logINFO, err); - UB_THROW(UbException(UB_EXARGS, err)); - } - } - - iprocessor->interpolateCoarseToFine(icellC, icellF, xoff, yoff, zoff); - this->writeICellFtoData(data, index, icellF); - //for (int iix3 = ix3; iix3<=ix3+1; iix3++) - //{ - // for (int iix2 = ix2; iix2<=ix2+1; iix2++) - // { - // for (int iix1 = ix1; iix1<=ix1+1; iix1++) - // { - // bcArray->setInterfaceCF(iix1, iix2, iix3); - // } - // } - //} - - } - } - } -} -////////////////////////////////////////////////////////////////////////// -template< typename VectorTransmitter > -double D3Q27ETCFOffVectorConnector<VectorTransmitter>::getSendRecieveTime() -{ - return 0; -} - -#endif diff --git a/src/VirtualFluids/Connectors/D3Q27ETFCOffVectorConnector.cpp b/src/VirtualFluids/Connectors/D3Q27ETFCOffVectorConnector.cpp deleted file mode 100644 index f745d7597..000000000 --- a/src/VirtualFluids/Connectors/D3Q27ETFCOffVectorConnector.cpp +++ /dev/null @@ -1,3 +0,0 @@ -#include "D3Q27ETFCOffVectorConnector.h" - - diff --git a/src/VirtualFluids/Connectors/D3Q27ETFCOffVectorConnector.h b/src/VirtualFluids/Connectors/D3Q27ETFCOffVectorConnector.h deleted file mode 100644 index 18805b684..000000000 --- a/src/VirtualFluids/Connectors/D3Q27ETFCOffVectorConnector.h +++ /dev/null @@ -1,1437 +0,0 @@ -/** -* @file D3Q27ETFCOffVectorConnector.h -* @class D3Q27ETFCVectorConnector -* @brief Interpolation from fine level to coarse. -* @author Kostyantyn Kucher and Ehsan Fard -* @date 08.06.2011 -*/ -#ifndef D3Q27ETFCOffVectorConnector_H -#define D3Q27ETFCOffVectorConnector_H - -#include <vector> - -#include "basics/transmitter/TbTransmitter.h" -#include "Block3DConnector.h" -#include "D3Q27System.h" -#include "Block3D.h" -#include "Grid3D.h" -#include "LBMKernel.h" -#include "InterpolationProcessor.h" -#include "MathUtil.hpp" -#include <memory> - -#include "BCProcessor.h" -#include "DataSet3D.h" - -class Block3D; - -enum CFconnectorType {EvenOddNW, EvenEvenSW, OddEvenSE, OddOddNE}; - -//daten werden in einen vector (dieser befindet sich im transmitter) kopiert -//der vector wird via transmitter uebertragen -//transmitter kann ein lokal, MPI, RCG, CTL oder was auch immer fuer ein -//transmitter sein, der von Transmitter abgeleitet ist ;-) - -template< typename VectorTransmitter > -class D3Q27ETFCOffVectorConnector : public Block3DConnector -{ -public: - -protected: - typedef typename VectorTransmitter::value_type vector_type; - typedef std::shared_ptr< VectorTransmitter > VectorTransmitterPtr; -public: - D3Q27ETFCOffVectorConnector(Block3DPtr block, VectorTransmitterPtr sender, VectorTransmitterPtr receiver, int sendDir, - InterpolationProcessorPtr iprocessor, CFconnectorType connType); - - bool isLocalConnector(); - bool isRemoteConnector(); - void init(); - - void sendTransmitterDataSize(); - void receiveTransmitterDataSize(); - - void prepareForSend(); - void sendVectors(); - - void prepareForReceive(); - void receiveVectors(); - - void fillSendVectors(); - void distributeReceiveVectors(); - - bool isInterpolationConnectorCF() { return false; } - bool isInterpolationConnectorFC() { return true; } - - double getSendRecieveTime(); - - void prepareForSendX1() {} - void prepareForSendX2() {} - void prepareForSendX3() {} - - void sendVectorsX1(){} - void sendVectorsX2(){} - void sendVectorsX3(){} - - void prepareForReceiveX1() {} - void prepareForReceiveX2() {} - void prepareForReceiveX3() {} - - void receiveVectorsX1() {} - void receiveVectorsX2() {} - void receiveVectorsX3() {} - -protected: - std::weak_ptr<Block3D> block; //dieser nvd sendet daten und die empfangenen werden diesem nvd zugeordnet - //gegenstelle muss "inversen" connector besitzen - VectorTransmitterPtr sender, receiver; - - InterpolationProcessorPtr iprocessor; - - CFconnectorType connType; - - void writeICellCtoData(vector_type& data, int& index, LBMReal* icellC); - void writeNodeToVector(vector_type& data, int& index, LBMReal* inode); - void getLocalMinMax(int& minX1, int& minX2, int& minX3, int& maxX1, int& maxX2, int& maxX3); - void getLocalMinMax(int& minX1, int& minX2, int& minX3, int& maxX1, int& maxX2, int& maxX3, CFconnectorType connType); - void getLocalMinMaxCF(int gMax, int& lMin, int& lMax); - void fillSendVector(DistributionArray3DPtr fFrom, const int& lMinX1, const int& lMinX2, const int& lMinX3, const int& lMaxX1, const int& lMaxX2, const int& lMaxX3, vector_type& data, int& index); - - void distributeReceiveVector(DistributionArray3DPtr fTo, const int& lMinX1, const int& lMinX2, const int& lMinX3, const int& lMaxX1, const int& lMaxX2, const int& lMaxX3, vector_type& data, int& index); - void readICellFfromData(vector_type& data, int& index, D3Q27ICell& icellF); - void readNodeFromVector(vector_type& data, int& index, LBMReal* inode); - void getLocalOffsets(const int& gMax, int& oMin); - void getLocalMins(int& minX1, int& minX2, int& minX3, const int& oMinX1, const int& oMinX2, const int& oMinX3); - - int bMaxX1, bMaxX2, bMaxX3; -}; -//////////////////////////////////////////////////////////////////////////// -template< typename VectorTransmitter > -D3Q27ETFCOffVectorConnector<VectorTransmitter>::D3Q27ETFCOffVectorConnector(Block3DPtr block, VectorTransmitterPtr sender, - VectorTransmitterPtr receiver, int sendDir, - InterpolationProcessorPtr iprocessor, - CFconnectorType connType) - : Block3DConnector(sendDir) - , block(block) - , sender(sender) - , receiver(receiver) - , iprocessor(iprocessor) - , connType(connType) -{ - if( !( sendDir==D3Q27System::E || sendDir==D3Q27System::W || sendDir==D3Q27System::N || sendDir==D3Q27System::S || sendDir==D3Q27System::T || sendDir==D3Q27System::B - || sendDir==D3Q27System::NE || sendDir==D3Q27System::SW || sendDir==D3Q27System::SE || sendDir==D3Q27System::NW - || sendDir==D3Q27System::TE || sendDir==D3Q27System::BW || sendDir==D3Q27System::BE || sendDir==D3Q27System::TW - || sendDir==D3Q27System::TN || sendDir==D3Q27System::BS || sendDir==D3Q27System::BN || sendDir==D3Q27System::TS - - || sendDir==D3Q27System::TNE || sendDir==D3Q27System::TNW || sendDir==D3Q27System::TSE || sendDir==D3Q27System::TSW - || sendDir==D3Q27System::BNE || sendDir==D3Q27System::BNW || sendDir==D3Q27System::BSE || sendDir==D3Q27System::BSW - - ) ) - { - throw UbException(UB_EXARGS,"invalid constructor for this direction"); - } -} -////////////////////////////////////////////////////////////////////////// -template< typename VectorTransmitter > -bool D3Q27ETFCOffVectorConnector<VectorTransmitter>::isLocalConnector() -{ - return !this->isRemoteConnector(); -} -////////////////////////////////////////////////////////////////////////// -template< typename VectorTransmitter > -bool D3Q27ETFCOffVectorConnector<VectorTransmitter>::isRemoteConnector() -{ - return sender->isRemoteTransmitter() || receiver->isRemoteTransmitter(); -} -////////////////////////////////////////////////////////////////////////// -template< typename VectorTransmitter > -void D3Q27ETFCOffVectorConnector<VectorTransmitter>::sendTransmitterDataSize() -{ - if(sender) - { - UBLOG(logDEBUG5, "D3Q27ETFCOffVectorConnector<VectorTransmitter>::sendTransmitterDataSize()"<<block.lock()->toString()+"sendDir="<<sendDir); - sender->sendDataSize(); - } -} -////////////////////////////////////////////////////////////////////////// -template< typename VectorTransmitter > -void D3Q27ETFCOffVectorConnector<VectorTransmitter>::receiveTransmitterDataSize() -{ - if(receiver) - { - UBLOG(logDEBUG5, "D3Q27ETFCOffVectorConnector<VectorTransmitter>::receiveTransmitterDataSize()"<<block.lock()->toString()<<"sendDir="<<sendDir); - receiver->receiveDataSize(); - } -} -////////////////////////////////////////////////////////////////////////// -template< typename VectorTransmitter > -void D3Q27ETFCOffVectorConnector<VectorTransmitter>::prepareForSend() -{ - if(sender) sender->prepareForSend(); -} -////////////////////////////////////////////////////////////////////////// -template< typename VectorTransmitter > -void D3Q27ETFCOffVectorConnector<VectorTransmitter>::sendVectors() -{ - if(sender) sender->sendData(); -} -////////////////////////////////////////////////////////////////////////// -template< typename VectorTransmitter > -void D3Q27ETFCOffVectorConnector<VectorTransmitter>::prepareForReceive() -{ - if(receiver) receiver->prepareForReceive(); -} -////////////////////////////////////////////////////////////////////////// -template< typename VectorTransmitter > -void D3Q27ETFCOffVectorConnector<VectorTransmitter>::receiveVectors() -{ - if(receiver) receiver->receiveData(); -} -////////////////////////////////////////////////////////////////////////// -template< typename VectorTransmitter > -void D3Q27ETFCOffVectorConnector<VectorTransmitter>::init() -{ - using namespace D3Q27System; - - bMaxX1 = (int)block.lock()->getKernel()->getDataSet()->getFdistributions()->getNX1(); - bMaxX2 = (int)block.lock()->getKernel()->getDataSet()->getFdistributions()->getNX2(); - bMaxX3 = (int)block.lock()->getKernel()->getDataSet()->getFdistributions()->getNX3(); - - int sendSize = 0; - LBMReal initValue = -999.0; - - int sendDataPerNode = 27/*f*/; - int iCellSize = 1; //size of interpolation cell - - switch(this->sendDir) - { - case E : case W : sendSize = (bMaxX2-1)/2*(bMaxX3-1)/2*sendDataPerNode*iCellSize; break; - case N : case S : sendSize = (bMaxX1-1)/2*(bMaxX3-1)/2*sendDataPerNode*iCellSize; break; - case T : case B : sendSize = (bMaxX1-1)/2*(bMaxX2-1)/2*sendDataPerNode*iCellSize; break; - case NE : case SW :case SE : case NW : sendSize = (3*bMaxX3-3)*sendDataPerNode*iCellSize; break; // buffer overhead, should be (3*bMaxX3-6) for even bMax3 - case TE : case BW :case BE : case TW : sendSize = (3*bMaxX2-3)*sendDataPerNode*iCellSize; break; - case TN : case BS :case BN : case TS : sendSize = (3*bMaxX1-3)*sendDataPerNode*iCellSize; break; - case TNE: case TNW:case TSE: case TSW:case BNE: case BNW:case BSE: case BSW: sendSize = 3*(3*bMaxX1-3)*sendDataPerNode*iCellSize; break; - default: throw UbException(UB_EXARGS,"direction not allowed in this constructor"); - } - sender->getData().resize(sendSize, initValue); -} -////////////////////////////////////////////////////////////////////////// -template< typename VectorTransmitter > -void D3Q27ETFCOffVectorConnector< VectorTransmitter>::fillSendVectors() -{ - using namespace D3Q27System; - - DistributionArray3DPtr fFrom = block.lock()->getKernel()->getDataSet()->getFdistributions(); - int maxX1 = (int)fFrom->getNX1(); - int maxX2 = (int)fFrom->getNX2(); - int maxX3 = (int)fFrom->getNX3(); - int minX1 = 0; - int minX2 = 0; - int minX3 = 0; - - int oMinX1, oMinX2, oMinX3; - getLocalOffsets(maxX1, oMinX1); - getLocalOffsets(maxX2, oMinX2); - getLocalOffsets(maxX3, oMinX3); - - int lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3; - int index = 0; - vector_type& data = sender->getData(); - - lMinX1 = minX1+1; lMinX2 = minX2+1; lMinX3 = minX3+1; - lMaxX1 = maxX1-2; lMaxX2 = maxX2-2; lMaxX3 = maxX3-2; - - /////////////////////////////////////// - ///DEBUG -#ifdef _DEBUG - if (block.lock()->getGlobalID() == 2558) - { - int test = 0; - } -#endif - ////////////// - - switch(sendDir) - { - case E: - getLocalMinMax(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3); - getLocalMins(lMinX1, lMinX2, lMinX3, oMinX1, oMinX2, oMinX3); - lMinX1 = maxX1-7; - lMaxX1 = lMinX1 + 1; - fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index); - break; - case W: - /////////////////////////////////////// - ///DEBUG -#ifdef _DEBUG - if (block.lock()->getGlobalID() == 2516) - { - int test = 0; - } -#endif - ////////////// - //getLocalMinMax(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, none); - getLocalMinMax(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3); - getLocalMins(lMinX1, lMinX2, lMinX3, oMinX1, oMinX2, oMinX3); - lMinX1 = 5; - lMaxX1 = lMinX1 + 1; - fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index); - break; - case N: - getLocalMinMax(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3); - getLocalMins(lMinX1, lMinX2, lMinX3, oMinX1, oMinX2, oMinX3); - lMinX2 = maxX2-7; - lMaxX2 = lMinX2 + 1; - fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index); - break; - case S: - getLocalMinMax(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3); - getLocalMins(lMinX1, lMinX2, lMinX3, oMinX1, oMinX2, oMinX3); - lMinX2 = 5; - lMaxX2 = lMinX2 + 1; - fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index); - break; - case T: - getLocalMinMax(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3); - getLocalMins(lMinX1, lMinX2, lMinX3, oMinX1, oMinX2, oMinX3); - lMinX3 = maxX3-7; - lMaxX3 = lMinX3 + 1; - fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index); - break; - case B: - getLocalMinMax(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3); - getLocalMins(lMinX1, lMinX2, lMinX3, oMinX1, oMinX2, oMinX3); - lMinX3 = 5; - lMaxX3 = lMinX3 + 1; - fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index); - break; - - // ////N-S-E-W - case NE: - getLocalMinMax(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3); - getLocalMins(lMinX1, lMinX2, lMinX3, oMinX1, oMinX2, oMinX3); - lMinX1 = maxX1-7; - lMaxX1 = lMinX1 +5; - lMinX2 = maxX2-7; - lMaxX2 = lMinX2 + 1; - fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index); - - lMinX1 = maxX1-7; - lMaxX1 = lMinX1 + 1; - lMinX2 = maxX2-7; - lMaxX2 = lMinX2 + 5; - fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index); - break; - case SW: - - getLocalMinMax(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3); - getLocalMins(lMinX1, lMinX2, lMinX3, oMinX1, oMinX2, oMinX3); - lMinX1 = 1; - lMaxX1 = lMinX1 + 5; - lMinX2 = 5; - lMaxX2 = lMinX2 + 1; - fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index); - - lMinX1 = 5; - lMaxX1 = lMinX1 + 1; - lMinX2 = 1; - lMaxX2 = lMinX2 + 5; - fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index); - break; - - case SE: - getLocalMinMax(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3); - getLocalMins(lMinX1, lMinX2, lMinX3, oMinX1, oMinX2, oMinX3); - lMinX1 = maxX1-7; - lMaxX1 = lMinX1 +5; - lMinX2 = 5; - lMaxX2 = lMinX2 + 1; - fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index); - - lMinX1 = maxX1-7; - lMaxX1 = lMinX1 + 1; - lMinX2 = 1; - lMaxX2 = lMinX2 + 5; - fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index); - - break; - - case NW: - getLocalMinMax(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3); - getLocalMins(lMinX1, lMinX2, lMinX3, oMinX1, oMinX2, oMinX3); - lMinX1 = 1; - lMaxX1 = lMinX1 + 5; - lMinX2 = maxX2-7; - lMaxX2 = lMinX2 + 1; - fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index); - - lMinX1 = 5; - lMaxX1 = lMinX1 + 1; - lMinX2 = maxX2-7; - lMaxX2 = lMinX2 + 5; - fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index); - break; -//////T-B-E-W - case TE: - getLocalMinMax(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3); - getLocalMins(lMinX1, lMinX2, lMinX3, oMinX1, oMinX2, oMinX3); - lMinX1 = maxX1-7; - lMaxX1 = lMinX1 +5; - lMinX3 = maxX3-7; - lMaxX3 = lMinX3 + 1; - fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index); - - lMinX1 = maxX1-7; - lMaxX1 = lMinX1 + 1; - lMinX3 = maxX3-7; - lMaxX3 = lMinX3 + 5; - fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index); - break; - - case BW: - getLocalMinMax(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3); - getLocalMins(lMinX1, lMinX2, lMinX3, oMinX1, oMinX2, oMinX3); - lMinX1 = 1; - lMaxX1 = lMinX1 + 5; - lMinX3 = 5; - lMaxX3 = lMinX3 + 1; - fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index); - - lMinX1 = 5; - lMaxX1 = lMinX1 + 1; - lMinX3 = 1; - lMaxX3 = lMinX3 + 5; - fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index); - break; - - case BE: - getLocalMinMax(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3); - getLocalMins(lMinX1, lMinX2, lMinX3, oMinX1, oMinX2, oMinX3); - lMinX1 = maxX1-7; - lMaxX1 = lMinX1 +5; - lMinX3 = 5; - lMaxX3 = lMinX3 + 1; - fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index); - - lMinX1 = maxX1-7; - lMaxX1 = lMinX1 + 1; - lMinX3 = 1; - lMaxX3 = lMinX3 + 5; - fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index); - break; - - case TW: - getLocalMinMax(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3); - getLocalMins(lMinX1, lMinX2, lMinX3, oMinX1, oMinX2, oMinX3); - lMinX1 = 1; - lMaxX1 = lMinX1 + 5; - lMinX3 = maxX3-7; - lMaxX3 = lMinX3 + 1; - fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index); - - lMinX1 = 5; - lMaxX1 = lMinX1 + 1; - lMinX3 = maxX3-7; - lMaxX3 = lMinX3 + 5; - fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index); - break; -///////////////T-B-N-S -// - case TN: - getLocalMinMax(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3); - getLocalMins(lMinX1, lMinX2, lMinX3, oMinX1, oMinX2, oMinX3); - lMinX2 = maxX2-7; - lMaxX2 = lMinX2 + 5; - lMinX3 = maxX3-7; - lMaxX3 = lMinX3 + 1; - fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index); - - lMinX2 = maxX2-7; - lMaxX2 = lMinX2 + 1; - lMinX3 = maxX3-7; - lMaxX3 = lMinX3 + 5; - fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index); - break; - - case BS: - getLocalMinMax(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3); - getLocalMins(lMinX1, lMinX2, lMinX3, oMinX1, oMinX2, oMinX3); - lMinX2 = 1; - lMaxX2 = lMinX2 + 5; - lMinX3 = 5; - lMaxX3 = lMinX3 + 1; - fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index); - - lMinX2 = 5; - lMaxX2 = lMinX2 + 1; - lMinX3 = 1; - lMaxX3 = lMinX3 + 5; - fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index); - break; - - case BN: - getLocalMinMax(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3); - getLocalMins(lMinX1, lMinX2, lMinX3, oMinX1, oMinX2, oMinX3); - lMinX2 = maxX2-7; - lMaxX2 = lMinX2 + 5; - lMinX3 = 5; - lMaxX3 = lMinX3 + 1; - fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index); - - lMinX2 = maxX2-7; - lMaxX2 = lMinX2 + 1; - lMinX3 = 1; - lMaxX3 = lMinX3 + 5; - fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index); - break; - - case TS: - getLocalMinMax(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3); - getLocalMins(lMinX1, lMinX2, lMinX3, oMinX1, oMinX2, oMinX3); - lMinX2 = 1; - lMaxX2 = lMinX2 + 5; - lMinX3 = maxX3-7; - lMaxX3 = lMinX3 + 1; - fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index); - - lMinX2 = 5; - lMaxX2 = lMinX2 + 1; - lMinX3 = maxX3-7; - lMaxX3 = lMinX3 + 5; - fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index); - break; - - //TNE - case TNE: - lMinX1 = maxX1-7; - lMaxX1 = maxX1-6; - lMinX2 = maxX2-7; - lMaxX2 = maxX2-2; - lMinX3 = maxX3-7; - lMaxX3 = maxX3-2; - fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index); - - lMinX1 = maxX1-7; - lMaxX1 = maxX1-2; - lMinX2 = maxX2-7; - lMaxX2 = maxX2-6; - lMinX3 = maxX3-7; - lMaxX3 = maxX3-2; - fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index); - - lMinX1 = maxX1-7; - lMaxX1 = maxX1-2; - lMinX2 = maxX2-7; - lMaxX2 = maxX2-2; - lMinX3 = maxX3-7; - lMaxX3 = maxX3-6; - fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index); - break; - - - //TNW - case TNW: - lMinX1 = 5; - lMaxX1 = 6; - lMinX2 = maxX2-7; - lMaxX2 = maxX2-2; - lMinX3 = maxX3-7; - lMaxX3 = maxX3-2; - fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index); - - lMinX1 = 1; - lMaxX1 = 6; - lMinX2 = maxX2-7; - lMaxX2 = maxX2-6; - lMinX3 = maxX3-7; - lMaxX3 = maxX3-2; - fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index); - - lMinX1 = 1; - lMaxX1 = 6; - lMinX2 = maxX2-7; - lMaxX2 = maxX2-2; - lMinX3 = maxX3-7; - lMaxX3 = maxX3-6; - fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index); - break; - - break; - - // TSE - case TSE: - lMinX1 = maxX1-7; - lMaxX1 = maxX1-6; - lMinX2 = 1; - lMaxX2 = 6; - lMinX3 = maxX3-7; - lMaxX3 = maxX3-2; - fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index); - - lMinX1 = maxX1-7; - lMaxX1 = maxX1-2; - lMinX2 = 5; - lMaxX2 = 6; - lMinX3 = maxX3-7; - lMaxX3 = maxX3-2; - fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index); - - lMinX1 = maxX1-7; - lMaxX1 = maxX1-2; - lMinX2 = 1; - lMaxX2 = 6; - lMinX3 = maxX3-7; - lMaxX3 = maxX3-6; - fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index); - - break; - // TSW - case TSW: - lMinX1 = 5; - lMaxX1 = 6; - lMinX2 = 1; - lMaxX2 = 6; - lMinX3 = maxX3-7; - lMaxX3 = maxX3-2; - fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index); - - lMinX1 = 1; - lMaxX1 = 6; - lMinX2 = 5; - lMaxX2 = 6; - lMinX3 = maxX3-7; - lMaxX3 = maxX3-2; - fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index); - - lMinX1 = 1; - lMaxX1 = 6; - lMinX2 = 1; - lMaxX2 = 6; - lMinX3 = maxX3-7; - lMaxX3 = maxX3-6; - fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index); - - break; - // BNE - case BNE: - lMinX1 = maxX1-7; - lMaxX1 = maxX1-6; - lMinX2 = maxX2-7; - lMaxX2 = maxX2-2; - lMinX3 = 1; - lMaxX3 = 6; - fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index); - - lMinX1 = maxX1-7; - lMaxX1 = maxX1-2; - lMinX2 = maxX2-7; - lMaxX2 = maxX2-6; - lMinX3 = 1; - lMaxX3 = 6; - fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index); - - lMinX1 = maxX1-7; - lMaxX1 = maxX1-2; - lMinX2 = maxX2-7; - lMaxX2 = maxX2-2; - lMinX3 = 5; - lMaxX3 = 6; - fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index); - - break; - // BNW - case BNW: - lMinX1 = 5; - lMaxX1 = 6; - lMinX2 = maxX2-7; - lMaxX2 = maxX2-2; - lMinX3 = 1; - lMaxX3 = 6; - fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index); - - lMinX1 = 1; - lMaxX1 = 6; - lMinX2 = maxX2-7; - lMaxX2 = maxX2-6; - lMinX3 = 1; - lMaxX3 = 6; - fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index); - - lMinX1 = 1; - lMaxX1 = 6; - lMinX2 = maxX2-7; - lMaxX2 = maxX2-2; - lMinX3 = 5; - lMaxX3 = 6; - fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index); - - break; - - - // BSE - case BSE: - lMinX1 = maxX1-7; - lMaxX1 = maxX1-6; - lMinX2 = 1; - lMaxX2 = 6; - lMinX3 = 1; - lMaxX3 = 6; - fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index); - - lMinX1 = maxX1-7; - lMaxX1 = maxX1-2; - lMinX2 = 5; - lMaxX2 = 6; - lMinX3 = 1; - lMaxX3 = 6; - fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index); - - lMinX1 = maxX1-7; - lMaxX1 = maxX1-2; - lMinX2 = 1; - lMaxX2 = 6; - lMinX3 = 5; - lMaxX3 = 6; - fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index); - - break; - - //BSW - case BSW: - lMinX1 = 5; - lMaxX1 = 6; - lMinX2 = 1; - lMaxX2 = 6; - lMinX3 = 1; - lMaxX3 = 6; - fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index); - - lMinX1 = 1; - lMaxX1 = 6; - lMinX2 = 5; - lMaxX2 = 6; - lMinX3 = 1; - lMaxX3 = 6; - fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index); - - lMinX1 = 1; - lMaxX1 = 6; - lMinX2 = 1; - lMaxX2 = 6; - lMinX3 = 5; - lMaxX3 = 6; - fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index); - - break; - } -} -////////////////////////////////////////////////////////////////////////// -template< typename VectorTransmitter > -void D3Q27ETFCOffVectorConnector< VectorTransmitter>::fillSendVector(DistributionArray3DPtr fFrom, const int& lMinX1, const int& lMinX2, const int& lMinX3, const int& lMaxX1, const int& lMaxX2, const int& lMaxX3, vector_type& data, int& index) -{ - int ix1, ix2, ix3; - LBMReal xoff, yoff, zoff; - BCArray3DPtr bcArray = block.lock()->getKernel()->getBCProcessor()->getBCArray(); - - for (ix3=lMinX3; ix3<lMaxX3; ix3+=2) - { - for (ix2=lMinX2; ix2<lMaxX2; ix2+=2) - { - for (ix1=lMinX1; ix1<lMaxX1; ix1+=2) - { - LBMReal icellC[27]; - D3Q27ICell icellF; - - int howManySolids= iprocessor->iCellHowManySolids(bcArray, ix1, ix2, ix3); - - if(howManySolids == 0 || howManySolids == 8) - { - iprocessor->readICell(fFrom, icellF, ix1, ix2, ix3); - xoff=0.0; - yoff=0.0; - zoff=0.0; - } - else - { - if(!iprocessor->findNeighborICell(bcArray, fFrom, icellF, bMaxX1, bMaxX2, bMaxX3, ix1, ix2, ix3, xoff, yoff, zoff)) - { - std::string err = "For "+block.lock()->toString()+" x1="+UbSystem::toString(ix1)+", x2=" + UbSystem::toString(ix2)+", x3=" + UbSystem::toString(ix3)+ - " interpolation is not implemented for other direction"+ - " by using in: "+(std::string)typeid(*this).name()+ - " or maybe you have a solid on the block boundary"; - //UBLOG(logINFO, err); - UB_THROW(UbException(UB_EXARGS, err)); - } - } - - iprocessor->interpolateFineToCoarse(icellF, icellC, xoff, yoff, zoff); - this->writeICellCtoData(data, index, icellC); - } - } - } -} -////////////////////////////////////////////////////////////////////////// -template< typename VectorTransmitter > -void D3Q27ETFCOffVectorConnector< VectorTransmitter>::writeICellCtoData(vector_type& data, int& index, LBMReal* icellC) -{ - for (int i = D3Q27System::STARTF; i < D3Q27System::ENDF+1; i++) - { - data[index++] = icellC[i]; - } -} -////////////////////////////////////////////////////////////////////////// -template< typename VectorTransmitter > -void D3Q27ETFCOffVectorConnector< VectorTransmitter>::getLocalMinMaxCF(int gMax, int& lMin, int& lMax) -{ - if (Utilities::isOdd(gMax)) - { - if(connType == OddEvenSE || connType == OddOddNE) - { - lMin = 1; - lMax = gMax; - } - } -} -////////////////////////////////////////////////////////////////////////// -template< typename VectorTransmitter > -void D3Q27ETFCOffVectorConnector< VectorTransmitter>::distributeReceiveVectors() -{ - using namespace D3Q27System; - - DistributionArray3DPtr fTo = block.lock()->getKernel()->getDataSet()->getFdistributions(); - int maxX1 = (int)fTo->getNX1(); - int maxX2 = (int)fTo->getNX2(); - int maxX3 = (int)fTo->getNX3(); - int minX1 = 0; - int minX2 = 0; - int minX3 = 0; - - int lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3; - int index = 0; - vector_type& data = receiver->getData(); - - lMinX1 = minX1; lMinX2 = minX2; lMinX3 = minX3; - lMaxX1 = maxX1-1; lMaxX2 = maxX2-1; lMaxX3 = maxX3-1; - - switch(sendDir) - { - case E: - lMinX1 = maxX1-4; - lMaxX1 = lMinX1 + 1; - getLocalMinMaxCF(maxX2, lMinX2, lMaxX2); - getLocalMinMaxCF(maxX3, lMinX3, lMaxX3); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index); - break; - case W: - /////////////////////////////////////// - ///DEBUG - //if (block.lock()->getGlobalID() == 2554) - //{ - // int test = 0; - //} - ////////////// - lMinX1 = 2; - lMaxX1 = lMinX1 + 1; - getLocalMinMaxCF(maxX2, lMinX2, lMaxX2); - getLocalMinMaxCF(maxX3, lMinX3, lMaxX3); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index); - break; - case N: - lMinX2 = maxX2-4; - lMaxX2 = lMinX2 + 1; - getLocalMinMaxCF(maxX1, lMinX1, lMaxX1); - getLocalMinMaxCF(maxX3, lMinX3, lMaxX3); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index); - break; - case S: - lMinX2 = 2; - lMaxX2 = lMinX2 + 1; - getLocalMinMaxCF(maxX1, lMinX1, lMaxX1); - getLocalMinMaxCF(maxX3, lMinX3, lMaxX3); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index); - break; - case T: - lMinX3 = maxX3-4; - lMaxX3 = lMinX3 + 1; - getLocalMinMaxCF(maxX1, lMinX1, lMaxX1); - getLocalMinMaxCF(maxX2, lMinX2, lMaxX2); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index); - break; - case B: - lMinX3 = 2; - lMaxX3 = lMinX3 + 1; - getLocalMinMaxCF(maxX1, lMinX1, lMaxX1); - getLocalMinMaxCF(maxX2, lMinX2, lMaxX2); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index); - break; - - /////E-W-N-S - case NE: - lMinX1 = maxX1-4; - lMaxX1 = lMinX1 + 3; - lMinX2 = maxX2-4; - lMaxX2 = lMinX2 + 3; - getLocalMinMaxCF(maxX3, lMinX3, lMaxX3); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index); - break; - - case SW: - lMinX1 = 0; - lMaxX1 = lMinX1 + 3; - lMinX2 = 0; - lMaxX2 = lMinX2 + 3; - getLocalMinMaxCF(maxX3, lMinX3, lMaxX3); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index); - break; - - case SE: - lMinX1 = maxX1-4; - lMaxX1 = lMinX1 + 3; - lMinX2 = 0; - lMaxX2 = lMinX2 + 3; - getLocalMinMaxCF(maxX3, lMinX3, lMaxX3); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index); - break; - - case NW: - lMinX1 = 0; - lMaxX1 = lMinX1 + 3; - lMinX2 = maxX2-4; - lMaxX2 = lMinX2 + 3; - getLocalMinMaxCF(maxX3, lMinX3, lMaxX3); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index); - break; - // - // /////T-B-E-W - case TE: - lMinX1 = maxX1-4; - lMaxX1 = lMinX1 + 3; - lMinX3 = maxX3-4; - lMaxX3 = lMinX3 + 3; - getLocalMinMaxCF(maxX2, lMinX2, lMaxX2); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index); - break; - - case BW: - lMinX1 = 0; - lMaxX1 = lMinX1 + 3; - lMinX3 = 0; - lMaxX3 = lMinX3 + 3; - getLocalMinMaxCF(maxX2, lMinX2, lMaxX2); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index); - break; - - case BE: - lMinX1 = maxX1-4; - lMaxX1 = lMinX1 + 3; - lMinX3 = 0; - lMaxX3 = lMinX3 + 3; - getLocalMinMaxCF(maxX2, lMinX2, lMaxX2); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index); - break; - - case TW: - lMinX1 = 0; - lMaxX1 = lMinX1 + 3; - lMinX3 = maxX3-4; - lMaxX3 = lMinX3 + 3; - getLocalMinMaxCF(maxX2, lMinX2, lMaxX2); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index); - break; - - // ////////////////T-B-N-S - // - case TN: - lMinX2 = maxX2-4; - lMaxX2 = lMinX2 + 3; - lMinX3 = maxX3-4; - lMaxX3 = lMinX3 + 3; - getLocalMinMaxCF(maxX1, lMinX1, lMaxX1); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index); - break; - - case BS: - lMinX2 = 0; - lMaxX2 = lMinX2 + 3; - lMinX3 = 0; - lMaxX3 = lMinX3 + 3; - getLocalMinMaxCF(maxX1, lMinX1, lMaxX1); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index); - break; - - case BN: - lMinX2 = maxX2-4; - lMaxX2 = lMinX2 + 3; - lMinX3 = 0; - lMaxX3 = lMinX3 + 3; - getLocalMinMaxCF(maxX1, lMinX1, lMaxX1); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index); - break; - - case TS: - lMinX2 = 0; - lMaxX2 = lMinX2 + 3; - lMinX3 = maxX3-4; - lMaxX3 = lMinX3 + 3; - getLocalMinMaxCF(maxX1, lMinX1, lMaxX1); - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index); - break; - - // //TNE - case TNE: - lMinX1 = maxX1-4; - lMaxX1 = maxX1-1; - lMinX2 = maxX2-4; - lMaxX2 = maxX2-1; - lMinX3 = maxX3-4; - lMaxX3 = maxX3-1; - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index); - break; - // TNW - case TNW: - lMinX1 = 0; - lMaxX1 = 3; - lMinX2 = maxX2-4; - lMaxX2 = maxX2-1; - lMinX3 = maxX3-4; - lMaxX3 = maxX3-1; - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index); - break; - // TSE - case TSE: - lMinX1 = maxX1-4; - lMaxX1 = maxX1-1; - lMinX2 = 0; - lMaxX2 = 3; - lMinX3 = maxX3-4; - lMaxX3 = maxX3-1; - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index); - break; - // TSW - case TSW: - lMinX1 = 0; - lMaxX1 = 3; - lMinX2 = 0; - lMaxX2 = 3; - lMinX3 = maxX3-4; - lMaxX3 = maxX3-1; - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index); - break; - // BNE - case BNE: - lMinX1 = maxX1-4; - lMaxX1 = maxX1-1; - lMinX2 = maxX2-4; - lMaxX2 = maxX2-1; - lMinX3 = 0; - lMaxX3 = 3; - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index); - break; - // BNW - case BNW: - lMinX1 = 0; - lMaxX1 = 3; - lMinX2 = maxX2-4; - lMaxX2 = maxX2-1; - lMinX3 = 0; - lMaxX3 = 3; - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index); - break; - // BSE - case BSE: - lMinX1 = maxX1-4; - lMaxX1 = maxX1-1; - lMinX2 = 0; - lMaxX2 = 3; - lMinX3 = 0; - lMaxX3 = 3; - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index); - break; - //BSW - case BSW: - lMinX1 = 0; - lMaxX1 = 3; - lMinX2 = 0; - lMaxX2 = 3; - lMinX3 = 0; - lMaxX3 = 3; - distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index); - break; - } -} -////////////////////////////////////////////////////////////////////////// -template< typename VectorTransmitter > -void D3Q27ETFCOffVectorConnector< VectorTransmitter>::distributeReceiveVector(DistributionArray3DPtr fTo, const int& lMinX1, const int& lMinX2, const int& lMinX3, const int& lMaxX1, const int& lMaxX2, const int& lMaxX3, vector_type& data, int& index) -{ - if(data.size() == 0) return; - - int ix1, ix2, ix3; - for (ix3=lMinX3; ix3<lMaxX3; ix3+=2) - { - for (ix2=lMinX2; ix2<lMaxX2; ix2+=2) - { - for (ix1=lMinX1; ix1<lMaxX1; ix1+=2) - { - D3Q27ICell icellF; - this->readICellFfromData(data, index, icellF); - iprocessor->writeICellInv(fTo, icellF, ix1, ix2, ix3); - } - } - } -} -////////////////////////////////////////////////////////////////////////// -template< typename VectorTransmitter > -void D3Q27ETFCOffVectorConnector< VectorTransmitter>::readICellFfromData(vector_type& data, int& index, D3Q27ICell& icellF) -{ - readNodeFromVector(data, index, icellF.BSW); - readNodeFromVector(data, index, icellF.BSE); - readNodeFromVector(data, index, icellF.BNW); - readNodeFromVector(data, index, icellF.BNE); - readNodeFromVector(data, index, icellF.TSW); - readNodeFromVector(data, index, icellF.TSE); - readNodeFromVector(data, index, icellF.TNW); - readNodeFromVector(data, index, icellF.TNE); -} -////////////////////////////////////////////////////////////////////////// -template< typename VectorTransmitter > -void D3Q27ETFCOffVectorConnector< VectorTransmitter>::readNodeFromVector(vector_type& data, int& index, LBMReal* inode) -{ - for (int i = D3Q27System::STARTF; i < D3Q27System::ENDF+1; i++) - { - inode[i] = data[index++]; - } -} -////////////////////////////////////////////////////////////////////////// -template< typename VectorTransmitter > -void D3Q27ETFCOffVectorConnector< VectorTransmitter>::getLocalMinMax(int& minX1, int& minX2, int& minX3, int& maxX1, int& maxX2, int& maxX3) -{ - using namespace D3Q27System; - int TminX1=minX1; int TminX2=minX2; int TminX3=minX3; int TmaxX1=maxX1; int TmaxX2=maxX2; int TmaxX3=maxX3; - - if(block.lock()->hasInterpolationFlagFC(E)) - { - if (maxX1==TmaxX1) maxX1 -= 3; - } - if(block.lock()->hasInterpolationFlagFC(W)) - { - if (minX1==TminX1) minX1 += 4; - } - if(block.lock()->hasInterpolationFlagFC(N)) - { - if (maxX2==TmaxX2) maxX2 -= 3; - } - if(block.lock()->hasInterpolationFlagFC(S)) - { - if (minX2==TminX2) minX2 += 4; - } - if(block.lock()->hasInterpolationFlagFC(T)) - { - if (maxX3==TmaxX3) maxX3 -= 3; - } - if(block.lock()->hasInterpolationFlagFC(B)) - { - if (minX3==TminX3) minX3 += 4; - } - - //////////// - /////E-W-N-S - if(block.lock()->hasInterpolationFlagFC(NE)&& !block.lock()->hasInterpolationFlagFC(N) && !block.lock()->hasInterpolationFlagFC(E)) - { - if (maxX1==TmaxX1) maxX1 -= 3; - if (maxX2==TmaxX2) maxX2 -= 3; - } - if(block.lock()->hasInterpolationFlagFC(SW)&& !block.lock()->hasInterpolationFlagFC(W) && !block.lock()->hasInterpolationFlagFC(S)) - { - if (minX1==TminX1) minX1 += 4; - if (minX2==TminX2) minX2 += 4; - } - if(block.lock()->hasInterpolationFlagFC(SE)&& !block.lock()->hasInterpolationFlagFC(E) && !block.lock()->hasInterpolationFlagFC(S)) - { - if (maxX1==TmaxX1) maxX1 -= 3; - if (minX2==TminX2) minX2 += 4; - } - if(block.lock()->hasInterpolationFlagFC(NW)&& !block.lock()->hasInterpolationFlagFC(N) && !block.lock()->hasInterpolationFlagFC(W)) - { - if (minX1==TminX1) minX1 += 4; - if (maxX2==TmaxX2) maxX2 -= 3; - } - - //////T-B-E-W - if(block.lock()->hasInterpolationFlagFC(TE) && !block.lock()->hasInterpolationFlagFC(E) && !block.lock()->hasInterpolationFlagFC(T)) - { - if (maxX1==TmaxX1) maxX1 -= 3; - if (maxX3==TmaxX3) maxX3 -= 3; - } - if(block.lock()->hasInterpolationFlagFC(BW)&& !block.lock()->hasInterpolationFlagFC(W) && !block.lock()->hasInterpolationFlagFC(B)) - { - if (minX1==TminX1) minX1 += 4; - if (minX3==TminX3) minX3 += 4; - } - if(block.lock()->hasInterpolationFlagFC(BE)&& !block.lock()->hasInterpolationFlagFC(E) && !block.lock()->hasInterpolationFlagFC(B)) - { - if (maxX1==TmaxX1) maxX1 -= 3; - if (minX3==TminX3) minX3 += 4; - } - if(block.lock()->hasInterpolationFlagFC(TW)&& !block.lock()->hasInterpolationFlagFC(W) && !block.lock()->hasInterpolationFlagFC(T)) - { - if (minX1==TminX1) minX1 += 4; - if (maxX3==TmaxX3) maxX3 -= 3; - } - - - ////T-B-N-S - if(block.lock()->hasInterpolationFlagFC(TN)&& !block.lock()->hasInterpolationFlagFC(N) && !block.lock()->hasInterpolationFlagFC(T)) - { - if (maxX2==TmaxX2) maxX2 -= 3; - if (maxX3==TmaxX3) maxX3 -= 3; - } - if(block.lock()->hasInterpolationFlagFC(BS)&& !block.lock()->hasInterpolationFlagFC(S) && !block.lock()->hasInterpolationFlagFC(B)) - { - if (minX2==TminX2) minX2 += 4; - if (minX3==TminX3) minX3 += 4; - } - if(block.lock()->hasInterpolationFlagFC(BN)&& !block.lock()->hasInterpolationFlagFC(N) && !block.lock()->hasInterpolationFlagFC(B)) - { - if (maxX2==TmaxX2) maxX2 -= 3; - if (minX3==TminX3) minX3 += 4; - } - if(block.lock()->hasInterpolationFlagFC(TS) && !block.lock()->hasInterpolationFlagFC(S) && !block.lock()->hasInterpolationFlagFC(T)) - { - if (minX2==TminX2) minX2 += 4; - if (maxX3==TmaxX3) maxX3 -= 3; - } - - //if (block.lock()->hasInterpolationFlagFC(D3Q27System::TNE)&&!block.lock()->hasInterpolationFlagFC(D3Q27System::TE)&&!block.lock()->hasInterpolationFlagFC(D3Q27System::TN)&&!block.lock()->hasInterpolationFlagFC(D3Q27System::NE)&&!block.lock()->hasInterpolationFlagFC(D3Q27System::T)&&!block.lock()->hasInterpolationFlagFC(D3Q27System::N) && !block.lock()->hasInterpolationFlagFC(D3Q27System::E)) - //if (!block.lock()->hasInterpolationFlagFC(D3Q27System::TE)&&!block.lock()->hasInterpolationFlagFC(D3Q27System::T) && !block.lock()->hasInterpolationFlagFC(D3Q27System::E)) - //{ - // if (maxX1==TmaxX1) maxX1 -= 3; - // if (maxX2==TmaxX2) maxX2 -= 3; - // if (maxX3==TmaxX3) maxX3 -= 3; - //} -} -////////////////////////////////////////////////////////////////////////// -template< typename VectorTransmitter > -void D3Q27ETFCOffVectorConnector< VectorTransmitter>::getLocalMinMax(int& minX1, int& minX2, int& minX3, int& maxX1, int& maxX2, int& maxX3, CFconnectorType connType) -{ - using namespace D3Q27System; - int TminX1 = minX1; int TminX2 = minX2; int TminX3 = minX3; int TmaxX1 = maxX1; int TmaxX2 = maxX2; int TmaxX3 = maxX3; - - if (block.lock()->hasInterpolationFlagFC(E)) - { - if (maxX1==TmaxX1) maxX1 -= 3; - } - if (block.lock()->hasInterpolationFlagFC(W)) - { - if (minX1==TminX1) minX1 += 4; - } - if (block.lock()->hasInterpolationFlagFC(N)) - { - if (maxX2==TmaxX2) maxX2 -= 3; - } - if (block.lock()->hasInterpolationFlagFC(S)) - { - if (minX2==TminX2) minX2 += 4; - } - if (block.lock()->hasInterpolationFlagFC(T)) - { - if (maxX3==TmaxX3) maxX3 -= 3; - } - if (block.lock()->hasInterpolationFlagFC(B)) - { - if (minX3==TminX3) minX3 += 4; - } - - //////////// - /////E-W-N-S - if (block.lock()->hasInterpolationFlagFC(NE)&& !block.lock()->hasInterpolationFlagFC(N) && !block.lock()->hasInterpolationFlagFC(E)) - { - if (maxX1==TmaxX1) maxX1 -= 3; - if (maxX2==TmaxX2) maxX2 -= 3; - } - if (block.lock()->hasInterpolationFlagFC(SW)&& !block.lock()->hasInterpolationFlagFC(W) && !block.lock()->hasInterpolationFlagFC(S)) - { - if (minX1==TminX1) minX1 += 4; - if (minX2==TminX2) minX2 += 4; - } - if (block.lock()->hasInterpolationFlagFC(SE)&& !block.lock()->hasInterpolationFlagFC(E) && !block.lock()->hasInterpolationFlagFC(S)) - { - if (maxX1==TmaxX1) maxX1 -= 3; - if (minX2==TminX2) minX2 += 4; - } - if (block.lock()->hasInterpolationFlagFC(NW)&& !block.lock()->hasInterpolationFlagFC(N) && !block.lock()->hasInterpolationFlagFC(W)) - { - if (minX1==TminX1) minX1 += 4; - if (maxX2==TmaxX2) maxX2 -= 3; - } - - //////T-B-E-W - if (block.lock()->hasInterpolationFlagFC(TE) && !block.lock()->hasInterpolationFlagFC(E) && !block.lock()->hasInterpolationFlagFC(T)) - { - if (maxX1==TmaxX1) maxX1 -= 3; - if (maxX3==TmaxX3) maxX3 -= 3; - } - if (block.lock()->hasInterpolationFlagFC(BW)&& !block.lock()->hasInterpolationFlagFC(W) && !block.lock()->hasInterpolationFlagFC(B)) - { - if (minX1==TminX1) minX1 += 4; - if (minX3==TminX3) minX3 += 4; - } - if (block.lock()->hasInterpolationFlagFC(BE)&& !block.lock()->hasInterpolationFlagFC(E) && !block.lock()->hasInterpolationFlagFC(B)) - { - if (maxX1==TmaxX1) maxX1 -= 3; - if (minX3==TminX3) minX3 += 4; - } - if (block.lock()->hasInterpolationFlagFC(TW)&& !block.lock()->hasInterpolationFlagFC(W) && !block.lock()->hasInterpolationFlagFC(T)) - { - if (minX1==TminX1) minX1 += 4; - if (maxX3==TmaxX3) maxX3 -= 3; - } - - - ////T-B-N-S - if (block.lock()->hasInterpolationFlagFC(TN)&& !block.lock()->hasInterpolationFlagFC(N) && !block.lock()->hasInterpolationFlagFC(T)) - { - if (maxX2==TmaxX2) maxX2 -= 3; - if (maxX3==TmaxX3) maxX3 -= 3; - } - if (block.lock()->hasInterpolationFlagFC(BS)&& !block.lock()->hasInterpolationFlagFC(S) && !block.lock()->hasInterpolationFlagFC(B)) - { - if (minX2==TminX2) minX2 += 4; - if (minX3==TminX3) minX3 += 4; - } - if (block.lock()->hasInterpolationFlagFC(BN)&& !block.lock()->hasInterpolationFlagFC(N) && !block.lock()->hasInterpolationFlagFC(B)) - { - if (maxX2==TmaxX2) maxX2 -= 3; - if (minX3==TminX3) minX3 += 4; - } - if (block.lock()->hasInterpolationFlagFC(TS) && !block.lock()->hasInterpolationFlagFC(S) && !block.lock()->hasInterpolationFlagFC(T)) - { - if (minX2==TminX2) minX2 += 4; - if (maxX3==TmaxX3) maxX3 -= 3; - } - - //if (block.lock()->hasInterpolationFlagFC(D3Q27System::TNE)&&!block.lock()->hasInterpolationFlagFC(D3Q27System::TE)&&!block.lock()->hasInterpolationFlagFC(D3Q27System::TN)&&!block.lock()->hasInterpolationFlagFC(D3Q27System::NE)&&!block.lock()->hasInterpolationFlagFC(D3Q27System::T)&&!block.lock()->hasInterpolationFlagFC(D3Q27System::N) && !block.lock()->hasInterpolationFlagFC(D3Q27System::E)) - //{ - // if (maxX1==TmaxX1) maxX1 -= 3; - // if (maxX2==TmaxX2) maxX2 -= 3; - // if (maxX3==TmaxX3) maxX3 -= 3; - //} -} -////////////////////////////////////////////////////////////////////////// -template< typename VectorTransmitter > -void D3Q27ETFCOffVectorConnector< VectorTransmitter>::getLocalOffsets(const int& gMax, int& oMin) -{ - if (Utilities::isEven(gMax)) - { - oMin = 0; - } - if (Utilities::isOdd(gMax)) - { - oMin = -1; - } - -} -////////////////////////////////////////////////////////////////////////// -template< typename VectorTransmitter > -void D3Q27ETFCOffVectorConnector< VectorTransmitter>::getLocalMins(int& minX1, int& minX2, int& minX3, const int& oMinX1, const int& oMinX2, const int& oMinX3) -{ - using namespace D3Q27System; - - switch(sendDir) - { - case E: case W: - if(connType == OddEvenSE) - minX2 += oMinX2; - if(connType == OddOddNE) - { - minX2 += oMinX2; - minX3 += oMinX3; - } - if(connType == EvenOddNW) - minX3 += oMinX3; - break; - case N: case S: - if(connType == OddEvenSE) - minX1 += oMinX1; - if(connType == OddOddNE) - { - minX1 += oMinX1; - minX3 += oMinX3; - } - if(connType == EvenOddNW) - minX3 += oMinX3; - break; - case T: case B: - if(connType == OddEvenSE) - minX1 += oMinX1; - if(connType == OddOddNE) - { - minX1 += oMinX1; - minX2 += oMinX2; - } - if(connType == EvenOddNW) - minX2 += oMinX2; - break; - - ///// - case NE: case SW: case SE: case NW: - //case SW: - if(connType == OddEvenSE) - //minX2 += oMinX2; - if(connType == OddOddNE) - { - //minX2 += oMinX2; - minX3 += oMinX3; - } - if(connType == EvenOddNW) - minX3 += oMinX3; - break; - - ////// - case TE: case BW: case BE: case TW: - if(connType == OddEvenSE) - // minX1 += oMinX1; - if(connType == OddOddNE) - { - // minX1 += oMinX1; - minX2 += oMinX2; - } - if(connType == EvenOddNW) - minX2 += oMinX2; - break; - - // ////// - case TN: case BS: case BN: case TS: - if(connType == OddEvenSE) - minX1 += oMinX1; - if(connType == OddOddNE) - { - minX1 += oMinX1; - //minX3 += oMinX3; - } - if(connType == EvenOddNW) - //minX3 += oMinX3; - break; - - // ///// - // case TNE: case TNW: case TSE: case TSW: case BNE: case BNW: case BSE: case BSW: - // if(connType == OddEvenSE) - // // minX1 += oMinX1; - // if(connType == OddOddNE) - // { - // //minX1 += oMinX1; - // //minX3 += oMinX3; - // } - // if(connType == EvenOddNW) - // //minX3 += oMinX3; - // break; - } -} -////////////////////////////////////////////////////////////////////////// -template< typename VectorTransmitter > -double D3Q27ETFCOffVectorConnector<VectorTransmitter>::getSendRecieveTime() -{ - return 0; -} - -#endif diff --git a/src/VirtualFluids/Connectors/D3Q27ETFullDirectConnector.cpp b/src/VirtualFluids/Connectors/D3Q27ETFullDirectConnector.cpp deleted file mode 100644 index 340b6d043..000000000 --- a/src/VirtualFluids/Connectors/D3Q27ETFullDirectConnector.cpp +++ /dev/null @@ -1,210 +0,0 @@ -#include "D3Q27ETFullDirectConnector.h" -#include "LBMKernel.h" -#include "D3Q27EsoTwist3DSplittedVector.h" -#include "DataSet3D.h" - -using namespace std; - -D3Q27ETFullDirectConnector::D3Q27ETFullDirectConnector(Block3DPtr from, Block3DPtr to, int sendDir) - : LocalBlock3DConnector(from, to, sendDir) - -{ - -} -////////////////////////////////////////////////////////////////////////// -void D3Q27ETFullDirectConnector::init() -{ - maxX1 = (int)this->from.lock()->getKernel()->getDataSet()->getFdistributions()->getNX1() - 1; - maxX2 = (int)this->from.lock()->getKernel()->getDataSet()->getFdistributions()->getNX2() - 1; - maxX3 = (int)this->from.lock()->getKernel()->getDataSet()->getFdistributions()->getNX3() - 1; - - fFrom = std::dynamic_pointer_cast<EsoTwist3D>(from.lock()->getKernel()->getDataSet()->getFdistributions()); - fTo = std::dynamic_pointer_cast<EsoTwist3D>(to.lock()->getKernel()->getDataSet()->getFdistributions()); -} -////////////////////////////////////////////////////////////////////////// -void D3Q27ETFullDirectConnector::sendVectors() -{ - localDistributionsFrom = std::dynamic_pointer_cast<D3Q27EsoTwist3DSplittedVector>(this->fFrom)->getLocalDistributions(); - nonLocalDistributionsFrom = std::dynamic_pointer_cast<D3Q27EsoTwist3DSplittedVector>(this->fFrom)->getNonLocalDistributions(); - zeroDistributionsFrom = std::dynamic_pointer_cast<D3Q27EsoTwist3DSplittedVector>(this->fFrom)->getZeroDistributions(); - - localDistributionsTo = std::dynamic_pointer_cast<D3Q27EsoTwist3DSplittedVector>(this->fTo)->getLocalDistributions(); - nonLocalDistributionsTo = std::dynamic_pointer_cast<D3Q27EsoTwist3DSplittedVector>(this->fTo)->getNonLocalDistributions(); - zeroDistributionsTo = std::dynamic_pointer_cast<D3Q27EsoTwist3DSplittedVector>(this->fTo)->getZeroDistributions(); - - //EAST - if (sendDir == D3Q27System::E) - { - for (int x3 = 1; x3 < maxX3; x3++) - { - for (int x2 = 1; x2 < maxX2; x2++) - { - exchangeData(maxX1 - 1, x2, x3, 0, x2, x3); - } - } - } - //WEST - else if (sendDir == D3Q27System::W) - { - for (int x3 = 1; x3 < maxX3; x3++) - { - for (int x2 = 1; x2 < maxX2; x2++) - { - exchangeData(1, x2, x3, maxX1, x2, x3); - } - } - } - //NORTH - else if (sendDir == D3Q27System::N) - { - for (int x3 = 1; x3 < maxX3; x3++) - { - for (int x1 = 1; x1 < maxX1; x1++) - { - exchangeData(x1, maxX2 - 1, x3, x1, 0, x3); - } - } - } - //SOUTH - else if (sendDir == D3Q27System::S) - { - for (int x3 = 1; x3 < maxX3; x3++) - { - for (int x1 = 1; x1 < maxX1; x1++) - { - exchangeData(x1, 1, x3, x1, maxX2, x3); - } - } - } - - //TOP - else if (sendDir == D3Q27System::T) - { - for (int x2 = 1; x2 < maxX2; x2++) - { - for (int x1 = 1; x1 < maxX1; x1++) - { - exchangeData(x1, x2, maxX3 - 1, x1, x2, 0); - } - } - } - //BOTTOM - else if (sendDir == D3Q27System::B) - { - for (int x2 = 1; x2 < maxX2; x2++) - { - for (int x1 = 1; x1 < maxX1; x1++) - { - exchangeData(x1, x2, 1, x1, x2, maxX3); - } - } - } - //NORTHEAST - else if (sendDir == D3Q27System::NE) - { - for (int x3 = 1; x3 < maxX3; x3++) - { - exchangeData(maxX1 - 1, maxX2 - 1, x3, 0, 0, x3); - } - } - //NORTHWEST - else if (sendDir == D3Q27System::NW) - { - for (int x3 = 1; x3 < maxX3; x3++) - { - exchangeData(1, maxX2 - 1, x3, maxX1, 0, x3); - } - } - //SOUTHWEST - else if (sendDir == D3Q27System::SW) - { - for (int x3 = 1; x3 < maxX3; x3++) - { - exchangeData(1, 1, x3, maxX1, maxX2, x3); - } - } - //SOUTHEAST - else if (sendDir == D3Q27System::SE) - { - for (int x3 = 1; x3 < maxX3; x3++) - { - exchangeData(maxX1 - 1, 1, x3, 0, maxX2, x3); - } - } - else if (sendDir == D3Q27System::TE) - for (int x2 = 1; x2 < maxX2; x2++) - { - exchangeData(maxX1 - 1, x2, maxX3 - 1, 0, x2, 0); - } - else if (sendDir == D3Q27System::BW) - for (int x2 = 1; x2 < maxX2; x2++) - { - exchangeData(1, x2, 1, maxX1, x2, maxX3); - } - else if (sendDir == D3Q27System::BE) - for (int x2 = 1; x2 < maxX2; x2++) - { - exchangeData(maxX1 - 1, x2, 1, 0, x2, maxX3); - } - else if (sendDir == D3Q27System::TW) - for (int x2 = 1; x2 < maxX2; x2++) - { - exchangeData(1, x2, maxX3 - 1, maxX1, x2, 0); - } - else if (sendDir == D3Q27System::TN) - for (int x1 = 1; x1 < maxX1; x1++) - { - exchangeData(x1, maxX2 - 1, maxX3 - 1, x1, 0, 0); - } - else if (sendDir == D3Q27System::BS) - for (int x1 = 1; x1 < maxX1; x1++) - { - exchangeData(x1, 1, 1, x1, maxX2, maxX3); - } - else if (sendDir == D3Q27System::BN) - for (int x1 = 1; x1 < maxX1; x1++) - { - exchangeData(x1, maxX2 - 1, 1, x1, 0, maxX3); - } - - else if (sendDir == D3Q27System::TS) - for (int x1 = 1; x1 < maxX1; x1++) - { - exchangeData(x1, 1, maxX3 - 1, x1, maxX2, 0); - } - - else if (sendDir == D3Q27System::TSW) - { - exchangeData(1, 1, maxX3 - 1, maxX1, maxX2, 0); - } - else if (sendDir == D3Q27System::TSE) - { - exchangeData(maxX1 - 1, 1, maxX3 - 1, 0, maxX2, 0); - } - else if (sendDir == D3Q27System::TNW) - { - exchangeData(1, maxX2 - 1, maxX3 - 1, maxX1, 0, 0); - } - else if (sendDir == D3Q27System::TNE) - { - exchangeData(maxX1 - 1, maxX2 - 1, maxX3 - 1, 0, 0, 0); - } - else if (sendDir == D3Q27System::BSW) - { - exchangeData(1, 1, 1, maxX1, maxX2, maxX3); - } - else if (sendDir == D3Q27System::BSE) - { - exchangeData(maxX1 - 1, 1, 1, 0, maxX2, maxX3); - } - else if (sendDir == D3Q27System::BNW) - { - exchangeData(1, maxX2 - 1, 1, maxX1, 0, maxX3); - } - else if (sendDir == D3Q27System::BNE) - { - exchangeData(maxX1 - 1, maxX2 - 1, 1, 0, 0, maxX3); - } - else UB_THROW(UbException(UB_EXARGS, "unknown dir")); -} - diff --git a/src/VirtualFluids/Connectors/D3Q27ETFullDirectConnector.h b/src/VirtualFluids/Connectors/D3Q27ETFullDirectConnector.h deleted file mode 100644 index c901f9d43..000000000 --- a/src/VirtualFluids/Connectors/D3Q27ETFullDirectConnector.h +++ /dev/null @@ -1,83 +0,0 @@ -/** -* @file D3Q27ETFullDirectConnector.h -* @brief Connector send and receive full distribution in shared memory -* -* @author Konstantin Kutscher -* @date 28.04.2016 -*/ -#ifndef D3Q27ETFULLDIRECTCONNECTOR_H -#define D3Q27ETFULLDIRECTCONNECTOR_H - -#include "LocalBlock3DConnector.h" -#include "Block3D.h" -#include "D3Q27System.h" -#include "basics/container/CbArray3D.h" -#include "basics/container/CbArray4D.h" -#include "EsoTwist3D.h" - -//! \brief Exchange data between blocks. -//! \details Connector send and receive full distributions between two blocks in shared memory. -//! \author Konstantin Kutscher - -class D3Q27ETFullDirectConnector : public LocalBlock3DConnector -{ -public: - D3Q27ETFullDirectConnector(Block3DPtr from, Block3DPtr to, int sendDir); - void init(); - void sendVectors(); - -protected: - inline void exchangeData(int x1From, int x2From, int x3From, int x1To, int x2To, int x3To); -private: - int maxX1; - int maxX2; - int maxX3; - - CbArray4D <LBMReal, IndexerX4X3X2X1>::CbArray4DPtr localDistributionsFrom; - CbArray4D <LBMReal, IndexerX4X3X2X1>::CbArray4DPtr nonLocalDistributionsFrom; - CbArray3D <LBMReal, IndexerX3X2X1>::CbArray3DPtr zeroDistributionsFrom; - - CbArray4D <LBMReal, IndexerX4X3X2X1>::CbArray4DPtr localDistributionsTo; - CbArray4D <LBMReal, IndexerX4X3X2X1>::CbArray4DPtr nonLocalDistributionsTo; - CbArray3D <LBMReal, IndexerX3X2X1>::CbArray3DPtr zeroDistributionsTo; - - EsoTwist3DPtr fFrom; - EsoTwist3DPtr fTo; -}; - - -////////////////////////////////////////////////////////////////////////// -inline void D3Q27ETFullDirectConnector::exchangeData(int x1From, int x2From, int x3From, int x1To, int x2To, int x3To) -{ - (*this->localDistributionsTo)(D3Q27System::ET_E, x1To, x2To, x3To) = (*this->localDistributionsFrom)(D3Q27System::ET_E, x1From, x2From, x3From); - (*this->localDistributionsTo)(D3Q27System::ET_N, x1To, x2To, x3To) = (*this->localDistributionsFrom)(D3Q27System::ET_N, x1From, x2From, x3From); - (*this->localDistributionsTo)(D3Q27System::ET_T, x1To, x2To, x3To) = (*this->localDistributionsFrom)(D3Q27System::ET_T, x1From, x2From, x3From); - (*this->localDistributionsTo)(D3Q27System::ET_NE, x1To, x2To, x3To) = (*this->localDistributionsFrom)(D3Q27System::ET_NE, x1From, x2From, x3From); - (*this->localDistributionsTo)(D3Q27System::ET_NW, x1To + 1, x2To, x3To) = (*this->localDistributionsFrom)(D3Q27System::ET_NW, x1From + 1, x2From, x3From); - (*this->localDistributionsTo)(D3Q27System::ET_TE, x1To, x2To, x3To) = (*this->localDistributionsFrom)(D3Q27System::ET_TE, x1From, x2From, x3From); - (*this->localDistributionsTo)(D3Q27System::ET_TW, x1To + 1, x2To, x3To) = (*this->localDistributionsFrom)(D3Q27System::ET_TW, x1From + 1, x2From, x3From); - (*this->localDistributionsTo)(D3Q27System::ET_TN, x1To, x2To, x3To) = (*this->localDistributionsFrom)(D3Q27System::ET_TN, x1From, x2From, x3From); - (*this->localDistributionsTo)(D3Q27System::ET_TS, x1To, x2To + 1, x3To) = (*this->localDistributionsFrom)(D3Q27System::ET_TS, x1From, x2From + 1, x3From); - (*this->localDistributionsTo)(D3Q27System::ET_TNE, x1To, x2To, x3To) = (*this->localDistributionsFrom)(D3Q27System::ET_TNE, x1From, x2From, x3From); - (*this->localDistributionsTo)(D3Q27System::ET_TNW, x1To + 1, x2To, x3To) = (*this->localDistributionsFrom)(D3Q27System::ET_TNW, x1From + 1, x2From, x3From); - (*this->localDistributionsTo)(D3Q27System::ET_TSE, x1To, x2To + 1, x3To) = (*this->localDistributionsFrom)(D3Q27System::ET_TSE, x1From, x2From + 1, x3From); - (*this->localDistributionsTo)(D3Q27System::ET_TSW, x1To + 1, x2To + 1, x3To) = (*this->localDistributionsFrom)(D3Q27System::ET_TSW, x1From + 1, x2From + 1, x3From); - - (*this->nonLocalDistributionsTo)(D3Q27System::ET_W, x1To + 1, x2To, x3To) = (*this->nonLocalDistributionsFrom)(D3Q27System::ET_W, x1From + 1, x2From, x3From); - (*this->nonLocalDistributionsTo)(D3Q27System::ET_S, x1To, x2To + 1, x3To) = (*this->nonLocalDistributionsFrom)(D3Q27System::ET_S, x1From, x2From + 1, x3From); - (*this->nonLocalDistributionsTo)(D3Q27System::ET_B, x1To, x2To, x3To + 1) = (*this->nonLocalDistributionsFrom)(D3Q27System::ET_B, x1From, x2From, x3From + 1); - (*this->nonLocalDistributionsTo)(D3Q27System::ET_SW, x1To + 1, x2To + 1, x3To) = (*this->nonLocalDistributionsFrom)(D3Q27System::ET_SW, x1From + 1, x2From + 1, x3From); - (*this->nonLocalDistributionsTo)(D3Q27System::ET_SE, x1To, x2To + 1, x3To) = (*this->nonLocalDistributionsFrom)(D3Q27System::ET_SE, x1From, x2From + 1, x3From); - (*this->nonLocalDistributionsTo)(D3Q27System::ET_BW, x1To + 1, x2To, x3To + 1) = (*this->nonLocalDistributionsFrom)(D3Q27System::ET_BW, x1From + 1, x2From, x3From + 1); - (*this->nonLocalDistributionsTo)(D3Q27System::ET_BE, x1To, x2To, x3To + 1) = (*this->nonLocalDistributionsFrom)(D3Q27System::ET_BE, x1From, x2From, x3From + 1); - (*this->nonLocalDistributionsTo)(D3Q27System::ET_BS, x1To, x2To + 1, x3To + 1) = (*this->nonLocalDistributionsFrom)(D3Q27System::ET_BS, x1From, x2From + 1, x3From + 1); - (*this->nonLocalDistributionsTo)(D3Q27System::ET_BN, x1To, x2To, x3To + 1) = (*this->nonLocalDistributionsFrom)(D3Q27System::ET_BN, x1From, x2From, x3From + 1); - (*this->nonLocalDistributionsTo)(D3Q27System::ET_BSW, x1To + 1, x2To + 1, x3To + 1) = (*this->nonLocalDistributionsFrom)(D3Q27System::ET_BSW, x1From + 1, x2From + 1, x3From + 1); - (*this->nonLocalDistributionsTo)(D3Q27System::ET_BSE, x1To, x2To + 1, x3To + 1) = (*this->nonLocalDistributionsFrom)(D3Q27System::ET_BSE, x1From, x2From + 1, x3From + 1); - (*this->nonLocalDistributionsTo)(D3Q27System::ET_BNW, x1To + 1, x2To, x3To + 1) = (*this->nonLocalDistributionsFrom)(D3Q27System::ET_BNW, x1From + 1, x2From, x3From + 1); - (*this->nonLocalDistributionsTo)(D3Q27System::ET_BNE, x1To, x2To, x3To + 1) = (*this->nonLocalDistributionsFrom)(D3Q27System::ET_BNE, x1From, x2From, x3From + 1); - - (*this->zeroDistributionsTo)(x1To, x2To, x3To) = (*this->zeroDistributionsFrom)(x1From, x2From, x3From); -} -#endif - diff --git a/src/VirtualFluids/Connectors/D3Q27ETFullVectorConnector.cpp b/src/VirtualFluids/Connectors/D3Q27ETFullVectorConnector.cpp deleted file mode 100644 index 3076e6777..000000000 --- a/src/VirtualFluids/Connectors/D3Q27ETFullVectorConnector.cpp +++ /dev/null @@ -1,468 +0,0 @@ -#include "D3Q27ETFullVectorConnector.h" -#include "D3Q27EsoTwist3DSplittedVector.h" -#include "LBMKernel.h" -#include "DataSet3D.h" -////////////////////////////////////////////////////////////////////////// -D3Q27ETFullVectorConnector::D3Q27ETFullVectorConnector(Block3DPtr block - , VectorTransmitterPtr sender - , VectorTransmitterPtr receiver - , int sendDir) - : RemoteBlock3DConnector(block, sender, receiver, sendDir) -{ - if (!block || !sender || !receiver) - UB_THROW(UbException(UB_EXARGS, "sender or receiver == NULL!!")); - -} -////////////////////////////////////////////////////////////////////////// -void D3Q27ETFullVectorConnector::init() -{ - maxX1 = (int)block.lock()->getKernel()->getDataSet()->getFdistributions()->getNX1() - 1; - maxX2 = (int)block.lock()->getKernel()->getDataSet()->getFdistributions()->getNX2() - 1; - maxX3 = (int)block.lock()->getKernel()->getDataSet()->getFdistributions()->getNX3() - 1; - - fDis = std::dynamic_pointer_cast<EsoTwist3D>(block.lock()->getKernel()->getDataSet()->getFdistributions()); - - int anz = 27; - switch (sendDir) - { - case D3Q27System::ZERO: UB_THROW(UbException(UB_EXARGS, "ZERO not allowed")); break; - case D3Q27System::E: - case D3Q27System::W: sender->getData().resize(maxX2*maxX3*anz, 0.0); break; - case D3Q27System::N: - case D3Q27System::S: sender->getData().resize(maxX1*maxX3*anz, 0.0); break; - case D3Q27System::T: - case D3Q27System::B: sender->getData().resize(maxX1*maxX2*anz, 0.0); break; - - case D3Q27System::NE: - case D3Q27System::SW: - case D3Q27System::SE: - case D3Q27System::NW: sender->getData().resize(maxX3*anz, 0.0); break; - - case D3Q27System::TE: - case D3Q27System::BW: - case D3Q27System::BE: - case D3Q27System::TW: sender->getData().resize(maxX2*anz, 0.0); break; - - case D3Q27System::TN: - case D3Q27System::BS: - case D3Q27System::BN: - case D3Q27System::TS: sender->getData().resize(maxX1*anz, 0.0); break; - - case D3Q27System::TNE: - case D3Q27System::BSW: - case D3Q27System::BNE: - case D3Q27System::TSW: - case D3Q27System::TSE: - case D3Q27System::BNW: - case D3Q27System::BSE: - case D3Q27System::TNW: sender->getData().resize(anz, 0.0); break; - - default: UB_THROW(UbException(UB_EXARGS, "unknown sendDir")); - } -} -////////////////////////////////////////////////////////////////////////// -void D3Q27ETFullVectorConnector::fillSendVectors() -{ - localDistributions = std::dynamic_pointer_cast<D3Q27EsoTwist3DSplittedVector>(this->fDis)->getLocalDistributions(); - nonLocalDistributions = std::dynamic_pointer_cast<D3Q27EsoTwist3DSplittedVector>(this->fDis)->getNonLocalDistributions(); - zeroDistributions = std::dynamic_pointer_cast<D3Q27EsoTwist3DSplittedVector>(this->fDis)->getZeroDistributions(); - - vector_type& sdata = sender->getData(); - - int index = 0; - //EAST - if (sendDir == D3Q27System::E) - { - for (int x3 = 1; x3 < maxX3; x3++) - { - for (int x2 = 1; x2 < maxX2; x2++) - { - fillData(sdata, index, maxX1 - 1, x2, x3); - } - } - } - //WEST - else if (sendDir == D3Q27System::W) - { - for (int x3 = 1; x3 < maxX3; x3++) - { - for (int x2 = 1; x2 < maxX2; x2++) - { - fillData(sdata, index, 1, x2, x3); - } - } - } - //NORTH - else if (sendDir == D3Q27System::N) - { - for (int x3 = 1; x3 < maxX3; x3++) - { - for (int x1 = 1; x1 < maxX1; x1++) - { - fillData(sdata, index, x1, maxX2 - 1, x3); - } - } - } - //SOUTH - else if (sendDir == D3Q27System::S) - { - for (int x3 = 1; x3 < maxX3; x3++) - { - for (int x1 = 1; x1 < maxX1; x1++) - { - fillData(sdata, index, x1, 1, x3); - } - } - } - //TOP - else if (sendDir == D3Q27System::T) - { - for (int x2 = 1; x2 < maxX2; x2++) - { - for (int x1 = 1; x1 < maxX1; x1++) - { - fillData(sdata, index, x1, x2, maxX3 - 1); - } - } - } - //BOTTOM - else if (sendDir == D3Q27System::B) - { - for (int x2 = 1; x2 < maxX2; x2++) - { - for (int x1 = 1; x1 < maxX1; x1++) - { - fillData(sdata, index, x1, x2, 1); - } - } - } - //NE NW SW SE - else if (sendDir == D3Q27System::NE || sendDir == D3Q27System::NW || sendDir == D3Q27System::SW || sendDir == D3Q27System::SE) - { - int x1 = 0; - int x2 = 0; - switch (sendDir) - { - case D3Q27System::NE: - x1 = maxX1 - 1; - x2 = maxX2 - 1; - break; - case D3Q27System::NW: - x1 = 1; - x2 = maxX2 - 1; - break; - case D3Q27System::SW: - x1 = 1; - x2 = 1; - break; - case D3Q27System::SE: - x1 = maxX1 - 1; - x2 = 1; - break; - } - for (int x3 = 1; x3 < maxX3; x3++) - { - fillData(sdata, index, x1, x2, x3); - } - } - //TE TW BW BE - else if (sendDir == D3Q27System::TE || sendDir == D3Q27System::TW || sendDir == D3Q27System::BW || sendDir == D3Q27System::BE) - { - int x1 = 0; - int x3 = 0; - switch (sendDir) - { - case D3Q27System::TE: - x1 = maxX1 - 1; - x3 = maxX3 - 1; - break; - case D3Q27System::TW: - x1 = 1; - x3 = maxX3 - 1; - break; - case D3Q27System::BW: - x1 = 1; - x3 = 1; - break; - case D3Q27System::BE: - x1 = maxX1 - 1; - x3 = 1; - break; - } - for (int x2 = 1; x2 < maxX2; x2++) - { - fillData(sdata, index, x1, x2, x3); - } - } - //TN BN BS TS - else if (sendDir == D3Q27System::TN || sendDir == D3Q27System::BN || sendDir == D3Q27System::BS || sendDir == D3Q27System::TS) - { - int x2 = 0; - int x3 = 0; - switch (sendDir) - { - case D3Q27System::TN: - x3 = maxX3 - 1; - x2 = maxX2 - 1; - break; - case D3Q27System::BN: - x3 = 1; - x2 = maxX2 - 1; - break; - case D3Q27System::BS: - x3 = 1; - x2 = 1; - break; - case D3Q27System::TS: - x3 = maxX3 - 1; - x2 = 1; - break; - } - for (int x1 = 1; x1 < maxX1; x1++) - { - fillData(sdata, index, x1, x2, x3); - } - } - //TNE TNW TSW TSE BNE BNW BSW BSE - else if (sendDir == D3Q27System::TNE || sendDir == D3Q27System::TNW || sendDir == D3Q27System::TSW || sendDir == D3Q27System::TSE - || sendDir == D3Q27System::BNE || sendDir == D3Q27System::BNW || sendDir == D3Q27System::BSW || sendDir == D3Q27System::BSE) - { - int x1 = 0; - int x2 = 0; - int x3 = 0; - switch (sendDir) - { - case D3Q27System::TNE: x1 = maxX1 - 1; x2 = maxX2 - 1; x3 = maxX3 - 1; break; - case D3Q27System::TNW: x1 = 1; x2 = maxX2 - 1; x3 = maxX3 - 1; break; - case D3Q27System::TSW: x1 = 1; x2 = 1; x3 = maxX3 - 1; break; - case D3Q27System::TSE: x1 = maxX1 - 1; x2 = 1; x3 = maxX3 - 1; break; - case D3Q27System::BNE: x1 = maxX1 - 1; x2 = maxX2 - 1; x3 = 1; break; - case D3Q27System::BNW: x1 = 1; x2 = maxX2 - 1; x3 = 1; break; - case D3Q27System::BSW: x1 = 1; x2 = 1; x3 = 1; break; - case D3Q27System::BSE: x1 = maxX1 - 1; x2 = 1; x3 = 1; break; - } - fillData(sdata, index, x1, x2, x3); - } - else UB_THROW(UbException(UB_EXARGS, "unknown dir")); -} -//////////////////////////////////////////////////////////////////////// -void D3Q27ETFullVectorConnector::distributeReceiveVectors() -{ - /*e.g. connector sendet nach EAST --> empfaengt daten aus WEST ;-)*/ - - localDistributions = std::dynamic_pointer_cast<D3Q27EsoTwist3DSplittedVector>(this->fDis)->getLocalDistributions(); - nonLocalDistributions = std::dynamic_pointer_cast<D3Q27EsoTwist3DSplittedVector>(this->fDis)->getNonLocalDistributions(); - zeroDistributions = std::dynamic_pointer_cast<D3Q27EsoTwist3DSplittedVector>(this->fDis)->getZeroDistributions(); - - vector_type& rdata = receiver->getData(); - - int index = 0; - - if (sendDir == D3Q27System::W) - { - for (int x3 = 1; x3 < maxX3; x3++) - { - for (int x2 = 1; x2 < maxX2; x2++) - { - distributeData(rdata, index, 0, x2, x3); - } - } - } - else if (sendDir == D3Q27System::E) - { - for (int x3 = 1; x3 < maxX3; x3++) - { - for (int x2 = 1; x2 < maxX2; x2++) - { - distributeData(rdata, index, maxX1, x2, x3); - } - } - } - else if (sendDir == D3Q27System::S) - { - for (int x3 = 1; x3 < maxX3; x3++) - { - for (int x1 = 1; x1 < maxX1; x1++) - { - distributeData(rdata, index, x1, 0, x3); - } - } - } - else if (sendDir == D3Q27System::N) - { - for (int x3 = 1; x3 < maxX3; x3++) - { - for (int x1 = 1; x1 < maxX1; x1++) - { - distributeData(rdata, index, x1, maxX2, x3); - } - } - } - else if (sendDir == D3Q27System::B) - { - for (int x2 = 1; x2 < maxX2; x2++) - { - for (int x1 = 1; x1 < maxX1; x1++) - { - distributeData(rdata, index, x1, x2, 0); - } - } - } - else if (sendDir == D3Q27System::T) - { - for (int x2 = 1; x2 < maxX2; x2++) - { - for (int x1 = 1; x1 < maxX1; x1++) - { - distributeData(rdata, index, x1, x2, maxX3); - } - } - } - //NE NW SW SE - else if (sendDir == D3Q27System::NE || sendDir == D3Q27System::NW || sendDir == D3Q27System::SW || sendDir == D3Q27System::SE) - { - int x1 = 0; - int x2 = 0; - switch (sendDir) //wenn sendir NE dann kommen werte von SW - { - case D3Q27System::NE: - x1 = maxX1; - x2 = maxX2; - break; - case D3Q27System::NW: - x1 = 0; - x2 = maxX2; - break; - case D3Q27System::SW: - x1 = 0; - x2 = 0; - break; - case D3Q27System::SE: - x1 = maxX1; - x2 = 0; - break; - } - for (int x3 = 1; x3 < maxX3; x3++) - { - distributeData(rdata, index, x1, x2, x3); - } - - } - //TE TW BW BE - else if (sendDir == D3Q27System::TE || sendDir == D3Q27System::TW || sendDir == D3Q27System::BW || sendDir == D3Q27System::BE) - - { - int x1 = 0; - int x3 = 0; - switch (sendDir) //wenn sendir NE dann kommen werte von SW - { - case D3Q27System::TE: - x1 = maxX1; - x3 = maxX3; - break; - case D3Q27System::TW: - x1 = 0; - x3 = maxX3; - break; - case D3Q27System::BW: - x1 = 0; - x3 = 0; - break; - case D3Q27System::BE: - x1 = maxX1; - x3 = 0; - break; - } - for (int x2 = 1; x2 < maxX2; x2++) - { - distributeData(rdata, index, x1, x2, x3); - } - } - //TN BN BS TS - else if (sendDir == D3Q27System::TN || sendDir == D3Q27System::BN || sendDir == D3Q27System::BS || sendDir == D3Q27System::TS) - { - int x2 = 0; - int x3 = 0; - switch (sendDir) - { - case D3Q27System::TN: - x3 = maxX3; - x2 = maxX2; - break; - case D3Q27System::BN: - x3 = 0; - x2 = maxX2; - break; - case D3Q27System::BS: - x3 = 0; - x2 = 0; - break; - case D3Q27System::TS: - x3 = maxX3; - x2 = 0; - break; - - } - for (int x1 = 1; x1 < maxX1; x1++) - { - distributeData(rdata, index, x1, x2, x3); - } - } - //TNE TNW TSW TSE BNE BNW BSW BSE - else if (sendDir == D3Q27System::TNE || sendDir == D3Q27System::TNW || sendDir == D3Q27System::TSW || sendDir == D3Q27System::TSE - || sendDir == D3Q27System::BNE || sendDir == D3Q27System::BNW || sendDir == D3Q27System::BSW || sendDir == D3Q27System::BSE) - { - int x1 = 0; - int x2 = 0; - int x3 = 0; - - switch (sendDir) - { - case D3Q27System::TNE: - x1 = maxX1; - x2 = maxX2; - x3 = maxX3; - break; - case D3Q27System::TNW: - x1 = 0; - x2 = maxX2; - x3 = maxX3; - break; - case D3Q27System::TSW: - x1 = 0; - x2 = 0; - x3 = maxX3; - break; - case D3Q27System::TSE: - x1 = maxX1; - x2 = 0; - x3 = maxX3; - break; - case D3Q27System::BNE: - x1 = maxX1; - x2 = maxX2; - x3 = 0; - break; - case D3Q27System::BNW: - x1 = 0; - x2 = maxX2; - x3 = 0; - break; - case D3Q27System::BSW: - x1 = 0; - x2 = 0; - x3 = 0; - break; - case D3Q27System::BSE: - x1 = maxX1; - x2 = 0; - x3 = 0; - break; - } - distributeData(rdata, index, x1, x2, x3); - } - else UB_THROW(UbException(UB_EXARGS, "unknown dir")); -} -////////////////////////////////////////////////////////////////////////// - - diff --git a/src/VirtualFluids/Connectors/D3Q27ETFullVectorConnector.h b/src/VirtualFluids/Connectors/D3Q27ETFullVectorConnector.h deleted file mode 100644 index 6a4dedebc..000000000 --- a/src/VirtualFluids/Connectors/D3Q27ETFullVectorConnector.h +++ /dev/null @@ -1,118 +0,0 @@ -#ifndef D3Q27ETFULLVECTORCONNECTOR_H -#define D3Q27ETFULLVECTORCONNECTOR_H - -#include <vector> - -#include "RemoteBlock3DConnector.h" -#include "D3Q27System.h" -#include "Block3D.h" -#include "LBMKernel.h" -#include "EsoTwistD3Q27System.h" -#include "basics/container/CbArray3D.h" -#include "basics/container/CbArray4D.h" -#include "EsoTwist3D.h" - - -//daten werden in einen vector (dieser befindet sich im transmitter) kopiert -//der vector wird via transmitter uebertragen -//transmitter kann ein lokal, MPI, RCG, CTL oder was auch immer fuer ein -//transmitter sein, der von Transmitter abgeleitet ist ;-) -class D3Q27ETFullVectorConnector : public RemoteBlock3DConnector -{ -public: - D3Q27ETFullVectorConnector(Block3DPtr block - , VectorTransmitterPtr sender - , VectorTransmitterPtr receiver - , int sendDir); - - void init(); - - void fillSendVectors(); - void distributeReceiveVectors(); - -protected: - inline void fillData(vector_type& sdata, int& index, int x1, int x2, int x3); - inline void distributeData(vector_type& rdata, int& index, int x1, int x2, int x3); -private: - int maxX1; - int maxX2; - int maxX3; - - CbArray4D <LBMReal, IndexerX4X3X2X1>::CbArray4DPtr localDistributions; - CbArray4D <LBMReal, IndexerX4X3X2X1>::CbArray4DPtr nonLocalDistributions; - CbArray3D <LBMReal, IndexerX3X2X1>::CbArray3DPtr zeroDistributions; - - EsoTwist3DPtr fDis; - -}; - -////////////////////////////////////////////////////////////////////////// -inline void D3Q27ETFullVectorConnector::fillData(vector_type& sdata, int& index, int x1, int x2, int x3) -{ - sdata[index++] = (*this->localDistributions)(D3Q27System::ET_E, x1, x2, x3); - sdata[index++] = (*this->localDistributions)(D3Q27System::ET_N, x1, x2, x3); - sdata[index++] = (*this->localDistributions)(D3Q27System::ET_T, x1, x2, x3); - sdata[index++] = (*this->localDistributions)(D3Q27System::ET_NE, x1, x2, x3); - sdata[index++] = (*this->localDistributions)(D3Q27System::ET_NW, x1 + 1, x2, x3); - sdata[index++] = (*this->localDistributions)(D3Q27System::ET_TE, x1, x2, x3); - sdata[index++] = (*this->localDistributions)(D3Q27System::ET_TW, x1 + 1, x2, x3); - sdata[index++] = (*this->localDistributions)(D3Q27System::ET_TN, x1, x2, x3); - sdata[index++] = (*this->localDistributions)(D3Q27System::ET_TS, x1, x2 + 1, x3); - sdata[index++] = (*this->localDistributions)(D3Q27System::ET_TNE, x1, x2, x3); - sdata[index++] = (*this->localDistributions)(D3Q27System::ET_TNW, x1 + 1, x2, x3); - sdata[index++] = (*this->localDistributions)(D3Q27System::ET_TSE, x1, x2 + 1, x3); - sdata[index++] = (*this->localDistributions)(D3Q27System::ET_TSW, x1 + 1, x2 + 1, x3); - - sdata[index++] = (*this->nonLocalDistributions)(D3Q27System::ET_W, x1 + 1, x2, x3); - sdata[index++] = (*this->nonLocalDistributions)(D3Q27System::ET_S, x1, x2 + 1, x3); - sdata[index++] = (*this->nonLocalDistributions)(D3Q27System::ET_B, x1, x2, x3 + 1); - sdata[index++] = (*this->nonLocalDistributions)(D3Q27System::ET_SW, x1 + 1, x2 + 1, x3); - sdata[index++] = (*this->nonLocalDistributions)(D3Q27System::ET_SE, x1, x2 + 1, x3); - sdata[index++] = (*this->nonLocalDistributions)(D3Q27System::ET_BW, x1 + 1, x2, x3 + 1); - sdata[index++] = (*this->nonLocalDistributions)(D3Q27System::ET_BE, x1, x2, x3 + 1); - sdata[index++] = (*this->nonLocalDistributions)(D3Q27System::ET_BS, x1, x2 + 1, x3 + 1); - sdata[index++] = (*this->nonLocalDistributions)(D3Q27System::ET_BN, x1, x2, x3 + 1); - sdata[index++] = (*this->nonLocalDistributions)(D3Q27System::ET_BSW, x1 + 1, x2 + 1, x3 + 1); - sdata[index++] = (*this->nonLocalDistributions)(D3Q27System::ET_BSE, x1, x2 + 1, x3 + 1); - sdata[index++] = (*this->nonLocalDistributions)(D3Q27System::ET_BNW, x1 + 1, x2, x3 + 1); - sdata[index++] = (*this->nonLocalDistributions)(D3Q27System::ET_BNE, x1, x2, x3 + 1); - - sdata[index++] = (*this->zeroDistributions)(x1, x2, x3); -} -////////////////////////////////////////////////////////////////////////// -inline void D3Q27ETFullVectorConnector::distributeData(vector_type& rdata, int& index, int x1, int x2, int x3) -{ - (*this->localDistributions)(D3Q27System::ET_E, x1, x2, x3) = rdata[index++]; - (*this->localDistributions)(D3Q27System::ET_N, x1, x2, x3) = rdata[index++]; - (*this->localDistributions)(D3Q27System::ET_T, x1, x2, x3) = rdata[index++]; - (*this->localDistributions)(D3Q27System::ET_NE, x1, x2, x3) = rdata[index++]; - (*this->localDistributions)(D3Q27System::ET_NW, x1 + 1, x2, x3) = rdata[index++]; - (*this->localDistributions)(D3Q27System::ET_TE, x1, x2, x3) = rdata[index++]; - (*this->localDistributions)(D3Q27System::ET_TW, x1 + 1, x2, x3) = rdata[index++]; - (*this->localDistributions)(D3Q27System::ET_TN, x1, x2, x3) = rdata[index++]; - (*this->localDistributions)(D3Q27System::ET_TS, x1, x2 + 1, x3) = rdata[index++]; - (*this->localDistributions)(D3Q27System::ET_TNE, x1, x2, x3) = rdata[index++]; - (*this->localDistributions)(D3Q27System::ET_TNW, x1 + 1, x2, x3) = rdata[index++]; - (*this->localDistributions)(D3Q27System::ET_TSE, x1, x2 + 1, x3) = rdata[index++]; - (*this->localDistributions)(D3Q27System::ET_TSW, x1 + 1, x2 + 1, x3) = rdata[index++]; - - (*this->nonLocalDistributions)(D3Q27System::ET_W, x1 + 1, x2, x3) = rdata[index++]; - (*this->nonLocalDistributions)(D3Q27System::ET_S, x1, x2 + 1, x3) = rdata[index++]; - (*this->nonLocalDistributions)(D3Q27System::ET_B, x1, x2, x3 + 1) = rdata[index++]; - (*this->nonLocalDistributions)(D3Q27System::ET_SW, x1 + 1, x2 + 1, x3) = rdata[index++]; - (*this->nonLocalDistributions)(D3Q27System::ET_SE, x1, x2 + 1, x3) = rdata[index++]; - (*this->nonLocalDistributions)(D3Q27System::ET_BW, x1 + 1, x2, x3 + 1) = rdata[index++]; - (*this->nonLocalDistributions)(D3Q27System::ET_BE, x1, x2, x3 + 1) = rdata[index++]; - (*this->nonLocalDistributions)(D3Q27System::ET_BS, x1, x2 + 1, x3 + 1) = rdata[index++]; - (*this->nonLocalDistributions)(D3Q27System::ET_BN, x1, x2, x3 + 1) = rdata[index++]; - (*this->nonLocalDistributions)(D3Q27System::ET_BSW, x1 + 1, x2 + 1, x3 + 1) = rdata[index++]; - (*this->nonLocalDistributions)(D3Q27System::ET_BSE, x1, x2 + 1, x3 + 1) = rdata[index++]; - (*this->nonLocalDistributions)(D3Q27System::ET_BNW, x1 + 1, x2, x3 + 1) = rdata[index++]; - (*this->nonLocalDistributions)(D3Q27System::ET_BNE, x1, x2, x3 + 1) = rdata[index++]; - - (*this->zeroDistributions)(x1, x2, x3) = rdata[index++]; -} - - -#endif //D3Q27VECTORCONNECTOR_H - diff --git a/src/VirtualFluids/Connectors/D3Q27ETOffConnectorFactory.cpp b/src/VirtualFluids/Connectors/D3Q27ETOffConnectorFactory.cpp deleted file mode 100644 index 1a3bb3940..000000000 --- a/src/VirtualFluids/Connectors/D3Q27ETOffConnectorFactory.cpp +++ /dev/null @@ -1,38 +0,0 @@ -//#include "D3Q27ETOffConnectorFactory.h" -//#include "TransmitterType.h" -//#include "D3Q27ETCFOffVectorConnector.h" -//#include "D3Q27ETFCOffVectorConnector.h" -//#include "D3Q27ETFCVectorConnector.h" -//#include "FineToCoarseBlock3DConnector.h" -// -//D3Q27ETOffConnectorFactory::D3Q27ETOffConnectorFactory() -//{ -//} -//////////////////////////////////////////////////////////////////////////// -//D3Q27ETOffConnectorFactory::~D3Q27ETOffConnectorFactory() -//{ -//} -//////////////////////////////////////////////////////////////////////////// -//Block3DConnectorPtr D3Q27ETOffConnectorFactory::createCoarseToFineConnector(Block3DPtr block, -// VectorTransmitterPtr sender00, VectorTransmitterPtr receiver00, -// VectorTransmitterPtr sender01, VectorTransmitterPtr receiver01, -// VectorTransmitterPtr sender10, VectorTransmitterPtr receiver10, -// VectorTransmitterPtr sender11, VectorTransmitterPtr receiver11, -// int sendDir, D3Q27InterpolationProcessorPtr iprocessor) -//{ -// return Block3DConnectorPtr(new D3Q27ETCFOffVectorConnector<VectorTransmitter>(block, -// sender00, receiver00, sender01, receiver01, -// sender10, receiver10, sender11, receiver11, -// sendDir, iprocessor)); -//} -//////////////////////////////////////////////////////////////////////////// -//Block3DConnectorPtr D3Q27ETOffConnectorFactory::createFineToCoarseConnector(Block3DPtr block, -// VectorTransmitterPtr sender, -// VectorTransmitterPtr receiver, -// int sendDir, -// D3Q27InterpolationProcessorPtr iprocessor, -// FineToCoarseBlock3DConnector::CFconnectorType connType) -//{ -// return Block3DConnectorPtr(new D3Q27ETFCOffVectorConnector<VectorTransmitter>(block, -// sender, receiver, sendDir, iprocessor, connType)); -//} diff --git a/src/VirtualFluids/Connectors/D3Q27ETOffConnectorFactory.h b/src/VirtualFluids/Connectors/D3Q27ETOffConnectorFactory.h deleted file mode 100644 index 3664a306c..000000000 --- a/src/VirtualFluids/Connectors/D3Q27ETOffConnectorFactory.h +++ /dev/null @@ -1,34 +0,0 @@ -//#ifndef D3Q27ETOffConnectorFactory_h__ -//#define D3Q27ETOffConnectorFactory_h__ -// -//#include "Block3DConnectorFactory.h" -// -//#include <memory> -//class D3Q27ETOffConnectorFactory; -//typedef std::shared_ptr<D3Q27ETOffConnectorFactory> D3Q27ETOffConnectorFactoryPtr; -// -//class D3Q27ETOffConnectorFactory : public Block3DConnectorFactory -//{ -//public: -// D3Q27ETOffConnectorFactory(); -// virtual ~D3Q27ETOffConnectorFactory(); -// -// virtual Block3DConnectorPtr createCoarseToFineConnector(Block3DPtr block, -// VectorTransmitterPtr sender00, VectorTransmitterPtr receiver00, -// VectorTransmitterPtr sender01, VectorTransmitterPtr receiver01, -// VectorTransmitterPtr sender10, VectorTransmitterPtr receiver10, -// VectorTransmitterPtr sender11, VectorTransmitterPtr receiver11, -// int sendDir, D3Q27InterpolationProcessorPtr iprocessor); -// -// virtual Block3DConnectorPtr createFineToCoarseConnector(Block3DPtr block, -// VectorTransmitterPtr sender, -// VectorTransmitterPtr receiver, -// int sendDir, -// D3Q27InterpolationProcessorPtr iprocessor, -// FineToCoarseBlock3DConnector::CFconnectorType connType); -// -//private: -// -//}; -//#endif // D3Q27ETOffConnectorFactory_h__ - diff --git a/src/VirtualFluids/Connectors/FineToCoarseBlock3DConnector.cpp b/src/VirtualFluids/Connectors/FineToCoarseBlock3DConnector.cpp deleted file mode 100644 index e0c2db2ab..000000000 --- a/src/VirtualFluids/Connectors/FineToCoarseBlock3DConnector.cpp +++ /dev/null @@ -1,77 +0,0 @@ -#include "FineToCoarseBlock3DConnector.h" - -//////////////////////////////////////////////////////////////////////////// -FineToCoarseBlock3DConnector::FineToCoarseBlock3DConnector(Block3DPtr block, VectorTransmitterPtr sender, - VectorTransmitterPtr receiver, int sendDir, - InterpolationProcessorPtr iprocessor, - CFconnectorType connType) - : Block3DConnector(sendDir) - , block(block) - , sender(sender) - , receiver(receiver) - , iprocessor(iprocessor) - , connType(connType) -{ - if (!(sendDir==D3Q27System::E || sendDir==D3Q27System::W || sendDir==D3Q27System::N || sendDir==D3Q27System::S || sendDir==D3Q27System::T || sendDir==D3Q27System::B - || sendDir==D3Q27System::NE || sendDir==D3Q27System::SW || sendDir==D3Q27System::SE || sendDir==D3Q27System::NW - || sendDir==D3Q27System::TE || sendDir==D3Q27System::BW || sendDir==D3Q27System::BE || sendDir==D3Q27System::TW - || sendDir==D3Q27System::TN || sendDir==D3Q27System::BS || sendDir==D3Q27System::BN || sendDir==D3Q27System::TS - - || sendDir==D3Q27System::TNE || sendDir==D3Q27System::TNW || sendDir==D3Q27System::TSE || sendDir==D3Q27System::TSW - || sendDir==D3Q27System::BNE || sendDir==D3Q27System::BNW || sendDir==D3Q27System::BSE || sendDir==D3Q27System::BSW - - )) - { - throw UbException(UB_EXARGS, "invalid constructor for this direction"); - } -} -////////////////////////////////////////////////////////////////////////// -bool FineToCoarseBlock3DConnector::isLocalConnector() -{ - return !this->isRemoteConnector(); -} -////////////////////////////////////////////////////////////////////////// -bool FineToCoarseBlock3DConnector::isRemoteConnector() -{ - return sender->isRemoteTransmitter() || receiver->isRemoteTransmitter(); -} -////////////////////////////////////////////////////////////////////////// -void FineToCoarseBlock3DConnector::sendTransmitterDataSize() -{ - if (sender) - { - UBLOG(logDEBUG5, "FineToCoarseBlock3DConnector<VectorTransmitter>::sendTransmitterDataSize()"<<block.lock()->toString()+"sendDir="<<sendDir); - sender->sendDataSize(); - } -} -////////////////////////////////////////////////////////////////////////// -void FineToCoarseBlock3DConnector::receiveTransmitterDataSize() -{ - if (receiver) - { - UBLOG(logDEBUG5, "FineToCoarseBlock3DConnector<VectorTransmitter>::receiveTransmitterDataSize()"<<block.lock()->toString()<<"sendDir="<<sendDir); - receiver->receiveDataSize(); - } -} -////////////////////////////////////////////////////////////////////////// -void FineToCoarseBlock3DConnector::prepareForSend() -{ - if (sender) sender->prepareForSend(); -} -////////////////////////////////////////////////////////////////////////// -void FineToCoarseBlock3DConnector::sendVectors() -{ - if (sender) sender->sendData(); -} -////////////////////////////////////////////////////////////////////////// -void FineToCoarseBlock3DConnector::prepareForReceive() -{ - if (receiver) receiver->prepareForReceive(); -} -////////////////////////////////////////////////////////////////////////// -void FineToCoarseBlock3DConnector::receiveVectors() -{ - if (receiver) receiver->receiveData(); -} - - diff --git a/src/VirtualFluids/Connectors/FineToCoarseBlock3DConnector.h b/src/VirtualFluids/Connectors/FineToCoarseBlock3DConnector.h deleted file mode 100644 index 2df9ba32c..000000000 --- a/src/VirtualFluids/Connectors/FineToCoarseBlock3DConnector.h +++ /dev/null @@ -1,95 +0,0 @@ -//! \file FineToCoarseBlock3DConnector.h -//! \brief Base class for connectors that interpolates and sends data from fine level to coarse. -//! \author Konstantin Kutscher -//! \date 21.05.2015 - -#ifndef FineToCoarseBlock3DConnector_H -#define FineToCoarseBlock3DConnector_H - -#include "TransmitterType.h" -#include "Block3DConnector.h" -#include "D3Q27System.h" -#include "Block3D.h" -#include "LBMKernel.h" -#include "InterpolationProcessor.h" - -#include <memory> - - -class Block3D; - -//! \class FineToCoarseBlock3DConnector -//! \brief Base class for connectors that interpolates and sends data from fine level to coarse. -//! \details The data is copied in a vector (this is located in the transmitter). -//! The vector is transmitted via transmitter. -//! The transmitter can be a local, MPI, RCG, CTL or whatever -//! which a transmitter that is derived from transmitter base class. -//! -//! four fine blocks inside a coarse block: -//! -//! | | | -//! |:--:|:---| -//! | 01 | 11 | -//! | 00 | 10 | -//! -//! send direction: -//! -//! |E<->W | N<->S | T<->B | -//! |--------|---------|--------| -//! | x3 | x3 | x2 | -//! | ^ | ^ | ^ | -//! | +->x2 | +->x1 | +->x1| - -class FineToCoarseBlock3DConnector : public Block3DConnector -{ -public: - enum CFconnectorType { Type00, Type10, Type01, Type11 }; -public: - FineToCoarseBlock3DConnector(Block3DPtr block, VectorTransmitterPtr sender, VectorTransmitterPtr receiver, int sendDir, InterpolationProcessorPtr iprocessor, CFconnectorType connType); - - bool isLocalConnector(); - bool isRemoteConnector(); - - void sendTransmitterDataSize(); - void receiveTransmitterDataSize(); - - void prepareForSend(); - void sendVectors(); - - void prepareForReceive(); - void receiveVectors(); - - virtual void init()=0; - virtual void fillSendVectors()=0; - virtual void distributeReceiveVectors()=0; - - bool isInterpolationConnectorCF() { return false; } - bool isInterpolationConnectorFC() { return true; } - - void prepareForSendX1() {} - void prepareForSendX2() {} - void prepareForSendX3() {} - - void sendVectorsX1() {} - void sendVectorsX2() {} - void sendVectorsX3() {} - - void prepareForReceiveX1() {} - void prepareForReceiveX2() {} - void prepareForReceiveX3() {} - - void receiveVectorsX1() {} - void receiveVectorsX2() {} - void receiveVectorsX3() {} - -protected: - std::weak_ptr<Block3D> block; - VectorTransmitterPtr sender, receiver; - InterpolationProcessorPtr iprocessor; - CFconnectorType connType; -}; - - - -#endif - diff --git a/src/VirtualFluids/Connectors/FineToCoarseNodeSetBlock3DConnector.cpp b/src/VirtualFluids/Connectors/FineToCoarseNodeSetBlock3DConnector.cpp deleted file mode 100644 index a61c8d1ba..000000000 --- a/src/VirtualFluids/Connectors/FineToCoarseNodeSetBlock3DConnector.cpp +++ /dev/null @@ -1,1235 +0,0 @@ -#include "FineToCoarseNodeSetBlock3DConnector.h" -#include "BCProcessor.h" -#include "DataSet3D.h" - - -////////////////////////////////////////////////////////////////////////// -FineToCoarseNodeSetBlock3DConnector::FineToCoarseNodeSetBlock3DConnector(Block3DPtr block, VectorTransmitterPtr sender, VectorTransmitterPtr receiver, - int sendDir, InterpolationProcessorPtr iprocessor, CFconnectorType connType) : FineToCoarseBlock3DConnector(block, sender, receiver, sendDir, iprocessor, connType) -{ - -} -////////////////////////////////////////////////////////////////////////// -void FineToCoarseNodeSetBlock3DConnector::init() -{ - bMaxX1 = (int)FineToCoarseBlock3DConnector::block.lock()->getKernel()->getDataSet()->getFdistributions()->getNX1(); - bMaxX2 = (int)FineToCoarseBlock3DConnector::block.lock()->getKernel()->getDataSet()->getFdistributions()->getNX2(); - bMaxX3 = (int)FineToCoarseBlock3DConnector::block.lock()->getKernel()->getDataSet()->getFdistributions()->getNX3(); - - minX1 = 0; - minX2 = 0; - minX3 = 0; - maxX1 = bMaxX1 - 1; - maxX2 = bMaxX2 - 1; - maxX3 = bMaxX3 - 1; - - minOffX1 = 0; - minOffX2 = 0; - minOffX3 = 0; - - maxOffX1 = 0; - maxOffX2 = 0; - maxOffX3 = 0; - - if (Utilities::isEven(bMaxX1)) - { - minOffX1 = 0; - maxOffX1 = 0; - } - else if (Utilities::isOdd(bMaxX1)) - { - minOffX1 = 1; - maxOffX1 = -1; - } - - if (Utilities::isEven(bMaxX2)) - { - minOffX2 = 0; - maxOffX2 = 0; - } - else if (Utilities::isOdd(bMaxX2)) - { - minOffX2 = 1; - maxOffX2 = -1; - } - - if (Utilities::isEven(bMaxX3)) - { - minOffX3 = 0; - maxOffX3 = 0; - } - else if (Utilities::isOdd(bMaxX3)) - { - minOffX3 = 1; - maxOffX3 = -1; - } - - //int sendSize = 0; - LBMReal initValue = -999.0; - - int sendDataPerNode = 27/*f*/; - int iCellSize = 1; //size of interpolation cell - - findFCCells(); - findCFCells(); - - ////////////////////////////////////////////////////// - //Debug - ////////////////////////////////////////////////////// - if (FineToCoarseBlock3DConnector::block.lock()->getGlobalID() == 2183) - { - int test = 0; - } - - - if (FineToCoarseBlock3DConnector::sender) FineToCoarseBlock3DConnector::sender->getData().resize(iNodeSetSender.size()*iCellSize*sendDataPerNode, initValue); - else FineToCoarseBlock3DConnector::sender = VectorTransmitterPtr(new TbLocalTransmitter< CbVector< LBMReal > >()); - - if (!FineToCoarseBlock3DConnector::receiver) FineToCoarseBlock3DConnector::receiver = VectorTransmitterPtr(new TbLocalTransmitter< CbVector< LBMReal > >()); -} -////////////////////////////////////////////////////////////////////////// -void FineToCoarseNodeSetBlock3DConnector::findFCCells(int lMinX1, int lMinX2, int lMinX3, int lMaxX1, int lMaxX2, int lMaxX3, INodeSet &inodes) -{ - ////////////////////////////////////////////////////// - //Debug - ////////////////////////////////////////////////////// - if (FineToCoarseBlock3DConnector::block.lock()->getGlobalID() == 2183) - { - int test = 0; - } - - - int ix1, ix2, ix3; - LBMReal x1off, x2off, x3off; - - DistributionArray3DPtr fFrom = FineToCoarseBlock3DConnector::block.lock()->getKernel()->getDataSet()->getFdistributions(); - BCArray3DPtr bcArray = FineToCoarseBlock3DConnector::block.lock()->getKernel()->getBCProcessor()->getBCArray(); - - for (ix3 = lMinX3; ix3<=lMaxX3; ix3 += 2) - { - for (ix2 = lMinX2; ix2<=lMaxX2; ix2 += 2) - { - for (ix1 = lMinX1; ix1<=lMaxX1; ix1 += 2) - { - D3Q27ICell icellC; - - int howManySolids = FineToCoarseBlock3DConnector::iprocessor->iCellHowManySolids(bcArray, ix1, ix2, ix3); - - if (howManySolids == 0 || howManySolids == 8) - { - x1off = 0.0; - x2off = 0.0; - x3off = 0.0; - } - else - { - if (!iprocessor->findNeighborICell(bcArray, fFrom, icellC, bMaxX1, bMaxX2, bMaxX3, ix1, ix2, ix3, x1off, x2off, x3off)) - { - std::string err = "For "+FineToCoarseBlock3DConnector::block.lock()->toString()+" x1="+UbSystem::toString(ix1)+", x2=" + UbSystem::toString(ix2)+", x3=" + UbSystem::toString(ix3)+ - " interpolation is not implemented for other direction"+ - " by using in: "+(std::string)typeid(*this).name()+ - " or maybe you have a solid on the block boundary"; - UB_THROW(UbException(UB_EXARGS, err)); - } - } - - INodeVector inv; - inv.push_back(ix1 + (int)x1off); - inv.push_back(ix2 + (int)x2off); - inv.push_back(ix3 + (int)x3off); - inv.push_back((int)x1off); - inv.push_back((int)x2off); - inv.push_back((int)x3off); - //inodes.insert(inv); - inodes.push_back(inv); - } - } - } -} -////////////////////////////////////////////////////////////////////////// - -void FineToCoarseNodeSetBlock3DConnector::findFCCells() -{ - using namespace D3Q27System; - - int lMin1X1, lMin1X2, lMin1X3, lMax1X1, lMax1X2, lMax1X3; - int lMin2X1, lMin2X2, lMin2X3, lMax2X1, lMax2X2, lMax2X3; - int lMin3X1, lMin3X2, lMin3X3, lMax3X1, lMax3X2, lMax3X3; - - //lMin1X1 = minX1+1; lMin1X2 = minX2+1; lMin1X3 = minX3+1; - //lMax1X1 = maxX1-1; lMax1X2 = maxX2-1; lMax1X3 = maxX3-1; - //getLocalMinMax(lMin1X1, lMin1X2, lMin1X3, lMax1X1, lMax1X2, lMax1X3); - - //lMin2X1 = minX1+1; lMin2X2 = minX2+1; lMin2X3 = minX3+1; - //lMax2X1 = maxX1-1; lMax2X2 = maxX2-1; lMax2X3 = maxX3-1; - //getLocalMinMax(lMin2X1, lMin2X2, lMin2X3, lMax2X1, lMax2X2, lMax2X3); - - //lMin3X1 = minX1+1; lMin3X2 = minX2+1; lMin3X3 = minX3+1; - //lMax3X1 = maxX1-1; lMax3X2 = maxX2-1; lMax3X3 = maxX3-1; - //getLocalMinMax(lMin3X1, lMin3X2, lMin3X3, lMax3X1, lMax3X2, lMax3X3); - - switch (sendDir) - { - //faces - case E: case W: - if (sendDir == E) - { - lMin1X1 = maxX1 - 6; - lMax1X1 = lMin1X1; - } - else if (sendDir == W) - { - lMin1X1 = 5; - lMax1X1 = lMin1X1; - } - - if (FineToCoarseBlock3DConnector::connType ==FineToCoarseBlock3DConnector::Type00) - { - lMin1X2 = minX2; - lMax1X2 = maxX2 + maxOffX2 - 1; - lMin1X3 = minX3; - lMax1X3 = maxX3 + maxOffX3 - 1; - } - else if (FineToCoarseBlock3DConnector::connType ==FineToCoarseBlock3DConnector::Type10) - { - lMin1X2 = minX2 + minOffX2; - lMax1X2 = maxX2 - 1; - lMin1X3 = minX3; - lMax1X3 = maxX3 + maxOffX3 - 1; - } - else if (FineToCoarseBlock3DConnector::connType ==FineToCoarseBlock3DConnector::Type01) - { - lMin1X2 = minX2; - lMax1X2 = maxX2 + maxOffX2 - 1; - lMin1X3 = minX3 + minOffX3; - lMax1X3 = maxX3 - 1; - } - else if (FineToCoarseBlock3DConnector::connType ==FineToCoarseBlock3DConnector::Type11) - { - lMin1X2 = minX2 + minOffX2; - lMax1X2 = maxX2 - 1; - lMin1X3 = minX3 + minOffX3; - lMax1X3 = maxX3 - 1; - } - findFCCells(lMin1X1, lMin1X2, lMin1X3, lMax1X1, lMax1X2, lMax1X3, iNodeSetSender); - break; - case N: case S: - if (sendDir == N) - { - lMin1X2 = maxX2 - 6; - lMax1X2 = lMin1X2; - } - else if (sendDir == S) - { - lMin1X2 = 5; - lMax1X2 = lMin1X2; - } - - if (FineToCoarseBlock3DConnector::connType ==FineToCoarseBlock3DConnector::Type00) - { - lMin1X1 = minX1; - lMax1X1 = maxX1 + maxOffX1 - 1; - lMin1X3 = minX3; - lMax1X3 = maxX3 + maxOffX3 - 1; - } - else if (FineToCoarseBlock3DConnector::connType ==FineToCoarseBlock3DConnector::Type10) - { - lMin1X1 = minX1 + minOffX1; - lMax1X1 = maxX1 - 1; - lMin1X3 = minX3; - lMax1X3 = maxX3 + maxOffX3 - 1; - } - else if (FineToCoarseBlock3DConnector::connType ==FineToCoarseBlock3DConnector::Type01) - { - lMin1X1 = minX1; - lMax1X1 = maxX1 + maxOffX1 - 1; - lMin1X3 = minX3 + minOffX3; - lMax1X3 = maxX3; - } - else if (FineToCoarseBlock3DConnector::connType ==FineToCoarseBlock3DConnector::Type11) - { - lMin1X1 = minX1 + minOffX1; - lMax1X1 = maxX1 - 1; - lMin1X3 = minX3 + minOffX3; - lMax1X3 = maxX3 - 1; - } - findFCCells(lMin1X1, lMin1X2, lMin1X3, lMax1X1, lMax1X2, lMax1X3, iNodeSetSender); - break; - case T: case B: - if (sendDir == T) - { - lMin1X3 = maxX3 - 6; - lMax1X3 = lMin1X3; - } - else if (sendDir == B) - { - lMin1X3 = 5; - lMax1X3 = lMin1X3; - } - - if (FineToCoarseBlock3DConnector::connType ==FineToCoarseBlock3DConnector::Type00) - { - lMin1X1 = minX1; - lMax1X1 = maxX1 + maxOffX1 - 1; - lMin1X2 = minX2; - lMax1X2 = maxX2 + maxOffX2 - 1; - } - else if (FineToCoarseBlock3DConnector::connType ==FineToCoarseBlock3DConnector::Type10) - { - lMin1X1 = minX1 + minOffX1; - lMax1X1 = maxX1 - 1; - lMin1X2 = minX2; - lMax1X2 = maxX2 + maxOffX2 - 1; - } - else if (FineToCoarseBlock3DConnector::connType ==FineToCoarseBlock3DConnector::Type01) - { - lMin1X1 = minX1; - lMax1X1 = maxX1 + maxOffX1 - 1; - lMin1X2 = minX2 + minOffX2; - lMax1X2 = maxX2 - 1; - } - else if (FineToCoarseBlock3DConnector::connType ==FineToCoarseBlock3DConnector::Type11) - { - lMin1X1 = minX1 + minOffX1; - lMax1X1 = maxX1 - 1; - lMin1X2 = minX2 + minOffX2; - lMax1X2 = maxX2 - 1; - } - findFCCells(lMin1X1, lMin1X2, lMin1X3, lMax1X1, lMax1X2, lMax1X3, iNodeSetSender); - break; - //edges - //N-S-E-W - case NE: case SW: case SE: case NW: - if (sendDir == NE) - { - lMin1X1 = maxX1 - 6; - lMax1X1 = lMin1X1 + 4; - lMin1X2 = maxX2 - 6; - lMax1X2 = lMin1X2; - - lMin2X1 = maxX1 - 6; - lMax2X1 = lMin2X1; - lMin2X2 = maxX2 - 6; - lMax2X2 = lMin2X2 + 4; - } - else if (sendDir == SW) - { - lMin1X1 = 1; - lMax1X1 = lMin1X1 + 4; - lMin1X2 = 5; - lMax1X2 = lMin1X2; - - lMin2X1 = 5; - lMax2X1 = lMin2X1; - lMin2X2 = 1; - lMax2X2 = lMin2X2 + 4; - } - else if (sendDir == SE) - { - lMin1X1 = maxX1 - 6; - lMax1X1 = lMin1X1 + 4; - lMin1X2 = 5; - lMax1X2 = lMin1X2; - - lMin2X1 = maxX1 - 6; - lMax2X1 = lMin2X1; - lMin2X2 = 1; - lMax2X2 = lMin2X2 + 4; - } - else if (sendDir == NW) - { - lMin1X1 = 1; - lMax1X1 = lMin1X1 + 4; - lMin1X2 = maxX2 - 6; - lMax1X2 = lMin1X2; - - lMin2X1 = 5; - lMax2X1 = lMin2X1; - lMin2X2 = maxX2 - 6; - lMax2X2 = lMin2X2 + 4; - } - - if (FineToCoarseBlock3DConnector::connType ==FineToCoarseBlock3DConnector::Type00) - { - lMin1X3 = minX3; - lMax1X3 = maxX3 + maxOffX3 - 1; - } - else if (FineToCoarseBlock3DConnector::connType ==FineToCoarseBlock3DConnector::Type10) - { - lMin1X3 = minX3 + minOffX3; - lMax1X3 = maxX3 - 1; - } - - findFCCells(lMin1X1, lMin1X2, lMin1X3, lMax1X1, lMax1X2, lMax1X3, iNodeSetSender); - findFCCells(lMin2X1, lMin2X2, lMin1X3, lMax2X1, lMax2X2, lMax1X3, iNodeSetSender); - - break; - //T-B-E-W - case TE: case BW: case BE: case TW: - if (sendDir == TE) - { - lMin1X1 = maxX1 - 6; - lMax1X1 = lMin1X1 + 4; - lMin1X3 = maxX3 - 6; - lMax1X3 = lMin1X3; - - lMin2X1 = maxX1 - 6; - lMax2X1 = lMin2X1; - lMin2X3 = maxX3 - 6; - lMax2X3 = lMin2X3 + 4; - } - else if (sendDir == BW) - { - lMin1X1 = 1; - lMax1X1 = lMin1X1 + 4; - lMin1X3 = 5; - lMax1X3 = lMin1X3; - - lMin2X1 = 5; - lMax2X1 = lMin2X1; - lMin2X3 = 1; - lMax2X3 = lMin2X3 + 4; - } - else if (sendDir == BE) - { - lMin1X1 = maxX1 - 6; - lMax1X1 = lMin1X1 + 4; - lMin1X3 = 5; - lMax1X3 = lMin1X3; - - - lMin2X1 = maxX1 - 6; - lMax2X1 = lMin2X1; - lMin2X3 = 1; - lMax2X3 = lMin2X3 + 4; - } - else if (sendDir == TW) - { - lMin1X1 = 1; - lMax1X1 = lMin1X1 + 5; - lMin1X3 = maxX3 - 6; - lMax1X3 = lMin1X3; - - lMin2X1 = 5; - lMax2X1 = lMin2X1; - lMin2X3 = maxX3 - 6; - lMax2X3 = lMin2X3 + 4; - } - - if (FineToCoarseBlock3DConnector::connType ==FineToCoarseBlock3DConnector::Type00) - { - lMin1X2 = minX2; - lMax1X2 = maxX2 + maxOffX2 - 1; - } - else if (FineToCoarseBlock3DConnector::connType ==FineToCoarseBlock3DConnector::Type10) - { - lMin1X2 = minX2 + minOffX2; - lMax1X2 = maxX2 - 1; - } - - findFCCells(lMin1X1, lMin1X2, lMin1X3, lMax1X1, lMax1X2, lMax1X3, iNodeSetSender); - findFCCells(lMin2X1, lMin1X2, lMin2X3, lMax2X1, lMax1X2, lMax2X3, iNodeSetSender); - break; - //T-B-N-S - case TN: case BS: case BN: case TS: - if (sendDir == TN) - { - lMin1X2 = maxX2 - 6; - lMax1X2 = lMin1X2 + 4; - lMin1X3 = maxX3 - 6; - lMax1X3 = lMin1X3; - - lMin2X2 = maxX2 - 6; - lMax2X2 = lMin2X2; - lMin2X3 = maxX3 - 6; - lMax2X3 = lMin2X3 + 4; - } - else if (sendDir == BS) - { - lMin1X2 = 1; - lMax1X2 = lMin1X2 + 4; - lMin1X3 = 5; - lMax1X3 = lMin1X3; - - lMin2X2 = 5; - lMax2X2 = lMin2X2; - lMin2X3 = 1; - lMax2X3 = lMin2X3 + 4; - } - else if (sendDir == BN) - { - lMin1X2 = maxX2 - 6; - lMax1X2 = lMin1X2 + 4; - lMin1X3 = 5; - lMax1X3 = lMin1X3; - - lMin2X2 = maxX2 - 6; - lMax2X2 = lMin2X2; - lMin2X3 = 1; - lMax2X3 = lMin2X3 + 4; - } - else if (sendDir == TS) - { - lMin1X2 = 1; - lMax1X2 = lMin1X2 + 4; - lMin1X3 = maxX3 - 6; - lMax1X3 = lMin1X3; - - lMin2X2 = 5; - lMax2X2 = lMin2X2; - lMin2X3 = maxX3 - 6; - lMax2X3 = lMin2X3 + 4; - } - - if (FineToCoarseBlock3DConnector::connType ==FineToCoarseBlock3DConnector::Type00) - { - lMin1X1 = minX1; - lMax1X1 = maxX1 + maxOffX1 - 1; - } - else if (FineToCoarseBlock3DConnector::connType ==FineToCoarseBlock3DConnector::Type10) - { - lMin1X1 = minX1 + minOffX1; - lMax1X1 = maxX1 - 1; - } - - findFCCells(lMin1X1, lMin1X2, lMin1X3, lMax1X1, lMax1X2, lMax1X3, iNodeSetSender); - findFCCells(lMin1X1, lMin2X2, lMin2X3, lMax1X1, lMax2X2, lMax2X3, iNodeSetSender); - break; - //corners - case TNE: case TNW: case TSE: case TSW: case BNE: case BNW: case BSE: case BSW: - if (sendDir == TNE) - { - lMin1X1 = maxX1-6; - lMax1X1 = maxX1-6; - lMin1X2 = maxX2-6; - lMax1X2 = maxX2-2; - lMin1X3 = maxX3-6; - lMax1X3 = maxX3-2; - - lMin2X1 = maxX1-6; - lMax2X1 = maxX1-2; - lMin2X2 = maxX2-6; - lMax2X2 = maxX2-6; - lMin2X3 = maxX3-6; - lMax2X3 = maxX3-1; - - lMin3X1 = maxX1-6; - lMax3X1 = maxX1-2; - lMin3X2 = maxX2-6; - lMax3X2 = maxX2-2; - lMin3X3 = maxX3-6; - lMax3X3 = maxX3-5; - } - else if (sendDir == TNW) - { - lMin1X1 = 5; - lMax1X1 = 5; - lMin1X2 = maxX2-6; - lMax1X2 = maxX2-2; - lMin1X3 = maxX3-6; - lMax1X3 = maxX3-2; - - lMin2X1 = 1; - lMax2X1 = 5; - lMin2X2 = maxX2-6; - lMax2X2 = maxX2-6; - lMin2X3 = maxX3-6; - lMax2X3 = maxX3-2; - - lMin3X1 = 1; - lMax3X1 = 5; - lMin3X2 = maxX2-6; - lMax3X2 = maxX2-2; - lMin3X3 = maxX3-6; - lMax3X3 = maxX3-6; - } - else if (sendDir == TSE) - { - lMin1X1 = maxX1-6; - lMax1X1 = maxX1-6; - lMin1X2 = 1; - lMax1X2 = 5; - lMin1X3 = maxX3-6; - lMax1X3 = maxX3-2; - - lMin2X1 = maxX1-6; - lMax2X1 = maxX1-2; - lMin2X2 = 5; - lMax2X2 = 5; - lMin2X3 = maxX3-6; - lMax2X3 = maxX3-2; - - lMin3X1 = maxX1-6; - lMax3X1 = maxX1-2; - lMin3X2 = 1; - lMax3X2 = 5; - lMin3X3 = maxX3-6; - lMax3X3 = maxX3-6; - } - else if (sendDir == TSW) - { - lMin1X1 = 5; - lMax1X1 = 5; - lMin1X2 = 1; - lMax1X2 = 5; - lMin1X3 = maxX3-6; - lMax1X3 = maxX3-2; - - lMin2X1 = 1; - lMax2X1 = 5; - lMin2X2 = 5; - lMax2X2 = 5; - lMin2X3 = maxX3-6; - lMax2X3 = maxX3-2; - - lMin3X1 = 1; - lMax3X1 = 5; - lMin3X2 = 1; - lMax3X2 = 5; - lMin3X3 = maxX3-6; - lMax3X3 = maxX3-6; - } - else if (sendDir == BNE) - { - lMin1X1 = maxX1-6; - lMax1X1 = maxX1-6; - lMin1X2 = maxX2-6; - lMax1X2 = maxX2-2; - lMin1X3 = 1; - lMax1X3 = 5; - - lMin2X1 = maxX1-6; - lMax2X1 = maxX1-2; - lMin2X2 = maxX2-6; - lMax2X2 = maxX2-6; - lMin2X3 = 1; - lMax2X3 = 5; - - lMin3X1 = maxX1-6; - lMax3X1 = maxX1-2; - lMin3X2 = maxX2-6; - lMax3X2 = maxX2-2; - lMin3X3 = 5; - lMax3X3 = 5; - } - else if (sendDir == BNW) - { - lMin1X1 = 5; - lMax1X1 = 5; - lMin1X2 = maxX2-6; - lMax1X2 = maxX2-2; - lMin1X3 = 1; - lMax1X3 = 5; - - lMin2X1 = 1; - lMax2X1 = 5; - lMin2X2 = maxX2-6; - lMax2X2 = maxX2-6; - lMin2X3 = 1; - lMax2X3 = 5; - - lMin3X1 = 1; - lMax3X1 = 5; - lMin3X2 = maxX2-6; - lMax3X2 = maxX2-2; - lMin3X3 = 5; - lMax3X3 = 5; - } - else if (sendDir == BSE) - { - lMin1X1 = maxX1-6; - lMax1X1 = maxX1-6; - lMin1X2 = 1; - lMax1X2 = 5; - lMin1X3 = 1; - lMax1X3 = 5; - - lMin2X1 = maxX1-6; - lMax2X1 = maxX1-2; - lMin2X2 = 5; - lMax2X2 = 5; - lMin2X3 = 1; - lMax2X3 = 5; - - lMin3X1 = maxX1-5; - lMax3X1 = maxX1-2; - lMin3X2 = 1; - lMax3X2 = 5; - lMin3X3 = 5; - lMax3X3 = 5; - } - else if (sendDir == BSW) - { - lMin1X1 = 5; - lMax1X1 = 5; - lMin1X2 = 1; - lMax1X2 = 5; - lMin1X3 = 1; - lMax1X3 = 5; - - lMin2X1 = 1; - lMax2X1 = 5; - lMin2X2 = 5; - lMax2X2 = 5; - lMin2X3 = 1; - lMax2X3 = 5; - - lMin3X1 = 1; - lMax3X1 = 5; - lMin3X2 = 1; - lMax3X2 = 5; - lMin3X3 = 5; - lMax3X3 = 5; - } - findFCCells(lMin1X1, lMin1X2, lMin1X3, lMax1X1, lMax1X2, lMax1X3, iNodeSetSender); - findFCCells(lMin2X1, lMin2X2, lMin2X3, lMax2X1, lMax2X2, lMax2X3, iNodeSetSender); - findFCCells(lMin3X1, lMin3X2, lMin3X3, lMax3X1, lMax3X2, lMax3X3, iNodeSetSender); - break; - } -} -////////////////////////////////////////////////////////////////////////// -void FineToCoarseNodeSetBlock3DConnector::fillSendVectors() -{ - using namespace D3Q27System; - - DistributionArray3DPtr fFrom = block.lock()->getKernel()->getDataSet()->getFdistributions(); - - int index = 0; - - vector_type& data = this->sender->getData(); - - for(INodeVector inode : iNodeSetSender) - { - LBMReal icellC[27]; - D3Q27ICell icellF; - iprocessor->readICell(fFrom, icellF, inode[0], inode[1], inode[2]); - iprocessor->interpolateFineToCoarse(icellF, icellC, inode[3], inode[4], inode[5]); - writeICellCtoData(data, index, icellC); - } - -} -////////////////////////////////////////////////////////////////////////// -void FineToCoarseNodeSetBlock3DConnector::readICellFfromData(vector_type& data, int& index, D3Q27ICell& icellF) -{ - readNodeFromVector(data, index, icellF.BSW); - readNodeFromVector(data, index, icellF.BSE); - readNodeFromVector(data, index, icellF.BNW); - readNodeFromVector(data, index, icellF.BNE); - readNodeFromVector(data, index, icellF.TSW); - readNodeFromVector(data, index, icellF.TSE); - readNodeFromVector(data, index, icellF.TNW); - readNodeFromVector(data, index, icellF.TNE); -} -////////////////////////////////////////////////////////////////////////// -void FineToCoarseNodeSetBlock3DConnector::readNodeFromVector(vector_type& data, int& index, LBMReal* inode) -{ - for (int i = D3Q27System::STARTF; i < D3Q27System::ENDF+1; i++) - { - inode[i] = data[index++]; - } -} -////////////////////////////////////////////////////////////////////////// -void FineToCoarseNodeSetBlock3DConnector::writeICellCtoData(vector_type& data, int& index, LBMReal* icellC) -{ - for (int i = D3Q27System::STARTF; i < D3Q27System::ENDF+1; i++) - { - data[index++] = icellC[i]; - } -} -////////////////////////////////////////////////////////////////////////// -void FineToCoarseNodeSetBlock3DConnector::findCFCells(int lMinX1, int lMinX2, int lMinX3, int lMaxX1, int lMaxX2, int lMaxX3, INodeSet &inodes) -{ - int ix1, ix2, ix3; - - for (ix3 = lMinX3; ix3<=lMaxX3; ix3 += 2) - { - for (ix2 = lMinX2; ix2<=lMaxX2; ix2 += 2) - { - for (ix1 = lMinX1; ix1<=lMaxX1; ix1 += 2) - { - INodeVector inv; - inv.push_back(ix1); - inv.push_back(ix2); - inv.push_back(ix3); - //inodes.insert(inv); - inodes.push_back(inv); - } - } - } -} -////////////////////////////////////////////////////////////////////////// -void FineToCoarseNodeSetBlock3DConnector::findCFCells() -{ - using namespace D3Q27System; - - int lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3; - - ////////////////////////////////////////////////////// - //Debug - ////////////////////////////////////////////////////// - if (block.lock()->getGlobalID() == 2183) - { - int test = 0; - } - - switch (sendDir) - { - //faces - case E: case W: - if (sendDir == E) - { - lMinX1 = maxX1 - 3; - lMaxX1 = lMinX1; - } - else if (sendDir == W) - { - lMinX1 = 2; - lMaxX1 = lMinX1; - } - - if (FineToCoarseBlock3DConnector::connType ==FineToCoarseBlock3DConnector::Type00) - { - lMinX2 = minX2; - lMaxX2 = maxX2 + maxOffX2 - 1; - lMinX3 = minX3; - lMaxX3 = maxX3 + maxOffX3 - 1; - } - else if (FineToCoarseBlock3DConnector::connType ==FineToCoarseBlock3DConnector::Type10) - { - lMinX2 = minX2 + minOffX2; - lMaxX2 = maxX2 - 1; - lMinX3 = minX3; - lMaxX3 = maxX3 + maxOffX3 - 1; - } - else if (FineToCoarseBlock3DConnector::connType ==FineToCoarseBlock3DConnector::Type01) - { - lMinX2 = minX2; - lMaxX2 = maxX2 + maxOffX2 - 1; - lMinX3 = minX3 + minOffX3; - lMaxX3 = maxX3 - 1; - } - else if (FineToCoarseBlock3DConnector::connType ==FineToCoarseBlock3DConnector::Type11) - { - lMinX2 = minX2 + minOffX2; - lMaxX2 = maxX2 - 1; - lMinX3 = minX3 + minOffX3; - lMaxX3 = maxX3 - 1; - } - findCFCells(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, iNodeSetReceiver); - break; - case N: case S: - if (sendDir == N) - { - lMinX2 = maxX2 - 3; - lMaxX2 = lMinX2; - } - else if (sendDir == S) - { - lMinX2 = 2; - lMaxX2 = lMinX2; - } - - if (FineToCoarseBlock3DConnector::connType ==FineToCoarseBlock3DConnector::Type00) - { - lMinX1 = minX1; - lMaxX1 = maxX1 + maxOffX1 - 1; - lMinX3 = minX3; - lMaxX3 = maxX3 + maxOffX3 - 1; - } - else if (FineToCoarseBlock3DConnector::connType ==FineToCoarseBlock3DConnector::Type10) - { - lMinX1 = minX1 + minOffX1; - lMaxX1 = maxX1; - lMinX3 = minX3; - lMaxX3 = maxX3 + maxOffX3 - 1; - } - else if (FineToCoarseBlock3DConnector::connType ==FineToCoarseBlock3DConnector::Type01) - { - lMinX1 = minX1; - lMaxX1 = maxX1 + maxOffX1 - 1; - lMinX3 = minX3 + minOffX3; - lMaxX3 = maxX3 - 1; - } - else if (FineToCoarseBlock3DConnector::connType ==FineToCoarseBlock3DConnector::Type11) - { - lMinX1 = minX1 + minOffX1; - lMaxX1 = maxX1 - 1; - lMinX3 = minX3 + minOffX3; - lMaxX3 = maxX3 - 1; - } - findCFCells(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, iNodeSetReceiver); - break; - case T: case B: - if (sendDir == T) - { - lMinX3 = maxX3 - 3; - lMaxX3 = lMinX3; - } - else if (sendDir == B) - { - lMinX3 = 2; - lMaxX3 = lMinX3; - } - - if (FineToCoarseBlock3DConnector::connType ==FineToCoarseBlock3DConnector::Type00) - { - lMinX1 = minX1; - lMaxX1 = maxX1 + maxOffX1 - 1; - lMinX2 = minX2; - lMaxX2 = maxX2 + maxOffX2 - 1; - } - else if (FineToCoarseBlock3DConnector::connType ==FineToCoarseBlock3DConnector::Type10) - { - lMinX1 = minX1 + minOffX1; - lMaxX1 = maxX1 - 1; - lMinX2 = minX2; - lMaxX2 = maxX2 + maxOffX2 - 1; - } - else if (FineToCoarseBlock3DConnector::connType ==FineToCoarseBlock3DConnector::Type01) - { - lMinX1 = minX1; - lMaxX1 = maxX1 + maxOffX1 - 1; - lMinX2 = minX2 + minOffX2; - lMaxX2 = maxX2 - 1; - } - else if (FineToCoarseBlock3DConnector::connType ==FineToCoarseBlock3DConnector::Type11) - { - lMinX1 = minX1 + minOffX1; - lMaxX1 = maxX1 - 1; - lMinX2 = minX2 + minOffX2; - lMaxX2 = maxX2 - 1; - } - findCFCells(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, iNodeSetReceiver); - break; - - //edges - //N-S-E-W - case NE: case SW: case SE: case NW: - if (sendDir == NE) - { - lMinX1 = maxX1 - 3; - lMaxX1 = lMinX1 + 2; - lMinX2 = maxX2 - 3; - lMaxX2 = lMinX2 + 2; - } - else if (sendDir == SW) - { - lMinX1 = 0; - lMaxX1 = lMinX1 + 3; - lMinX2 = 0; - lMaxX2 = lMinX2 + 3; - } - else if (sendDir == SE) - { - lMinX1 = maxX1 - 3; - lMaxX1 = lMinX1 + 2; - lMinX2 = 0; - lMaxX2 = lMinX2 + 2; - } - else if (sendDir == NW) - { - lMinX1 = 0; - lMaxX1 = lMinX1 + 2; - lMinX2 = maxX2 - 3; - lMaxX2 = lMinX2 + 2; - } - - if (FineToCoarseBlock3DConnector::connType ==FineToCoarseBlock3DConnector::Type00) - { - lMinX3 = minX3; - lMaxX3 = maxX3 + maxOffX3 - 1; - } - else if (FineToCoarseBlock3DConnector::connType ==FineToCoarseBlock3DConnector::Type10) - { - lMinX3 = minX3 + minOffX3; - lMaxX3 = maxX3 - 1; - } - - findCFCells(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, iNodeSetReceiver); - break; - //T-B-E-W - case TE: case BW: case BE: case TW: - if (sendDir == TE) - { - lMinX1 = maxX1 - 3; - lMaxX1 = lMinX1 + 2; - lMinX3 = maxX3 - 3; - lMaxX3 = lMinX3 + 2; - } - else if (sendDir == BW) - { - lMinX1 = 0; - lMaxX1 = lMinX1 + 2; - lMinX3 = 0; - lMaxX3 = lMinX3 + 2; - } - else if (sendDir == BE) - { - lMinX1 = maxX1 - 3; - lMaxX1 = lMinX1 + 2; - lMinX3 = 0; - lMaxX3 = lMinX3 + 2; - } - else if (sendDir == TW) - { - lMinX1 = 0; - lMaxX1 = lMinX1 + 2; - lMinX3 = maxX3 - 3; - lMaxX3 = lMinX3 + 2; - } - - if (FineToCoarseBlock3DConnector::connType ==FineToCoarseBlock3DConnector::Type00) - { - lMinX2 = minX2; - lMaxX2 = maxX2 + maxOffX2 - 1; - } - else if (FineToCoarseBlock3DConnector::connType ==FineToCoarseBlock3DConnector::Type10) - { - lMinX2 = minX2 + minOffX2; - lMaxX2 = maxX2 - 1; - } - - findCFCells(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, iNodeSetReceiver); - break; - //T-B-N-S - case TN: case BS: case BN: case TS: - if (sendDir == TN) - { - lMinX2 = maxX2 - 3; - lMaxX2 = lMinX2 + 2; - lMinX3 = maxX3 - 3; - lMaxX3 = lMinX3 + 2; - } - else if (sendDir == BS) - { - lMinX2 = 0; - lMaxX2 = lMinX2 + 2; - lMinX3 = 0; - lMaxX3 = lMinX3 + 2; - } - else if (sendDir == BN) - { - lMinX2 = maxX2 - 3; - lMaxX2 = lMinX2 + 2; - lMinX3 = 0; - lMaxX3 = lMinX3 + 2; - } - else if (sendDir == TS) - { - lMinX2 = 0; - lMaxX2 = lMinX2 + 2; - lMinX3 = maxX3 - 3; - lMaxX3 = lMinX3 + 2; - } - - if (FineToCoarseBlock3DConnector::connType ==FineToCoarseBlock3DConnector::Type00) - { - lMinX1 = minX1; - lMaxX1 = maxX1 + maxOffX1 - 1; - } - else if (FineToCoarseBlock3DConnector::connType ==FineToCoarseBlock3DConnector::Type10) - { - lMinX1 = minX1 + minOffX1; - lMaxX1 = maxX1 - 1; - } - - findCFCells(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, iNodeSetReceiver); - break; - //corners - case TNE: case TNW: case TSE: case TSW: case BNE: case BNW: case BSE: case BSW: - if (sendDir == TNE) - { - lMinX1 = maxX1 - 3; - lMaxX1 = maxX1 - 1; - lMinX2 = maxX2 - 3; - lMaxX2 = maxX2 - 1; - lMinX3 = maxX3 - 3; - lMaxX3 = maxX3 - 1; - } - else if (sendDir == TNW) - { - lMinX1 = 0; - lMaxX1 = 2; - lMinX2 = maxX2 - 3; - lMaxX2 = maxX2 - 1; - lMinX3 = maxX3 - 3; - lMaxX3 = maxX3 - 1; - } - else if (sendDir == TSE) - { - lMinX1 = maxX1 - 3; - lMaxX1 = maxX1 - 1; - lMinX2 = 0; - lMaxX2 = 2; - lMinX3 = maxX3 - 3; - lMaxX3 = maxX3 - 1; - } - else if (sendDir == TSW) - { - lMinX1 = 0; - lMaxX1 = 2; - lMinX2 = 0; - lMaxX2 = 2; - lMinX3 = maxX3 - 3; - lMaxX3 = maxX3 - 1; - } - else if (sendDir == BNE) - { - lMinX1 = maxX1 - 3; - lMaxX1 = maxX1 - 1; - lMinX2 = maxX2 - 3; - lMaxX2 = maxX2 - 1; - lMinX3 = 0; - lMaxX3 = 2; - } - else if (sendDir == BNW) - { - lMinX1 = 0; - lMaxX1 = 2; - lMinX2 = maxX2 - 3; - lMaxX2 = maxX2 - 1; - lMinX3 = 0; - lMaxX3 = 2; - } - else if (sendDir == BSE) - { - lMinX1 = maxX1 - 3; - lMaxX1 = maxX1 - 1; - lMinX2 = 0; - lMaxX2 = 2; - lMinX3 = 0; - lMaxX3 = 2; - } - else if (sendDir == BSW) - { - lMinX1 = 0; - lMaxX1 = 2; - lMinX2 = 0; - lMaxX2 = 2; - lMinX3 = 0; - lMaxX3 = 2; - } - findCFCells(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, iNodeSetReceiver); - break; - } -} -////////////////////////////////////////////////////////////////////////// -void FineToCoarseNodeSetBlock3DConnector::distributeReceiveVectors() -{ - using namespace D3Q27System; - - DistributionArray3DPtr fTo = FineToCoarseBlock3DConnector::block.lock()->getKernel()->getDataSet()->getFdistributions(); - - int index = 0; - - vector_type& data = this->receiver->getData(); - - for(INodeVector inode : iNodeSetReceiver) - { - D3Q27ICell icellF; - this->readICellFfromData(data, index, icellF); - iprocessor->writeICellInv(fTo, icellF, inode[0], inode[1], inode[2]); - } -} -////////////////////////////////////////////////////////////////////////// -// -//void FineToCoarseNodeSetBlock3DConnector::getLocalMinMax(int& minX1, int& minX2, int& minX3, int& maxX1, int& maxX2, int& maxX3) -//{ -// using namespace D3Q27System; -// int TminX1 = minX1; int TminX2 = minX2; int TminX3 = minX3; int TmaxX1 = maxX1; int TmaxX2 = maxX2; int TmaxX3 = maxX3; -// -// if (block.lock()->hasInterpolationFlagFC(E)) -// { -// if (maxX1==TmaxX1) maxX1 -= 2; -// } -// if (block.lock()->hasInterpolationFlagFC(W)) -// { -// if (minX1==TminX1) minX1 += 4; -// } -// if (block.lock()->hasInterpolationFlagFC(N)) -// { -// if (maxX2==TmaxX2) maxX2 -= 2; -// } -// if (block.lock()->hasInterpolationFlagFC(S)) -// { -// if (minX2==TminX2) minX2 += 4; -// } -// if (block.lock()->hasInterpolationFlagFC(T)) -// { -// if (maxX3==TmaxX3) maxX3 -= 2; -// } -// if (block.lock()->hasInterpolationFlagFC(B)) -// { -// if (minX3==TminX3) minX3 += 4; -// } -// -// //////////// -// /////E-W-N-S -// if (block.lock()->hasInterpolationFlagFC(NE)&& !block.lock()->hasInterpolationFlagFC(N) && !block.lock()->hasInterpolationFlagFC(E)) -// { -// if (maxX1==TmaxX1) maxX1 -= 2; -// if (maxX2==TmaxX2) maxX2 -= 2; -// } -// if (block.lock()->hasInterpolationFlagFC(SW)&& !block.lock()->hasInterpolationFlagFC(W) && !block.lock()->hasInterpolationFlagFC(S)) -// { -// if (minX1==TminX1) minX1 += 4; -// if (minX2==TminX2) minX2 += 4; -// } -// if (block.lock()->hasInterpolationFlagFC(SE)&& !block.lock()->hasInterpolationFlagFC(E) && !block.lock()->hasInterpolationFlagFC(S)) -// { -// if (maxX1==TmaxX1) maxX1 -= 2; -// if (minX2==TminX2) minX2 += 4; -// } -// if (block.lock()->hasInterpolationFlagFC(NW)&& !block.lock()->hasInterpolationFlagFC(N) && !block.lock()->hasInterpolationFlagFC(W)) -// { -// if (minX1==TminX1) minX1 += 4; -// if (maxX2==TmaxX2) maxX2 -= 2; -// } -// -// //////T-B-E-W -// if (block.lock()->hasInterpolationFlagFC(TE) && !block.lock()->hasInterpolationFlagFC(E) && !block.lock()->hasInterpolationFlagFC(T)) -// { -// if (maxX1==TmaxX1) maxX1 -= 2; -// if (maxX3==TmaxX3) maxX3 -= 2; -// } -// if (block.lock()->hasInterpolationFlagFC(BW)&& !block.lock()->hasInterpolationFlagFC(W) && !block.lock()->hasInterpolationFlagFC(B)) -// { -// if (minX1==TminX1) minX1 += 4; -// if (minX3==TminX3) minX3 += 4; -// } -// if (block.lock()->hasInterpolationFlagFC(BE)&& !block.lock()->hasInterpolationFlagFC(E) && !block.lock()->hasInterpolationFlagFC(B)) -// { -// if (maxX1==TmaxX1) maxX1 -= 2; -// if (minX3==TminX3) minX3 += 4; -// } -// if (block.lock()->hasInterpolationFlagFC(TW)&& !block.lock()->hasInterpolationFlagFC(W) && !block.lock()->hasInterpolationFlagFC(T)) -// { -// if (minX1==TminX1) minX1 += 4; -// if (maxX3==TmaxX3) maxX3 -= 2; -// } -// -// -// ////T-B-N-S -// if (block.lock()->hasInterpolationFlagFC(TN)&& !block.lock()->hasInterpolationFlagFC(N) && !block.lock()->hasInterpolationFlagFC(T)) -// { -// if (maxX2==TmaxX2) maxX2 -= 2; -// if (maxX3==TmaxX3) maxX3 -= 2; -// } -// if (block.lock()->hasInterpolationFlagFC(BS)&& !block.lock()->hasInterpolationFlagFC(S) && !block.lock()->hasInterpolationFlagFC(B)) -// { -// if (minX2==TminX2) minX2 += 4; -// if (minX3==TminX3) minX3 += 4; -// } -// if (block.lock()->hasInterpolationFlagFC(BN)&& !block.lock()->hasInterpolationFlagFC(N) && !block.lock()->hasInterpolationFlagFC(B)) -// { -// if (maxX2==TmaxX2) maxX2 -= 2; -// if (minX3==TminX3) minX3 += 4; -// } -// if (block.lock()->hasInterpolationFlagFC(TS) && !block.lock()->hasInterpolationFlagFC(S) && !block.lock()->hasInterpolationFlagFC(T)) -// { -// if (minX2==TminX2) minX2 += 4; -// if (maxX3==TmaxX3) maxX3 -= 2; -// } -//} -////////////////////////////////////////////////////////////////////////// - diff --git a/src/VirtualFluids/Connectors/FineToCoarseNodeSetBlock3DConnector.h b/src/VirtualFluids/Connectors/FineToCoarseNodeSetBlock3DConnector.h deleted file mode 100644 index 9191dcca1..000000000 --- a/src/VirtualFluids/Connectors/FineToCoarseNodeSetBlock3DConnector.h +++ /dev/null @@ -1,78 +0,0 @@ -/// \file CoarseToFineNodeSetBlock3DConnector.h -/// \class CoarseToFineNodeSetBlock3DConnector -/// \brief Connector interpolates and sends data from coarse level to fine. -/// \author Konstantin Kutscher -/// \date 21.05.2015 - -#ifndef FineToCoarseNodeSetBlock3DConnector_H -#define FineToCoarseNodeSetBlock3DConnector_H - -#include <vector> -#include "FineToCoarseBlock3DConnector.h" -#include "D3Q27System.h" -#include "Block3D.h" -#include "Grid3D.h" -#include "LBMKernel.h" -#include "InterpolationProcessor.h" -#include "MathUtil.hpp" -#include <memory> - - -class Block3D; - -//daten werden in einen vector (dieser befindet sich im transmitter) kopiert -//der vector wird via transmitter uebertragen -//transmitter kann ein lokal, MPI, RCG, CTL oder was auch immer fuer ein -//transmitter sein, der von Transmitter abgeleitet ist ;-) - -class FineToCoarseNodeSetBlock3DConnector : public FineToCoarseBlock3DConnector -{ -public: - FineToCoarseNodeSetBlock3DConnector(Block3DPtr block, VectorTransmitterPtr sender, VectorTransmitterPtr receiver, int sendDir, InterpolationProcessorPtr iprocessor, CFconnectorType connType); - void init(); - void fillSendVectors(); - void distributeReceiveVectors(); -protected: - typedef std::vector< int > INodeVector; - typedef std::vector < INodeVector > INodeSet; - INodeSet iNodeSetSender; - INodeSet iNodeSetReceiver; - - void readICellFfromData(vector_type& data, int& index, D3Q27ICell& icellF); - void readNodeFromVector(vector_type& data, int& index, LBMReal* inode); - - void writeICellCtoData(vector_type& data, int& index, LBMReal* icellC); - - void findFCCells(); - void findFCCells(int lMinX1, int lMinX2, int lMinX3, int lMaxX1, int lMaxX2, int lMaxX3, INodeSet &inodes); - - void findCFCells(); - void findCFCells(int lMinX1, int lMinX2, int lMinX3, int lMaxX1, int lMaxX2, int lMaxX3, INodeSet &inodes); - - //void getLocalMinMax(int& minX1, int& minX2, int& minX3, int& maxX1, int& maxX2, int& maxX3); - - - int bMaxX1, bMaxX2, bMaxX3; - - int minX1; - int minX2; - int minX3; - - int maxX1; - int maxX2; - int maxX3; - - int minOffX1; - int minOffX2; - int minOffX3; - - int maxOffX1; - int maxOffX2; - int maxOffX3; -}; - - - - - -#endif diff --git a/src/VirtualFluids/Connectors/LocalBlock3DConnector.h b/src/VirtualFluids/Connectors/LocalBlock3DConnector.h deleted file mode 100644 index e8e2a37c0..000000000 --- a/src/VirtualFluids/Connectors/LocalBlock3DConnector.h +++ /dev/null @@ -1,59 +0,0 @@ -#ifndef LocalBlock3DConnector_H -#define LocalBlock3DConnector_H - - - -#include "Block3DConnector.h" -#include "Block3D.h" - -class LocalBlock3DConnector : public Block3DConnector -{ -public: - LocalBlock3DConnector(Block3DPtr from, Block3DPtr to, int sendDir) - : Block3DConnector(sendDir) - , from(from) - , to(to) - { - - } - virtual ~LocalBlock3DConnector() {} - void sendTransmitterDataSize() {} - void receiveTransmitterDataSize() {} - virtual void init() = 0; - void prepareForReceive() {} - void prepareForSend() {} - void fillSendVectors() {} - virtual void sendVectors()=0; - void receiveVectors() {} - - void distributeReceiveVectors() {} - - bool isLocalConnector() { return true; } - bool isRemoteConnector() { return false; } - bool isInterpolationConnectorCF() { return false; } - bool isInterpolationConnectorFC() { return false; } - - double getSendRecieveTime(); - - void prepareForSendX1() {} - void prepareForSendX2() {} - void prepareForSendX3() {} - - void sendVectorsX1() {} - void sendVectorsX2() {} - void sendVectorsX3() {} - - void prepareForReceiveX1() {} - void prepareForReceiveX2() {} - void prepareForReceiveX3() {} - - void receiveVectorsX1() {} - void receiveVectorsX2() {} - void receiveVectorsX3() {} - -protected: - std::weak_ptr<Block3D> from; - std::weak_ptr<Block3D> to; -}; - -#endif //LocalBlock3DConnector_H diff --git a/src/VirtualFluids/Connectors/RemoteBlock3DConnector.cpp b/src/VirtualFluids/Connectors/RemoteBlock3DConnector.cpp deleted file mode 100644 index 1bc7a0c71..000000000 --- a/src/VirtualFluids/Connectors/RemoteBlock3DConnector.cpp +++ /dev/null @@ -1,64 +0,0 @@ -#include "RemoteBlock3DConnector.h" - -////////////////////////////////////////////////////////////////////////// -RemoteBlock3DConnector::RemoteBlock3DConnector(Block3DPtr block - , VectorTransmitterPtr sender - , VectorTransmitterPtr receiver - , int sendDir) - : Block3DConnector(sendDir) - , block(block) - , sender(sender) - , receiver(receiver) -{ - if (!block || !sender || !receiver) - UB_THROW(UbException(UB_EXARGS, "sender or receiver == NULL!!")); -} -////////////////////////////////////////////////////////////////////////// - -bool RemoteBlock3DConnector::isLocalConnector() -{ - return !this->isRemoteConnector(); -} -////////////////////////////////////////////////////////////////////////// - -bool RemoteBlock3DConnector::isRemoteConnector() -{ - return ((sender && sender->isRemoteTransmitter()) - || (receiver && receiver->isRemoteTransmitter())); -} -////////////////////////////////////////////////////////////////////////// - -void RemoteBlock3DConnector::sendTransmitterDataSize() -{ - assert(sender !=NULL); sender->sendDataSize(); -} -////////////////////////////////////////////////////////////////////////// - -void RemoteBlock3DConnector::receiveTransmitterDataSize() -{ - assert(receiver!=NULL); receiver->receiveDataSize(); -} -////////////////////////////////////////////////////////////////////////// - -void RemoteBlock3DConnector::prepareForSend() -{ - assert(sender !=NULL); sender->prepareForSend(); -} -////////////////////////////////////////////////////////////////////////// - -void RemoteBlock3DConnector::sendVectors() -{ - assert(sender !=NULL); sender->sendData(); -} -////////////////////////////////////////////////////////////////////////// - -void RemoteBlock3DConnector::prepareForReceive() -{ - assert(receiver!=NULL); receiver->prepareForReceive(); -} -////////////////////////////////////////////////////////////////////////// - -void RemoteBlock3DConnector::receiveVectors() -{ - assert(receiver!=NULL); receiver->receiveData(); -} diff --git a/src/VirtualFluids/Connectors/RemoteBlock3DConnector.h b/src/VirtualFluids/Connectors/RemoteBlock3DConnector.h deleted file mode 100644 index e405a0855..000000000 --- a/src/VirtualFluids/Connectors/RemoteBlock3DConnector.h +++ /dev/null @@ -1,72 +0,0 @@ -#ifndef RemoteBlock3DConnector_H -#define RemoteBlock3DConnector_H - -#include <vector> - -#include "TransmitterType.h" -#include "Block3DConnector.h" -#include "D3Q27System.h" -#include "Block3D.h" -#include "LBMKernel.h" -#include "EsoTwistD3Q27System.h" - - -//daten werden in einen vector (dieser befindet sich im transmitter) kopiert -//der vector wird via transmitter uebertragen -//transmitter kann ein lokal, MPI, RCG, CTL oder was auch immer fuer ein -//transmitter sein, der von Transmitter abgeleitet ist ;-) -class RemoteBlock3DConnector : public Block3DConnector -{ -public: - RemoteBlock3DConnector(Block3DPtr block - , VectorTransmitterPtr sender - , VectorTransmitterPtr receiver - , int sendDir); - - bool isLocalConnector(); - bool isRemoteConnector(); - - virtual void init() = 0; - - void sendTransmitterDataSize(); - void receiveTransmitterDataSize(); - - void prepareForSend(); - void sendVectors(); - - void prepareForReceive(); - void receiveVectors(); - - virtual void fillSendVectors() = 0; - virtual void distributeReceiveVectors() = 0; - - bool isInterpolationConnectorCF() { return false; } - bool isInterpolationConnectorFC() { return false; } - - double getSendRecieveTime() { return 0; } - - void prepareForSendX1() {} - void prepareForSendX2() {} - void prepareForSendX3() {} - - void sendVectorsX1() {} - void sendVectorsX2() {} - void sendVectorsX3() {} - - void prepareForReceiveX1() {} - void prepareForReceiveX2() {} - void prepareForReceiveX3() {} - - void receiveVectorsX1() {} - void receiveVectorsX2() {} - void receiveVectorsX3() {} - -protected: - std::weak_ptr<Block3D> block; - VectorTransmitterPtr sender; - VectorTransmitterPtr receiver; -}; - - -#endif //RemoteBlock3DConnector_H - diff --git a/src/VirtualFluids/Connectors/TransmitterType.h b/src/VirtualFluids/Connectors/TransmitterType.h deleted file mode 100644 index c6b86dfe2..000000000 --- a/src/VirtualFluids/Connectors/TransmitterType.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef TransmitterType_h__ -#define TransmitterType_h__ - -#include "basics/transmitter/TbTransmitter.h" -#include "basics/transmitter/TbTransmitterLocal.h" -#include "basics/container/CbVector.h" -#include "D3Q27System.h" -#include <memory> - - -typedef TbTransmitter< CbVector< LBMReal > > VectorTransmitter; -typedef VectorTransmitter::value_type vector_type; -typedef std::shared_ptr< TbTransmitter< CbVector< LBMReal > > > VectorTransmitterPtr; - -#endif // TransmitterType_h__ - diff --git a/src/VirtualFluids/Data/CMakePackage.txt b/src/VirtualFluids/Data/CMakePackage.txt deleted file mode 100644 index 1b8416f01..000000000 --- a/src/VirtualFluids/Data/CMakePackage.txt +++ /dev/null @@ -1,2 +0,0 @@ -GET_FILENAME_COMPONENT( CURRENT_DIR ${CMAKE_CURRENT_LIST_FILE} PATH) -COLLECT_PACKAGE_DATA_WITH_OPTION(${CURRENT_DIR} ALL_SOURCES) diff --git a/src/VirtualFluids/Data/D3Q27EsoTwist3DSoA.cpp b/src/VirtualFluids/Data/D3Q27EsoTwist3DSoA.cpp deleted file mode 100644 index a27563d9b..000000000 --- a/src/VirtualFluids/Data/D3Q27EsoTwist3DSoA.cpp +++ /dev/null @@ -1,594 +0,0 @@ -#include "D3Q27EsoTwist3DSoA.h" -#include <D3Q27System.h> -#include "EsoTwistD3Q27System.h" - -D3Q27EsoTwist3DSoA::D3Q27EsoTwist3DSoA() -{ -} -////////////////////////////////////////////////////////////////////////// -D3Q27EsoTwist3DSoA::D3Q27EsoTwist3DSoA( const size_t& nx1, const size_t& nx2, const size_t& nx3, LBMReal value ) -{ - this->NX1 = nx1; - this->NX2 = nx2; - this->NX3 = nx3; - - d.E = CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<LBMReal,IndexerX3X2X1>(nx1+1, nx2+1, nx3+1, value)); - d.W = CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<LBMReal,IndexerX3X2X1>(nx1+1, nx2+1, nx3+1, value)); - d.N = CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<LBMReal,IndexerX3X2X1>(nx1+1, nx2+1, nx3+1, value)); - d.S = CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<LBMReal,IndexerX3X2X1>(nx1+1, nx2+1, nx3+1, value)); - d.T = CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<LBMReal,IndexerX3X2X1>(nx1+1, nx2+1, nx3+1, value)); - d.B = CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<LBMReal,IndexerX3X2X1>(nx1+1, nx2+1, nx3+1, value)); - d.NE = CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<LBMReal,IndexerX3X2X1>(nx1+1, nx2+1, nx3+1, value)); - d.SW = CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<LBMReal,IndexerX3X2X1>(nx1+1, nx2+1, nx3+1, value)); - d.SE = CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<LBMReal,IndexerX3X2X1>(nx1+1, nx2+1, nx3+1, value)); - d.NW = CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<LBMReal,IndexerX3X2X1>(nx1+1, nx2+1, nx3+1, value)); - d.TE = CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<LBMReal,IndexerX3X2X1>(nx1+1, nx2+1, nx3+1, value)); - d.BW = CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<LBMReal,IndexerX3X2X1>(nx1+1, nx2+1, nx3+1, value)); - d.BE = CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<LBMReal,IndexerX3X2X1>(nx1+1, nx2+1, nx3+1, value)); - d.TW = CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<LBMReal,IndexerX3X2X1>(nx1+1, nx2+1, nx3+1, value)); - d.TN = CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<LBMReal,IndexerX3X2X1>(nx1+1, nx2+1, nx3+1, value)); - d.BS = CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<LBMReal,IndexerX3X2X1>(nx1+1, nx2+1, nx3+1, value)); - d.BN = CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<LBMReal,IndexerX3X2X1>(nx1+1, nx2+1, nx3+1, value)); - d.TS = CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<LBMReal,IndexerX3X2X1>(nx1+1, nx2+1, nx3+1, value)); - d.TNE = CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<LBMReal,IndexerX3X2X1>(nx1+1, nx2+1, nx3+1, value)); - d.TNW = CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<LBMReal,IndexerX3X2X1>(nx1+1, nx2+1, nx3+1, value)); - d.TSE = CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<LBMReal,IndexerX3X2X1>(nx1+1, nx2+1, nx3+1, value)); - d.TSW = CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<LBMReal,IndexerX3X2X1>(nx1+1, nx2+1, nx3+1, value)); - d.BNE = CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<LBMReal,IndexerX3X2X1>(nx1+1, nx2+1, nx3+1, value)); - d.BNW = CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<LBMReal,IndexerX3X2X1>(nx1+1, nx2+1, nx3+1, value)); - d.BSE = CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<LBMReal,IndexerX3X2X1>(nx1+1, nx2+1, nx3+1, value)); - d.BSW = CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<LBMReal,IndexerX3X2X1>(nx1+1, nx2+1, nx3+1, value)); - d.ZERO= CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<LBMReal,IndexerX3X2X1>(nx1, nx2, nx3, value)); -} -////////////////////////////////////////////////////////////////////////// -D3Q27EsoTwist3DSoA::~D3Q27EsoTwist3DSoA() -{ - -} -////////////////////////////////////////////////////////////////////////// -void D3Q27EsoTwist3DSoA::swap() -{ - std::swap(d.E , d.W ); - std::swap(d.N , d.S ); - std::swap(d.T , d.B ); - std::swap(d.NE , d.SW ); - std::swap(d.NW , d.SE ); - std::swap(d.TE , d.BW ); - std::swap(d.TW , d.BE ); - std::swap(d.TN , d.BS ); - std::swap(d.TS , d.BN ); - std::swap(d.TNE, d.BSW); - std::swap(d.TNW, d.BSE); - std::swap(d.TSE, d.BNW); - std::swap(d.TSW, d.BNE); -} -////////////////////////////////////////////////////////////////////////// -void D3Q27EsoTwist3DSoA::getDistribution(LBMReal* const f, size_t x1, size_t x2, size_t x3) -{ - size_t x1p = x1 + 1; - size_t x2p = x2 + 1; - size_t x3p = x3 + 1; - - f[D3Q27System::E] = (*d.E)(x1,x2,x3); - f[D3Q27System::N] = (*d.N)(x1,x2,x3); - f[D3Q27System::T] = (*d.T)(x1,x2,x3); - f[D3Q27System::NE] = (*d.NE)(x1,x2,x3); - f[D3Q27System::NW] = (*d.NW)(x1p,x2,x3); - f[D3Q27System::TE] = (*d.TE)(x1,x2,x3); - f[D3Q27System::TW] = (*d.TW)(x1p,x2,x3); - f[D3Q27System::TN] = (*d.TN)(x1,x2,x3); - f[D3Q27System::TS] = (*d.TS)(x1,x2p,x3); - f[D3Q27System::TNE] = (*d.TNE)(x1,x2,x3); - f[D3Q27System::TNW] = (*d.TNW)(x1p,x2,x3); - f[D3Q27System::TSE] = (*d.TSE)(x1,x2p,x3); - f[D3Q27System::TSW] = (*d.TSW)(x1p,x2p,x3); - - f[D3Q27System::W ] = (*d.W)(x1p,x2,x3); - f[D3Q27System::S ] = (*d.S)(x1,x2p,x3); - f[D3Q27System::B ] = (*d.B)(x1,x2,x3p); - f[D3Q27System::SW] = (*d.SW)(x1p,x2p,x3); - f[D3Q27System::SE] = (*d.SE)(x1,x2p,x3); - f[D3Q27System::BW] = (*d.BW)(x1p,x2,x3p); - f[D3Q27System::BE] = (*d.BE)(x1,x2,x3p); - f[D3Q27System::BS] = (*d.BS)(x1,x2p,x3p); - f[D3Q27System::BN] = (*d.BN)(x1,x2,x3p); - f[D3Q27System::BSW] = (*d.BSW)(x1p,x2p,x3p); - f[D3Q27System::BSE] = (*d.BSE)(x1,x2p,x3p); - f[D3Q27System::BNW] = (*d.BNW)(x1p,x2,x3p); - f[D3Q27System::BNE] = (*d.BNE)(x1,x2,x3p); - - f[D3Q27System::ZERO] = (*d.ZERO)(x1,x2,x3); -} -////////////////////////////////////////////////////////////////////////// -void D3Q27EsoTwist3DSoA::setDistribution(const LBMReal* const f, size_t x1, size_t x2, size_t x3) -{ - size_t x1p = x1 + 1; - size_t x2p = x2 + 1; - size_t x3p = x3 + 1; - - (*d.E)(x1,x2,x3) = f[D3Q27System::INV_E]; - (*d.N)(x1,x2,x3) = f[D3Q27System::INV_N]; - (*d.T)(x1,x2,x3) = f[D3Q27System::INV_T]; - (*d.NE)(x1,x2,x3) = f[D3Q27System::INV_NE]; - (*d.NW)(x1p,x2,x3) = f[D3Q27System::INV_NW]; - (*d.TE)(x1,x2,x3) = f[D3Q27System::INV_TE]; - (*d.TW)(x1p,x2,x3) = f[D3Q27System::INV_TW]; - (*d.TN)(x1,x2,x3) = f[D3Q27System::INV_TN]; - (*d.TS)(x1,x2p,x3) = f[D3Q27System::INV_TS]; - (*d.TNE)(x1,x2,x3) = f[D3Q27System::INV_TNE]; - (*d.TNW)(x1p,x2,x3) = f[D3Q27System::INV_TNW]; - (*d.TSE)(x1,x2p,x3) = f[D3Q27System::INV_TSE]; - (*d.TSW)(x1p,x2p,x3) = f[D3Q27System::INV_TSW]; - - (*d.W)(x1p,x2,x3) = f[D3Q27System::INV_W ]; - (*d.S)(x1,x2p,x3) = f[D3Q27System::INV_S ]; - (*d.B)(x1,x2,x3p) = f[D3Q27System::INV_B ]; - (*d.SW)(x1p,x2p,x3) = f[D3Q27System::INV_SW]; - (*d.SE)(x1,x2p,x3) = f[D3Q27System::INV_SE]; - (*d.BW)(x1p,x2,x3p) = f[D3Q27System::INV_BW]; - (*d.BE)(x1,x2,x3p) = f[D3Q27System::INV_BE]; - (*d.BS)(x1,x2p,x3p) = f[D3Q27System::INV_BS]; - (*d.BN)(x1,x2,x3p) = f[D3Q27System::INV_BN]; - (*d.BSW)(x1p,x2p,x3p) = f[D3Q27System::INV_BSW]; - (*d.BSE)(x1,x2p,x3p) = f[D3Q27System::INV_BSE]; - (*d.BNW)(x1p,x2,x3p) = f[D3Q27System::INV_BNW]; - (*d.BNE)(x1,x2,x3p) = f[D3Q27System::INV_BNE]; - - (*d.ZERO)(x1,x2,x3) = f[D3Q27System::ZERO]; -} -////////////////////////////////////////////////////////////////////////// -void D3Q27EsoTwist3DSoA::getDistributionInv(LBMReal* const f, size_t x1, size_t x2, size_t x3) -{ - f[D3Q27System::INV_E] = (*d.E)(x1,x2,x3); - f[D3Q27System::INV_N] = (*d.N)(x1,x2,x3); - f[D3Q27System::INV_T] = (*d.T)(x1,x2,x3); - f[D3Q27System::INV_NE] = (*d.NE)(x1,x2,x3); - f[D3Q27System::INV_NW] = (*d.NW)(x1+1,x2,x3); - f[D3Q27System::INV_TE] = (*d.TE)(x1,x2,x3); - f[D3Q27System::INV_TW] = (*d.TW)(x1+1,x2,x3); - f[D3Q27System::INV_TN] = (*d.TN)(x1,x2,x3); - f[D3Q27System::INV_TS] = (*d.TS)(x1,x2+1,x3); - f[D3Q27System::INV_TNE] = (*d.TNE)(x1,x2,x3); - f[D3Q27System::INV_TNW] = (*d.TNW)(x1+1,x2,x3); - f[D3Q27System::INV_TSE] = (*d.TSE)(x1,x2+1,x3); - f[D3Q27System::INV_TSW] = (*d.TSW)(x1+1,x2+1,x3); - - f[D3Q27System::INV_W ] = (*d.W)(x1+1,x2,x3 ); - f[D3Q27System::INV_S ] = (*d.S)(x1,x2+1,x3 ); - f[D3Q27System::INV_B ] = (*d.B)(x1,x2,x3+1 ); - f[D3Q27System::INV_SW] = (*d.SW)(x1+1,x2+1,x3 ); - f[D3Q27System::INV_SE] = (*d.SE)(x1,x2+1,x3 ); - f[D3Q27System::INV_BW] = (*d.BW)(x1+1,x2,x3+1 ); - f[D3Q27System::INV_BE] = (*d.BE)(x1,x2,x3+1 ); - f[D3Q27System::INV_BS] = (*d.BS)(x1,x2+1,x3+1 ); - f[D3Q27System::INV_BN] = (*d.BN)(x1,x2,x3+1 ); - f[D3Q27System::INV_BSW] = (*d.BSW)(x1+1,x2+1,x3+1); - f[D3Q27System::INV_BSE] = (*d.BSE)(x1,x2+1,x3+1); - f[D3Q27System::INV_BNW] = (*d.BNW)(x1+1,x2,x3+1); - f[D3Q27System::INV_BNE] = (*d.BNE)(x1,x2,x3+1); - - f[D3Q27System::ZERO] = (*d.ZERO)(x1,x2,x3); -} -////////////////////////////////////////////////////////////////////////// -void D3Q27EsoTwist3DSoA::setDistributionInv(const LBMReal* const f, size_t x1, size_t x2, size_t x3) -{ - //(*this->localDistributions)(D3Q27System::ET_E,x1, x2, x3) = f[D3Q27System::E]; - //(*this->localDistributions)(D3Q27System::ET_N,x1, x2, x3) = f[D3Q27System::N]; - //(*this->localDistributions)(D3Q27System::ET_T,x1, x2, x3) = f[D3Q27System::T]; - //(*this->localDistributions)(D3Q27System::ET_NE,x1, x2, x3) = f[D3Q27System::NE]; - //(*this->localDistributions)(D3Q27System::ET_NW,x1+1,x2, x3) = f[D3Q27System::NW]; - //(*this->localDistributions)(D3Q27System::ET_TE,x1, x2, x3) = f[D3Q27System::TE]; - //(*this->localDistributions)(D3Q27System::ET_TW,x1+1,x2, x3) = f[D3Q27System::TW]; - //(*this->localDistributions)(D3Q27System::ET_TN,x1, x2, x3) = f[D3Q27System::TN]; - //(*this->localDistributions)(D3Q27System::ET_TS,x1, x2+1,x3) = f[D3Q27System::TS]; - //(*this->localDistributions)(D3Q27System::ET_TNE,x1, x2, x3) = f[D3Q27System::TNE]; - //(*this->localDistributions)(D3Q27System::ET_TNW,x1+1,x2, x3) = f[D3Q27System::TNW]; - //(*this->localDistributions)(D3Q27System::ET_TSE,x1, x2+1,x3) = f[D3Q27System::TSE]; - //(*this->localDistributions)(D3Q27System::ET_TSW,x1+1,x2+1,x3) = f[D3Q27System::TSW]; - - //(*this->nonLocalDistributions)(D3Q27System::ET_W,x1+1,x2, x3 ) = f[D3Q27System::W ]; - //(*this->nonLocalDistributions)(D3Q27System::ET_S,x1, x2+1,x3 ) = f[D3Q27System::S ]; - //(*this->nonLocalDistributions)(D3Q27System::ET_B,x1, x2, x3+1 ) = f[D3Q27System::B ]; - //(*this->nonLocalDistributions)(D3Q27System::ET_SW,x1+1,x2+1,x3 ) = f[D3Q27System::SW]; - //(*this->nonLocalDistributions)(D3Q27System::ET_SE,x1, x2+1,x3 ) = f[D3Q27System::SE]; - //(*this->nonLocalDistributions)(D3Q27System::ET_BW,x1+1,x2, x3+1 ) = f[D3Q27System::BW]; - //(*this->nonLocalDistributions)(D3Q27System::ET_BE,x1, x2, x3+1 ) = f[D3Q27System::BE]; - //(*this->nonLocalDistributions)(D3Q27System::ET_BS,x1, x2+1,x3+1 ) = f[D3Q27System::BS]; - //(*this->nonLocalDistributions)(D3Q27System::ET_BN,x1, x2, x3+1 ) = f[D3Q27System::BN]; - //(*this->nonLocalDistributions)(D3Q27System::ET_BSW,x1+1,x2+1,x3+1) = f[D3Q27System::BSW]; - //(*this->nonLocalDistributions)(D3Q27System::ET_BSE,x1, x2+1,x3+1) = f[D3Q27System::BSE]; - //(*this->nonLocalDistributions)(D3Q27System::ET_BNW,x1+1,x2, x3+1) = f[D3Q27System::BNW]; - //(*this->nonLocalDistributions)(D3Q27System::ET_BNE,x1, x2, x3+1) = f[D3Q27System::BNE]; - - //(*this->zeroDistributions)(x1,x2,x3) = f[D3Q27System::ZERO]; -} -////////////////////////////////////////////////////////////////////////// -void D3Q27EsoTwist3DSoA::setDistributionForDirection(const LBMReal* const f, size_t x1, size_t x2, size_t x3, unsigned long int direction) -{ - //bool directionFlag = false; - //if ((direction & EsoTwistD3Q27System::etE) == EsoTwistD3Q27System::etE) - // (*this->nonLocalDistributions)(D3Q27System::ET_W,x1+1,x2, x3 ) = f[D3Q27System::E]; directionFlag=true; - //if ((direction & EsoTwistD3Q27System::etW) == EsoTwistD3Q27System::etW) - // (*this->localDistributions)(D3Q27System::ET_E,x1, x2, x3) = f[D3Q27System::W]; directionFlag=true; - //if ((direction & EsoTwistD3Q27System::etS) == EsoTwistD3Q27System::etS) - // (*this->localDistributions)(D3Q27System::ET_N,x1, x2, x3) = f[D3Q27System::S]; directionFlag=true; - //if ((direction & EsoTwistD3Q27System::etN) == EsoTwistD3Q27System::etN) - // (*this->nonLocalDistributions)(D3Q27System::ET_S,x1, x2+1,x3 ) = f[D3Q27System::N]; directionFlag=true; - //if ((direction & EsoTwistD3Q27System::etB) == EsoTwistD3Q27System::etB) - // (*this->localDistributions)(D3Q27System::ET_T,x1, x2, x3) = f[D3Q27System::B]; directionFlag=true; - //if ((direction & EsoTwistD3Q27System::etT) == EsoTwistD3Q27System::etT) - // (*this->nonLocalDistributions)(D3Q27System::ET_B,x1, x2, x3+1 ) = f[D3Q27System::T]; directionFlag=true; - //if ((direction & EsoTwistD3Q27System::etSW) == EsoTwistD3Q27System::etSW) - // (*this->localDistributions)(D3Q27System::ET_NE,x1, x2, x3) = f[D3Q27System::SW]; directionFlag=true; - //if ((direction & EsoTwistD3Q27System::etNE) == EsoTwistD3Q27System::etNE) - // (*this->nonLocalDistributions)(D3Q27System::ET_SW,x1+1,x2+1,x3 ) = f[D3Q27System::NE]; directionFlag=true; - //if ((direction & EsoTwistD3Q27System::etNW) == EsoTwistD3Q27System::etNW) - // (*this->nonLocalDistributions)(D3Q27System::ET_SE,x1, x2+1,x3 ) = f[D3Q27System::NW]; directionFlag=true; - //if ((direction & EsoTwistD3Q27System::etSE) == EsoTwistD3Q27System::etSE) - // (*this->localDistributions)(D3Q27System::ET_NW,x1+1,x2, x3) = f[D3Q27System::SE]; directionFlag=true; - //if ((direction & EsoTwistD3Q27System::etBW) == EsoTwistD3Q27System::etBW) - // (*this->localDistributions)(D3Q27System::ET_TE,x1, x2, x3) = f[D3Q27System::BW]; directionFlag=true; - //if ((direction & EsoTwistD3Q27System::etTE) == EsoTwistD3Q27System::etTE) - // (*this->nonLocalDistributions)(D3Q27System::ET_BW,x1+1,x2, x3+1 ) = f[D3Q27System::TE]; directionFlag=true; - //if ((direction & EsoTwistD3Q27System::etTW) == EsoTwistD3Q27System::etTW) - // (*this->nonLocalDistributions)(D3Q27System::ET_BE,x1, x2, x3+1 ) = f[D3Q27System::TW]; directionFlag=true; - //if ((direction & EsoTwistD3Q27System::etBE) == EsoTwistD3Q27System::etBE) - // (*this->localDistributions)(D3Q27System::ET_TW,x1+1,x2, x3) = f[D3Q27System::BE]; directionFlag=true; - //if ((direction & EsoTwistD3Q27System::etBS) == EsoTwistD3Q27System::etBS) - // (*this->localDistributions)(D3Q27System::ET_TN,x1, x2, x3) = f[D3Q27System::BS]; directionFlag=true; - //if ((direction & EsoTwistD3Q27System::etTN) == EsoTwistD3Q27System::etTN) - // (*this->nonLocalDistributions)(D3Q27System::ET_BS,x1, x2+1,x3+1 ) = f[D3Q27System::TN]; directionFlag=true; - //if ((direction & EsoTwistD3Q27System::etTS) == EsoTwistD3Q27System::etTS) - // (*this->nonLocalDistributions)(D3Q27System::ET_BN,x1, x2, x3+1 ) = f[D3Q27System::TS]; directionFlag=true; - //if ((direction & EsoTwistD3Q27System::etBN) == EsoTwistD3Q27System::etBN) - // (*this->localDistributions)(D3Q27System::ET_TS,x1, x2+1,x3) = f[D3Q27System::BN]; directionFlag=true; - //if ((direction & EsoTwistD3Q27System::etBSW) == EsoTwistD3Q27System::etBSW) - // (*this->localDistributions)(D3Q27System::ET_TNE,x1, x2, x3) = f[D3Q27System::BSW]; directionFlag=true; - //if ((direction & EsoTwistD3Q27System::etTNE) == EsoTwistD3Q27System::etTNE) - // (*this->nonLocalDistributions)(D3Q27System::ET_BSW,x1+1,x2+1,x3+1) = f[D3Q27System::TNE]; directionFlag=true; - //if ((direction & EsoTwistD3Q27System::etBSE) == EsoTwistD3Q27System::etBSE) - // (*this->localDistributions)(D3Q27System::ET_TNW,x1+1,x2, x3) = f[D3Q27System::BSE]; directionFlag=true; - //if ((direction & EsoTwistD3Q27System::etTNW) == EsoTwistD3Q27System::etTNW) - // (*this->nonLocalDistributions)(D3Q27System::ET_BSE,x1, x2+1,x3+1) = f[D3Q27System::TNW]; directionFlag=true; - //if ((direction & EsoTwistD3Q27System::etBNW) == EsoTwistD3Q27System::etBNW) - // (*this->localDistributions)(D3Q27System::ET_TSE,x1, x2+1,x3) = f[D3Q27System::BNW]; directionFlag=true; - //if ((direction & EsoTwistD3Q27System::etTSE) == EsoTwistD3Q27System::etTSE) - // (*this->nonLocalDistributions)(D3Q27System::ET_BNW,x1+1,x2, x3+1) = f[D3Q27System::TSE]; directionFlag=true; - //if ((direction & EsoTwistD3Q27System::etBNE) == EsoTwistD3Q27System::etBNE) - // (*this->localDistributions)(D3Q27System::ET_TSW,x1+1,x2+1,x3) = f[D3Q27System::BNE]; directionFlag=true; - //if ((direction & EsoTwistD3Q27System::etTSW) == EsoTwistD3Q27System::etTSW) - // (*this->nonLocalDistributions)(D3Q27System::ET_BNE,x1, x2, x3+1) = f[D3Q27System::TSW]; directionFlag=true; - //if ((direction & EsoTwistD3Q27System::ZERO) == EsoTwistD3Q27System::ZERO) - // (*this->zeroDistributions)(x1,x2,x3) = f[D3Q27System::ZERO]; directionFlag=true; -//#ifdef _DEBUG -// if(!directionFlag)UB_THROW( UbException(UB_EXARGS, "Direction didn't find") ); -//#endif //DEBUG -} -////////////////////////////////////////////////////////////////////////// -void D3Q27EsoTwist3DSoA::setDistributionForDirection(LBMReal f, size_t x1, size_t x2, size_t x3, int direction) -{ - //switch (direction) - //{ - //case D3Q27System::E : - // (*this->nonLocalDistributions)(D3Q27System::ET_W,x1+1,x2, x3 ) = f; - // break; - //case D3Q27System::W : - // (*this->localDistributions)(D3Q27System::ET_E,x1, x2, x3) = f; - // break; - //case D3Q27System::S : - // (*this->localDistributions)(D3Q27System::ET_N,x1, x2, x3) = f; - // break; - //case D3Q27System::N : - // (*this->nonLocalDistributions)(D3Q27System::ET_S,x1, x2+1,x3 ) = f; - // break; - //case D3Q27System::B : - // (*this->localDistributions)(D3Q27System::ET_T,x1, x2, x3) = f; - // break; - //case D3Q27System::T : - // (*this->nonLocalDistributions)(D3Q27System::ET_B,x1, x2, x3+1 ) = f; - // break; - //case D3Q27System::SW : - // (*this->localDistributions)(D3Q27System::ET_NE,x1, x2, x3) = f; - // break; - //case D3Q27System::NE : - // (*this->nonLocalDistributions)(D3Q27System::ET_SW,x1+1,x2+1,x3 ) = f; - // break; - //case D3Q27System::NW : - // (*this->nonLocalDistributions)(D3Q27System::ET_SE,x1, x2+1,x3 ) = f; - // break; - //case D3Q27System::SE : - // (*this->localDistributions)(D3Q27System::ET_NW,x1+1,x2, x3) = f; - // break; - //case D3Q27System::BW : - // (*this->localDistributions)(D3Q27System::ET_TE,x1, x2, x3) = f; - // break; - //case D3Q27System::TE : - // (*this->nonLocalDistributions)(D3Q27System::ET_BW,x1+1,x2, x3+1 ) = f; - // break; - //case D3Q27System::TW : - // (*this->nonLocalDistributions)(D3Q27System::ET_BE,x1, x2, x3+1 ) = f; - // break; - //case D3Q27System::BE : - // (*this->localDistributions)(D3Q27System::ET_TW,x1+1,x2, x3) = f; - // break; - //case D3Q27System::BS : - // (*this->localDistributions)(D3Q27System::ET_TN,x1, x2, x3) = f; - // break; - //case D3Q27System::TN : - // (*this->nonLocalDistributions)(D3Q27System::ET_BS,x1, x2+1,x3+1 ) = f; - // break; - //case D3Q27System::TS : - // (*this->nonLocalDistributions)(D3Q27System::ET_BN,x1, x2, x3+1 ) = f; - // break; - //case D3Q27System::BN : - // (*this->localDistributions)(D3Q27System::ET_TS,x1, x2+1,x3) = f; - // break; - //case D3Q27System::BSW : - // (*this->localDistributions)(D3Q27System::ET_TNE,x1, x2, x3) = f; - // break; - //case D3Q27System::TNE : - // (*this->nonLocalDistributions)(D3Q27System::ET_BSW,x1+1,x2+1,x3+1) = f; - // break; - //case D3Q27System::BSE : - // (*this->localDistributions)(D3Q27System::ET_TNW,x1+1,x2, x3) = f; - // break; - //case D3Q27System::TNW : - // (*this->nonLocalDistributions)(D3Q27System::ET_BSE,x1, x2+1,x3+1) = f; - // break; - //case D3Q27System::BNW : - // (*this->localDistributions)(D3Q27System::ET_TSE,x1, x2+1,x3) = f; - // break; - //case D3Q27System::TSE : - // (*this->nonLocalDistributions)(D3Q27System::ET_BNW,x1+1,x2, x3+1) = f; - // break; - //case D3Q27System::BNE : - // (*this->localDistributions)(D3Q27System::ET_TSW,x1+1,x2+1,x3) = f; - // break; - //case D3Q27System::TSW : - // (*this->nonLocalDistributions)(D3Q27System::ET_BNE,x1, x2, x3+1) = f; - // break; - //case D3Q27System::ZERO : - // (*this->zeroDistributions)(x1,x2,x3) = f; - // break; - //default: - // UB_THROW( UbException(UB_EXARGS, "Direction didn't find") ); - //} -} -////////////////////////////////////////////////////////////////////////// -void D3Q27EsoTwist3DSoA::setDistributionInvForDirection(const LBMReal* const f, size_t x1, size_t x2, size_t x3, unsigned long int direction) -{ -// bool directionFlag = false; -// if ((direction & EsoTwistD3Q27System::etE) == EsoTwistD3Q27System::etE) -// (*this->localDistributions)(D3Q27System::ET_E,x1, x2, x3) = f[D3Q27System::E]; directionFlag=true; -// if ((direction & EsoTwistD3Q27System::etW) == EsoTwistD3Q27System::etW) -// (*this->nonLocalDistributions)(D3Q27System::ET_W,x1+1,x2, x3 ) = f[D3Q27System::W]; directionFlag=true; -// if ((direction & EsoTwistD3Q27System::etS) == EsoTwistD3Q27System::etS) -// (*this->nonLocalDistributions)(D3Q27System::ET_S,x1, x2+1,x3 ) = f[D3Q27System::S]; directionFlag=true; -// if ((direction & EsoTwistD3Q27System::etN) == EsoTwistD3Q27System::etN) -// (*this->localDistributions)(D3Q27System::ET_N,x1, x2, x3) = f[D3Q27System::N]; directionFlag=true; -// if ((direction & EsoTwistD3Q27System::etB) == EsoTwistD3Q27System::etB) -// (*this->nonLocalDistributions)(D3Q27System::ET_B,x1, x2, x3+1 ) = f[D3Q27System::B]; directionFlag=true; -// if ((direction & EsoTwistD3Q27System::etT) == EsoTwistD3Q27System::etT) -// (*this->localDistributions)(D3Q27System::ET_T,x1, x2, x3) = f[D3Q27System::T]; directionFlag=true; -// if ((direction & EsoTwistD3Q27System::etSW) == EsoTwistD3Q27System::etSW) -// (*this->nonLocalDistributions)(D3Q27System::ET_SW,x1+1,x2+1,x3 ) = f[D3Q27System::SW]; directionFlag=true; -// if ((direction & EsoTwistD3Q27System::etNE) == EsoTwistD3Q27System::etNE) -// (*this->localDistributions)(D3Q27System::ET_NE,x1, x2, x3) = f[D3Q27System::NE]; directionFlag=true; -// if ((direction & EsoTwistD3Q27System::etNW) == EsoTwistD3Q27System::etNW) -// (*this->localDistributions)(D3Q27System::ET_NW,x1+1,x2, x3) = f[D3Q27System::NW]; directionFlag=true; -// if ((direction & EsoTwistD3Q27System::etSE) == EsoTwistD3Q27System::etSE) -// (*this->nonLocalDistributions)(D3Q27System::ET_SE,x1, x2+1,x3 ) = f[D3Q27System::SE]; directionFlag=true; -// if ((direction & EsoTwistD3Q27System::etBW) == EsoTwistD3Q27System::etBW) -// (*this->nonLocalDistributions)(D3Q27System::ET_BW,x1+1,x2, x3+1 ) = f[D3Q27System::BW]; directionFlag=true; -// if ((direction & EsoTwistD3Q27System::etTE) == EsoTwistD3Q27System::etTE) -// (*this->localDistributions)(D3Q27System::ET_TE,x1, x2, x3) = f[D3Q27System::TE]; directionFlag=true; -// if ((direction & EsoTwistD3Q27System::etTW) == EsoTwistD3Q27System::etTW) -// (*this->localDistributions)(D3Q27System::ET_TW,x1+1,x2, x3) = f[D3Q27System::TW]; directionFlag=true; -// if ((direction & EsoTwistD3Q27System::etBE) == EsoTwistD3Q27System::etBE) -// (*this->nonLocalDistributions)(D3Q27System::ET_BE,x1, x2, x3+1 ) = f[D3Q27System::BE]; directionFlag=true; -// if ((direction & EsoTwistD3Q27System::etBS) == EsoTwistD3Q27System::etBS) -// (*this->nonLocalDistributions)(D3Q27System::ET_BS,x1, x2+1,x3+1 ) = f[D3Q27System::BS]; directionFlag=true; -// if ((direction & EsoTwistD3Q27System::etTN) == EsoTwistD3Q27System::etTN) -// (*this->localDistributions)(D3Q27System::ET_TN,x1, x2, x3) = f[D3Q27System::TN]; directionFlag=true; -// if ((direction & EsoTwistD3Q27System::etTS) == EsoTwistD3Q27System::etTS) -// (*this->localDistributions)(D3Q27System::ET_TS,x1, x2+1,x3) = f[D3Q27System::TS]; directionFlag=true; -// if ((direction & EsoTwistD3Q27System::etBN) == EsoTwistD3Q27System::etBN) -// (*this->nonLocalDistributions)(D3Q27System::ET_BN,x1, x2, x3+1 ) = f[D3Q27System::BN]; directionFlag=true; -// if ((direction & EsoTwistD3Q27System::etBSW) == EsoTwistD3Q27System::etBSW) -// (*this->nonLocalDistributions)(D3Q27System::ET_BSW,x1+1,x2+1,x3+1) = f[D3Q27System::BSW]; directionFlag=true; -// if ((direction & EsoTwistD3Q27System::etTNE) == EsoTwistD3Q27System::etTNE) -// (*this->localDistributions)(D3Q27System::ET_TNE,x1, x2, x3) = f[D3Q27System::TNE]; directionFlag=true; -// if ((direction & EsoTwistD3Q27System::etBSE) == EsoTwistD3Q27System::etBSE) -// (*this->nonLocalDistributions)(D3Q27System::ET_BSE,x1, x2+1,x3+1) = f[D3Q27System::BSE]; directionFlag=true; -// if ((direction & EsoTwistD3Q27System::etTNW) == EsoTwistD3Q27System::etTNW) -// (*this->localDistributions)(D3Q27System::ET_TNW,x1+1,x2, x3) = f[D3Q27System::TNW]; directionFlag=true; -// if ((direction & EsoTwistD3Q27System::etBNW) == EsoTwistD3Q27System::etBNW) -// (*this->nonLocalDistributions)(D3Q27System::ET_BNW,x1+1,x2, x3+1) = f[D3Q27System::BNW]; directionFlag=true; -// if ((direction & EsoTwistD3Q27System::etTSE) == EsoTwistD3Q27System::etTSE) -// (*this->localDistributions)(D3Q27System::ET_TSE,x1, x2+1,x3) = f[D3Q27System::TSE]; directionFlag=true; -// if ((direction & EsoTwistD3Q27System::etBNE) == EsoTwistD3Q27System::etBNE) -// (*this->nonLocalDistributions)(D3Q27System::ET_BNE,x1, x2, x3+1)= f[D3Q27System::BNE]; directionFlag=true; -// if ((direction & EsoTwistD3Q27System::etTSW) == EsoTwistD3Q27System::etTSW) -// (*this->localDistributions)(D3Q27System::ET_TSW,x1+1,x2+1,x3) = f[D3Q27System::TSW]; directionFlag=true; -// if ((direction & EsoTwistD3Q27System::ZERO) == EsoTwistD3Q27System::ZERO) -// (*this->zeroDistributions)(x1,x2,x3) = f[D3Q27System::ZERO]; directionFlag=true; -//#ifdef _DEBUG -// if(!directionFlag)UB_THROW( UbException(UB_EXARGS, "Direction didn't find") ); -//#endif //DEBUG -} -////////////////////////////////////////////////////////////////////////// -void D3Q27EsoTwist3DSoA::setDistributionInvForDirection(LBMReal f, size_t x1, size_t x2, size_t x3, unsigned long int direction) -{ - //switch (direction) - //{ - //case D3Q27System::E : - // (*this->localDistributions)(D3Q27System::ET_E,x1, x2, x3) = f; - // break; - //case D3Q27System::W : - // (*this->nonLocalDistributions)(D3Q27System::ET_W,x1+1,x2, x3 ) = f; - // break; - //case D3Q27System::S : - // (*this->nonLocalDistributions)(D3Q27System::ET_S,x1, x2+1,x3 ) = f; - // break; - //case D3Q27System::N : - // (*this->localDistributions)(D3Q27System::ET_N,x1, x2, x3) = f; - // break; - //case D3Q27System::B : - // (*this->nonLocalDistributions)(D3Q27System::ET_B,x1, x2, x3+1 ) = f; - // break; - //case D3Q27System::T : - // (*this->localDistributions)(D3Q27System::ET_T,x1, x2, x3) = f; - // break; - //case D3Q27System::SW : - // (*this->nonLocalDistributions)(D3Q27System::ET_SW,x1+1,x2+1,x3 ) = f; - // break; - //case D3Q27System::NE : - // (*this->localDistributions)(D3Q27System::ET_NE,x1, x2, x3) = f; - // break; - //case D3Q27System::NW : - // (*this->localDistributions)(D3Q27System::ET_NW,x1+1,x2, x3) = f; - // break; - //case D3Q27System::SE : - // (*this->nonLocalDistributions)(D3Q27System::ET_SE,x1, x2+1,x3 ) = f; - // break; - //case D3Q27System::BW : - // (*this->nonLocalDistributions)(D3Q27System::ET_BW,x1+1,x2, x3+1 ) = f; - // break; - //case D3Q27System::TE : - // (*this->localDistributions)(D3Q27System::ET_TE,x1, x2, x3) = f; - // break; - //case D3Q27System::TW : - // (*this->localDistributions)(D3Q27System::ET_TW,x1+1,x2, x3) = f; - // break; - //case D3Q27System::BE : - // (*this->nonLocalDistributions)(D3Q27System::ET_BE,x1, x2, x3+1 ) = f; - // break; - //case D3Q27System::BS : - // (*this->nonLocalDistributions)(D3Q27System::ET_BS,x1, x2+1,x3+1 ) = f; - // break; - //case D3Q27System::TN : - // (*this->localDistributions)(D3Q27System::ET_TN,x1, x2, x3) = f; - // break; - //case D3Q27System::TS : - // (*this->localDistributions)(D3Q27System::ET_TS,x1, x2+1,x3) = f; - // break; - //case D3Q27System::BN : - // (*this->nonLocalDistributions)(D3Q27System::ET_BN,x1, x2, x3+1 ) = f; - // break; - //case D3Q27System::BSW : - // (*this->nonLocalDistributions)(D3Q27System::ET_BSW,x1+1,x2+1,x3+1) = f; - // break; - //case D3Q27System::TNE : - // (*this->localDistributions)(D3Q27System::ET_TNE,x1, x2, x3) = f; - // break; - //case D3Q27System::BSE : - // (*this->nonLocalDistributions)(D3Q27System::ET_BSE,x1, x2+1,x3+1) = f; - // break; - //case D3Q27System::TNW : - // (*this->localDistributions)(D3Q27System::ET_TNW,x1+1,x2, x3) = f; - // break; - //case D3Q27System::BNW : - // (*this->nonLocalDistributions)(D3Q27System::ET_BNW,x1+1,x2, x3+1) = f; - // break; - //case D3Q27System::TSE : - // (*this->localDistributions)(D3Q27System::ET_TSE,x1, x2+1,x3) = f; - // break; - //case D3Q27System::BNE : - // (*this->nonLocalDistributions)(D3Q27System::ET_BNE,x1, x2, x3+1) = f; - // break; - //case D3Q27System::TSW : - // (*this->localDistributions)(D3Q27System::ET_TSW,x1+1,x2+1,x3) = f; - // break; - //case D3Q27System::ZERO : - // (*this->zeroDistributions)(x1,x2,x3) = f; - // break; - //default: - // UB_THROW( UbException(UB_EXARGS, "Direction didn't find") ); - //} -} -////////////////////////////////////////////////////////////////////////// -LBMReal D3Q27EsoTwist3DSoA::getDistributionInvForDirection(size_t x1, size_t x2, size_t x3, int direction) -{ - //switch (direction) - //{ - //case D3Q27System::E : - // return (*this->nonLocalDistributions)(D3Q27System::ET_W,x1+1,x2, x3 ); - //case D3Q27System::W : - // return (*this->localDistributions)(D3Q27System::ET_E,x1, x2, x3); - //case D3Q27System::S : - // return (*this->localDistributions)(D3Q27System::ET_N,x1, x2, x3); - //case D3Q27System::N : - // return (*this->nonLocalDistributions)(D3Q27System::ET_S,x1, x2+1,x3 ); - //case D3Q27System::B : - // return (*this->localDistributions)(D3Q27System::ET_T,x1, x2, x3); - //case D3Q27System::T : - // return (*this->nonLocalDistributions)(D3Q27System::ET_B,x1, x2, x3+1 ); - //case D3Q27System::SW : - // return (*this->localDistributions)(D3Q27System::ET_NE,x1, x2, x3); - //case D3Q27System::NE : - // return (*this->nonLocalDistributions)(D3Q27System::ET_SW,x1+1,x2+1,x3 ); - //case D3Q27System::NW : - // return (*this->nonLocalDistributions)(D3Q27System::ET_SE,x1, x2+1,x3 ); - //case D3Q27System::SE : - // return (*this->localDistributions)(D3Q27System::ET_NW,x1+1,x2, x3); - //case D3Q27System::BW : - // return (*this->localDistributions)(D3Q27System::ET_TE,x1, x2, x3); - //case D3Q27System::TE : - // return (*this->nonLocalDistributions)(D3Q27System::ET_BW,x1+1,x2, x3+1 ); - //case D3Q27System::TW : - // return (*this->nonLocalDistributions)(D3Q27System::ET_BE,x1, x2, x3+1 ); - //case D3Q27System::BE : - // return (*this->localDistributions)(D3Q27System::ET_TW,x1+1,x2, x3); - //case D3Q27System::BS : - // return (*this->localDistributions)(D3Q27System::ET_TN,x1, x2, x3); - //case D3Q27System::TN : - // return (*this->nonLocalDistributions)(D3Q27System::ET_BS,x1, x2+1,x3+1 ); - //case D3Q27System::TS : - // return (*this->nonLocalDistributions)(D3Q27System::ET_BN,x1, x2, x3+1 ); - //case D3Q27System::BN : - // return (*this->localDistributions)(D3Q27System::ET_TS,x1, x2+1,x3); - //case D3Q27System::BSW : - // return (*this->localDistributions)(D3Q27System::ET_TNE,x1, x2, x3); - //case D3Q27System::TNE : - // return (*this->nonLocalDistributions)(D3Q27System::ET_BSW,x1+1,x2+1,x3+1); - //case D3Q27System::BSE : - // return (*this->localDistributions)(D3Q27System::ET_TNW,x1+1,x2, x3); - //case D3Q27System::TNW : - // return (*this->nonLocalDistributions)(D3Q27System::ET_BSE,x1, x2+1,x3+1); - //case D3Q27System::BNW : - // return (*this->localDistributions)(D3Q27System::ET_TSE,x1, x2+1,x3); - //case D3Q27System::TSE : - // return (*this->nonLocalDistributions)(D3Q27System::ET_BNW,x1+1,x2, x3+1); - //case D3Q27System::BNE : - // return (*this->localDistributions)(D3Q27System::ET_TSW,x1+1,x2+1,x3); - //case D3Q27System::TSW : - // return (*this->nonLocalDistributions)(D3Q27System::ET_BNE,x1, x2, x3+1); - //case D3Q27System::ZERO : - // return (*this->zeroDistributions)(x1,x2,x3); - //default: - // UB_THROW( UbException(UB_EXARGS, "Direction didn't find") ); - //} - return 0; -} -////////////////////////////////////////////////////////////////////////// -size_t D3Q27EsoTwist3DSoA::getNX1() const -{ - return NX1; -} -////////////////////////////////////////////////////////////////////////// -size_t D3Q27EsoTwist3DSoA::getNX2() const -{ - return NX2; -} -////////////////////////////////////////////////////////////////////////// -size_t D3Q27EsoTwist3DSoA::getNX3() const -{ - return NX3; -} -////////////////////////////////////////////////////////////////////////// -Distributions D3Q27EsoTwist3DSoA::getDistributions() -{ - return d; -} -////////////////////////////////////////////////////////////////////////// - diff --git a/src/VirtualFluids/Data/D3Q27EsoTwist3DSoA.h b/src/VirtualFluids/Data/D3Q27EsoTwist3DSoA.h deleted file mode 100644 index 252311bff..000000000 --- a/src/VirtualFluids/Data/D3Q27EsoTwist3DSoA.h +++ /dev/null @@ -1,91 +0,0 @@ -#ifndef D3Q27EsoTwist3DSoA_h -#define D3Q27EsoTwist3DSoA_h - -#include "EsoTwist3D.h" -//#include "D3Q27System.h" -//#include "basics/container/CbArray4D.h" -#include <basics/container/CbArray3D.h> -//#include <boost/serialization/serialization.hpp> -//#include <boost/serialization/base_object.hpp> - - -struct Distributions -{ - CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr E; - CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr W; - CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr N; - CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr S; - CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr T; - CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr B; - CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr NE; - CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr SW; - CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr SE; - CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr NW; - CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr TE; - CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr BW; - CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr BE; - CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr TW; - CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr TN; - CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr BS; - CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr BN; - CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr TS; - CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr TNE; - CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr TNW; - CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr TSE; - CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr TSW; - CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr BNE; - CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr BNW; - CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr BSE; - CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr BSW; - CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr ZERO; -}; - - -class D3Q27EsoTwist3DSoA : public EsoTwist3D -{ -public: - D3Q27EsoTwist3DSoA(); - D3Q27EsoTwist3DSoA(const size_t& nx1, const size_t& nx2, const size_t& nx3, LBMReal value); - ////////////////////////////////////////////////////////////////////////// - ~D3Q27EsoTwist3DSoA(); - ////////////////////////////////////////////////////////////////////////// - void swap(); - ////////////////////////////////////////////////////////////////////////// - virtual void getDistribution( LBMReal* const f, size_t x1, size_t x2, size_t x3); - ////////////////////////////////////////////////////////////////////////// - virtual void setDistribution(const LBMReal* const f, size_t x1, size_t x2, size_t x3); - //////////////////////////////////////////////////////////////////////// - virtual void getDistributionInv( LBMReal* const f, size_t x1, size_t x2, size_t x3); - ////////////////////////////////////////////////////////////////////////// - virtual void setDistributionInv(const LBMReal* const f, size_t x1, size_t x2, size_t x3); - ////////////////////////////////////////////////////////////////////////// - virtual void setDistributionForDirection(const LBMReal* const f, size_t x1, size_t x2, size_t x3, unsigned long int direction); - ////////////////////////////////////////////////////////////////////////// - virtual void setDistributionForDirection(LBMReal f, size_t x1, size_t x2, size_t x3, int direction); - ////////////////////////////////////////////////////////////////////////// - virtual LBMReal getDistributionInvForDirection(size_t x1, size_t x2, size_t x3, int direction); - ////////////////////////////////////////////////////////////////////////// - virtual void setDistributionInvForDirection(const LBMReal* const f, size_t x1, size_t x2, size_t x3, unsigned long int direction); - ////////////////////////////////////////////////////////////////////////// - virtual void setDistributionInvForDirection(LBMReal f, size_t x1, size_t x2, size_t x3, unsigned long int direction); - ////////////////////////////////////////////////////////////////////////// - virtual LBMReal getDistributionForDirection(size_t x1, size_t x2, size_t x3, int direction); - ////////////////////////////////////////////////////////////////////////// - size_t getNX1() const; - ////////////////////////////////////////////////////////////////////////// - size_t getNX2() const; - ////////////////////////////////////////////////////////////////////////// - size_t getNX3() const; - ////////////////////////////////////////////////////////////////////////// - Distributions getDistributions(); - ////////////////////////////////////////////////////////////////////////// - void getDistributionAfterLastStep(LBMReal* const f, size_t x1, size_t x2, size_t x3); - -protected: - Distributions d; - size_t NX1, NX2, NX3; - -}; - -#endif - diff --git a/src/VirtualFluids/Data/D3Q27EsoTwist3DSplittedVector.cpp b/src/VirtualFluids/Data/D3Q27EsoTwist3DSplittedVector.cpp deleted file mode 100644 index f2cd516d6..000000000 --- a/src/VirtualFluids/Data/D3Q27EsoTwist3DSplittedVector.cpp +++ /dev/null @@ -1,653 +0,0 @@ -#include "D3Q27EsoTwist3DSplittedVector.h" -#include "EsoTwistD3Q27System.h" - -D3Q27EsoTwist3DSplittedVector::D3Q27EsoTwist3DSplittedVector() -{ -} -////////////////////////////////////////////////////////////////////////// -D3Q27EsoTwist3DSplittedVector::D3Q27EsoTwist3DSplittedVector( size_t nx1, size_t nx2, size_t nx3, LBMReal value ) -{ - this->NX1 = nx1; - this->NX2 = nx2; - this->NX3 = nx3; - - this->localDistributions = CbArray4D<LBMReal,IndexerX4X3X2X1>::CbArray4DPtr(new CbArray4D<LBMReal,IndexerX4X3X2X1>(13, nx1+1, nx2+1, nx3+1, value)); - this->nonLocalDistributions = CbArray4D<LBMReal,IndexerX4X3X2X1>::CbArray4DPtr(new CbArray4D<LBMReal,IndexerX4X3X2X1>(13, nx1+1, nx2+1, nx3+1, value)); - - this->zeroDistributions = CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<LBMReal,IndexerX3X2X1>(nx1, nx2, nx3, value)); -} -////////////////////////////////////////////////////////////////////////// -D3Q27EsoTwist3DSplittedVector::~D3Q27EsoTwist3DSplittedVector() -{ - -} -////////////////////////////////////////////////////////////////////////// -void D3Q27EsoTwist3DSplittedVector::swap() -{ - std::swap( this->localDistributions, this->nonLocalDistributions ); -} -////////////////////////////////////////////////////////////////////////// -void D3Q27EsoTwist3DSplittedVector::getDistribution(LBMReal* const f, size_t x1, size_t x2, size_t x3) -{ - f[D3Q27System::E] = (*this->localDistributions)(D3Q27System::ET_E, x1,x2,x3); - f[D3Q27System::N] = (*this->localDistributions)(D3Q27System::ET_N,x1,x2,x3); - f[D3Q27System::T] = (*this->localDistributions)(D3Q27System::ET_T,x1,x2,x3); - f[D3Q27System::NE] = (*this->localDistributions)(D3Q27System::ET_NE,x1,x2,x3); - f[D3Q27System::NW] = (*this->localDistributions)(D3Q27System::ET_NW,x1+1,x2,x3); - f[D3Q27System::TE] = (*this->localDistributions)(D3Q27System::ET_TE,x1,x2,x3); - f[D3Q27System::TW] = (*this->localDistributions)(D3Q27System::ET_TW, x1+1,x2,x3); - f[D3Q27System::TN] = (*this->localDistributions)(D3Q27System::ET_TN,x1,x2,x3); - f[D3Q27System::TS] = (*this->localDistributions)(D3Q27System::ET_TS,x1,x2+1,x3); - f[D3Q27System::TNE] = (*this->localDistributions)(D3Q27System::ET_TNE,x1,x2,x3); - f[D3Q27System::TNW] = (*this->localDistributions)(D3Q27System::ET_TNW,x1+1,x2,x3); - f[D3Q27System::TSE] = (*this->localDistributions)(D3Q27System::ET_TSE,x1,x2+1,x3); - f[D3Q27System::TSW] = (*this->localDistributions)(D3Q27System::ET_TSW,x1+1,x2+1,x3); - - f[D3Q27System::W ] = (*this->nonLocalDistributions)(D3Q27System::ET_W,x1+1,x2,x3 ); - f[D3Q27System::S ] = (*this->nonLocalDistributions)(D3Q27System::ET_S,x1,x2+1,x3 ); - f[D3Q27System::B ] = (*this->nonLocalDistributions)(D3Q27System::ET_B,x1,x2,x3+1 ); - f[D3Q27System::SW] = (*this->nonLocalDistributions)(D3Q27System::ET_SW,x1+1,x2+1,x3 ); - f[D3Q27System::SE] = (*this->nonLocalDistributions)(D3Q27System::ET_SE,x1,x2+1,x3 ); - f[D3Q27System::BW] = (*this->nonLocalDistributions)(D3Q27System::ET_BW,x1+1,x2,x3+1 ); - f[D3Q27System::BE] = (*this->nonLocalDistributions)(D3Q27System::ET_BE,x1,x2,x3+1 ); - f[D3Q27System::BS] = (*this->nonLocalDistributions)(D3Q27System::ET_BS,x1,x2+1,x3+1 ); - f[D3Q27System::BN] = (*this->nonLocalDistributions)(D3Q27System::ET_BN,x1,x2,x3+1 ); - f[D3Q27System::BSW] = (*this->nonLocalDistributions)(D3Q27System::ET_BSW,x1+1,x2+1,x3+1); - f[D3Q27System::BSE] = (*this->nonLocalDistributions)(D3Q27System::ET_BSE,x1,x2+1,x3+1); - f[D3Q27System::BNW] = (*this->nonLocalDistributions)(D3Q27System::ET_BNW,x1+1,x2,x3+1); - f[D3Q27System::BNE] = (*this->nonLocalDistributions)(D3Q27System::ET_BNE,x1,x2,x3+1); - - f[D3Q27System::ZERO] = (*this->zeroDistributions)(x1,x2,x3); -} -////////////////////////////////////////////////////////////////////////// -void D3Q27EsoTwist3DSplittedVector::setDistribution(const LBMReal* const f, size_t x1, size_t x2, size_t x3) -{ - (*this->localDistributions)(D3Q27System::ET_E,x1, x2, x3) = f[D3Q27System::INV_E]; - (*this->localDistributions)(D3Q27System::ET_N,x1, x2, x3) = f[D3Q27System::INV_N]; - (*this->localDistributions)(D3Q27System::ET_T,x1, x2, x3) = f[D3Q27System::INV_T]; - (*this->localDistributions)(D3Q27System::ET_NE,x1, x2, x3) = f[D3Q27System::INV_NE]; - (*this->localDistributions)(D3Q27System::ET_NW,x1+1,x2, x3) = f[D3Q27System::INV_NW]; - (*this->localDistributions)(D3Q27System::ET_TE,x1, x2, x3) = f[D3Q27System::INV_TE]; - (*this->localDistributions)(D3Q27System::ET_TW,x1+1,x2, x3) = f[D3Q27System::INV_TW]; - (*this->localDistributions)(D3Q27System::ET_TN,x1, x2, x3) = f[D3Q27System::INV_TN]; - (*this->localDistributions)(D3Q27System::ET_TS,x1, x2+1,x3) = f[D3Q27System::INV_TS]; - (*this->localDistributions)(D3Q27System::ET_TNE,x1, x2, x3) = f[D3Q27System::INV_TNE]; - (*this->localDistributions)(D3Q27System::ET_TNW,x1+1,x2, x3) = f[D3Q27System::INV_TNW]; - (*this->localDistributions)(D3Q27System::ET_TSE,x1, x2+1,x3) = f[D3Q27System::INV_TSE]; - (*this->localDistributions)(D3Q27System::ET_TSW,x1+1,x2+1,x3) = f[D3Q27System::INV_TSW]; - - (*this->nonLocalDistributions)(D3Q27System::ET_W,x1+1,x2, x3 ) = f[D3Q27System::INV_W ]; - (*this->nonLocalDistributions)(D3Q27System::ET_S,x1, x2+1,x3 ) = f[D3Q27System::INV_S ]; - (*this->nonLocalDistributions)(D3Q27System::ET_B,x1, x2, x3+1 ) = f[D3Q27System::INV_B ]; - (*this->nonLocalDistributions)(D3Q27System::ET_SW,x1+1,x2+1,x3 ) = f[D3Q27System::INV_SW]; - (*this->nonLocalDistributions)(D3Q27System::ET_SE,x1, x2+1,x3 ) = f[D3Q27System::INV_SE]; - (*this->nonLocalDistributions)(D3Q27System::ET_BW,x1+1,x2, x3+1 ) = f[D3Q27System::INV_BW]; - (*this->nonLocalDistributions)(D3Q27System::ET_BE,x1, x2, x3+1 ) = f[D3Q27System::INV_BE]; - (*this->nonLocalDistributions)(D3Q27System::ET_BS,x1, x2+1,x3+1 ) = f[D3Q27System::INV_BS]; - (*this->nonLocalDistributions)(D3Q27System::ET_BN,x1, x2, x3+1 ) = f[D3Q27System::INV_BN]; - (*this->nonLocalDistributions)(D3Q27System::ET_BSW,x1+1,x2+1,x3+1) = f[D3Q27System::INV_BSW]; - (*this->nonLocalDistributions)(D3Q27System::ET_BSE,x1, x2+1,x3+1) = f[D3Q27System::INV_BSE]; - (*this->nonLocalDistributions)(D3Q27System::ET_BNW,x1+1,x2, x3+1) = f[D3Q27System::INV_BNW]; - (*this->nonLocalDistributions)(D3Q27System::ET_BNE,x1, x2, x3+1) = f[D3Q27System::INV_BNE]; - - (*this->zeroDistributions)(x1,x2,x3) = f[D3Q27System::ZERO]; -} -////////////////////////////////////////////////////////////////////////// -void D3Q27EsoTwist3DSplittedVector::getDistributionInv(LBMReal* const f, size_t x1, size_t x2, size_t x3) -{ - f[D3Q27System::INV_E] = (*this->localDistributions)(D3Q27System::ET_E, x1,x2,x3); - f[D3Q27System::INV_N] = (*this->localDistributions)(D3Q27System::ET_N,x1,x2,x3); - f[D3Q27System::INV_T] = (*this->localDistributions)(D3Q27System::ET_T,x1,x2,x3); - f[D3Q27System::INV_NE] = (*this->localDistributions)(D3Q27System::ET_NE,x1,x2,x3); - f[D3Q27System::INV_NW] = (*this->localDistributions)(D3Q27System::ET_NW,x1+1,x2,x3); - f[D3Q27System::INV_TE] = (*this->localDistributions)(D3Q27System::ET_TE,x1,x2,x3); - f[D3Q27System::INV_TW] = (*this->localDistributions)(D3Q27System::ET_TW, x1+1,x2,x3); - f[D3Q27System::INV_TN] = (*this->localDistributions)(D3Q27System::ET_TN,x1,x2,x3); - f[D3Q27System::INV_TS] = (*this->localDistributions)(D3Q27System::ET_TS,x1,x2+1,x3); - f[D3Q27System::INV_TNE] = (*this->localDistributions)(D3Q27System::ET_TNE,x1,x2,x3); - f[D3Q27System::INV_TNW] = (*this->localDistributions)(D3Q27System::ET_TNW,x1+1,x2,x3); - f[D3Q27System::INV_TSE] = (*this->localDistributions)(D3Q27System::ET_TSE,x1,x2+1,x3); - f[D3Q27System::INV_TSW] = (*this->localDistributions)(D3Q27System::ET_TSW,x1+1,x2+1,x3); - - f[D3Q27System::INV_W ] = (*this->nonLocalDistributions)(D3Q27System::ET_W,x1+1,x2,x3 ); - f[D3Q27System::INV_S ] = (*this->nonLocalDistributions)(D3Q27System::ET_S,x1,x2+1,x3 ); - f[D3Q27System::INV_B ] = (*this->nonLocalDistributions)(D3Q27System::ET_B,x1,x2,x3+1 ); - f[D3Q27System::INV_SW] = (*this->nonLocalDistributions)(D3Q27System::ET_SW,x1+1,x2+1,x3 ); - f[D3Q27System::INV_SE] = (*this->nonLocalDistributions)(D3Q27System::ET_SE,x1,x2+1,x3 ); - f[D3Q27System::INV_BW] = (*this->nonLocalDistributions)(D3Q27System::ET_BW,x1+1,x2,x3+1 ); - f[D3Q27System::INV_BE] = (*this->nonLocalDistributions)(D3Q27System::ET_BE,x1,x2,x3+1 ); - f[D3Q27System::INV_BS] = (*this->nonLocalDistributions)(D3Q27System::ET_BS,x1,x2+1,x3+1 ); - f[D3Q27System::INV_BN] = (*this->nonLocalDistributions)(D3Q27System::ET_BN,x1,x2,x3+1 ); - f[D3Q27System::INV_BSW] = (*this->nonLocalDistributions)(D3Q27System::ET_BSW,x1+1,x2+1,x3+1); - f[D3Q27System::INV_BSE] = (*this->nonLocalDistributions)(D3Q27System::ET_BSE,x1,x2+1,x3+1); - f[D3Q27System::INV_BNW] = (*this->nonLocalDistributions)(D3Q27System::ET_BNW,x1+1,x2,x3+1); - f[D3Q27System::INV_BNE] = (*this->nonLocalDistributions)(D3Q27System::ET_BNE,x1,x2,x3+1); - - f[D3Q27System::ZERO] = (*this->zeroDistributions)(x1,x2,x3); -} -////////////////////////////////////////////////////////////////////////// -void D3Q27EsoTwist3DSplittedVector::setDistributionInv(const LBMReal* const f, size_t x1, size_t x2, size_t x3) -{ - (*this->localDistributions)(D3Q27System::ET_E,x1, x2, x3) = f[D3Q27System::E]; - (*this->localDistributions)(D3Q27System::ET_N,x1, x2, x3) = f[D3Q27System::N]; - (*this->localDistributions)(D3Q27System::ET_T,x1, x2, x3) = f[D3Q27System::T]; - (*this->localDistributions)(D3Q27System::ET_NE,x1, x2, x3) = f[D3Q27System::NE]; - (*this->localDistributions)(D3Q27System::ET_NW,x1+1,x2, x3) = f[D3Q27System::NW]; - (*this->localDistributions)(D3Q27System::ET_TE,x1, x2, x3) = f[D3Q27System::TE]; - (*this->localDistributions)(D3Q27System::ET_TW,x1+1,x2, x3) = f[D3Q27System::TW]; - (*this->localDistributions)(D3Q27System::ET_TN,x1, x2, x3) = f[D3Q27System::TN]; - (*this->localDistributions)(D3Q27System::ET_TS,x1, x2+1,x3) = f[D3Q27System::TS]; - (*this->localDistributions)(D3Q27System::ET_TNE,x1, x2, x3) = f[D3Q27System::TNE]; - (*this->localDistributions)(D3Q27System::ET_TNW,x1+1,x2, x3) = f[D3Q27System::TNW]; - (*this->localDistributions)(D3Q27System::ET_TSE,x1, x2+1,x3) = f[D3Q27System::TSE]; - (*this->localDistributions)(D3Q27System::ET_TSW,x1+1,x2+1,x3) = f[D3Q27System::TSW]; - - (*this->nonLocalDistributions)(D3Q27System::ET_W,x1+1,x2, x3 ) = f[D3Q27System::W ]; - (*this->nonLocalDistributions)(D3Q27System::ET_S,x1, x2+1,x3 ) = f[D3Q27System::S ]; - (*this->nonLocalDistributions)(D3Q27System::ET_B,x1, x2, x3+1 ) = f[D3Q27System::B ]; - (*this->nonLocalDistributions)(D3Q27System::ET_SW,x1+1,x2+1,x3 ) = f[D3Q27System::SW]; - (*this->nonLocalDistributions)(D3Q27System::ET_SE,x1, x2+1,x3 ) = f[D3Q27System::SE]; - (*this->nonLocalDistributions)(D3Q27System::ET_BW,x1+1,x2, x3+1 ) = f[D3Q27System::BW]; - (*this->nonLocalDistributions)(D3Q27System::ET_BE,x1, x2, x3+1 ) = f[D3Q27System::BE]; - (*this->nonLocalDistributions)(D3Q27System::ET_BS,x1, x2+1,x3+1 ) = f[D3Q27System::BS]; - (*this->nonLocalDistributions)(D3Q27System::ET_BN,x1, x2, x3+1 ) = f[D3Q27System::BN]; - (*this->nonLocalDistributions)(D3Q27System::ET_BSW,x1+1,x2+1,x3+1) = f[D3Q27System::BSW]; - (*this->nonLocalDistributions)(D3Q27System::ET_BSE,x1, x2+1,x3+1) = f[D3Q27System::BSE]; - (*this->nonLocalDistributions)(D3Q27System::ET_BNW,x1+1,x2, x3+1) = f[D3Q27System::BNW]; - (*this->nonLocalDistributions)(D3Q27System::ET_BNE,x1, x2, x3+1) = f[D3Q27System::BNE]; - - (*this->zeroDistributions)(x1,x2,x3) = f[D3Q27System::ZERO]; -} -////////////////////////////////////////////////////////////////////////// -void D3Q27EsoTwist3DSplittedVector::setDistributionForDirection(const LBMReal* const f, size_t x1, size_t x2, size_t x3, unsigned long int direction) -{ - bool directionFlag = false; - if ((direction & EsoTwistD3Q27System::etE) == EsoTwistD3Q27System::etE) - (*this->nonLocalDistributions)(D3Q27System::ET_W,x1+1,x2, x3 ) = f[D3Q27System::E]; directionFlag=true; - if ((direction & EsoTwistD3Q27System::etW) == EsoTwistD3Q27System::etW) - (*this->localDistributions)(D3Q27System::ET_E,x1, x2, x3) = f[D3Q27System::W]; directionFlag=true; - if ((direction & EsoTwistD3Q27System::etS) == EsoTwistD3Q27System::etS) - (*this->localDistributions)(D3Q27System::ET_N,x1, x2, x3) = f[D3Q27System::S]; directionFlag=true; - if ((direction & EsoTwistD3Q27System::etN) == EsoTwistD3Q27System::etN) - (*this->nonLocalDistributions)(D3Q27System::ET_S,x1, x2+1,x3 ) = f[D3Q27System::N]; directionFlag=true; - if ((direction & EsoTwistD3Q27System::etB) == EsoTwistD3Q27System::etB) - (*this->localDistributions)(D3Q27System::ET_T,x1, x2, x3) = f[D3Q27System::B]; directionFlag=true; - if ((direction & EsoTwistD3Q27System::etT) == EsoTwistD3Q27System::etT) - (*this->nonLocalDistributions)(D3Q27System::ET_B,x1, x2, x3+1 ) = f[D3Q27System::T]; directionFlag=true; - if ((direction & EsoTwistD3Q27System::etSW) == EsoTwistD3Q27System::etSW) - (*this->localDistributions)(D3Q27System::ET_NE,x1, x2, x3) = f[D3Q27System::SW]; directionFlag=true; - if ((direction & EsoTwistD3Q27System::etNE) == EsoTwistD3Q27System::etNE) - (*this->nonLocalDistributions)(D3Q27System::ET_SW,x1+1,x2+1,x3 ) = f[D3Q27System::NE]; directionFlag=true; - if ((direction & EsoTwistD3Q27System::etNW) == EsoTwistD3Q27System::etNW) - (*this->nonLocalDistributions)(D3Q27System::ET_SE,x1, x2+1,x3 ) = f[D3Q27System::NW]; directionFlag=true; - if ((direction & EsoTwistD3Q27System::etSE) == EsoTwistD3Q27System::etSE) - (*this->localDistributions)(D3Q27System::ET_NW,x1+1,x2, x3) = f[D3Q27System::SE]; directionFlag=true; - if ((direction & EsoTwistD3Q27System::etBW) == EsoTwistD3Q27System::etBW) - (*this->localDistributions)(D3Q27System::ET_TE,x1, x2, x3) = f[D3Q27System::BW]; directionFlag=true; - if ((direction & EsoTwistD3Q27System::etTE) == EsoTwistD3Q27System::etTE) - (*this->nonLocalDistributions)(D3Q27System::ET_BW,x1+1,x2, x3+1 ) = f[D3Q27System::TE]; directionFlag=true; - if ((direction & EsoTwistD3Q27System::etTW) == EsoTwistD3Q27System::etTW) - (*this->nonLocalDistributions)(D3Q27System::ET_BE,x1, x2, x3+1 ) = f[D3Q27System::TW]; directionFlag=true; - if ((direction & EsoTwistD3Q27System::etBE) == EsoTwistD3Q27System::etBE) - (*this->localDistributions)(D3Q27System::ET_TW,x1+1,x2, x3) = f[D3Q27System::BE]; directionFlag=true; - if ((direction & EsoTwistD3Q27System::etBS) == EsoTwistD3Q27System::etBS) - (*this->localDistributions)(D3Q27System::ET_TN,x1, x2, x3) = f[D3Q27System::BS]; directionFlag=true; - if ((direction & EsoTwistD3Q27System::etTN) == EsoTwistD3Q27System::etTN) - (*this->nonLocalDistributions)(D3Q27System::ET_BS,x1, x2+1,x3+1 ) = f[D3Q27System::TN]; directionFlag=true; - if ((direction & EsoTwistD3Q27System::etTS) == EsoTwistD3Q27System::etTS) - (*this->nonLocalDistributions)(D3Q27System::ET_BN,x1, x2, x3+1 ) = f[D3Q27System::TS]; directionFlag=true; - if ((direction & EsoTwistD3Q27System::etBN) == EsoTwistD3Q27System::etBN) - (*this->localDistributions)(D3Q27System::ET_TS,x1, x2+1,x3) = f[D3Q27System::BN]; directionFlag=true; - if ((direction & EsoTwistD3Q27System::etBSW) == EsoTwistD3Q27System::etBSW) - (*this->localDistributions)(D3Q27System::ET_TNE,x1, x2, x3) = f[D3Q27System::BSW]; directionFlag=true; - if ((direction & EsoTwistD3Q27System::etTNE) == EsoTwistD3Q27System::etTNE) - (*this->nonLocalDistributions)(D3Q27System::ET_BSW,x1+1,x2+1,x3+1) = f[D3Q27System::TNE]; directionFlag=true; - if ((direction & EsoTwistD3Q27System::etBSE) == EsoTwistD3Q27System::etBSE) - (*this->localDistributions)(D3Q27System::ET_TNW,x1+1,x2, x3) = f[D3Q27System::BSE]; directionFlag=true; - if ((direction & EsoTwistD3Q27System::etTNW) == EsoTwistD3Q27System::etTNW) - (*this->nonLocalDistributions)(D3Q27System::ET_BSE,x1, x2+1,x3+1) = f[D3Q27System::TNW]; directionFlag=true; - if ((direction & EsoTwistD3Q27System::etBNW) == EsoTwistD3Q27System::etBNW) - (*this->localDistributions)(D3Q27System::ET_TSE,x1, x2+1,x3) = f[D3Q27System::BNW]; directionFlag=true; - if ((direction & EsoTwistD3Q27System::etTSE) == EsoTwistD3Q27System::etTSE) - (*this->nonLocalDistributions)(D3Q27System::ET_BNW,x1+1,x2, x3+1) = f[D3Q27System::TSE]; directionFlag=true; - if ((direction & EsoTwistD3Q27System::etBNE) == EsoTwistD3Q27System::etBNE) - (*this->localDistributions)(D3Q27System::ET_TSW,x1+1,x2+1,x3) = f[D3Q27System::BNE]; directionFlag=true; - if ((direction & EsoTwistD3Q27System::etTSW) == EsoTwistD3Q27System::etTSW) - (*this->nonLocalDistributions)(D3Q27System::ET_BNE,x1, x2, x3+1) = f[D3Q27System::TSW]; directionFlag=true; - if ((direction & EsoTwistD3Q27System::ZERO) == EsoTwistD3Q27System::ZERO) - (*this->zeroDistributions)(x1,x2,x3) = f[D3Q27System::ZERO]; directionFlag=true; -#ifdef _DEBUG - if(!directionFlag)UB_THROW( UbException(UB_EXARGS, "Direction didn't find") ); -#endif //DEBUG -} -////////////////////////////////////////////////////////////////////////// -void D3Q27EsoTwist3DSplittedVector::setDistributionForDirection(LBMReal f, size_t x1, size_t x2, size_t x3, int direction) -{ - switch (direction) - { - case D3Q27System::E : - (*this->nonLocalDistributions)(D3Q27System::ET_W,x1+1,x2, x3 ) = f; - break; - case D3Q27System::W : - (*this->localDistributions)(D3Q27System::ET_E,x1, x2, x3) = f; - break; - case D3Q27System::S : - (*this->localDistributions)(D3Q27System::ET_N,x1, x2, x3) = f; - break; - case D3Q27System::N : - (*this->nonLocalDistributions)(D3Q27System::ET_S,x1, x2+1,x3 ) = f; - break; - case D3Q27System::B : - (*this->localDistributions)(D3Q27System::ET_T,x1, x2, x3) = f; - break; - case D3Q27System::T : - (*this->nonLocalDistributions)(D3Q27System::ET_B,x1, x2, x3+1 ) = f; - break; - case D3Q27System::SW : - (*this->localDistributions)(D3Q27System::ET_NE,x1, x2, x3) = f; - break; - case D3Q27System::NE : - (*this->nonLocalDistributions)(D3Q27System::ET_SW,x1+1,x2+1,x3 ) = f; - break; - case D3Q27System::NW : - (*this->nonLocalDistributions)(D3Q27System::ET_SE,x1, x2+1,x3 ) = f; - break; - case D3Q27System::SE : - (*this->localDistributions)(D3Q27System::ET_NW,x1+1,x2, x3) = f; - break; - case D3Q27System::BW : - (*this->localDistributions)(D3Q27System::ET_TE,x1, x2, x3) = f; - break; - case D3Q27System::TE : - (*this->nonLocalDistributions)(D3Q27System::ET_BW,x1+1,x2, x3+1 ) = f; - break; - case D3Q27System::TW : - (*this->nonLocalDistributions)(D3Q27System::ET_BE,x1, x2, x3+1 ) = f; - break; - case D3Q27System::BE : - (*this->localDistributions)(D3Q27System::ET_TW,x1+1,x2, x3) = f; - break; - case D3Q27System::BS : - (*this->localDistributions)(D3Q27System::ET_TN,x1, x2, x3) = f; - break; - case D3Q27System::TN : - (*this->nonLocalDistributions)(D3Q27System::ET_BS,x1, x2+1,x3+1 ) = f; - break; - case D3Q27System::TS : - (*this->nonLocalDistributions)(D3Q27System::ET_BN,x1, x2, x3+1 ) = f; - break; - case D3Q27System::BN : - (*this->localDistributions)(D3Q27System::ET_TS,x1, x2+1,x3) = f; - break; - case D3Q27System::BSW : - (*this->localDistributions)(D3Q27System::ET_TNE,x1, x2, x3) = f; - break; - case D3Q27System::TNE : - (*this->nonLocalDistributions)(D3Q27System::ET_BSW,x1+1,x2+1,x3+1) = f; - break; - case D3Q27System::BSE : - (*this->localDistributions)(D3Q27System::ET_TNW,x1+1,x2, x3) = f; - break; - case D3Q27System::TNW : - (*this->nonLocalDistributions)(D3Q27System::ET_BSE,x1, x2+1,x3+1) = f; - break; - case D3Q27System::BNW : - (*this->localDistributions)(D3Q27System::ET_TSE,x1, x2+1,x3) = f; - break; - case D3Q27System::TSE : - (*this->nonLocalDistributions)(D3Q27System::ET_BNW,x1+1,x2, x3+1) = f; - break; - case D3Q27System::BNE : - (*this->localDistributions)(D3Q27System::ET_TSW,x1+1,x2+1,x3) = f; - break; - case D3Q27System::TSW : - (*this->nonLocalDistributions)(D3Q27System::ET_BNE,x1, x2, x3+1) = f; - break; - case D3Q27System::ZERO : - (*this->zeroDistributions)(x1,x2,x3) = f; - break; - default: - UB_THROW( UbException(UB_EXARGS, "Direction didn't find") ); - } -} -////////////////////////////////////////////////////////////////////////// -void D3Q27EsoTwist3DSplittedVector::setDistributionInvForDirection(const LBMReal* const f, size_t x1, size_t x2, size_t x3, unsigned long int direction) -{ - bool directionFlag = false; - if ((direction & EsoTwistD3Q27System::etE) == EsoTwistD3Q27System::etE) - (*this->localDistributions)(D3Q27System::ET_E,x1, x2, x3) = f[D3Q27System::E]; directionFlag=true; - if ((direction & EsoTwistD3Q27System::etW) == EsoTwistD3Q27System::etW) - (*this->nonLocalDistributions)(D3Q27System::ET_W,x1+1,x2, x3 ) = f[D3Q27System::W]; directionFlag=true; - if ((direction & EsoTwistD3Q27System::etS) == EsoTwistD3Q27System::etS) - (*this->nonLocalDistributions)(D3Q27System::ET_S,x1, x2+1,x3 ) = f[D3Q27System::S]; directionFlag=true; - if ((direction & EsoTwistD3Q27System::etN) == EsoTwistD3Q27System::etN) - (*this->localDistributions)(D3Q27System::ET_N,x1, x2, x3) = f[D3Q27System::N]; directionFlag=true; - if ((direction & EsoTwistD3Q27System::etB) == EsoTwistD3Q27System::etB) - (*this->nonLocalDistributions)(D3Q27System::ET_B,x1, x2, x3+1 ) = f[D3Q27System::B]; directionFlag=true; - if ((direction & EsoTwistD3Q27System::etT) == EsoTwistD3Q27System::etT) - (*this->localDistributions)(D3Q27System::ET_T,x1, x2, x3) = f[D3Q27System::T]; directionFlag=true; - if ((direction & EsoTwistD3Q27System::etSW) == EsoTwistD3Q27System::etSW) - (*this->nonLocalDistributions)(D3Q27System::ET_SW,x1+1,x2+1,x3 ) = f[D3Q27System::SW]; directionFlag=true; - if ((direction & EsoTwistD3Q27System::etNE) == EsoTwistD3Q27System::etNE) - (*this->localDistributions)(D3Q27System::ET_NE,x1, x2, x3) = f[D3Q27System::NE]; directionFlag=true; - if ((direction & EsoTwistD3Q27System::etNW) == EsoTwistD3Q27System::etNW) - (*this->localDistributions)(D3Q27System::ET_NW,x1+1,x2, x3) = f[D3Q27System::NW]; directionFlag=true; - if ((direction & EsoTwistD3Q27System::etSE) == EsoTwistD3Q27System::etSE) - (*this->nonLocalDistributions)(D3Q27System::ET_SE,x1, x2+1,x3 ) = f[D3Q27System::SE]; directionFlag=true; - if ((direction & EsoTwistD3Q27System::etBW) == EsoTwistD3Q27System::etBW) - (*this->nonLocalDistributions)(D3Q27System::ET_BW,x1+1,x2, x3+1 ) = f[D3Q27System::BW]; directionFlag=true; - if ((direction & EsoTwistD3Q27System::etTE) == EsoTwistD3Q27System::etTE) - (*this->localDistributions)(D3Q27System::ET_TE,x1, x2, x3) = f[D3Q27System::TE]; directionFlag=true; - if ((direction & EsoTwistD3Q27System::etTW) == EsoTwistD3Q27System::etTW) - (*this->localDistributions)(D3Q27System::ET_TW,x1+1,x2, x3) = f[D3Q27System::TW]; directionFlag=true; - if ((direction & EsoTwistD3Q27System::etBE) == EsoTwistD3Q27System::etBE) - (*this->nonLocalDistributions)(D3Q27System::ET_BE,x1, x2, x3+1 ) = f[D3Q27System::BE]; directionFlag=true; - if ((direction & EsoTwistD3Q27System::etBS) == EsoTwistD3Q27System::etBS) - (*this->nonLocalDistributions)(D3Q27System::ET_BS,x1, x2+1,x3+1 ) = f[D3Q27System::BS]; directionFlag=true; - if ((direction & EsoTwistD3Q27System::etTN) == EsoTwistD3Q27System::etTN) - (*this->localDistributions)(D3Q27System::ET_TN,x1, x2, x3) = f[D3Q27System::TN]; directionFlag=true; - if ((direction & EsoTwistD3Q27System::etTS) == EsoTwistD3Q27System::etTS) - (*this->localDistributions)(D3Q27System::ET_TS,x1, x2+1,x3) = f[D3Q27System::TS]; directionFlag=true; - if ((direction & EsoTwistD3Q27System::etBN) == EsoTwistD3Q27System::etBN) - (*this->nonLocalDistributions)(D3Q27System::ET_BN,x1, x2, x3+1 ) = f[D3Q27System::BN]; directionFlag=true; - if ((direction & EsoTwistD3Q27System::etBSW) == EsoTwistD3Q27System::etBSW) - (*this->nonLocalDistributions)(D3Q27System::ET_BSW,x1+1,x2+1,x3+1) = f[D3Q27System::BSW]; directionFlag=true; - if ((direction & EsoTwistD3Q27System::etTNE) == EsoTwistD3Q27System::etTNE) - (*this->localDistributions)(D3Q27System::ET_TNE,x1, x2, x3) = f[D3Q27System::TNE]; directionFlag=true; - if ((direction & EsoTwistD3Q27System::etBSE) == EsoTwistD3Q27System::etBSE) - (*this->nonLocalDistributions)(D3Q27System::ET_BSE,x1, x2+1,x3+1) = f[D3Q27System::BSE]; directionFlag=true; - if ((direction & EsoTwistD3Q27System::etTNW) == EsoTwistD3Q27System::etTNW) - (*this->localDistributions)(D3Q27System::ET_TNW,x1+1,x2, x3) = f[D3Q27System::TNW]; directionFlag=true; - if ((direction & EsoTwistD3Q27System::etBNW) == EsoTwistD3Q27System::etBNW) - (*this->nonLocalDistributions)(D3Q27System::ET_BNW,x1+1,x2, x3+1) = f[D3Q27System::BNW]; directionFlag=true; - if ((direction & EsoTwistD3Q27System::etTSE) == EsoTwistD3Q27System::etTSE) - (*this->localDistributions)(D3Q27System::ET_TSE,x1, x2+1,x3) = f[D3Q27System::TSE]; directionFlag=true; - if ((direction & EsoTwistD3Q27System::etBNE) == EsoTwistD3Q27System::etBNE) - (*this->nonLocalDistributions)(D3Q27System::ET_BNE,x1, x2, x3+1)= f[D3Q27System::BNE]; directionFlag=true; - if ((direction & EsoTwistD3Q27System::etTSW) == EsoTwistD3Q27System::etTSW) - (*this->localDistributions)(D3Q27System::ET_TSW,x1+1,x2+1,x3) = f[D3Q27System::TSW]; directionFlag=true; - if ((direction & EsoTwistD3Q27System::ZERO) == EsoTwistD3Q27System::ZERO) - (*this->zeroDistributions)(x1,x2,x3) = f[D3Q27System::ZERO]; directionFlag=true; -#ifdef _DEBUG - if(!directionFlag)UB_THROW( UbException(UB_EXARGS, "Direction didn't find") ); -#endif //DEBUG -} -////////////////////////////////////////////////////////////////////////// -void D3Q27EsoTwist3DSplittedVector::setDistributionInvForDirection(LBMReal f, size_t x1, size_t x2, size_t x3, unsigned long int direction) -{ - switch (direction) - { - case D3Q27System::E : - (*this->localDistributions)(D3Q27System::ET_E,x1, x2, x3) = f; - break; - case D3Q27System::W : - (*this->nonLocalDistributions)(D3Q27System::ET_W,x1+1,x2, x3 ) = f; - break; - case D3Q27System::S : - (*this->nonLocalDistributions)(D3Q27System::ET_S,x1, x2+1,x3 ) = f; - break; - case D3Q27System::N : - (*this->localDistributions)(D3Q27System::ET_N,x1, x2, x3) = f; - break; - case D3Q27System::B : - (*this->nonLocalDistributions)(D3Q27System::ET_B,x1, x2, x3+1 ) = f; - break; - case D3Q27System::T : - (*this->localDistributions)(D3Q27System::ET_T,x1, x2, x3) = f; - break; - case D3Q27System::SW : - (*this->nonLocalDistributions)(D3Q27System::ET_SW,x1+1,x2+1,x3 ) = f; - break; - case D3Q27System::NE : - (*this->localDistributions)(D3Q27System::ET_NE,x1, x2, x3) = f; - break; - case D3Q27System::NW : - (*this->localDistributions)(D3Q27System::ET_NW,x1+1,x2, x3) = f; - break; - case D3Q27System::SE : - (*this->nonLocalDistributions)(D3Q27System::ET_SE,x1, x2+1,x3 ) = f; - break; - case D3Q27System::BW : - (*this->nonLocalDistributions)(D3Q27System::ET_BW,x1+1,x2, x3+1 ) = f; - break; - case D3Q27System::TE : - (*this->localDistributions)(D3Q27System::ET_TE,x1, x2, x3) = f; - break; - case D3Q27System::TW : - (*this->localDistributions)(D3Q27System::ET_TW,x1+1,x2, x3) = f; - break; - case D3Q27System::BE : - (*this->nonLocalDistributions)(D3Q27System::ET_BE,x1, x2, x3+1 ) = f; - break; - case D3Q27System::BS : - (*this->nonLocalDistributions)(D3Q27System::ET_BS,x1, x2+1,x3+1 ) = f; - break; - case D3Q27System::TN : - (*this->localDistributions)(D3Q27System::ET_TN,x1, x2, x3) = f; - break; - case D3Q27System::TS : - (*this->localDistributions)(D3Q27System::ET_TS,x1, x2+1,x3) = f; - break; - case D3Q27System::BN : - (*this->nonLocalDistributions)(D3Q27System::ET_BN,x1, x2, x3+1 ) = f; - break; - case D3Q27System::BSW : - (*this->nonLocalDistributions)(D3Q27System::ET_BSW,x1+1,x2+1,x3+1) = f; - break; - case D3Q27System::TNE : - (*this->localDistributions)(D3Q27System::ET_TNE,x1, x2, x3) = f; - break; - case D3Q27System::BSE : - (*this->nonLocalDistributions)(D3Q27System::ET_BSE,x1, x2+1,x3+1) = f; - break; - case D3Q27System::TNW : - (*this->localDistributions)(D3Q27System::ET_TNW,x1+1,x2, x3) = f; - break; - case D3Q27System::BNW : - (*this->nonLocalDistributions)(D3Q27System::ET_BNW,x1+1,x2, x3+1) = f; - break; - case D3Q27System::TSE : - (*this->localDistributions)(D3Q27System::ET_TSE,x1, x2+1,x3) = f; - break; - case D3Q27System::BNE : - (*this->nonLocalDistributions)(D3Q27System::ET_BNE,x1, x2, x3+1) = f; - break; - case D3Q27System::TSW : - (*this->localDistributions)(D3Q27System::ET_TSW,x1+1,x2+1,x3) = f; - break; - case D3Q27System::ZERO : - (*this->zeroDistributions)(x1,x2,x3) = f; - break; - default: - UB_THROW( UbException(UB_EXARGS, "Direction didn't find") ); - } -} -////////////////////////////////////////////////////////////////////////// -LBMReal D3Q27EsoTwist3DSplittedVector::getDistributionForDirection(size_t x1, size_t x2, size_t x3, int direction) -{ - switch (direction) - { - case D3Q27System::W : - return (*this->nonLocalDistributions)(D3Q27System::ET_W,x1+1,x2, x3 ); - case D3Q27System::E : - return (*this->localDistributions)(D3Q27System::ET_E,x1, x2, x3); - case D3Q27System::N : - return (*this->localDistributions)(D3Q27System::ET_N,x1, x2, x3); - case D3Q27System::S : - return (*this->nonLocalDistributions)(D3Q27System::ET_S,x1, x2+1,x3 ); - case D3Q27System::T : - return (*this->localDistributions)(D3Q27System::ET_T,x1, x2, x3); - case D3Q27System::B : - return (*this->nonLocalDistributions)(D3Q27System::ET_B,x1, x2, x3+1 ); - case D3Q27System::NE : - return (*this->localDistributions)(D3Q27System::ET_NE,x1, x2, x3); - case D3Q27System::SW : - return (*this->nonLocalDistributions)(D3Q27System::ET_SW,x1+1,x2+1,x3 ); - case D3Q27System::SE : - return (*this->nonLocalDistributions)(D3Q27System::ET_SE,x1, x2+1,x3 ); - case D3Q27System::NW : - return (*this->localDistributions)(D3Q27System::ET_NW,x1+1,x2, x3); - case D3Q27System::TE : - return (*this->localDistributions)(D3Q27System::ET_TE,x1, x2, x3); - case D3Q27System::BW : - return (*this->nonLocalDistributions)(D3Q27System::ET_BW,x1+1,x2, x3+1 ); - case D3Q27System::BE : - return (*this->nonLocalDistributions)(D3Q27System::ET_BE,x1, x2, x3+1 ); - case D3Q27System::TW : - return (*this->localDistributions)(D3Q27System::ET_TW,x1+1,x2, x3); - case D3Q27System::TN : - return (*this->localDistributions)(D3Q27System::ET_TN,x1, x2, x3); - case D3Q27System::BS : - return (*this->nonLocalDistributions)(D3Q27System::ET_BS,x1, x2+1,x3+1 ); - case D3Q27System::BN : - return (*this->nonLocalDistributions)(D3Q27System::ET_BN,x1, x2, x3+1 ); - case D3Q27System::TS : - return (*this->localDistributions)(D3Q27System::ET_TS,x1, x2+1,x3); - case D3Q27System::TNE : - return (*this->localDistributions)(D3Q27System::ET_TNE,x1, x2, x3); - case D3Q27System::BSW : - return (*this->nonLocalDistributions)(D3Q27System::ET_BSW,x1+1,x2+1,x3+1); - case D3Q27System::TNW : - return (*this->localDistributions)(D3Q27System::ET_TNW,x1+1,x2, x3); - case D3Q27System::BSE : - return (*this->nonLocalDistributions)(D3Q27System::ET_BSE,x1, x2+1,x3+1); - case D3Q27System::TSE : - return (*this->localDistributions)(D3Q27System::ET_TSE,x1, x2+1,x3); - case D3Q27System::BNW : - return (*this->nonLocalDistributions)(D3Q27System::ET_BNW,x1+1,x2, x3+1); - case D3Q27System::TSW : - return (*this->localDistributions)(D3Q27System::ET_TSW,x1+1,x2+1,x3); - case D3Q27System::BNE : - return (*this->nonLocalDistributions)(D3Q27System::ET_BNE,x1, x2, x3+1); - case D3Q27System::ZERO : - return (*this->zeroDistributions)(x1,x2,x3); - default: - UB_THROW( UbException(UB_EXARGS, "Direction didn't find") ); - } -} -////////////////////////////////////////////////////////////////////////// -LBMReal D3Q27EsoTwist3DSplittedVector::getDistributionInvForDirection(size_t x1, size_t x2, size_t x3, int direction) -{ - switch (direction) - { - case D3Q27System::E : - return (*this->nonLocalDistributions)(D3Q27System::ET_W,x1+1,x2, x3 ); - case D3Q27System::W : - return (*this->localDistributions)(D3Q27System::ET_E,x1, x2, x3); - case D3Q27System::S : - return (*this->localDistributions)(D3Q27System::ET_N,x1, x2, x3); - case D3Q27System::N : - return (*this->nonLocalDistributions)(D3Q27System::ET_S,x1, x2+1,x3 ); - case D3Q27System::B : - return (*this->localDistributions)(D3Q27System::ET_T,x1, x2, x3); - case D3Q27System::T : - return (*this->nonLocalDistributions)(D3Q27System::ET_B,x1, x2, x3+1 ); - case D3Q27System::SW : - return (*this->localDistributions)(D3Q27System::ET_NE,x1, x2, x3); - case D3Q27System::NE : - return (*this->nonLocalDistributions)(D3Q27System::ET_SW,x1+1,x2+1,x3 ); - case D3Q27System::NW : - return (*this->nonLocalDistributions)(D3Q27System::ET_SE,x1, x2+1,x3 ); - case D3Q27System::SE : - return (*this->localDistributions)(D3Q27System::ET_NW,x1+1,x2, x3); - case D3Q27System::BW : - return (*this->localDistributions)(D3Q27System::ET_TE,x1, x2, x3); - case D3Q27System::TE : - return (*this->nonLocalDistributions)(D3Q27System::ET_BW,x1+1,x2, x3+1 ); - case D3Q27System::TW : - return (*this->nonLocalDistributions)(D3Q27System::ET_BE,x1, x2, x3+1 ); - case D3Q27System::BE : - return (*this->localDistributions)(D3Q27System::ET_TW,x1+1,x2, x3); - case D3Q27System::BS : - return (*this->localDistributions)(D3Q27System::ET_TN,x1, x2, x3); - case D3Q27System::TN : - return (*this->nonLocalDistributions)(D3Q27System::ET_BS,x1, x2+1,x3+1 ); - case D3Q27System::TS : - return (*this->nonLocalDistributions)(D3Q27System::ET_BN,x1, x2, x3+1 ); - case D3Q27System::BN : - return (*this->localDistributions)(D3Q27System::ET_TS,x1, x2+1,x3); - case D3Q27System::BSW : - return (*this->localDistributions)(D3Q27System::ET_TNE,x1, x2, x3); - case D3Q27System::TNE : - return (*this->nonLocalDistributions)(D3Q27System::ET_BSW,x1+1,x2+1,x3+1); - case D3Q27System::BSE : - return (*this->localDistributions)(D3Q27System::ET_TNW,x1+1,x2, x3); - case D3Q27System::TNW : - return (*this->nonLocalDistributions)(D3Q27System::ET_BSE,x1, x2+1,x3+1); - case D3Q27System::BNW : - return (*this->localDistributions)(D3Q27System::ET_TSE,x1, x2+1,x3); - case D3Q27System::TSE : - return (*this->nonLocalDistributions)(D3Q27System::ET_BNW,x1+1,x2, x3+1); - case D3Q27System::BNE : - return (*this->localDistributions)(D3Q27System::ET_TSW,x1+1,x2+1,x3); - case D3Q27System::TSW : - return (*this->nonLocalDistributions)(D3Q27System::ET_BNE,x1, x2, x3+1); - case D3Q27System::ZERO : - return (*this->zeroDistributions)(x1,x2,x3); - default: - UB_THROW( UbException(UB_EXARGS, "Direction didn't find") ); - } -} -////////////////////////////////////////////////////////////////////////// -size_t D3Q27EsoTwist3DSplittedVector::getNX1() const -{ - return NX1; -} -////////////////////////////////////////////////////////////////////////// -size_t D3Q27EsoTwist3DSplittedVector::getNX2() const -{ - return NX2; -} -////////////////////////////////////////////////////////////////////////// -size_t D3Q27EsoTwist3DSplittedVector::getNX3() const -{ - return NX3; -} -////////////////////////////////////////////////////////////////////////// -CbArray4D<LBMReal,IndexerX4X3X2X1>::CbArray4DPtr D3Q27EsoTwist3DSplittedVector::getLocalDistributions() -{ - return this->localDistributions; -} -////////////////////////////////////////////////////////////////////////// -CbArray4D<LBMReal,IndexerX4X3X2X1>::CbArray4DPtr D3Q27EsoTwist3DSplittedVector::getNonLocalDistributions() -{ - return this->nonLocalDistributions; -} -////////////////////////////////////////////////////////////////////////// -CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr D3Q27EsoTwist3DSplittedVector::getZeroDistributions() -{ - return this->zeroDistributions; -} -////////////////////////////////////////////////////////////////////////// -void D3Q27EsoTwist3DSplittedVector::setNX1(size_t newNX1) -{ - NX1 = newNX1; -} -////////////////////////////////////////////////////////////////////////// -void D3Q27EsoTwist3DSplittedVector::setNX2(size_t newNX2) -{ - NX2 = newNX2; -} -////////////////////////////////////////////////////////////////////////// -void D3Q27EsoTwist3DSplittedVector::setNX3(size_t newNX3) -{ - NX3 = newNX3; -} -////////////////////////////////////////////////////////////////////////// -void D3Q27EsoTwist3DSplittedVector::setLocalDistributions(CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr array) -{ - localDistributions = array; -} -////////////////////////////////////////////////////////////////////////// -void D3Q27EsoTwist3DSplittedVector::setNonLocalDistributions(CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr array) -{ - nonLocalDistributions = array; -} -////////////////////////////////////////////////////////////////////////// -void D3Q27EsoTwist3DSplittedVector::setZeroDistributions(CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr array) -{ - zeroDistributions = array; -} - -////////////////////////////////////////////////////////////////////////// - diff --git a/src/VirtualFluids/Data/D3Q27EsoTwist3DSplittedVector.h b/src/VirtualFluids/Data/D3Q27EsoTwist3DSplittedVector.h deleted file mode 100644 index 1429eb286..000000000 --- a/src/VirtualFluids/Data/D3Q27EsoTwist3DSplittedVector.h +++ /dev/null @@ -1,86 +0,0 @@ -#ifndef D3Q27EsoTwist3DSplittedVector_h -#define D3Q27EsoTwist3DSplittedVector_h - -#include "EsoTwist3D.h" -#include "D3Q27System.h" -#include "basics/container/CbArray4D.h" -#include "basics/container/CbArray3D.h" -#include <boost/serialization/serialization.hpp> -#include <boost/serialization/base_object.hpp> - -class D3Q27EsoTwist3DSplittedVector : public EsoTwist3D -{ -public: - D3Q27EsoTwist3DSplittedVector(); - D3Q27EsoTwist3DSplittedVector(size_t nx1, size_t nx2, size_t nx3, LBMReal value); - ////////////////////////////////////////////////////////////////////////// - ~D3Q27EsoTwist3DSplittedVector(); - ////////////////////////////////////////////////////////////////////////// - void swap(); - ////////////////////////////////////////////////////////////////////////// - virtual void getDistribution( LBMReal* const f, size_t x1, size_t x2, size_t x3); - ////////////////////////////////////////////////////////////////////////// - virtual void setDistribution(const LBMReal* const f, size_t x1, size_t x2, size_t x3); - //////////////////////////////////////////////////////////////////////// - virtual void getDistributionInv( LBMReal* const f, size_t x1, size_t x2, size_t x3); - ////////////////////////////////////////////////////////////////////////// - virtual void setDistributionInv(const LBMReal* const f, size_t x1, size_t x2, size_t x3); - ////////////////////////////////////////////////////////////////////////// - virtual void setDistributionForDirection(const LBMReal* const f, size_t x1, size_t x2, size_t x3, unsigned long int direction); - ////////////////////////////////////////////////////////////////////////// - virtual void setDistributionForDirection(LBMReal f, size_t x1, size_t x2, size_t x3, int direction); - ////////////////////////////////////////////////////////////////////////// - virtual LBMReal getDistributionInvForDirection(size_t x1, size_t x2, size_t x3, int direction); - ////////////////////////////////////////////////////////////////////////// - virtual void setDistributionInvForDirection(const LBMReal* const f, size_t x1, size_t x2, size_t x3, unsigned long int direction); - ////////////////////////////////////////////////////////////////////////// - virtual void setDistributionInvForDirection(LBMReal f, size_t x1, size_t x2, size_t x3, unsigned long int direction); - ////////////////////////////////////////////////////////////////////////// - virtual LBMReal getDistributionForDirection(size_t x1, size_t x2, size_t x3, int direction); - ////////////////////////////////////////////////////////////////////////// - size_t getNX1() const; - ////////////////////////////////////////////////////////////////////////// - size_t getNX2() const; - ////////////////////////////////////////////////////////////////////////// - size_t getNX3() const; - ////////////////////////////////////////////////////////////////////////// - CbArray4D<LBMReal,IndexerX4X3X2X1>::CbArray4DPtr getLocalDistributions(); - ////////////////////////////////////////////////////////////////////////// - CbArray4D<LBMReal,IndexerX4X3X2X1>::CbArray4DPtr getNonLocalDistributions(); - ////////////////////////////////////////////////////////////////////////// - CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr getZeroDistributions(); - ////////////////////////////////////////////////////////////////////////// - void setNX1(size_t newNX1); - void setNX2(size_t newNX2); - void setNX3(size_t newNX3); - void setLocalDistributions(CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr array); - void setNonLocalDistributions(CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr array); - void setZeroDistributions(CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr array); - -protected: - CbArray4D<LBMReal,IndexerX4X3X2X1>::CbArray4DPtr localDistributions; - CbArray4D<LBMReal,IndexerX4X3X2X1>::CbArray4DPtr nonLocalDistributions; - CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr zeroDistributions; - size_t NX1, NX2, NX3; - - friend class MPIIORestart1CoProcessor; - friend class MPIIORestart2CoProcessor; - friend class MPIIORestart11CoProcessor; - friend class MPIIORestart21CoProcessor; - - - friend class boost::serialization::access; - template<class Archive> - void serialize(Archive & ar, const unsigned int version) - { - ar & boost::serialization::base_object< EsoTwist3D >(*this); - ar & NX1; - ar & NX2; - ar & NX3; - ar & localDistributions; - ar & nonLocalDistributions; - ar & zeroDistributions; - } -}; - -#endif diff --git a/src/VirtualFluids/Data/D3Q27EsoTwist3DSplittedVectorEx.cpp b/src/VirtualFluids/Data/D3Q27EsoTwist3DSplittedVectorEx.cpp deleted file mode 100644 index 6a8ccc149..000000000 --- a/src/VirtualFluids/Data/D3Q27EsoTwist3DSplittedVectorEx.cpp +++ /dev/null @@ -1,13 +0,0 @@ -#include "D3Q27EsoTwist3DSplittedVectorEx.h" - -D3Q27EsoTwist3DSplittedVectorEx::D3Q27EsoTwist3DSplittedVectorEx( int nx1, int nx2, int nx3, LBMReal value ) -{ - this->NX1 = nx1; - this->NX2 = nx2; - this->NX3 = nx3; - - this->localDistributions = CbArray4D<LBMReal,IndexerX4X3X2X1>::CbArray4DPtr(new CbArray4D<LBMReal,IndexerX4X3X2X1>(13, nx1, nx2, nx3, value)); - this->nonLocalDistributions = CbArray4D<LBMReal,IndexerX4X3X2X1>::CbArray4DPtr(new CbArray4D<LBMReal,IndexerX4X3X2X1>(13, nx1, nx2, nx3, value)); - - this->zeroDistributions = CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<LBMReal,IndexerX3X2X1>(nx1, nx2, nx3, value)); -} diff --git a/src/VirtualFluids/Data/D3Q27EsoTwist3DSplittedVectorEx.h b/src/VirtualFluids/Data/D3Q27EsoTwist3DSplittedVectorEx.h deleted file mode 100644 index 9e41d877b..000000000 --- a/src/VirtualFluids/Data/D3Q27EsoTwist3DSplittedVectorEx.h +++ /dev/null @@ -1,15 +0,0 @@ -#ifndef D3Q27EsoTwist3DSplittedVectorEx_h -#define D3Q27EsoTwist3DSplittedVectorEx_h - -#include "D3Q27EsoTwist3DSplittedVector.h" - -class D3Q27EsoTwist3DSplittedVectorEx : public D3Q27EsoTwist3DSplittedVector -{ -public: - D3Q27EsoTwist3DSplittedVectorEx(int nx1, int nx2, int nx3, LBMReal value); -protected: -private: -}; - -#endif - diff --git a/src/VirtualFluids/Data/DataSet3D.h b/src/VirtualFluids/Data/DataSet3D.h deleted file mode 100644 index bcf0685b9..000000000 --- a/src/VirtualFluids/Data/DataSet3D.h +++ /dev/null @@ -1,155 +0,0 @@ -#ifndef DataSet3D_h -#define DataSet3D_h - -#include <boost/serialization/serialization.hpp> -#include "basics/container/CbArray4D.h" -#include "basics/container/CbArray3D.h" -#include "DistributionArray3D.h" - -class DataSet3D; -typedef std::shared_ptr<DataSet3D> DataSet3DPtr; - -typedef CbArray4D<LBMReal,IndexerX4X3X2X1> AverageValuesArray3D; -typedef std::shared_ptr< AverageValuesArray3D > AverageValuesArray3DPtr; - -typedef CbArray4D<LBMReal,IndexerX4X3X2X1> ShearStressValuesArray3D; -typedef std::shared_ptr< ShearStressValuesArray3D > ShearStressValuesArray3DPtr; - -typedef CbArray3D<LBMReal, IndexerX3X2X1> RelaxationFactorArray3D; -typedef std::shared_ptr< RelaxationFactorArray3D > RelaxationFactorArray3DPtr; - -class DataSet3D -{ -public: - DistributionArray3DPtr getFdistributions() const; - void setFdistributions(DistributionArray3DPtr distributions); - - AverageValuesArray3DPtr getAverageDencity() const; - void setAverageDencity(AverageValuesArray3DPtr values); - - AverageValuesArray3DPtr getAverageVelocity() const; - void setAverageVelocity(AverageValuesArray3DPtr values); - - AverageValuesArray3DPtr getAverageFluctuations() const; - void setAverageFluctuations(AverageValuesArray3DPtr values); - - AverageValuesArray3DPtr getAverageTriplecorrelations() const; - void setAverageTriplecorrelations(AverageValuesArray3DPtr values); - - AverageValuesArray3DPtr getAverageValues() const; - void setAverageValues(AverageValuesArray3DPtr values); - - ShearStressValuesArray3DPtr getShearStressValues() const; - void setShearStressValues(ShearStressValuesArray3DPtr values); - - RelaxationFactorArray3DPtr getRelaxationFactor() const; - void setRelaxationFactor(RelaxationFactorArray3DPtr values); -protected: -private: - DistributionArray3DPtr fdistributions; - AverageValuesArray3DPtr averageValues; - - AverageValuesArray3DPtr averageDencity; - AverageValuesArray3DPtr averageVelocity; - AverageValuesArray3DPtr averageFluktuations; - AverageValuesArray3DPtr averageTriplecorrelations; - - ShearStressValuesArray3DPtr shearStressValues; - - RelaxationFactorArray3DPtr relaxationFactor; - - friend class boost::serialization::access; - template<class Archive> - void serialize(Archive & ar, const unsigned int version) - { - ar & fdistributions; - ar & averageValues; - ar & shearStressValues; - ar & averageDencity; - ar & averageVelocity; - ar & averageFluktuations; - ar & averageTriplecorrelations; - ar & relaxationFactor; - } -}; - -inline DistributionArray3DPtr DataSet3D::getFdistributions() const -{ - return fdistributions; -} - -inline void DataSet3D::setFdistributions(DistributionArray3DPtr distributions) -{ - fdistributions = distributions; -} - -inline AverageValuesArray3DPtr DataSet3D::getAverageValues() const -{ - return averageValues; -} - -inline void DataSet3D::setAverageValues(AverageValuesArray3DPtr values) -{ - averageValues = values; -} - -inline AverageValuesArray3DPtr DataSet3D::getAverageDencity() const -{ - return averageDencity; -} - -inline void DataSet3D::setAverageDencity(AverageValuesArray3DPtr values) -{ - averageDencity = values; -} - -inline AverageValuesArray3DPtr DataSet3D::getAverageVelocity() const -{ - return averageVelocity; -} - -inline void DataSet3D::setAverageVelocity(AverageValuesArray3DPtr values) -{ - averageVelocity = values; -} - -inline AverageValuesArray3DPtr DataSet3D::getAverageFluctuations() const -{ - return averageFluktuations; -} - -inline void DataSet3D::setAverageFluctuations(AverageValuesArray3DPtr values) -{ - averageFluktuations = values; -} - -inline AverageValuesArray3DPtr DataSet3D::getAverageTriplecorrelations() const -{ - return averageTriplecorrelations; -} - -inline void DataSet3D::setAverageTriplecorrelations(AverageValuesArray3DPtr values) -{ - averageTriplecorrelations = values; -} - -inline ShearStressValuesArray3DPtr DataSet3D::getShearStressValues() const -{ - return shearStressValues; -} - -inline void DataSet3D::setShearStressValues(ShearStressValuesArray3DPtr values) -{ - shearStressValues = values; -} - -inline RelaxationFactorArray3DPtr DataSet3D::getRelaxationFactor() const -{ - return relaxationFactor; -} - -inline void DataSet3D::setRelaxationFactor(RelaxationFactorArray3DPtr values) -{ - relaxationFactor = values; -} -#endif diff --git a/src/VirtualFluids/Data/DistributionArray3D.h b/src/VirtualFluids/Data/DistributionArray3D.h deleted file mode 100644 index 476e4739a..000000000 --- a/src/VirtualFluids/Data/DistributionArray3D.h +++ /dev/null @@ -1,37 +0,0 @@ -#ifndef DistributionArray3D_H -#define DistributionArray3D_H - -#include <LBMSystem.h> -#include <boost/serialization/serialization.hpp> - -class DistributionArray3D; -typedef std::shared_ptr<DistributionArray3D> DistributionArray3DPtr; - -class DistributionArray3D -{ -public: - DistributionArray3D() {}; - virtual ~DistributionArray3D(){}; - virtual size_t getNX1() const = 0; - virtual size_t getNX2() const = 0; - virtual size_t getNX3() const = 0; - virtual void getDistribution(LBMReal* const f, size_t x1, size_t x2, size_t x3) = 0; - virtual void setDistribution(const LBMReal* const f, size_t x1, size_t x2, size_t x3) = 0; - virtual void getDistributionInv( LBMReal* const f, size_t x1, size_t x2, size_t x3) = 0; - virtual void setDistributionInv(const LBMReal* const f, size_t x1, size_t x2, size_t x3) = 0; - virtual void setDistributionForDirection(const LBMReal* const f, size_t x1, size_t x2, size_t x3, unsigned long int direction) = 0; - virtual void setDistributionForDirection(LBMReal f, size_t x1, size_t x2, size_t x3, int direction) = 0; - virtual LBMReal getDistributionInvForDirection(size_t x1, size_t x2, size_t x3, int direction) = 0; - virtual void setDistributionInvForDirection(const LBMReal* const f, size_t x1, size_t x2, size_t x3, unsigned long int direction) = 0; - virtual void setDistributionInvForDirection(LBMReal f, size_t x1, size_t x2, size_t x3, unsigned long int direction) = 0; - virtual LBMReal getDistributionForDirection(size_t x1, size_t x2, size_t x3, int direction) = 0; - virtual void swap() = 0; -protected: -private: - friend class boost::serialization::access; - template<class Archive> - void serialize(Archive & ar, const unsigned int version) - {} -}; - -#endif diff --git a/src/VirtualFluids/Data/EsoTwist3D.h b/src/VirtualFluids/Data/EsoTwist3D.h deleted file mode 100644 index 437cf8ef2..000000000 --- a/src/VirtualFluids/Data/EsoTwist3D.h +++ /dev/null @@ -1,61 +0,0 @@ -#ifndef ESOTWIST3D_H -#define ESOTWIST3D_H - -#include "DistributionArray3D.h" -#include <LBMSystem.h> -#include <boost/serialization/serialization.hpp> -#include <boost/serialization/base_object.hpp> - -class EsoTwist3D; -typedef std::shared_ptr<EsoTwist3D> EsoTwist3DPtr; - -class EsoTwistD3Q27UnrollArray{}; -class EsoTwistPlusD3Q27UnrollArray{}; -class EsoTwistPlusD3Q19UnrollArray{}; - -class EsoTwist3D : public DistributionArray3D -{ -public: - EsoTwist3D(){}; - virtual ~EsoTwist3D(){}; - ////////////////////////////////////////////////////////////////////////// - virtual void swap() = 0; - ////////////////////////////////////////////////////////////////////////// - virtual void getDistribution(LBMReal* const f, size_t x1, size_t x2, size_t x3) = 0; - ////////////////////////////////////////////////////////////////////////// - virtual void setDistribution(const LBMReal* const f, size_t x1, size_t x2, size_t x3) = 0; - //////////////////////////////////////////////////////////////////////// - virtual void getDistributionInv( LBMReal* const f, size_t x1, size_t x2, size_t x3) = 0; - ////////////////////////////////////////////////////////////////////////// - virtual void setDistributionInv(const LBMReal* const f, size_t x1, size_t x2, size_t x3) = 0; - ////////////////////////////////////////////////////////////////////////// - virtual void setDistributionForDirection(const LBMReal* const f, size_t x1, size_t x2, size_t x3, unsigned long int direction) = 0; - ////////////////////////////////////////////////////////////////////////// - virtual void setDistributionForDirection(LBMReal f, size_t x1, size_t x2, size_t x3, int direction) = 0; - ////////////////////////////////////////////////////////////////////////// - //virtual void getDistributionInvForDirection(LBMReal* const& f, const size_t& x1, const size_t& x2, const size_t& x3, const unsigned long int& direction) = 0; - ////////////////////////////////////////////////////////////////////////// - virtual LBMReal getDistributionInvForDirection(size_t x1, size_t x2, size_t x3, int direction) = 0; - ////////////////////////////////////////////////////////////////////////// - virtual void setDistributionInvForDirection(const LBMReal* const f, size_t x1, size_t x2, size_t x3, unsigned long int direction) = 0; - ////////////////////////////////////////////////////////////////////////// - virtual void setDistributionInvForDirection(LBMReal f, size_t x1, size_t x2, size_t x3, unsigned long int direction) = 0; - ////////////////////////////////////////////////////////////////////////// - virtual LBMReal getDistributionForDirection(size_t x1, size_t x2, size_t x3, int direction) = 0; - ////////////////////////////////////////////////////////////////////////// - virtual size_t getNX1() const = 0; - ////////////////////////////////////////////////////////////////////////// - virtual size_t getNX2() const = 0; - ////////////////////////////////////////////////////////////////////////// - virtual size_t getNX3() const = 0; - ////////////////////////////////////////////////////////////////////////// - - friend class boost::serialization::access; - template<class Archive> - void serialize(Archive & ar, const unsigned int version) - { - ar & boost::serialization::base_object< DistributionArray3D >(*this); - } -}; - -#endif diff --git a/src/VirtualFluids/Data/EsoTwistD3Q27SparseData.cpp b/src/VirtualFluids/Data/EsoTwistD3Q27SparseData.cpp deleted file mode 100644 index 31e0b44bc..000000000 --- a/src/VirtualFluids/Data/EsoTwistD3Q27SparseData.cpp +++ /dev/null @@ -1,628 +0,0 @@ -#include "EsoTwistD3Q27SparseData.h" -#include "EsoTwistD3Q27System.h" - -EsoTwistD3Q27SparseData::SparseData EsoTwistD3Q27SparseData::localDistributions; -EsoTwistD3Q27SparseData::SparseData EsoTwistD3Q27SparseData::nonLocalDistributions; -EsoTwistD3Q27SparseData::SparseData EsoTwistD3Q27SparseData::zeroDistributions; - -size_t EsoTwistD3Q27SparseData::nx1=0; -size_t EsoTwistD3Q27SparseData::nx2=0; -size_t EsoTwistD3Q27SparseData::nx3=0; -size_t EsoTwistD3Q27SparseData::nx4=0; -size_t EsoTwistD3Q27SparseData::nx5=0; -////////////////////////////////////////////////////////////////////////// -EsoTwistD3Q27SparseData::EsoTwistD3Q27SparseData() -{ -} -////////////////////////////////////////////////////////////////////////// -EsoTwistD3Q27SparseData::EsoTwistD3Q27SparseData( size_t ibx[3], size_t nx[3], size_t level, double value ) -{ - this->NX1 = nx[0]; - this->NX2 = nx[1]; - this->NX3 = nx[2]; - - this->ox1 = ibx[0]*nx[0]; - this->ox2 = ibx[1]*nx[1]; - this->ox3 = ibx[2]*nx[2]; - this->level = level; - - ld = SparseDataPtr(&localDistributions); - nld = SparseDataPtr(&nonLocalDistributions); - zd = SparseDataPtr(&zeroDistributions); - - for(int x3 = 0; x3 < NX3; x3++) - { - for(int x2 = 0; x2 < NX2; x2++) - { - for(int x1 = 0; x1 < NX1; x1++) - { - for(int f = 0; f < 13; f++) - { - ld->insert(std::make_pair(index4D(f,x1,x2,x3),value)); - nld->insert(std::make_pair(index4D(f,x1,x2,x3),value)); - } - zd->insert(std::make_pair(index3D(x1,x2,x3),value)); - } - } - } -} -////////////////////////////////////////////////////////////////////////// -EsoTwistD3Q27SparseData::~EsoTwistD3Q27SparseData() -{ - ld = SparseDataPtr(); - nld = SparseDataPtr(); - zd = SparseDataPtr(); - -} -////////////////////////////////////////////////////////////////////////// -void EsoTwistD3Q27SparseData::swap() -{ - std::swap( this->ld, this->nld ); -} -////////////////////////////////////////////////////////////////////////// -void EsoTwistD3Q27SparseData::getDistribution(LBMReal* const f, size_t x1, size_t x2, size_t x3) -{ - size_t x1plus = x1+1; - size_t x2plus = x2+1; - size_t x3plus = x3+1; - - f[D3Q27System::E] = (*ld)[index4D(D3Q27System::ET_E, x1,x2,x3)]; - f[D3Q27System::N] = (*ld)[index4D(D3Q27System::ET_N,x1,x2,x3)]; - f[D3Q27System::T] = (*ld)[index4D(D3Q27System::ET_T,x1,x2,x3)]; - f[D3Q27System::NE] = (*ld)[index4D(D3Q27System::ET_NE,x1,x2,x3)]; - f[D3Q27System::NW] = (*ld)[index4D(D3Q27System::ET_NW,x1plus,x2,x3)]; - f[D3Q27System::TE] = (*ld)[index4D(D3Q27System::ET_TE,x1,x2,x3)]; - f[D3Q27System::TW] = (*ld)[index4D(D3Q27System::ET_TW, x1plus,x2,x3)]; - f[D3Q27System::TN] = (*ld)[index4D(D3Q27System::ET_TN,x1,x2,x3)]; - f[D3Q27System::TS] = (*ld)[index4D(D3Q27System::ET_TS,x1,x2plus,x3)]; - f[D3Q27System::TNE] = (*ld)[index4D(D3Q27System::ET_TNE,x1,x2,x3)]; - f[D3Q27System::TNW] = (*ld)[index4D(D3Q27System::ET_TNW,x1plus,x2,x3)]; - f[D3Q27System::TSE] = (*ld)[index4D(D3Q27System::ET_TSE,x1,x2plus,x3)]; - f[D3Q27System::TSW] = (*ld)[index4D(D3Q27System::ET_TSW,x1plus,x2plus,x3)]; - - f[D3Q27System::W ] = (*nld)[index4D(D3Q27System::ET_W,x1plus,x2,x3 )]; - f[D3Q27System::S ] = (*nld)[index4D(D3Q27System::ET_S,x1,x2plus,x3 )]; - f[D3Q27System::B ] = (*nld)[index4D(D3Q27System::ET_B,x1,x2,x3plus )]; - f[D3Q27System::SW] = (*nld)[index4D(D3Q27System::ET_SW,x1plus,x2plus,x3 )]; - f[D3Q27System::SE] = (*nld)[index4D(D3Q27System::ET_SE,x1,x2plus,x3 )]; - f[D3Q27System::BW] = (*nld)[index4D(D3Q27System::ET_BW,x1plus,x2,x3plus )]; - f[D3Q27System::BE] = (*nld)[index4D(D3Q27System::ET_BE,x1,x2,x3plus )]; - f[D3Q27System::BS] = (*nld)[index4D(D3Q27System::ET_BS,x1,x2plus,x3plus )]; - f[D3Q27System::BN] = (*nld)[index4D(D3Q27System::ET_BN,x1,x2,x3plus )]; - f[D3Q27System::BSW] = (*nld)[index4D(D3Q27System::ET_BSW,x1plus,x2plus,x3plus)]; - f[D3Q27System::BSE] = (*nld)[index4D(D3Q27System::ET_BSE,x1,x2plus,x3plus)]; - f[D3Q27System::BNW] = (*nld)[index4D(D3Q27System::ET_BNW,x1plus,x2,x3plus)]; - f[D3Q27System::BNE] = (*nld)[index4D(D3Q27System::ET_BNE,x1,x2,x3plus)]; - - f[D3Q27System::ZERO] = (*zd)[index3D(x1,x2,x3)]; -} -//////////////////////////////////////////////////////////////////////// -void EsoTwistD3Q27SparseData::setDistribution(const LBMReal* const f, size_t x1, size_t x2, size_t x3) -{ - size_t x1plus = x1+1; - size_t x2plus = x2+1; - size_t x3plus = x3+1; - - (*ld)[index4D(D3Q27System::ET_E,x1, x2, x3)] = f[D3Q27System::INV_E]; - (*ld)[index4D(D3Q27System::ET_N,x1, x2, x3)] = f[D3Q27System::INV_N]; - (*ld)[index4D(D3Q27System::ET_T,x1, x2, x3)] = f[D3Q27System::INV_T]; - (*ld)[index4D(D3Q27System::ET_NE,x1, x2, x3)] = f[D3Q27System::INV_NE]; - (*ld)[index4D(D3Q27System::ET_NW,x1plus,x2, x3)] = f[D3Q27System::INV_NW]; - (*ld)[index4D(D3Q27System::ET_TE,x1, x2, x3)] = f[D3Q27System::INV_TE]; - (*ld)[index4D(D3Q27System::ET_TW,x1plus,x2, x3)] = f[D3Q27System::INV_TW]; - (*ld)[index4D(D3Q27System::ET_TN,x1, x2, x3)] = f[D3Q27System::INV_TN]; - (*ld)[index4D(D3Q27System::ET_TS,x1, x2plus,x3)] = f[D3Q27System::INV_TS]; - (*ld)[index4D(D3Q27System::ET_TNE,x1, x2, x3)] = f[D3Q27System::INV_TNE]; - (*ld)[index4D(D3Q27System::ET_TNW,x1plus,x2, x3)] = f[D3Q27System::INV_TNW]; - (*ld)[index4D(D3Q27System::ET_TSE,x1, x2plus,x3)] = f[D3Q27System::INV_TSE]; - (*ld)[index4D(D3Q27System::ET_TSW,x1plus,x2plus,x3)] = f[D3Q27System::INV_TSW]; - - (*nld)[index4D(D3Q27System::ET_W,x1plus,x2, x3 )] = f[D3Q27System::INV_W ]; - (*nld)[index4D(D3Q27System::ET_S,x1, x2plus,x3 )] = f[D3Q27System::INV_S ]; - (*nld)[index4D(D3Q27System::ET_B,x1, x2, x3plus )] = f[D3Q27System::INV_B ]; - (*nld)[index4D(D3Q27System::ET_SW,x1plus,x2plus,x3 )] = f[D3Q27System::INV_SW]; - (*nld)[index4D(D3Q27System::ET_SE,x1, x2plus,x3 )] = f[D3Q27System::INV_SE]; - (*nld)[index4D(D3Q27System::ET_BW,x1plus,x2, x3plus )] = f[D3Q27System::INV_BW]; - (*nld)[index4D(D3Q27System::ET_BE,x1, x2, x3plus )] = f[D3Q27System::INV_BE]; - (*nld)[index4D(D3Q27System::ET_BS,x1, x2plus,x3plus )] = f[D3Q27System::INV_BS]; - (*nld)[index4D(D3Q27System::ET_BN,x1, x2, x3plus )] = f[D3Q27System::INV_BN]; - (*nld)[index4D(D3Q27System::ET_BSW,x1plus,x2plus,x3plus)] = f[D3Q27System::INV_BSW]; - (*nld)[index4D(D3Q27System::ET_BSE,x1, x2plus,x3plus)] = f[D3Q27System::INV_BSE]; - (*nld)[index4D(D3Q27System::ET_BNW,x1plus,x2, x3plus)] = f[D3Q27System::INV_BNW]; - (*nld)[index4D(D3Q27System::ET_BNE,x1, x2, x3plus)] = f[D3Q27System::INV_BNE]; - - (*zd)[index3D(x1,x2,x3)] = f[D3Q27System::ZERO]; -} -//////////////////////////////////////////////////////////////////////// -void EsoTwistD3Q27SparseData::getDistributionInv(LBMReal* const f, size_t x1, size_t x2, size_t x3) -{ - size_t x1plus = x1+1; - size_t x2plus = x2+1; - size_t x3plus = x3+1; - - f[D3Q27System::INV_E] = (*ld)[index4D(D3Q27System::ET_E, x1,x2,x3)]; - f[D3Q27System::INV_N] = (*ld)[index4D(D3Q27System::ET_N,x1,x2,x3)]; - f[D3Q27System::INV_T] = (*ld)[index4D(D3Q27System::ET_T,x1,x2,x3)]; - f[D3Q27System::INV_NE] = (*ld)[index4D(D3Q27System::ET_NE,x1,x2,x3)]; - f[D3Q27System::INV_NW] = (*ld)[index4D(D3Q27System::ET_NW,x1plus,x2,x3)]; - f[D3Q27System::INV_TE] = (*ld)[index4D(D3Q27System::ET_TE,x1,x2,x3)]; - f[D3Q27System::INV_TW] = (*ld)[index4D(D3Q27System::ET_TW, x1plus,x2,x3)]; - f[D3Q27System::INV_TN] = (*ld)[index4D(D3Q27System::ET_TN,x1,x2,x3)]; - f[D3Q27System::INV_TS] = (*ld)[index4D(D3Q27System::ET_TS,x1,x2plus,x3)]; - f[D3Q27System::INV_TNE] = (*ld)[index4D(D3Q27System::ET_TNE,x1,x2,x3)]; - f[D3Q27System::INV_TNW] = (*ld)[index4D(D3Q27System::ET_TNW,x1plus,x2,x3)]; - f[D3Q27System::INV_TSE] = (*ld)[index4D(D3Q27System::ET_TSE,x1,x2plus,x3)]; - f[D3Q27System::INV_TSW] = (*ld)[index4D(D3Q27System::ET_TSW,x1plus,x2plus,x3)]; - - f[D3Q27System::INV_W ] = (*nld)[index4D(D3Q27System::ET_W,x1plus,x2,x3 )]; - f[D3Q27System::INV_S ] = (*nld)[index4D(D3Q27System::ET_S,x1,x2plus,x3 )]; - f[D3Q27System::INV_B ] = (*nld)[index4D(D3Q27System::ET_B,x1,x2,x3plus )]; - f[D3Q27System::INV_SW] = (*nld)[index4D(D3Q27System::ET_SW,x1plus,x2plus,x3 )]; - f[D3Q27System::INV_SE] = (*nld)[index4D(D3Q27System::ET_SE,x1,x2plus,x3 )]; - f[D3Q27System::INV_BW] = (*nld)[index4D(D3Q27System::ET_BW,x1plus,x2,x3plus )]; - f[D3Q27System::INV_BE] = (*nld)[index4D(D3Q27System::ET_BE,x1,x2,x3plus )]; - f[D3Q27System::INV_BS] = (*nld)[index4D(D3Q27System::ET_BS,x1,x2plus,x3plus )]; - f[D3Q27System::INV_BN] = (*nld)[index4D(D3Q27System::ET_BN,x1,x2,x3plus )]; - f[D3Q27System::INV_BSW] = (*nld)[index4D(D3Q27System::ET_BSW,x1plus,x2plus,x3plus)]; - f[D3Q27System::INV_BSE] = (*nld)[index4D(D3Q27System::ET_BSE,x1,x2plus,x3plus)]; - f[D3Q27System::INV_BNW] = (*nld)[index4D(D3Q27System::ET_BNW,x1plus,x2,x3plus)]; - f[D3Q27System::INV_BNE] = (*nld)[index4D(D3Q27System::ET_BNE,x1,x2,x3plus)]; - - f[D3Q27System::ZERO] = (*zd)[index3D(x1,x2,x3)]; -} -////////////////////////////////////////////////////////////////////////// -void EsoTwistD3Q27SparseData::setDistributionInv(const LBMReal* const f, size_t x1, size_t x2, size_t x3) -{ - size_t x1plus = x1+1; - size_t x2plus = x2+1; - size_t x3plus = x3+1; - - (*ld)[index4D(D3Q27System::ET_E,x1, x2, x3)] = f[D3Q27System::E]; - (*ld)[index4D(D3Q27System::ET_N,x1, x2, x3)] = f[D3Q27System::N]; - (*ld)[index4D(D3Q27System::ET_T,x1, x2, x3)] = f[D3Q27System::T]; - (*ld)[index4D(D3Q27System::ET_NE,x1, x2, x3)] = f[D3Q27System::NE]; - (*ld)[index4D(D3Q27System::ET_NW,x1plus,x2, x3)] = f[D3Q27System::NW]; - (*ld)[index4D(D3Q27System::ET_TE,x1, x2, x3)] = f[D3Q27System::TE]; - (*ld)[index4D(D3Q27System::ET_TW,x1plus,x2, x3)] = f[D3Q27System::TW]; - (*ld)[index4D(D3Q27System::ET_TN,x1, x2, x3)] = f[D3Q27System::TN]; - (*ld)[index4D(D3Q27System::ET_TS,x1, x2plus,x3)] = f[D3Q27System::TS]; - (*ld)[index4D(D3Q27System::ET_TNE,x1, x2, x3)] = f[D3Q27System::TNE]; - (*ld)[index4D(D3Q27System::ET_TNW,x1plus,x2, x3)] = f[D3Q27System::TNW]; - (*ld)[index4D(D3Q27System::ET_TSE,x1, x2plus,x3)] = f[D3Q27System::TSE]; - (*ld)[index4D(D3Q27System::ET_TSW,x1plus,x2plus,x3)] = f[D3Q27System::TSW]; - - (*nld)[index4D(D3Q27System::ET_W,x1plus,x2, x3 )] = f[D3Q27System::W ]; - (*nld)[index4D(D3Q27System::ET_S,x1, x2plus,x3 )] = f[D3Q27System::S ]; - (*nld)[index4D(D3Q27System::ET_B,x1, x2, x3plus )] = f[D3Q27System::B ]; - (*nld)[index4D(D3Q27System::ET_SW,x1plus,x2plus,x3 )] = f[D3Q27System::SW]; - (*nld)[index4D(D3Q27System::ET_SE,x1, x2plus,x3 )] = f[D3Q27System::SE]; - (*nld)[index4D(D3Q27System::ET_BW,x1plus,x2, x3plus )] = f[D3Q27System::BW]; - (*nld)[index4D(D3Q27System::ET_BE,x1, x2, x3plus )] = f[D3Q27System::BE]; - (*nld)[index4D(D3Q27System::ET_BS,x1, x2plus,x3plus )] = f[D3Q27System::BS]; - (*nld)[index4D(D3Q27System::ET_BN,x1, x2, x3plus )] = f[D3Q27System::BN]; - (*nld)[index4D(D3Q27System::ET_BSW,x1plus,x2plus,x3plus)] = f[D3Q27System::BSW]; - (*nld)[index4D(D3Q27System::ET_BSE,x1, x2plus,x3plus)] = f[D3Q27System::BSE]; - (*nld)[index4D(D3Q27System::ET_BNW,x1plus,x2, x3plus)] = f[D3Q27System::BNW]; - (*nld)[index4D(D3Q27System::ET_BNE,x1, x2, x3plus)] = f[D3Q27System::BNE]; - - (*zd)[index3D(x1,x2,x3)] = f[D3Q27System::ZERO]; -} -////////////////////////////////////////////////////////////////////////// -void EsoTwistD3Q27SparseData::setDistributionForDirection(const LBMReal* const f, size_t x1, size_t x2, size_t x3, unsigned long int direction) -{ - size_t x1plus = x1+1; - size_t x2plus = x2+1; - size_t x3plus = x3+1; - - bool directionFlag = false; - if ((direction & EsoTwistD3Q27System::etE) == EsoTwistD3Q27System::etE) - (*nld)[index4D(D3Q27System::ET_W,x1plus,x2, x3 )] = f[D3Q27System::E]; directionFlag=true; - if ((direction & EsoTwistD3Q27System::etW) == EsoTwistD3Q27System::etW) - (*ld)[index4D(D3Q27System::ET_E,x1, x2, x3)] = f[D3Q27System::W]; directionFlag=true; - if ((direction & EsoTwistD3Q27System::etS) == EsoTwistD3Q27System::etS) - (*ld)[index4D(D3Q27System::ET_N,x1, x2, x3)] = f[D3Q27System::S]; directionFlag=true; - if ((direction & EsoTwistD3Q27System::etN) == EsoTwistD3Q27System::etN) - (*nld)[index4D(D3Q27System::ET_S,x1, x2plus,x3 )] = f[D3Q27System::N]; directionFlag=true; - if ((direction & EsoTwistD3Q27System::etB) == EsoTwistD3Q27System::etB) - (*ld)[index4D(D3Q27System::ET_T,x1, x2, x3)] = f[D3Q27System::B]; directionFlag=true; - if ((direction & EsoTwistD3Q27System::etT) == EsoTwistD3Q27System::etT) - (*nld)[index4D(D3Q27System::ET_B,x1, x2, x3plus )] = f[D3Q27System::T]; directionFlag=true; - if ((direction & EsoTwistD3Q27System::etSW) == EsoTwistD3Q27System::etSW) - (*ld)[index4D(D3Q27System::ET_NE,x1, x2, x3)] = f[D3Q27System::SW]; directionFlag=true; - if ((direction & EsoTwistD3Q27System::etNE) == EsoTwistD3Q27System::etNE) - (*nld)[index4D(D3Q27System::ET_SW,x1plus,x2plus,x3 )] = f[D3Q27System::NE]; directionFlag=true; - if ((direction & EsoTwistD3Q27System::etNW) == EsoTwistD3Q27System::etNW) - (*nld)[index4D(D3Q27System::ET_SE,x1, x2plus,x3 )] = f[D3Q27System::NW]; directionFlag=true; - if ((direction & EsoTwistD3Q27System::etSE) == EsoTwistD3Q27System::etSE) - (*ld)[index4D(D3Q27System::ET_NW,x1plus,x2, x3)] = f[D3Q27System::SE]; directionFlag=true; - if ((direction & EsoTwistD3Q27System::etBW) == EsoTwistD3Q27System::etBW) - (*ld)[index4D(D3Q27System::ET_TE,x1, x2, x3)] = f[D3Q27System::BW]; directionFlag=true; - if ((direction & EsoTwistD3Q27System::etTE) == EsoTwistD3Q27System::etTE) - (*nld)[index4D(D3Q27System::ET_BW,x1plus,x2, x3plus )] = f[D3Q27System::TE]; directionFlag=true; - if ((direction & EsoTwistD3Q27System::etTW) == EsoTwistD3Q27System::etTW) - (*nld)[index4D(D3Q27System::ET_BE,x1, x2, x3plus )] = f[D3Q27System::TW]; directionFlag=true; - if ((direction & EsoTwistD3Q27System::etBE) == EsoTwistD3Q27System::etBE) - (*ld)[index4D(D3Q27System::ET_TW,x1plus,x2, x3)] = f[D3Q27System::BE]; directionFlag=true; - if ((direction & EsoTwistD3Q27System::etBS) == EsoTwistD3Q27System::etBS) - (*ld)[index4D(D3Q27System::ET_TN,x1, x2, x3)] = f[D3Q27System::BS]; directionFlag=true; - if ((direction & EsoTwistD3Q27System::etTN) == EsoTwistD3Q27System::etTN) - (*nld)[index4D(D3Q27System::ET_BS,x1, x2plus,x3plus )] = f[D3Q27System::TN]; directionFlag=true; - if ((direction & EsoTwistD3Q27System::etTS) == EsoTwistD3Q27System::etTS) - (*nld)[index4D(D3Q27System::ET_BN,x1, x2, x3plus )] = f[D3Q27System::TS]; directionFlag=true; - if ((direction & EsoTwistD3Q27System::etBN) == EsoTwistD3Q27System::etBN) - (*ld)[index4D(D3Q27System::ET_TS,x1, x2plus,x3)] = f[D3Q27System::BN]; directionFlag=true; - if ((direction & EsoTwistD3Q27System::etBSW) == EsoTwistD3Q27System::etBSW) - (*ld)[index4D(D3Q27System::ET_TNE,x1, x2, x3)] = f[D3Q27System::BSW]; directionFlag=true; - if ((direction & EsoTwistD3Q27System::etTNE) == EsoTwistD3Q27System::etTNE) - (*nld)[index4D(D3Q27System::ET_BSW,x1plus,x2plus,x3plus)] = f[D3Q27System::TNE]; directionFlag=true; - if ((direction & EsoTwistD3Q27System::etBSE) == EsoTwistD3Q27System::etBSE) - (*ld)[index4D(D3Q27System::ET_TNW,x1plus,x2, x3)] = f[D3Q27System::BSE]; directionFlag=true; - if ((direction & EsoTwistD3Q27System::etTNW) == EsoTwistD3Q27System::etTNW) - (*nld)[index4D(D3Q27System::ET_BSE,x1, x2plus,x3plus)] = f[D3Q27System::TNW]; directionFlag=true; - if ((direction & EsoTwistD3Q27System::etBNW) == EsoTwistD3Q27System::etBNW) - (*ld)[index4D(D3Q27System::ET_TSE,x1, x2plus,x3)] = f[D3Q27System::BNW]; directionFlag=true; - if ((direction & EsoTwistD3Q27System::etTSE) == EsoTwistD3Q27System::etTSE) - (*nld)[index4D(D3Q27System::ET_BNW,x1plus,x2, x3plus)] = f[D3Q27System::TSE]; directionFlag=true; - if ((direction & EsoTwistD3Q27System::etBNE) == EsoTwistD3Q27System::etBNE) - (*ld)[index4D(D3Q27System::ET_TSW,x1plus,x2plus,x3)] = f[D3Q27System::BNE]; directionFlag=true; - if ((direction & EsoTwistD3Q27System::etTSW) == EsoTwistD3Q27System::etTSW) - (*nld)[index4D(D3Q27System::ET_BNE,x1, x2, x3plus)] = f[D3Q27System::TSW]; directionFlag=true; - if ((direction & EsoTwistD3Q27System::ZERO) == EsoTwistD3Q27System::ZERO) - (*zd)[index3D(x1,x2,x3)] = f[D3Q27System::ZERO]; directionFlag=true; -#ifdef _DEBUG - if(!directionFlag)UB_THROW( UbException(UB_EXARGS, "Direction didn't find") ); -#endif //DEBUG -} -////////////////////////////////////////////////////////////////////////// -void EsoTwistD3Q27SparseData::setDistributionForDirection(LBMReal f, size_t x1, size_t x2, size_t x3, int direction) -{ - switch (direction) - { - case D3Q27System::E : - (*nld)[index4D(D3Q27System::ET_W,x1+1,x2, x3 )] = f; - break; - case D3Q27System::W : - (*ld)[index4D(D3Q27System::ET_E,x1, x2, x3)] = f; - break; - case D3Q27System::S : - (*ld)[index4D(D3Q27System::ET_N,x1, x2, x3)] = f; - break; - case D3Q27System::N : - (*nld)[index4D(D3Q27System::ET_S,x1, x2+1,x3 )] = f; - break; - case D3Q27System::B : - (*ld)[index4D(D3Q27System::ET_T,x1, x2, x3)] = f; - break; - case D3Q27System::T : - (*nld)[index4D(D3Q27System::ET_B,x1, x2, x3+1 )] = f; - break; - case D3Q27System::SW : - (*ld)[index4D(D3Q27System::ET_NE,x1, x2, x3)] = f; - break; - case D3Q27System::NE : - (*nld)[index4D(D3Q27System::ET_SW,x1+1,x2+1,x3 )] = f; - break; - case D3Q27System::NW : - (*nld)[index4D(D3Q27System::ET_SE,x1, x2+1,x3 )] = f; - break; - case D3Q27System::SE : - (*ld)[index4D(D3Q27System::ET_NW,x1+1,x2, x3)] = f; - break; - case D3Q27System::BW : - (*ld)[index4D(D3Q27System::ET_TE,x1, x2, x3)] = f; - break; - case D3Q27System::TE : - (*nld)[index4D(D3Q27System::ET_BW,x1+1,x2, x3+1 )] = f; - break; - case D3Q27System::TW : - (*nld)[index4D(D3Q27System::ET_BE,x1, x2, x3+1 )] = f; - break; - case D3Q27System::BE : - (*ld)[index4D(D3Q27System::ET_TW,x1+1,x2, x3)] = f; - break; - case D3Q27System::BS : - (*ld)[index4D(D3Q27System::ET_TN,x1, x2, x3)] = f; - break; - case D3Q27System::TN : - (*nld)[index4D(D3Q27System::ET_BS,x1, x2+1,x3+1 )] = f; - break; - case D3Q27System::TS : - (*nld)[index4D(D3Q27System::ET_BN,x1, x2, x3+1 )] = f; - break; - case D3Q27System::BN : - (*ld)[index4D(D3Q27System::ET_TS,x1, x2+1,x3)] = f; - break; - case D3Q27System::BSW : - (*ld)[index4D(D3Q27System::ET_TNE,x1, x2, x3)] = f; - break; - case D3Q27System::TNE : - (*nld)[index4D(D3Q27System::ET_BSW,x1+1,x2+1,x3+1)] = f; - break; - case D3Q27System::BSE : - (*ld)[index4D(D3Q27System::ET_TNW,x1+1,x2, x3)] = f; - break; - case D3Q27System::TNW : - (*nld)[index4D(D3Q27System::ET_BSE,x1, x2+1,x3+1)] = f; - break; - case D3Q27System::BNW : - (*ld)[index4D(D3Q27System::ET_TSE,x1, x2+1,x3)] = f; - break; - case D3Q27System::TSE : - (*nld)[index4D(D3Q27System::ET_BNW,x1+1,x2, x3+1)] = f; - break; - case D3Q27System::BNE : - (*ld)[index4D(D3Q27System::ET_TSW,x1+1,x2+1,x3)] = f; - break; - case D3Q27System::TSW : - (*nld)[index4D(D3Q27System::ET_BNE,x1, x2, x3+1)] = f; - break; - case D3Q27System::ZERO : - (*zd)[index3D(x1,x2,x3)] = f; - break; - default: - UB_THROW( UbException(UB_EXARGS, "Direction didn't find")); - } -} -////////////////////////////////////////////////////////////////////////// -void EsoTwistD3Q27SparseData::setDistributionInvForDirection(const LBMReal* const f, size_t x1, size_t x2, size_t x3, unsigned long int direction) -{ - size_t x1plus = x1+1; - size_t x2plus = x2+1; - size_t x3plus = x3+1; - - bool directionFlag = false; - if ((direction & EsoTwistD3Q27System::etE) == EsoTwistD3Q27System::etE) - (*ld)[index4D(D3Q27System::ET_E,x1, x2, x3)] = f[D3Q27System::E]; directionFlag=true; - if ((direction & EsoTwistD3Q27System::etW) == EsoTwistD3Q27System::etW) - (*nld)[index4D(D3Q27System::ET_W,x1plus,x2, x3 )] = f[D3Q27System::W]; directionFlag=true; - if ((direction & EsoTwistD3Q27System::etS) == EsoTwistD3Q27System::etS) - (*nld)[index4D(D3Q27System::ET_S,x1, x2plus,x3 )] = f[D3Q27System::S]; directionFlag=true; - if ((direction & EsoTwistD3Q27System::etN) == EsoTwistD3Q27System::etN) - (*ld)[index4D(D3Q27System::ET_N,x1, x2, x3)] = f[D3Q27System::N]; directionFlag=true; - if ((direction & EsoTwistD3Q27System::etB) == EsoTwistD3Q27System::etB) - (*nld)[index4D(D3Q27System::ET_B,x1, x2, x3plus )] = f[D3Q27System::B]; directionFlag=true; - if ((direction & EsoTwistD3Q27System::etT) == EsoTwistD3Q27System::etT) - (*ld)[index4D(D3Q27System::ET_T,x1, x2, x3)] = f[D3Q27System::T]; directionFlag=true; - if ((direction & EsoTwistD3Q27System::etSW) == EsoTwistD3Q27System::etSW) - (*nld)[index4D(D3Q27System::ET_SW,x1plus,x2plus,x3 )] = f[D3Q27System::SW]; directionFlag=true; - if ((direction & EsoTwistD3Q27System::etNE) == EsoTwistD3Q27System::etNE) - (*ld)[index4D(D3Q27System::ET_NE,x1, x2, x3)] = f[D3Q27System::NE]; directionFlag=true; - if ((direction & EsoTwistD3Q27System::etNW) == EsoTwistD3Q27System::etNW) - (*ld)[index4D(D3Q27System::ET_NW,x1plus,x2, x3)] = f[D3Q27System::NW]; directionFlag=true; - if ((direction & EsoTwistD3Q27System::etSE) == EsoTwistD3Q27System::etSE) - (*nld)[index4D(D3Q27System::ET_SE,x1, x2plus,x3 )] = f[D3Q27System::SE]; directionFlag=true; - if ((direction & EsoTwistD3Q27System::etBW) == EsoTwistD3Q27System::etBW) - (*nld)[index4D(D3Q27System::ET_BW,x1plus,x2, x3plus )] = f[D3Q27System::BW]; directionFlag=true; - if ((direction & EsoTwistD3Q27System::etTE) == EsoTwistD3Q27System::etTE) - (*ld)[index4D(D3Q27System::ET_TE,x1, x2, x3)] = f[D3Q27System::TE]; directionFlag=true; - if ((direction & EsoTwistD3Q27System::etTW) == EsoTwistD3Q27System::etTW) - (*ld)[index4D(D3Q27System::ET_TW,x1plus,x2, x3)] = f[D3Q27System::TW]; directionFlag=true; - if ((direction & EsoTwistD3Q27System::etBE) == EsoTwistD3Q27System::etBE) - (*nld)[index4D(D3Q27System::ET_BE,x1, x2, x3plus )] = f[D3Q27System::BE]; directionFlag=true; - if ((direction & EsoTwistD3Q27System::etBS) == EsoTwistD3Q27System::etBS) - (*nld)[index4D(D3Q27System::ET_BS,x1, x2plus,x3plus )] = f[D3Q27System::BS]; directionFlag=true; - if ((direction & EsoTwistD3Q27System::etTN) == EsoTwistD3Q27System::etTN) - (*ld)[index4D(D3Q27System::ET_TN,x1, x2, x3)] = f[D3Q27System::TN]; directionFlag=true; - if ((direction & EsoTwistD3Q27System::etTS) == EsoTwistD3Q27System::etTS) - (*ld)[index4D(D3Q27System::ET_TS,x1, x2plus,x3)] = f[D3Q27System::TS]; directionFlag=true; - if ((direction & EsoTwistD3Q27System::etBN) == EsoTwistD3Q27System::etBN) - (*nld)[index4D(D3Q27System::ET_BN,x1, x2, x3plus )] = f[D3Q27System::BN]; directionFlag=true; - if ((direction & EsoTwistD3Q27System::etBSW) == EsoTwistD3Q27System::etBSW) - (*nld)[index4D(D3Q27System::ET_BSW,x1plus,x2plus,x3plus)] = f[D3Q27System::BSW]; directionFlag=true; - if ((direction & EsoTwistD3Q27System::etTNE) == EsoTwistD3Q27System::etTNE) - (*ld)[index4D(D3Q27System::ET_TNE,x1, x2, x3)] = f[D3Q27System::TNE]; directionFlag=true; - if ((direction & EsoTwistD3Q27System::etBSE) == EsoTwistD3Q27System::etBSE) - (*nld)[index4D(D3Q27System::ET_BSE,x1, x2plus,x3plus)] = f[D3Q27System::BSE]; directionFlag=true; - if ((direction & EsoTwistD3Q27System::etTNW) == EsoTwistD3Q27System::etTNW) - (*ld)[index4D(D3Q27System::ET_TNW,x1plus,x2, x3)] = f[D3Q27System::TNW]; directionFlag=true; - if ((direction & EsoTwistD3Q27System::etBNW) == EsoTwistD3Q27System::etBNW) - (*nld)[index4D(D3Q27System::ET_BNW,x1plus,x2, x3plus)] = f[D3Q27System::BNW]; directionFlag=true; - if ((direction & EsoTwistD3Q27System::etTSE) == EsoTwistD3Q27System::etTSE) - (*ld)[index4D(D3Q27System::ET_TSE,x1, x2plus,x3)] = f[D3Q27System::TSE]; directionFlag=true; - if ((direction & EsoTwistD3Q27System::etBNE) == EsoTwistD3Q27System::etBNE) - (*nld)[index4D(D3Q27System::ET_BNE,x1, x2, x3plus)] = f[D3Q27System::BNE]; directionFlag=true; - if ((direction & EsoTwistD3Q27System::etTSW) == EsoTwistD3Q27System::etTSW) - (*ld)[index4D(D3Q27System::ET_TSW,x1plus,x2plus,x3)] = f[D3Q27System::TSW]; directionFlag=true; - if ((direction & EsoTwistD3Q27System::ZERO) == EsoTwistD3Q27System::ZERO) - (*zd)[index3D(x1,x2,x3)] = f[D3Q27System::ZERO]; directionFlag=true; -#ifdef _DEBUG - if(!directionFlag)UB_THROW( UbException(UB_EXARGS, "Direction didn't find") ); -#endif //DEBUG -} -////////////////////////////////////////////////////////////////////////// -void EsoTwistD3Q27SparseData::setDistributionInvForDirection(LBMReal f, size_t x1, size_t x2, size_t x3, unsigned long int direction) -{ - switch (direction) - { - case D3Q27System::E : - (*ld)[index4D(D3Q27System::ET_E,x1, x2, x3)] = f; - break; - case D3Q27System::W : - (*nld)[index4D(D3Q27System::ET_W,x1+1,x2, x3 )] = f; - break; - case D3Q27System::S : - (*nld)[index4D(D3Q27System::ET_S,x1, x2+1,x3 )] = f; - break; - case D3Q27System::N : - (*ld)[index4D(D3Q27System::ET_N,x1, x2, x3)] = f; - break; - case D3Q27System::B : - (*nld)[index4D(D3Q27System::ET_B,x1, x2, x3+1 )] = f; - break; - case D3Q27System::T : - (*ld)[index4D(D3Q27System::ET_T,x1, x2, x3)] = f; - break; - case D3Q27System::SW : - (*nld)[index4D(D3Q27System::ET_SW,x1+1,x2+1,x3 )] = f; - break; - case D3Q27System::NE : - (*ld)[index4D(D3Q27System::ET_NE,x1, x2, x3)] = f; - break; - case D3Q27System::NW : - (*ld)[index4D(D3Q27System::ET_NW,x1+1,x2, x3)] = f; - break; - case D3Q27System::SE : - (*nld)[index4D(D3Q27System::ET_SE,x1, x2+1,x3 )] = f; - break; - case D3Q27System::BW : - (*nld)[index4D(D3Q27System::ET_BW,x1+1,x2, x3+1 )] = f; - break; - case D3Q27System::TE : - (*ld)[index4D(D3Q27System::ET_TE,x1, x2, x3)] = f; - break; - case D3Q27System::TW : - (*ld)[index4D(D3Q27System::ET_TW,x1+1,x2, x3)] = f; - break; - case D3Q27System::BE : - (*nld)[index4D(D3Q27System::ET_BE,x1, x2, x3+1 )] = f; - break; - case D3Q27System::BS : - (*nld)[index4D(D3Q27System::ET_BS,x1, x2+1,x3+1 )] = f; - break; - case D3Q27System::TN : - (*ld)[index4D(D3Q27System::ET_TN,x1, x2, x3)] = f; - break; - case D3Q27System::TS : - (*ld)[index4D(D3Q27System::ET_TS,x1, x2+1,x3)] = f; - break; - case D3Q27System::BN : - (*nld)[index4D(D3Q27System::ET_BN,x1, x2, x3+1 )] = f; - break; - case D3Q27System::BSW : - (*nld)[index4D(D3Q27System::ET_BSW,x1+1,x2+1,x3+1)] = f; - break; - case D3Q27System::TNE : - (*ld)[index4D(D3Q27System::ET_TNE,x1, x2, x3)] = f; - break; - case D3Q27System::BSE : - (*nld)[index4D(D3Q27System::ET_BSE,x1, x2+1,x3+1)] = f; - break; - case D3Q27System::TNW : - (*ld)[index4D(D3Q27System::ET_TNW,x1+1,x2, x3)] = f; - break; - case D3Q27System::BNW : - (*nld)[index4D(D3Q27System::ET_BNW,x1+1,x2, x3+1)] = f; - break; - case D3Q27System::TSE : - (*ld)[index4D(D3Q27System::ET_TSE,x1, x2+1,x3)] = f; - break; - case D3Q27System::BNE : - (*nld)[index4D(D3Q27System::ET_BNE,x1, x2, x3+1)] = f; - break; - case D3Q27System::TSW : - (*ld)[index4D(D3Q27System::ET_TSW,x1+1,x2+1,x3)] = f; - break; - case D3Q27System::ZERO : - (*zd)[index3D(x1,x2,x3)] = f; - break; - default: - UB_THROW( UbException(UB_EXARGS, "Direction didn't find")); - } -} -////////////////////////////////////////////////////////////////////////// -LBMReal EsoTwistD3Q27SparseData::getDistributionInvForDirection(size_t x1, size_t x2, size_t x3, int direction) -{ - switch (direction) - { - case D3Q27System::E : - return (*nld)[index4D(D3Q27System::ET_W,x1+1,x2, x3 )]; - case D3Q27System::W : - return (*ld)[index4D(D3Q27System::ET_E,x1, x2, x3)]; - case D3Q27System::S : - return (*ld)[index4D(D3Q27System::ET_N,x1, x2, x3)]; - case D3Q27System::N : - return (*nld)[index4D(D3Q27System::ET_S,x1, x2+1,x3 )]; - case D3Q27System::B : - return (*ld)[index4D(D3Q27System::ET_T,x1, x2, x3)]; - case D3Q27System::T : - return (*nld)[index4D(D3Q27System::ET_B,x1, x2, x3+1 )]; - case D3Q27System::SW : - return (*ld)[index4D(D3Q27System::ET_NE,x1, x2, x3)]; - case D3Q27System::NE : - return (*nld)[index4D(D3Q27System::ET_SW,x1+1,x2+1,x3 )]; - case D3Q27System::NW : - return (*nld)[index4D(D3Q27System::ET_SE,x1, x2+1,x3 )]; - case D3Q27System::SE : - return (*ld)[index4D(D3Q27System::ET_NW,x1+1,x2, x3)]; - case D3Q27System::BW : - return (*ld)[index4D(D3Q27System::ET_TE,x1, x2, x3)]; - case D3Q27System::TE : - return (*nld)[index4D(D3Q27System::ET_BW,x1+1,x2, x3+1 )]; - case D3Q27System::TW : - return (*nld)[index4D(D3Q27System::ET_BE,x1, x2, x3+1 )]; - case D3Q27System::BE : - return (*ld)[index4D(D3Q27System::ET_TW,x1+1,x2, x3)]; - case D3Q27System::BS : - return (*ld)[index4D(D3Q27System::ET_TN,x1, x2, x3)]; - case D3Q27System::TN : - return (*nld)[index4D(D3Q27System::ET_BS,x1, x2+1,x3+1 )]; - case D3Q27System::TS : - return (*nld)[index4D(D3Q27System::ET_BN,x1, x2, x3+1 )]; - case D3Q27System::BN : - return (*ld)[index4D(D3Q27System::ET_TS,x1, x2+1,x3)]; - case D3Q27System::BSW : - return (*ld)[index4D(D3Q27System::ET_TNE,x1, x2, x3)]; - case D3Q27System::TNE : - return (*nld)[index4D(D3Q27System::ET_BSW,x1+1,x2+1,x3+1)]; - case D3Q27System::BSE : - return (*ld)[index4D(D3Q27System::ET_TNW,x1+1,x2, x3)]; - case D3Q27System::TNW : - return (*nld)[index4D(D3Q27System::ET_BSE,x1, x2+1,x3+1)]; - case D3Q27System::BNW : - return (*ld)[index4D(D3Q27System::ET_TSE,x1, x2+1,x3)]; - case D3Q27System::TSE : - return (*nld)[index4D(D3Q27System::ET_BNW,x1+1,x2, x3+1)]; - case D3Q27System::BNE : - return (*ld)[index4D(D3Q27System::ET_TSW,x1+1,x2+1,x3)]; - case D3Q27System::TSW : - return (*nld)[index4D(D3Q27System::ET_BNE,x1, x2, x3+1)]; - case D3Q27System::ZERO : - return (*zd)[index3D(x1,x2,x3)]; - default: - UB_THROW( UbException(UB_EXARGS, "Direction didn't find") ); - } -} -////////////////////////////////////////////////////////////////////////// -size_t EsoTwistD3Q27SparseData::getNX1() const -{ - return NX1; -} -////////////////////////////////////////////////////////////////////////// -size_t EsoTwistD3Q27SparseData::getNX2() const -{ - return NX2; -} -////////////////////////////////////////////////////////////////////////// -size_t EsoTwistD3Q27SparseData::getNX3() const -{ - return NX3; -} -////////////////////////////////////////////////////////////////////////// -EsoTwistD3Q27SparseData::SparseDataPtr EsoTwistD3Q27SparseData::getLocalDistributions() -{ - return ld; -} -////////////////////////////////////////////////////////////////////////// -EsoTwistD3Q27SparseData::SparseDataPtr EsoTwistD3Q27SparseData::getNonLocalDistributions() -{ - return nld; -} -////////////////////////////////////////////////////////////////////////// -EsoTwistD3Q27SparseData::SparseDataPtr EsoTwistD3Q27SparseData::getZeroDistributions() -{ - return zd; -} -////////////////////////////////////////////////////////////////////////// -void EsoTwistD3Q27SparseData::setSize( int nx[4] ) -{ - nx1 = 13; - nx2 = nx[0]; - nx3 = nx[1]; - nx4 = nx[2]; - nx5 = nx[3]; -} -////////////////////////////////////////////////////////////////////////// - - - - diff --git a/src/VirtualFluids/Data/EsoTwistD3Q27SparseData.h b/src/VirtualFluids/Data/EsoTwistD3Q27SparseData.h deleted file mode 100644 index 11409fdf8..000000000 --- a/src/VirtualFluids/Data/EsoTwistD3Q27SparseData.h +++ /dev/null @@ -1,105 +0,0 @@ -#ifndef EsoTwistD3Q27SparseData_h -#define EsoTwistD3Q27SparseData_h - -#include "EsoTwist3D.h" -#include <D3Q27System.h> - -#include <boost/unordered_map.hpp> - -#include <boost/serialization/serialization.hpp> -#include <boost/serialization/base_object.hpp> - -class EsoTwistD3Q27SparseData; -typedef std::shared_ptr<EsoTwistD3Q27SparseData> EsoTwistD3Q27SparseDataPtr; - -class EsoTwistD3Q27SparseData : public EsoTwist3D -{ -public: - typedef boost::unordered_map<size_t, LBMReal> SparseData; - typedef std::shared_ptr<SparseData> SparseDataPtr; - //typedef std::map<size_t, LBMReal> SparseData; - //typedef std::shared_ptr<SparseData> SparseDataPtr; -public: - EsoTwistD3Q27SparseData(); - EsoTwistD3Q27SparseData(size_t ibx[3], size_t nx[3], size_t level, double value ); - ////////////////////////////////////////////////////////////////////////// - ~EsoTwistD3Q27SparseData(); - ////////////////////////////////////////////////////////////////////////// - void swap(); - ////////////////////////////////////////////////////////////////////////// - virtual void getDistribution( LBMReal* const f, size_t x1, size_t x2, size_t x3); - ////////////////////////////////////////////////////////////////////////// - virtual void setDistribution(const LBMReal* const f, size_t x1, size_t x2, size_t x3); - //////////////////////////////////////////////////////////////////////// - virtual void getDistributionInv( LBMReal* const f, size_t x1, size_t x2, size_t x3); - ////////////////////////////////////////////////////////////////////////// - virtual void setDistributionInv(const LBMReal* const f, size_t x1, size_t x2, size_t x3); - ////////////////////////////////////////////////////////////////////////// - virtual void setDistributionForDirection(const LBMReal* const f, size_t x1, size_t x2, size_t x3, unsigned long int direction); - ////////////////////////////////////////////////////////////////////////// - virtual void setDistributionForDirection(LBMReal f, size_t x1, size_t x2, size_t x3, int direction); - ////////////////////////////////////////////////////////////////////////// - virtual LBMReal getDistributionInvForDirection(size_t x1, size_t x2, size_t x3, int direction); - ////////////////////////////////////////////////////////////////////////// - virtual void setDistributionInvForDirection(const LBMReal* const f, size_t x1, size_t x2, size_t x3, unsigned long int direction); - ////////////////////////////////////////////////////////////////////////// - virtual void setDistributionInvForDirection(LBMReal f, size_t x1, size_t x2, size_t x3, unsigned long int direction); - ////////////////////////////////////////////////////////////////////////// - virtual LBMReal getDistributionForDirection(size_t x1, size_t x2, size_t x3, int direction); - ////////////////////////////////////////////////////////////////////////// - size_t getNX1() const; - ////////////////////////////////////////////////////////////////////////// - size_t getNX2() const; - ////////////////////////////////////////////////////////////////////////// - size_t getNX3() const; - //////////////////////////////////////////////////////////////////////// - SparseDataPtr getLocalDistributions(); - ////////////////////////////////////////////////////////////////////////// - SparseDataPtr getNonLocalDistributions(); - ////////////////////////////////////////////////////////////////////////// - SparseDataPtr getZeroDistributions(); - ////////////////////////////////////////////////////////////////////////// - static void setSize(int nx[]); - ////////////////////////////////////////////////////////////////////////// - inline size_t index4D(size_t x1, size_t x2, size_t x3, size_t x4) - { - //return nx1*(nx2*(nx3*x4+x3)+x2)+x1; - return nx1*(nx2*(nx3*(nx4*level+(x4+ox3))+(x3+ox2))+(x2+ox1))+x1; - } - ////////////////////////////////////////////////////////////////////////// - inline size_t index3D(size_t x1, size_t x2, size_t x3) - { - //return nx2 * ( nx3 * x3 + x2) + x1 ; - return nx2*(nx3*(nx4*level+(x3+ox3))+(x2+ox2))+(x1+ox1); - } - -protected: - static SparseData localDistributions; - static SparseData nonLocalDistributions; - static SparseData zeroDistributions; - SparseDataPtr ld; //local distributions; - SparseDataPtr nld; //non local distributions; - SparseDataPtr zd; //zero distributions; - size_t NX1, NX2, NX3; - static size_t nx1, nx2, nx3, nx4, nx5; - size_t ox1, ox2, ox3; - size_t level; - - - - - //friend class boost::serialization::access; - //template<class Archive> - //void serialize(Archive & ar, const unsigned int version) - //{ - // ar & boost::serialization::base_object< EsoTwist3D >(*this); - // ar & NX1; - // ar & NX2; - // ar & NX3; - // ar & localDistributions; - // ar & nonLocalDistributions; - // ar & zeroDistributions; - //} -}; - -#endif diff --git a/src/VirtualFluids/Data/EsoTwistD3Q27System.cpp b/src/VirtualFluids/Data/EsoTwistD3Q27System.cpp deleted file mode 100644 index 93a815d46..000000000 --- a/src/VirtualFluids/Data/EsoTwistD3Q27System.cpp +++ /dev/null @@ -1,92 +0,0 @@ -#include "EsoTwistD3Q27System.h" - -//index 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 -//f: E, W, N, S, T, B, NE, SW, SE, NW, TE, BW, BE, TW, TN, BS, BN, TS, TNE TNW TSE TSW BNE BNW BSE BSW ZERO -const int EsoTwistD3Q27System::ETX1[EsoTwistD3Q27System::ENDF+1] = { 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0 }; -const int EsoTwistD3Q27System::ETX2[EsoTwistD3Q27System::ENDF+1] = { 0, 0, 0, 1, 0, 0, 0, 1, 0, -1, 0, 0, 0, 0, 0, 1, -1, 0, 0, -1, 0, 1, 0, -1, 0, 1, 0 }; -const int EsoTwistD3Q27System::ETX3[EsoTwistD3Q27System::ENDF+1] = { 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, -1, 0, 1, 1, 0, 0, -1, 0, -1, 0, 1, 0, 1, 0 }; - -const int EsoTwistD3Q27System::etINVDIR[EsoTwistD3Q27System::ENDF+1] = { D3Q27System::INV_E, - D3Q27System::INV_W, - D3Q27System::INV_N, - D3Q27System::INV_S, - D3Q27System::INV_T, - D3Q27System::INV_B, - D3Q27System::INV_NE, - D3Q27System::INV_SW, - D3Q27System::INV_SE, - D3Q27System::INV_NW, - D3Q27System::INV_TE, - D3Q27System::INV_BW, - D3Q27System::INV_BE, - D3Q27System::INV_TW, - D3Q27System::INV_TN, - D3Q27System::INV_BS, - D3Q27System::INV_BN, - D3Q27System::INV_TS, - D3Q27System::INV_TNE, - D3Q27System::INV_TNW, - D3Q27System::INV_TSE, - D3Q27System::INV_TSW, - D3Q27System::INV_BNE, - D3Q27System::INV_BNW, - D3Q27System::INV_BSE, - D3Q27System::INV_BSW, - D3Q27System::ZERO}; - -const unsigned long int EsoTwistD3Q27System::etDIR[EsoTwistD3Q27System::ENDF+1] = { etE, - etW, - etN, - etS, - etT, - etB, - etNE, - etSW, - etSE, - etNW, - etTE, - etBW, - etBE, - etTW, - etTN, - etBS, - etBN, - etTS, - etTNE, - etTNW, - etTSE, - etTSW, - etBNE, - etBNW, - etBSE, - etBSW, - etZERO}; - - const unsigned long int EsoTwistD3Q27System::etZERO = 1;/*f0 */ - const unsigned long int EsoTwistD3Q27System::etE = 2; /*f1 */ - const unsigned long int EsoTwistD3Q27System::etW = 4; /*f2 */ - const unsigned long int EsoTwistD3Q27System::etN = 8; /*f3 */ - const unsigned long int EsoTwistD3Q27System::etS = 16; /*f4 */ - const unsigned long int EsoTwistD3Q27System::etT = 32; /*f5 */ - const unsigned long int EsoTwistD3Q27System::etB = 64; /*f6 */ - const unsigned long int EsoTwistD3Q27System::etNE = 128; /*f7 */ - const unsigned long int EsoTwistD3Q27System::etSW = 256; /*f8 */ - const unsigned long int EsoTwistD3Q27System::etSE = 512; /*f9 */ - const unsigned long int EsoTwistD3Q27System::etNW = 1024; /*f10*/ - const unsigned long int EsoTwistD3Q27System::etTE = 2048; /*f11*/ - const unsigned long int EsoTwistD3Q27System::etBW = 4096; /*f12*/ - const unsigned long int EsoTwistD3Q27System::etBE = 8192; /*f13*/ - const unsigned long int EsoTwistD3Q27System::etTW = 16384; /*f14*/ - const unsigned long int EsoTwistD3Q27System::etTN = 32768; /*f15*/ - const unsigned long int EsoTwistD3Q27System::etBS = 65536; /*f16*/ - const unsigned long int EsoTwistD3Q27System::etBN = 131072; /*f17*/ - const unsigned long int EsoTwistD3Q27System::etTS = 262144; /*f18*/ - const unsigned long int EsoTwistD3Q27System::etTNE = 524288; - const unsigned long int EsoTwistD3Q27System::etTNW = 1048576; - const unsigned long int EsoTwistD3Q27System::etTSE = 2097152; - const unsigned long int EsoTwistD3Q27System::etTSW = 4194304; - const unsigned long int EsoTwistD3Q27System::etBNE = 8388608; - const unsigned long int EsoTwistD3Q27System::etBNW = 16777216; - const unsigned long int EsoTwistD3Q27System::etBSE = 33554432; -const unsigned long int EsoTwistD3Q27System::etBSW = 67108864; - diff --git a/src/VirtualFluids/Data/EsoTwistD3Q27System.h b/src/VirtualFluids/Data/EsoTwistD3Q27System.h deleted file mode 100644 index 38db50674..000000000 --- a/src/VirtualFluids/Data/EsoTwistD3Q27System.h +++ /dev/null @@ -1,108 +0,0 @@ -#ifndef ESOTWISTD3Q27SYSTEM_H -#define ESOTWISTD3Q27SYSTEM_H - -#include "D3Q27System.h" - -struct EsoTwistD3Q27System -{ - const static int FSTARTDIR = D3Q27System::FSTARTDIR; - const static int FENDDIR = D3Q27System::FENDDIR; //gellerstyle: meint alle frichtungen OHNE f0 - - const static int STARTF = D3Q27System::STARTF; - const static int ENDF = D3Q27System::ENDF; - - const static int STARTDIR = D3Q27System::STARTDIR; - const static int ENDDIR = D3Q27System::ENDDIR; - - static const int ZERO = D3Q27System::ZERO;/*f0 */ - static const int E = D3Q27System::E; /*f1 */ - static const int W = D3Q27System::W; /*f2 */ - static const int N = D3Q27System::N; /*f3 */ - static const int S = D3Q27System::S; /*f4 */ - static const int T = D3Q27System::T; /*f5 */ - static const int B = D3Q27System::B; /*f6 */ - static const int NE = D3Q27System::NE; /*f7 */ - static const int SW = D3Q27System::SW; /*f8 */ - static const int SE = D3Q27System::SE; /*f9 */ - static const int NW = D3Q27System::NW; /*f10*/ - static const int TE = D3Q27System::TE; /*f11*/ - static const int BW = D3Q27System::BW; /*f12*/ - static const int BE = D3Q27System::BE; /*f13*/ - static const int TW = D3Q27System::TW; /*f14*/ - static const int TN = D3Q27System::TN; /*f15*/ - static const int BS = D3Q27System::BS; /*f16*/ - static const int BN = D3Q27System::BN; /*f17*/ - static const int TS = D3Q27System::TS; /*f18*/ - static const int TNE = D3Q27System::TNE; - static const int TNW = D3Q27System::TNW; - static const int TSE = D3Q27System::TSE; - static const int TSW = D3Q27System::TSW; - static const int BNE = D3Q27System::BNE; - static const int BNW = D3Q27System::BNW; - static const int BSE = D3Q27System::BSE; - static const int BSW = D3Q27System::BSW; - - - static const int INV_E = D3Q27System::W; - static const int INV_W = D3Q27System::E; - static const int INV_N = D3Q27System::S; - static const int INV_S = D3Q27System::N; - static const int INV_T = D3Q27System::B; - static const int INV_B = D3Q27System::T; - static const int INV_NE = D3Q27System::SW; - static const int INV_SW = D3Q27System::NE; - static const int INV_SE = D3Q27System::NW; - static const int INV_NW = D3Q27System::SE; - static const int INV_TE = D3Q27System::BW; - static const int INV_BW = D3Q27System::TE; - static const int INV_BE = D3Q27System::TW; - static const int INV_TW = D3Q27System::BE; - static const int INV_TN = D3Q27System::BS; - static const int INV_BS = D3Q27System::TN; - static const int INV_BN = D3Q27System::TS; - static const int INV_TS = D3Q27System::BN; - static const int INV_TNE = D3Q27System::BSW; - static const int INV_TNW = D3Q27System::BSE; - static const int INV_TSE = D3Q27System::BNW; - static const int INV_TSW = D3Q27System::BNE; - static const int INV_BNE = D3Q27System::TSW; - static const int INV_BNW = D3Q27System::TSE; - static const int INV_BSE = D3Q27System::TNW; - static const int INV_BSW = D3Q27System::TNE; - - static const unsigned long int etZERO;// 1;/*f0 */ - static const unsigned long int etE;// 2; /*f1 */ - static const unsigned long int etW;// 4; /*f2 */ - static const unsigned long int etN;// 8; /*f3 */ - static const unsigned long int etS;// 16; /*f4 */ - static const unsigned long int etT;// 32; /*f5 */ - static const unsigned long int etB;// 64; /*f6 */ - static const unsigned long int etNE;// 128; /*f7 */ - static const unsigned long int etSW;// 256; /*f8 */ - static const unsigned long int etSE;// 512; /*f9 */ - static const unsigned long int etNW;// 1024; /*f10*/ - static const unsigned long int etTE;// 2048; /*f11*/ - static const unsigned long int etBW;// 4096; /*f12*/ - static const unsigned long int etBE;// 8192; /*f13*/ - static const unsigned long int etTW;// 16384; /*f14*/ - static const unsigned long int etTN;// 32768; /*f15*/ - static const unsigned long int etBS;// 65536; /*f16*/ - static const unsigned long int etBN;// 131072; /*f17*/ - static const unsigned long int etTS;// 262144; /*f18*/ - static const unsigned long int etTNE;// 524288; - static const unsigned long int etTNW;// 1048576; - static const unsigned long int etTSE;// 2097152; - static const unsigned long int etTSW;// 4194304; - static const unsigned long int etBNE;// 8388608; - static const unsigned long int etBNW;// 16777216; - static const unsigned long int etBSE;// 33554432; - static const unsigned long int etBSW;// = 67108864; - - const static int ETX1[ENDF+1]; - const static int ETX2[ENDF+1]; - const static int ETX3[ENDF+1]; - const static int etINVDIR[ENDF+1]; - const static unsigned long int etDIR[ENDF+1]; -}; - -#endif diff --git a/src/VirtualFluids/Data/SparseMatrix3D.cpp b/src/VirtualFluids/Data/SparseMatrix3D.cpp deleted file mode 100644 index 71a2ff89b..000000000 --- a/src/VirtualFluids/Data/SparseMatrix3D.cpp +++ /dev/null @@ -1,39 +0,0 @@ -#include "SparseMatrix3D.h" - - -size_t SparseMatrix3D::nx1 = 0; -size_t SparseMatrix3D::nx2 = 0; -size_t SparseMatrix3D::nx3 = 0; -////////////////////////////////////////////////////////////////////////// -SparseMatrix3D::SparseMatrix3D() -{ - -} -////////////////////////////////////////////////////////////////////////// -SparseMatrix3D::~SparseMatrix3D() -{ - -} -////////////////////////////////////////////////////////////////////////// -SparseMatrix3DPtr SparseMatrix3D::getInstance() -{ - if( !SparseMatrix3D::instance ) - SparseMatrix3D::instance = SparseMatrix3DPtr(new SparseMatrix3D()); - return SparseMatrix3D::instance; -} -////////////////////////////////////////////////////////////////////////// -void SparseMatrix3D::setDimensions(size_t nx1, size_t nx2, size_t nx3) -{ - SparseMatrix3D::nx1 = nx1; - SparseMatrix3D::nx2 = nx2; - SparseMatrix3D::nx3 = nx3; -} -////////////////////////////////////////////////////////////////////////// -void SparseMatrix3D::getDimensions(size_t& nx1, size_t& nx2, size_t& nx3) -{ - nx1 = SparseMatrix3D::nx1; - nx2 = SparseMatrix3D::nx2; - nx3 = SparseMatrix3D::nx3; -} -///////////////////////////////////////////////////////////////////////// - diff --git a/src/VirtualFluids/Data/SparseMatrix3D.h b/src/VirtualFluids/Data/SparseMatrix3D.h deleted file mode 100644 index d731affb3..000000000 --- a/src/VirtualFluids/Data/SparseMatrix3D.h +++ /dev/null @@ -1,29 +0,0 @@ -#ifndef SparseMatrix3D_h -#define SparseMatrix3D_h - -#include <boost/unordered_map.hpp> - -#include <memory> -class SparseMatrix3D; -typedef std::shared_ptr<SparseMatrix3D> SparseMatrix3DPtr; - -class SparseMatrix3D -{ -public: - static SparseMatrix3DPtr getInstance(); - static void setDimensions(size_t nx1, size_t nx2, size_t nx3); - static void getDimensions(size_t& nx1, size_t& nx2, size_t& nx3); - virtual ~SparseMatrix3D(); - ////////////////////////////////////////////////////////////////////////// - inline size_t index(size_t x1, size_t x2, size_t x3) - { - return nx1 * ( nx2 * x3 + x2) + x1 ; - } -protected: -private: - SparseMatrix3D(); - static SparseMatrix3DPtr instance; - static size_t nx1, nx2, nx3; -}; - -#endif diff --git a/src/VirtualFluids/Data/SparseMatrix4D.cpp b/src/VirtualFluids/Data/SparseMatrix4D.cpp deleted file mode 100644 index 2a5f56240..000000000 --- a/src/VirtualFluids/Data/SparseMatrix4D.cpp +++ /dev/null @@ -1,42 +0,0 @@ -#include "SparseMatrix4D.h" - - -size_t SparseMatrix4D::nx1 = 0; -size_t SparseMatrix4D::nx2 = 0; -size_t SparseMatrix4D::nx3 = 0; -size_t SparseMatrix4D::nx4 = 0; -////////////////////////////////////////////////////////////////////////// -SparseMatrix4D::SparseMatrix4D() -{ - -} -////////////////////////////////////////////////////////////////////////// -SparseMatrix4D::~SparseMatrix4D() -{ - -} -////////////////////////////////////////////////////////////////////////// -SparseMatrix4DPtr SparseMatrix4D::getInstance() -{ - if( !SparseMatrix4D::instance ) - SparseMatrix4D::instance = SparseMatrix4DPtr(new SparseMatrix4D()); - return SparseMatrix4D::instance; -} -////////////////////////////////////////////////////////////////////////// -void SparseMatrix4D::setDimensions(size_t nx1, size_t nx2, size_t nx3, size_t nx4) -{ - SparseMatrix4D::nx1 = nx1; - SparseMatrix4D::nx2 = nx2; - SparseMatrix4D::nx3 = nx3; - SparseMatrix4D::nx4 = nx4; -} -////////////////////////////////////////////////////////////////////////// -void SparseMatrix4D::getDimensions(size_t& nx1, size_t& nx2, size_t& nx3, size_t& nx4) -{ - nx1 = SparseMatrix4D::nx1; - nx2 = SparseMatrix4D::nx2; - nx3 = SparseMatrix4D::nx3; - nx4 = SparseMatrix4D::nx4; -} -///////////////////////////////////////////////////////////////////////// - diff --git a/src/VirtualFluids/Data/SparseMatrix4D.h b/src/VirtualFluids/Data/SparseMatrix4D.h deleted file mode 100644 index 11dc9e865..000000000 --- a/src/VirtualFluids/Data/SparseMatrix4D.h +++ /dev/null @@ -1,27 +0,0 @@ -#ifndef SparseMatrix4D_h -#define SparseMatrix4D_h - - -#include <memory> -class SparseMatrix4D; -typedef std::shared_ptr<SparseMatrix4D> SparseMatrix4DPtr; - -class SparseMatrix4D -{ -public: - static SparseMatrix4DPtr getInstance(); - static void setDimensions(size_t nx1, size_t nx2, size_t nx3, size_t x4); - static void getDimensions(size_t& nx1, size_t& nx2, size_t& nx3, size_t& x4); - virtual ~SparseMatrix4D(); - ////////////////////////////////////////////////////////////////////////// - inline size_t index(size_t x1, size_t x2, size_t x3, size_t x4) - { - return nx4*(nx3*(nx2*x1+x2)+x3)+x4; - } -private: - SparseMatrix4D(); - static SparseMatrix4DPtr instance; - static size_t nx1, nx2, nx3, nx4; -}; - -#endif diff --git a/src/VirtualFluids/Data/VoidData3D.h b/src/VirtualFluids/Data/VoidData3D.h deleted file mode 100644 index 50b9cc187..000000000 --- a/src/VirtualFluids/Data/VoidData3D.h +++ /dev/null @@ -1,46 +0,0 @@ -#ifndef VoidData3D_H -#define VoidData3D_H - -#include "EsoTwist3D.h" -#include <boost/serialization/serialization.hpp> - -class VoidData3D; -typedef std::shared_ptr<VoidData3D> VoidData3DPtr; - -class VoidData3D : public EsoTwist3D -{ -public: - VoidData3D() {}; - VoidData3D (size_t nx1, size_t nx2, size_t nx3, LBMReal value) - { - this->NX1 = nx1; - this->NX2 = nx2; - this->NX3 = nx3; - } - ~VoidData3D() {}; - size_t getNX1() const { return NX1;} - size_t getNX2() const { return NX2;} - size_t getNX3() const { return NX3;} - void getDistribution(LBMReal* const f, size_t x1, size_t x2, size_t x3) {} - void setDistribution(const LBMReal* const f, size_t x1, size_t x2, size_t x3){} - void getDistributionInv(LBMReal* const f, size_t x1, size_t x2, size_t x3) {} - void setDistributionInv(const LBMReal* const f, size_t x1, size_t x2, size_t x3) {} - void setDistributionForDirection(const LBMReal* const f, size_t x1, size_t x2, size_t x3, unsigned long int direction) {} - void setDistributionForDirection(LBMReal f, size_t x1, size_t x2, size_t x3, int direction) {} - LBMReal getDistributionInvForDirection(size_t x1, size_t x2, size_t x3, int direction) {return 0.0;} - void setDistributionInvForDirection(const LBMReal* const f, size_t x1, size_t x2, size_t x3, unsigned long int direction) {} - void setDistributionInvForDirection(LBMReal f, size_t x1, size_t x2, size_t x3, unsigned long int direction) {} - LBMReal getDistributionForDirection(size_t x1, size_t x2, size_t x3, int direction) {return 0.0;} - void swap() {} -protected: -private: - size_t NX1, NX2, NX3; - friend class boost::serialization::access; - template<class Archive> - void serialize(Archive & ar, const unsigned int version) - { - ar & boost::serialization::base_object< EsoTwist3D >(*this); - } -}; - -#endif diff --git a/src/VirtualFluids/FETOL/CMakePackage.txt b/src/VirtualFluids/FETOL/CMakePackage.txt deleted file mode 100644 index 1b8416f01..000000000 --- a/src/VirtualFluids/FETOL/CMakePackage.txt +++ /dev/null @@ -1,2 +0,0 @@ -GET_FILENAME_COMPONENT( CURRENT_DIR ${CMAKE_CURRENT_LIST_FILE} PATH) -COLLECT_PACKAGE_DATA_WITH_OPTION(${CURRENT_DIR} ALL_SOURCES) diff --git a/src/VirtualFluids/FETOL/FETOLCalculator.cpp b/src/VirtualFluids/FETOL/FETOLCalculator.cpp deleted file mode 100644 index 98af09037..000000000 --- a/src/VirtualFluids/FETOL/FETOLCalculator.cpp +++ /dev/null @@ -1,384 +0,0 @@ -#if defined VF_FETOL - -#if defined(_WIN32) || defined(_WIN64) - #include <winsock2.h> -#endif - -#include "FETOLCalculator.h" -#include <basics/utilities/UbException.h> -#include <D3Q27OffsetInterpolationProcessor.h> -#include <FETOLSetConnectorsBlockVisitor.h> - -//problem with Windows, by Unix should be uncomment -#include <JM.h> -using namespace fetol; - -FETOLCalculator::FETOLCalculator() -{ - -} -////////////////////////////////////////////////////////////////////////// -FETOLCalculator::FETOLCalculator(Grid3DPtr grid, SynchronizerPtr sync, bool mainThread) : - Calculator(grid, sync, mainThread) - -{ - remoteMPIConns.resize(maxLevel+1); - remoteBondConns.resize(maxLevel+1); -} -////////////////////////////////////////////////////////////////////////// -void FETOLCalculator::calculate(const double& endTime, CalculationManagerPtr cm, boost::exception_ptr& error) -{ - UBLOG(logDEBUG1, "FETOLCalculator::calculate() - started"); - try - { - int anzLevel = maxLevel-minLevel+1; - - int minInitLevel = minLevel; - int maxInitLevel = maxLevel-minLevel; - int straightStartLevel = minInitLevel; - int internalIterations = 1 << (maxInitLevel-minInitLevel); - int forwardStartLevel; - int threshold; - int startStep = int(grid->getTimeStep())+1; - - if (startStep > 1) - { - vector<int> cs; - cs.push_back(startStep); - Communicator::getInstance()->broadcastInts(cs); - startStep = cs[0]; - } - - //UBLOG(logINFO, "startStep="<<startStep); - int anzCalcSteps = static_cast<int>(endTime); -#ifdef TIMING - UbTimer timer; - double time[6]; -#endif - - ////////////////////////////////////////////////////////////////////////// - // UBLOG(logINFO, "Number of connectors = " <<this->localConns[0].size()); - ////////////////////////////////////////////////////////////////////////// - - - - for(calcStep=startStep; calcStep<=anzCalcSteps; calcStep++) - { - - - - //exchange data between blocks for visualization - //sync->wait(); - ////if(visScheduler->isDue((double)(calcStep-1))) - ////{ - // //exchangeBlockData(minInitLevel, maxInitLevel, true); - ////} - - ////wait for write dump files - //sync->wait(); - //write dump - if (mainThread) - { - try - { - UBLOG(logDEBUG1,"JM::getApplicationState(): "<<JM::getApplicationState()); - grid->doPostProcess((double)(calcStep-1)); - } - catch (...) - { - ifRestart(straightStartLevel, maxInitLevel, false); - } - } - sync->wait(); - - - ////////////////////////////////////////////////////////////////////////// -#ifdef TIMING - UBLOG(logINFO, "calcStep = " <<calcStep); -#endif - UBLOG(logDEBUG1, "FETOLCalculator::calculate() calcStep = " <<calcStep); - ////////////////////////////////////////////////////////////////////////// - - for(int staggeredStep=1; staggeredStep<=internalIterations; staggeredStep++) - { - forwardStartLevel = straightStartLevel; - if(staggeredStep == internalIterations) straightStartLevel = minInitLevel; - else - { - for(straightStartLevel=maxInitLevel,threshold=1; - (staggeredStep&threshold)!=threshold; straightStartLevel--,threshold<<=1); - } - ////////////////////////////////////////////////////////////////////////// -#ifdef TIMING - timer.resetAndStart(); -#endif - ////////////////////////////////////////////////////////////////////////// - calculateBlocks(straightStartLevel, maxInitLevel); - //calculateBlocks(minInitLevel, maxInitLevel, staggeredStep); - ////////////////////////////////////////////////////////////////////////// -#ifdef TIMING - time[0] = timer.stop(); - //UBLOG(logINFO, "calculateBlocks time = " <<time); -#endif - ////////////////////////////////////////////////////////////////////////// - - //exchange data between blocks - //Sleep(10000); - try - { - UBLOG(logDEBUG1,"JM::getApplicationState(): "<<JM::getApplicationState()); - exchangeFETOLBlockData(straightStartLevel, maxInitLevel, false); - } - catch (...) - { - ifRestart(straightStartLevel, maxInitLevel, false); - } - - UBLOG(logDEBUG1,"JM::getApplicationState(): "<<JM::getApplicationState()); - - ////////////////////////////////////////////////////////////////////////// -#ifdef TIMING - time[1] = timer.stop(); - //UBLOG(logINFO, "exchangeBlockData time = " <<time); -#endif - ////////////////////////////////////////////////////////////////////////// - - applyBCs(straightStartLevel, maxInitLevel); - ////////////////////////////////////////////////////////////////////////// -#ifdef TIMING - time[2] = timer.stop(); - //UBLOG(logINFO, "applyBCs time = " <<time); -#endif - ////////////////////////////////////////////////////////////////////////// - - //swap distributions in kernel - swapDistributions(straightStartLevel, maxInitLevel); - ////////////////////////////////////////////////////////////////////////// -#ifdef TIMING - time[3] = timer.stop(); - //UBLOG(logINFO, "swapDistributions time = " <<time); -#endif - ////////////////////////////////////////////////////////////////////////// - -// if (refinement) -// { -// //exchange data between blocks for grid refinement -// //exchangeInterfaceBlockData(straightStartLevel, maxInitLevel, true); -// if(straightStartLevel<maxInitLevel) -// exchangeBlockData(straightStartLevel, maxInitLevel, true); -// //exchangeInterfaceBlockData(straightStartLevel, maxInitLevel, true); -// ////////////////////////////////////////////////////////////////////////// -//#ifdef TIMING -// time[4] = timer.stop(); -// UBLOG(logINFO, "refinement exchangeBlockData time = " <<time); -//#endif -// ////////////////////////////////////////////////////////////////////////// -// //now ghost nodes have actual values -// //interpolation of interface nodes between grid levels -// interpolation(straightStartLevel, maxInitLevel); -// ////////////////////////////////////////////////////////////////////////// -//#ifdef TIMING -// time[5] = timer.stop(); -// UBLOG(logINFO, "refinement interpolation time = " <<time); -//#endif -// ////////////////////////////////////////////////////////////////////////// -// } - - } - //exchange data between blocks for visualization - if(mainThread) visScheduler->isDue((double)(calcStep-1)); - if((int)visScheduler->getNextDueTime() == calcStep) - { - try - { - UBLOG(logDEBUG1,"JM::getApplicationState(): "<<JM::getApplicationState()); - exchangeFETOLBlockData(straightStartLevel, maxInitLevel, true); - } - catch (...) - { - ifRestart(straightStartLevel, maxInitLevel, false); - } - } - //now ghost nodes have actual values - - } - error = boost::exception_ptr(); - UBLOG(logDEBUG1, "FETOLCalculator::calculate() - stoped"); - } - catch( std::exception& e ) - { - //error = boost::current_exception(); - UBLOG(logERROR, e.what()); - UBLOG(logERROR, " step = "<<calcStep); - exit(EXIT_FAILURE); - } -} -////////////////////////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////// -void FETOLCalculator::initRemoteConnectors() -{ - Calculator::initRemoteConnectors(); - initFETOLConnectors(); -} -////////////////////////////////////////////////////////////////////////// -void FETOLCalculator::initFETOLConnectors() -{ - UBLOG(logDEBUG5, "FETOLCalculator::initFETOLConnectors():start"); - for(int l = minLevel; l <= maxLevel; l++) - { - for(Block3DConnectorPtr c : remoteConns[l]) - { - if(c->getTransmitterType() == Block3DConnector::MPI) - { - remoteMPIConns[l].push_back(c); - } - else if(c->getTransmitterType() == Block3DConnector::BOND) - { - remoteBondConns[l].push_back(c); - } - else - { - UB_THROW( UbException(UB_EXARGS,"Transmitter type isn't exist!")); - } - } - } - UBLOG(logDEBUG5, "FETOLCalculator::initFETOLConnectors():remoteMPIConns.size = "<<remoteMPIConns[0].size()); - UBLOG(logDEBUG5, "FETOLCalculator::initFETOLConnectors():remoteBondConns.size = "<<remoteBondConns[0].size()); - UBLOG(logDEBUG5, "FETOLCalculator::initFETOLConnectors():end"); -} -////////////////////////////////////////////////////////////////////////// -void FETOLCalculator::exchangeFETOLBlockData(int startLevel, int maxInitLevel, bool invStep) -{ - UBLOG(logDEBUG5, "FETOLCalculator::exchangeFETOLBlockData():start"); - sync->wait(); - UBLOG(logDEBUG5, "FETOLCalculator::exchangeFETOLBlockData():localConns:start"); - //startLevel bis maxInitLevel - for(int level=startLevel; level<=maxInitLevel; level++) - { - connectorsPrepare(localConns[level]); - - connectorsSend(localConns[level], invStep); - - connectorsReceive(localConns[level], invStep); - } - UBLOG(logDEBUG5, "FETOLCalculator::exchangeFETOLBlockData():localConns:end"); - sync->wait(); - - UBLOG(logDEBUG5, "FETOLCalculator::exchangeFETOLBlockData():remoteMPIConns:start"); - for(int level=startLevel; level<=maxInitLevel; level++) - { - connectorsPrepare(remoteMPIConns[level]); - - connectorsSend(remoteMPIConns[level], invStep); - - connectorsReceive(remoteMPIConns[level], invStep); - } - UBLOG(logDEBUG5, "FETOLCalculator::exchangeFETOLBlockData():remoteMPIConns:end"); - - UBLOG(logDEBUG5, "FETOLCalculator::exchangeFETOLBlockData():remoteBondConns:start"); - for(int level=startLevel; level<=maxInitLevel; level++) - { - connectorsPrepare(remoteBondConns[level]); - - connectorsSend(remoteBondConns[level], invStep); - - connectorsReceive(remoteBondConns[level], invStep); - } - UBLOG(logDEBUG5, "FETOLCalculator::exchangeFETOLBlockData():remoteBondConns:end"); - UBLOG(logDEBUG5, "FETOLCalculator::exchangeFETOLBlockData():end"); -} -////////////////////////////////////////////////////////////////////////// -void FETOLCalculator::ifRestart(int startLevel, int maxInitLevel, bool invStep) -{ - UBLOG(logINFO, "before paused"); - while (JM::getApplicationState() != paused) - { - ; //NOP - } - - UBLOG(logINFO,"JM::getApplicationState(): "<<JM::getApplicationState()); - - while (JM::getApplicationState() == paused) - { - ; //NOP - } - UBLOG(logINFO, "after paused"); - deleteConnectors(remoteConns); - deleteConnectors(remoteMPIConns); - deleteConnectors(remoteBondConns); - grid->deleteConnectors(); - D3Q27InterpolationProcessorPtr iProcessor(new D3Q27OffsetInterpolationProcessor()); - CommunicatorPtr comm = FETOLCommunicator::getInstance(); - double nueLB=1; - FETOLSetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nueLB, iProcessor); - grid->accept( setConnsVisitor ); - initRemoteConnectors(); - vector<int> cs; - cs.push_back(calcStep); - Communicator::getInstance()->broadcastInts(cs); - exchangeFETOLBlockData(startLevel, maxInitLevel, false); - //UBLOG(logINFO,"new exchange JM::getApplicationState(): "<<JM::getApplicationState()); -} - -////////////////////////////////////////////////////////////////////////// -//void FETOLCalculator::connectorsPrepare(std::vector< Block3DConnectorPtr >& connectors) -//{ -// for(Block3DConnectorPtr c : connectors) -// { -// c->prepareForReceive(); -// c->prepareForSend(); -// } -//} -//////////////////////////////////////////////////////////////////////////// -//void FETOLCalculator::connectorsSend(std::vector< Block3DConnectorPtr >& connectors, bool invStep) -//{ -// for(Block3DConnectorPtr c : connectors) -// { -// c->setInvStep(invStep); -// c->fillSendVectors(); -// c->sendVectors(); -// } -//} -//////////////////////////////////////////////////////////////////////////// -//void FETOLCalculator::connectorsReceive(std::vector< Block3DConnectorPtr >& connectors, bool invStep) -//{ -// for(Block3DConnectorPtr c : connectors) -// { -// c->receiveVectors(); -// c->setInvStep(invStep); -// c->distributeReceiveVectors(); -// } -//} -//////////////////////////////////////////////////////////////////////////// -//void FETOLCalculator::bondConnectorsPrepare(std::vector< Block3DConnectorPtr >& connectors, bool invStep) -//{ -// for(Block3DConnectorPtr c : connectors) -// { -// c->prepareForReceive(); -// c->prepareForSend(); -// } -//} -//////////////////////////////////////////////////////////////////////////// -//void FETOLCalculator::bondConnectorsSend(std::vector< Block3DConnectorPtr >& connectors, bool invStep) -//{ -// for(Block3DConnectorPtr c : connectors) -// { -// c->setInvStep(invStep); -// c->fillSendVectors(); -// c->sendVectors(); -// } -//} -//////////////////////////////////////////////////////////////////////////// -//void FETOLCalculator::bondConnectorsReceive(std::vector< Block3DConnectorPtr >& connectors, bool invStep) -//{ -// for(Block3DConnectorPtr c : connectors) -// { -// c->receiveVectors(); -// c->setInvStep(invStep); -// c->distributeReceiveVectors(); -// } -//} - -////////////////////////////////////////////////////////////////////////// - -#endif diff --git a/src/VirtualFluids/FETOL/FETOLCalculator.h b/src/VirtualFluids/FETOL/FETOLCalculator.h deleted file mode 100644 index 1560d8ea3..000000000 --- a/src/VirtualFluids/FETOL/FETOLCalculator.h +++ /dev/null @@ -1,39 +0,0 @@ -#if defined VF_FETOL - -#ifndef FETOLCALCULATOR_H -#define FETOLCALCULATOR_H - -#include "Calculator.h" - - -class FETOLCalculator; -typedef std::shared_ptr<FETOLCalculator> FETOLCalculator2Ptr; - -#include "CalculationManager.h" - -class FETOLCalculator : public Calculator -{ -public: - FETOLCalculator(); - FETOLCalculator(Grid3DPtr grid, SynchronizerPtr sync, bool mainThread = true); - virtual ~FETOLCalculator(){} - void calculate(const double& endTime, CalculationManagerPtr cm, boost::exception_ptr& error); -protected: - void initRemoteConnectors(); - void exchangeFETOLBlockData(int startLevel, int maxInitLevel, bool invStep); - //void connectorsPrepare(std::vector< Block3DConnectorPtr >& connectors); - //void connectorsSend(std::vector< Block3DConnectorPtr >& connectors, bool invStep); - //void connectorsReceive(std::vector< Block3DConnectorPtr >& connectors, bool invStep); - //void bondConnectorsPrepare(std::vector< Block3DConnectorPtr >& connectors, bool invStep); - //void bondConnectorsSend(std::vector< Block3DConnectorPtr >& connectors, bool invStep); - //void bondConnectorsReceive(std::vector< Block3DConnectorPtr >& connectors, bool invStep); - void initFETOLConnectors(); - void ifRestart(int startLevel, int maxInitLevel, bool invStep); -private: - std::vector< std::vector< Block3DConnectorPtr > > remoteMPIConns; - std::vector< std::vector< Block3DConnectorPtr > > remoteBondConns; -}; - -#endif - -#endif diff --git a/src/VirtualFluids/FETOL/FETOLCommunicator.cpp b/src/VirtualFluids/FETOL/FETOLCommunicator.cpp deleted file mode 100644 index 28183aace..000000000 --- a/src/VirtualFluids/FETOL/FETOLCommunicator.cpp +++ /dev/null @@ -1,260 +0,0 @@ -#if defined VF_MPI && defined VF_FETOL - -#include "FETOLCommunicator.h" -#include <MPICommunicator.h> -#include <basics/utilities/UbLogger.h> -#include <basics/utilities/UbException.h> - - - -#include <fbond.h> -#include <Version.h> - -using namespace std; - -////////////////////////////////////////////////////////////////////////// -FETOLCommunicator::FETOLCommunicator() -{ - bond::init(); - - mpi_comm = MPICommunicator::getInstance(); - mpi_rank = mpi_comm->getProcessID(); - mpi_size = mpi_comm->getNumberOfProcesses(); - - BID = bond::bundleID(); - numberOfBundles = bond::bundleCount(); - numberOfProcesses = bond::processCount(); - PID = bond::processID(); - bundleSizes.resize(numberOfBundles); - bond::bundleSizes(numberOfBundles, &bundleSizes[0]); - - root = 0; -} -////////////////////////////////////////////////////////////////////////// -FETOLCommunicator::~FETOLCommunicator() -{ - bond::finalize(); -} -////////////////////////////////////////////////////////////////////////// -CommunicatorPtr FETOLCommunicator::getInstance() -{ - if( !Communicator::instance ) - Communicator::instance = CommunicatorPtr(new FETOLCommunicator()); - return Communicator::instance; -}////////////////////////////////////////////////////////////////////////// -int FETOLCommunicator::getBundleID() -{ - return bond::bundleID(); -} -////////////////////////////////////////////////////////////////////////// -int FETOLCommunicator::getNumberOfBundles() -{ - return bond::bundleCount(); -} -////////////////////////////////////////////////////////////////////////// -int FETOLCommunicator::getBONDProcessID() -{ - return bond::processID(); -} -////////////////////////////////////////////////////////////////////////// -int FETOLCommunicator::getBONDProcessCount() -{ - return bond::processCount(); -} -////////////////////////////////////////////////////////////////////////// -int FETOLCommunicator::getProcessID() -{ - return PID; -} -////////////////////////////////////////////////////////////////////////// -int FETOLCommunicator::getProcessID(int bundle, int rank) -{ - return bond::processID_for_bundleID_and_MPIRank(bundle, rank); -} -////////////////////////////////////////////////////////////////////////// -int FETOLCommunicator::getNumberOfProcesses() -{ - return numberOfProcesses; -} -////////////////////////////////////////////////////////////////////////// -void* FETOLCommunicator::getNativeCommunicator() -{ - return mpi_comm->getNativeCommunicator(); -} -////////////////////////////////////////////////////////////////////////// -int FETOLCommunicator::getRoot() -{ - return root; -} -////////////////////////////////////////////////////////////////////////// -int FETOLCommunicator::getBundleRoot() -{ - return 0; -} -////////////////////////////////////////////////////////////////////////// -int FETOLCommunicator::getProcessRoot() -{ - return 0; -} -////////////////////////////////////////////////////////////////////////// -int FETOLCommunicator::getNumberOfProcessesInBundle(int bundle) -{ - return bundleSizes[bundle]; -} -////////////////////////////////////////////////////////////////////////// -int FETOLCommunicator::getMPIRank() -{ - return mpi_rank; -} -////////////////////////////////////////////////////////////////////////// -int FETOLCommunicator::getMPICommSize() -{ - return mpi_size; -} -////////////////////////////////////////////////////////////////////////// -void FETOLCommunicator::broadcastInts(std::vector<int>& values) -{ - int rcount; - - if (PID == root) - { - UBLOG(logDEBUG5, "bond::send-start: "<<"Bundle ID="<<BID<<", PID="<<PID<<", MPI rank="<<mpi_rank); - rcount = (int)values.size(); - - for(int i = 1; i < numberOfProcesses; i++) - { - bond::sendComplete(&rcount, 1, MPI_INT, i, 0); - } - if (rcount > 0) - { - for(int i = 1; i < numberOfProcesses; i++) - { - bond::sendComplete(&values[0], rcount, MPI_INT, i, 0); - } - } - UBLOG(logDEBUG5, "bond::send-end: "<<"Bundle ID="<<BID<<", PID="<<PID<<", MPI rank="<<mpi_rank); - } - else - { - UBLOG(logDEBUG5, "bond::receive-start: "<<"Bundle ID="<<BID<<", PID="<<PID<<", MPI rank="<<mpi_rank); - bond::receiveComplete(&rcount, 1, MPI_INT, root, 0); - if (rcount > 0) - { - values.resize(rcount); - bond::receiveComplete(&values[0], (int)values.size(), MPI_INT, root, 0); - } - UBLOG(logDEBUG5, "bond::receive-end: "<<"Bundle ID="<<BID<<", PID="<<PID<<", MPI rank="<<mpi_rank); - } -} -////////////////////////////////////////////////////////////////////////// -std::vector<std::string> FETOLCommunicator::gatherStrings(const std::string& str) -{ - vector<string> parts; - vector<string> strings; - int scount; - vector<char> rbuf(1); - vector<int> rcounts(1); - - if (PID == root) - { - rcounts.resize(numberOfProcesses - 1); - strings.push_back(str); - - for (int i = 1; i < numberOfProcesses; i++) - { - bond::receiveComplete(&rcounts[i-1], 1, MPI_INT, i, 0); - } - for (int i = 1; i < numberOfProcesses; i++) - { - rbuf.resize(rcounts[i-1]); - bond::receiveComplete(&rbuf[0], rcounts[i-1], MPI_CHAR, i, 0); - string s(&rbuf[0], rcounts[i-1]); - if (s != "") strings.push_back(s); - } - } - else - { - scount = (int)str.length(); - bond::sendComplete(&scount, 1, MPI_INT, root, 0); - bond::sendComplete((char *)str.c_str(), scount, MPI_CHAR, root, 0); - } - return strings; -} -////////////////////////////////////////////////////////////////////////// -std::vector<double> FETOLCommunicator::gatherDoubles(std::vector<double>& values) -{ - return mpi_comm->gatherDoubles(values); -} -////////////////////////////////////////////////////////////////////////// -void FETOLCommunicator::allGatherInts(std::vector<int>& svalues, std::vector<int>& rvalues) -{ - int scount; - vector<int> rbuf; - vector<int> rcounts; - - if (PID == root) - { - rvalues.resize(0); - rvalues.insert(rvalues.end(), svalues.begin(), svalues.end()); - rcounts.resize(numberOfProcesses - 1); - - for (int i = 1; i < numberOfProcesses; i++) - { - bond::receiveComplete(&rcounts[i-1], 1, MPI_INT, i, 0); - } - for (int i = 1; i < numberOfProcesses; i++) - { - if(rcounts[i-1] > 0) - { - rbuf.resize(rcounts[i-1]); - bond::receiveComplete(&rbuf[0], rcounts[i-1], MPI_INT, i, 0); - rvalues.insert(rvalues.end(), rbuf.begin(), rbuf.end()); - } - } - } - else - { - scount = (int)svalues.size(); - bond::sendComplete(&scount, 1, MPI_INT, root, 0); - if(scount > 0) - bond::sendComplete(&svalues[0], scount, MPI_INT, root, 0); - } - - if(rvalues.size() > 0) - broadcastInts(rvalues); -} -////////////////////////////////////////////////////////////////////////// -void FETOLCommunicator::sendSerializedObject(std::stringstream& ss, int target) -{ - -} -////////////////////////////////////////////////////////////////////////// -void FETOLCommunicator::receiveSerializedObject(std::stringstream& ss, int source) -{ - -} -////////////////////////////////////////////////////////////////////////// -void FETOLCommunicator::barrier() -{ - int flag = 0; - - if (PID == root) - { - for (int i = 1; i < numberOfProcesses; i++) - { - bond::receiveComplete(&flag, 1, MPI_INT, i, 0); - } - - for (int i = 1; i < numberOfProcesses; i++) - { - bond::sendComplete(&flag, 1, MPI_INT, i, 0); - } - } - else - { - bond::sendComplete(&flag, 1, MPI_INT, root, 0); - bond::receiveComplete(&flag, 1, MPI_INT, root, 0); - } -} - -#endif diff --git a/src/VirtualFluids/FETOL/FETOLCommunicator.h b/src/VirtualFluids/FETOL/FETOLCommunicator.h deleted file mode 100644 index 6fcd64b0b..000000000 --- a/src/VirtualFluids/FETOL/FETOLCommunicator.h +++ /dev/null @@ -1,56 +0,0 @@ -#if defined VF_MPI && defined VF_FETOL - -#ifndef FETOLCommunicator_H -#define FETOLCommunicator_H - -#include <iostream> -#include <vector> -#include <string> - -#include <MPICommunicator.h> - -#include <memory> -class FETOLCommunicator; -typedef std::shared_ptr<FETOLCommunicator> BondCommunicatorPtr; - -///\brief Communicator for agent-based framework BOND - -class FETOLCommunicator : public Communicator -{ -private: - FETOLCommunicator(); -public: - ~FETOLCommunicator(); - static CommunicatorPtr getInstance(); - int getBundleID(); - int getNumberOfBundles(); - int getProcessID(); - int getProcessID(int bundle, int rank); - int getNumberOfProcesses(); - int getBONDProcessID(); - int getBONDProcessCount(); - int getMPIRank(); - int getMPICommSize(); - int getRoot(); - int getBundleRoot(); - int getProcessRoot(); - int getNumberOfProcessesInBundle(int bundle); - void* getNativeCommunicator(); - void broadcastInts(std::vector<int>& values); - std::vector<std::string> gatherStrings(const std::string& str); - std::vector<double> gatherDoubles(std::vector<double>& values); - void allGatherInts(std::vector<int>& svalues, std::vector<int>& rvalues); - void sendSerializedObject(std::stringstream& ss, int target); - void receiveSerializedObject(std::stringstream& ss, int source); - void barrier(); -private: - CommunicatorPtr mpi_comm; - int mpi_rank, mpi_size; - int numberOfBundles, BID, numberOfProcesses, PID; - int root; - std::vector<int> bundleSizes; -}; - -#endif - -#endif diff --git a/src/VirtualFluids/FETOL/FETOLSetConnectorsBlockVisitor.cpp b/src/VirtualFluids/FETOL/FETOLSetConnectorsBlockVisitor.cpp deleted file mode 100644 index c81b15bda..000000000 --- a/src/VirtualFluids/FETOL/FETOLSetConnectorsBlockVisitor.cpp +++ /dev/null @@ -1,289 +0,0 @@ -#if defined VF_MPI && defined VF_FETOL - -#include "FETOLSetConnectorsBlockVisitor.h" -#include "D3Q27ETFullVectorConnector.h" -#include "D3Q27ETFullDirectConnector.h" -#include "D3Q27ETFullDirectConnector2.h" -#include "D3Q27ETFullVectorConnector.h" -#include "D3Q27ETCFVectorConnector.h" -#include "D3Q27ETFCVectorConnector.h" -#include "D3Q27ETCFOffVectorConnector.h" -#include "D3Q27ETFCOffVectorConnector.h" -#include "Grid3DSystem.h" -#include "D3Q27ETDirectConnector.h" -#include <basics/transmitter/TbTransmitterLocal.h> - -FETOLSetConnectorsBlockVisitor::FETOLSetConnectorsBlockVisitor(CommunicatorPtr comm, bool fullConnector, int dirs, - LBMReal nue, D3Q27InterpolationProcessorPtr iProcessor) : - Block3DVisitor(0, Grid3DSystem::MAXLEVEL), - fullConnector(fullConnector), - dirs(dirs), - nue(nue), - iProcessor(iProcessor) -{ - this->comm = std::dynamic_pointer_cast<FETOLCommunicator>(comm); - gridBundle = this->comm->getBundleID(); - gridRank = comm->getProcessID(); - UBLOG(logDEBUG5, "D3Q27BondSetConnectorsBlockVisitor: gridBundle = "<<gridBundle<<" gridRank = "<<gridRank); -} -////////////////////////////////////////////////////////////////////////// -FETOLSetConnectorsBlockVisitor::~FETOLSetConnectorsBlockVisitor(void) -{ -} -////////////////////////////////////////////////////////////////////////// -void FETOLSetConnectorsBlockVisitor::visit(Grid3DPtr grid, Block3DPtr block) -{ - if(!block) return; - - //UBLOG(logDEBUG5, "D3Q27BondSetConnectorsBlockVisitor::visit() - start"); - //gridBundle = comm->getBundleID(); - //grid->setBundle(gridBundle); - - //gridRank = comm->getProcessID(); - //grid->setRank(gridRank); - - setSameLevelConnectors(grid, block); - - //if(grid->getFinestInitializedLevel() > grid->getCoarsestInitializedLevel()) - // setInterpolationConnectors(grid, block); - - //UBLOG(logDEBUG5, "D3Q27BondSetConnectorsBlockVisitor::visit() - end"); -} -////////////////////////////////////////////////////////////////////////// -void FETOLSetConnectorsBlockVisitor::setSameLevelConnectors(Grid3DPtr grid, Block3DPtr block) -{ - int blockBundle = block->getBundle(); - int blockRank = block->getRank(); - if (gridBundle == blockBundle && gridRank == blockRank && block->isActive()) - { - block->clearWeight(); - std::vector<Block3DPtr> neighbors; - int ix1 = block->getX1(); - int ix2 = block->getX2(); - int ix3 = block->getX3(); - int level = block->getLevel(); - - for( int dir = 0; dir < dirs; dir++) - { - Block3DPtr neighBlock = grid->getNeighborBlock(dir, ix1, ix2, ix3, level); - - if(neighBlock) - { - int neighBlockBundle = neighBlock->getBundle(); - int neighBlockRank = neighBlock->getRank(); - if(blockBundle == neighBlockBundle && blockRank == neighBlockRank && neighBlock->isActive()) - { - Block3DConnectorPtr connector; - connector = Block3DConnectorPtr(new D3Q27ETFullDirectConnector2( block, neighBlock, dir)); - block->setConnector(connector); - } - else if(blockBundle == neighBlockBundle && blockRank != neighBlockRank && neighBlock->isActive()) - { - setRemoteConnectors(block, neighBlock, dir); - } - else if(blockBundle != neighBlockBundle && neighBlock->isActive()) - { - setBundleConnectors(block, neighBlock, dir); - } - } - } - } -} -////////////////////////////////////////////////////////////////////////// -void FETOLSetConnectorsBlockVisitor::setRemoteConnectors(Block3DPtr sblock, Block3DPtr tblock, int dir) -{ - CreateTransmittersHelper helper; - CreateTransmittersHelper::TransmitterPtr sender, receiver; - helper.createTransmitters(sblock, tblock, dir, CreateTransmittersHelper::NONE, sender, receiver, comm, CreateTransmittersHelper::MPI2BOND); - - Block3DConnectorPtr connector; - connector = Block3DConnectorPtr(new D3Q27ETFullVectorConnector< TbTransmitter< CbVector< LBMReal > > >(sblock, sender, receiver, dir)); - connector->setTransmitterType(Block3DConnector::MPI); - UBLOG(logDEBUG5,"setTransmitterType: "<< Block3DConnector::MPI); - sblock->setConnector(connector); - UBLOG(logDEBUG5, "D3Q27BondSetConnectorsBlockVisitor::setRemoteConnectors() - sblock = "<<sblock->toString()); -} -////////////////////////////////////////////////////////////////////////// -void FETOLSetConnectorsBlockVisitor::setBundleConnectors(Block3DPtr sblock, Block3DPtr tblock, int dir) -{ - CreateTransmittersHelper helper; - CreateTransmittersHelper::TransmitterPtr sender, receiver; - bool MPIpool = true; - bool orthogonal = false; - helper.createTransmitters(sblock, tblock, dir, CreateTransmittersHelper::NONE, sender, receiver, comm, CreateTransmittersHelper::BOND); - - Block3DConnectorPtr connector; - connector = Block3DConnectorPtr(new D3Q27ETFullVectorConnector< TbTransmitter< CbVector< LBMReal > > >(sblock, sender, receiver, dir)); - connector->setTransmitterType(Block3DConnector::BOND); - UBLOG(logDEBUG5,"setTransmitterType: "<< Block3DConnector::BOND); - sblock->setConnector(connector); - UBLOG(logDEBUG5, "D3Q27BondSetConnectorsBlockVisitor::setBundleConnectors() - sblock = "<<sblock->toString()); -} -////////////////////////////////////////////////////////////////////////// -//void D3Q27BondSetConnectorsBlockVisitor::setInterpolationConnectors(Grid3DPtr grid, Block3DPtr block) -//{ -// //int blockRank = block->getRank(); -// -// //search for all blocks with different ranks -// if (block->hasInterpolationFlagCF() && block->isActive()) -// { -// int fbx1 = block->getX1() << 1; -// int fbx2 = block->getX2() << 1; -// int fbx3 = block->getX3() << 1; -// int level = block->getLevel() + 1; -// -// if( block->hasInterpolationFlagCF(D3Q27System::E)) -// { -// Block3DPtr fblockSW = grid->getBlock(fbx1+1,fbx2,fbx3,level); -// Block3DPtr fblockSE = grid->getBlock(fbx1+1,fbx2+1,fbx3,level); -// Block3DPtr fblockNW = grid->getBlock(fbx1+1,fbx2,fbx3+1,level); -// Block3DPtr fblockNE = grid->getBlock(fbx1+1,fbx2+1,fbx3+1,level); -// -// setInterpolationConnectors(grid, fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::E); -// } -// if( block->hasInterpolationFlagCF(D3Q27System::W)) -// { -// Block3DPtr fblockSW = grid->getBlock(fbx1,fbx2,fbx3,level); -// Block3DPtr fblockSE = grid->getBlock(fbx1,fbx2+1,fbx3,level); -// Block3DPtr fblockNW = grid->getBlock(fbx1,fbx2,fbx3+1,level); -// Block3DPtr fblockNE = grid->getBlock(fbx1,fbx2+1,fbx3+1,level); -// -// setInterpolationConnectors(grid, fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::W); -// } -// if( block->hasInterpolationFlagCF(D3Q27System::N)) -// { -// Block3DPtr fblockSW = grid->getBlock(fbx1,fbx2+1,fbx3,level); -// Block3DPtr fblockSE = grid->getBlock(fbx1+1,fbx2+1,fbx3,level); -// Block3DPtr fblockNW = grid->getBlock(fbx1,fbx2+1,fbx3+1,level); -// Block3DPtr fblockNE = grid->getBlock(fbx1+1,fbx2+1,fbx3+1,level); -// -// setInterpolationConnectors(grid, fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::N); -// } -// if( block->hasInterpolationFlagCF(D3Q27System::S)) -// { -// Block3DPtr fblockSW = grid->getBlock(fbx1,fbx2,fbx3,level); -// Block3DPtr fblockSE = grid->getBlock(fbx1+1,fbx2,fbx3,level); -// Block3DPtr fblockNW = grid->getBlock(fbx1,fbx2,fbx3+1,level); -// Block3DPtr fblockNE = grid->getBlock(fbx1+1,fbx2,fbx3+1,level); -// -// setInterpolationConnectors(grid, fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::S); -// } -// if( block->hasInterpolationFlagCF(D3Q27System::T)) -// { -// Block3DPtr fblockSW = grid->getBlock(fbx1,fbx2,fbx3+1,level); -// Block3DPtr fblockSE = grid->getBlock(fbx1+1,fbx2,fbx3+1,level); -// Block3DPtr fblockNW = grid->getBlock(fbx1,fbx2+1,fbx3+1,level); -// Block3DPtr fblockNE = grid->getBlock(fbx1+1,fbx2+1,fbx3+1,level); -// -// setInterpolationConnectors(grid, fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::T); -// } -// if( block->hasInterpolationFlagCF(D3Q27System::B)) -// { -// Block3DPtr fblockSW = grid->getBlock(fbx1,fbx2,fbx3,level); -// Block3DPtr fblockSE = grid->getBlock(fbx1+1,fbx2,fbx3,level); -// Block3DPtr fblockNW = grid->getBlock(fbx1,fbx2+1,fbx3,level); -// Block3DPtr fblockNE = grid->getBlock(fbx1+1,fbx2+1,fbx3,level); -// -// setInterpolationConnectors(grid, fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::B); -// } -// } -//} -//////////////////////////////////////////////////////////////////////////// -//void D3Q27BondSetConnectorsBlockVisitor::setInterpolationConnectors(Grid3DPtr grid, Block3DPtr fBlockSW, Block3DPtr fBlockSE, Block3DPtr fBlockNW, Block3DPtr fBlockNE, Block3DPtr cBlock, int dir) -//{ -// 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); -// -// D3Q27InterpolationProcessorPtr cIProcessor(iProcessor->clone()); -// D3Q27InterpolationProcessorPtr fIProcessorSW(iProcessor->clone()); -// D3Q27InterpolationProcessorPtr fIProcessorSE(iProcessor->clone()); -// D3Q27InterpolationProcessorPtr fIProcessorNW(iProcessor->clone()); -// D3Q27InterpolationProcessorPtr fIProcessorNE(iProcessor->clone()); -// -// D3Q27CreateTransmittersHelper::TransmitterPtr senderCFevenEvenSW, receiverCFevenEvenSW, -// senderCFevenOddNW, receiverCFevenOddNW, -// senderCFoddEvenSE, receiverCFoddEvenSE, -// senderCFoddOddNE, receiverCFoddOddNE, -// senderFCevenEvenSW, receiverFCevenEvenSW, -// senderFCevenOddNW, receiverFCevenOddNW, -// senderFCoddEvenSE, receiverFCoddEvenSE, -// senderFCoddOddNE, receiverFCoddOddNE; -// -// if(fBlockSW) createTransmitters(cBlock, fBlockSW, dir, senderCFevenEvenSW, receiverCFevenEvenSW, senderFCevenEvenSW, receiverFCevenEvenSW); -// if(fBlockNW) createTransmitters(cBlock, fBlockNW, dir, senderCFevenOddNW, receiverCFevenOddNW, senderFCevenOddNW, receiverFCevenOddNW); -// if(fBlockSE) createTransmitters(cBlock, fBlockSE, dir, senderCFoddEvenSE, receiverCFoddEvenSE, senderFCoddEvenSE, receiverFCoddEvenSE); -// if(fBlockNE) createTransmitters(cBlock, fBlockNE, dir, senderCFoddOddNE, receiverCFoddOddNE, senderFCoddOddNE, receiverFCoddOddNE); -// -// if(cBlockRank == gridRank) -// { -// Block3DConnectorPtr connector( new D3Q27ETCFOffVectorConnector< TbTransmitter< CbVector< LBMReal > > >(cBlock, -// senderCFevenEvenSW, receiverCFevenEvenSW, senderCFevenOddNW, receiverCFevenOddNW, -// senderCFoddEvenSE, receiverCFoddEvenSE, senderCFoddOddNE, receiverCFoddOddNE, -// dir, cIProcessor) ); -// cBlock->setConnector(connector); -// } -// if(fBlockSW && fBlockSWRank == gridRank) -// { -// Block3DConnectorPtr connector( new D3Q27ETFCOffVectorConnector< TbTransmitter< CbVector< LBMReal > > >(fBlockSW, -// senderFCevenEvenSW, receiverFCevenEvenSW, dir, fIProcessorSW, EvenEvenSW) ); -// fBlockSW->setConnector(connector); -// } -// if(fBlockNW && fBlockNWRank == gridRank) -// { -// Block3DConnectorPtr connector( new D3Q27ETFCOffVectorConnector< TbTransmitter< CbVector< LBMReal > > >(fBlockNW, -// senderFCevenOddNW, receiverFCevenOddNW, dir, fIProcessorNW, EvenOddNW) ); -// fBlockNW->setConnector(connector); -// } -// if(fBlockSE && fBlockSERank == gridRank) -// { -// Block3DConnectorPtr connector( new D3Q27ETFCOffVectorConnector< TbTransmitter< CbVector< LBMReal > > >(fBlockSE, -// senderFCoddEvenSE, receiverFCoddEvenSE, dir, fIProcessorSE, OddEvenSE) ); -// fBlockSE->setConnector(connector); -// } -// if(fBlockNE && fBlockNERank == gridRank) -// { -// Block3DConnectorPtr connector( new D3Q27ETFCOffVectorConnector< TbTransmitter< CbVector< LBMReal > > >(fBlockNE, -// senderFCoddOddNE, receiverFCoddOddNE, dir, fIProcessorNE, OddOddNE) ); -// fBlockNE->setConnector(connector); -// } -//} -//////////////////////////////////////////////////////////////////////////// -//void D3Q27BondSetConnectorsBlockVisitor::createTransmitters(Block3DPtr cBlock, Block3DPtr fBlock, int dir, -// D3Q27CreateTransmittersHelper::TransmitterPtr& senderCF, -// D3Q27CreateTransmittersHelper::TransmitterPtr& receiverCF, -// D3Q27CreateTransmittersHelper::TransmitterPtr& senderFC, -// D3Q27CreateTransmittersHelper::TransmitterPtr& receiverFC) -//{ -// D3Q27CreateTransmittersHelper helper; -// bool MPIpool = true; -// bool orthogonal = false; -// int fBlockRank = fBlock->getRank(); -// int cBlockRank = cBlock->getRank(); -// if(fBlockRank == cBlockRank && fBlockRank == gridRank) -// { -// senderCF = receiverFC = D3Q27CreateTransmittersHelper::TransmitterPtr( new TbLocalTransmitter< CbVector< LBMReal > >()); -// senderFC = receiverCF = D3Q27CreateTransmittersHelper::TransmitterPtr( new TbLocalTransmitter< CbVector< LBMReal > >()); -// } -// else if(cBlockRank == gridRank) -// { -// helper.createTransmitters(cBlock, fBlock, dir, senderCF, receiverCF, comm); -// } -// else if(fBlockRank == gridRank) -// { -// helper.createTransmitters(fBlock, cBlock, dir, senderFC, receiverFC, comm); -// } -//} - -#endif diff --git a/src/VirtualFluids/FETOL/FETOLSetConnectorsBlockVisitor.h b/src/VirtualFluids/FETOL/FETOLSetConnectorsBlockVisitor.h deleted file mode 100644 index f91cc42ba..000000000 --- a/src/VirtualFluids/FETOL/FETOLSetConnectorsBlockVisitor.h +++ /dev/null @@ -1,41 +0,0 @@ -#if defined VF_MPI && defined VF_FETOL - -#ifndef D3Q27BondSetConnectorsBlockVisitor_H -#define D3Q27BondSetConnectorsBlockVisitor_H - -#include "Block3DVisitor.h" -#include "D3Q27System.h" -#include "FETOLCommunicator.h" -#include "InterpolationProcessor.h" -#include "CreateTransmittersHelper.h" - -class FETOLSetConnectorsBlockVisitor : public Block3DVisitor -{ -public: - FETOLSetConnectorsBlockVisitor(CommunicatorPtr comm, bool fullConnector, int dirs, LBMReal nue, D3Q27InterpolationProcessorPtr iProcessor); - virtual ~FETOLSetConnectorsBlockVisitor(); - void visit(std::shared_ptr<Grid3D> grid, std::shared_ptr<Block3D> block) override; - ////////////////////////////////////////////////////////////////////////// -protected: - void setSameLevelConnectors(Grid3DPtr grid, Block3DPtr block); - void setRemoteConnectors(Block3DPtr sblock, Block3DPtr tblock, int dir); - void setBundleConnectors(Block3DPtr sblock, Block3DPtr tblock, int dir); - //void setInterpolationConnectors(Grid3DPtr grid, Block3DPtr block); - //void setInterpolationConnectors(Grid3DPtr grid, Block3DPtr fBlockSW, Block3DPtr fBlockSE, Block3DPtr fBlockNW, Block3DPtr fBlockNE, Block3DPtr cBlock, int dir); - //void createTransmitters(Block3DPtr cBlock, Block3DPtr fBlock, int dir, - // D3Q27CreateTransmittersHelper::TransmitterPtr& senderCF, - // D3Q27CreateTransmittersHelper::TransmitterPtr& receiverCF, - // D3Q27CreateTransmittersHelper::TransmitterPtr& senderFC, - // D3Q27CreateTransmittersHelper::TransmitterPtr& receiverFC); - BondCommunicatorPtr comm; - bool fullConnector; - int dirs; - int gridBundle; - int gridRank; - LBMReal nue; - D3Q27InterpolationProcessorPtr iProcessor; -}; - -#endif //D3Q27SETCONNECTORSVISITOR_H - -#endif diff --git a/src/VirtualFluids/FETOL/FETOLTransmitterBondPool.h b/src/VirtualFluids/FETOL/FETOLTransmitterBondPool.h deleted file mode 100644 index 4ed78a36e..000000000 --- a/src/VirtualFluids/FETOL/FETOLTransmitterBondPool.h +++ /dev/null @@ -1,510 +0,0 @@ -// _ ___ __ __________ _ __ -// | | / (_)____/ /___ ______ _/ / ____/ /_ __(_)___/ /____ -// | | / / / ___/ __/ / / / __ `/ / /_ / / / / / / __ / ___/ -// | |/ / / / / /_/ /_/ / /_/ / / __/ / / /_/ / / /_/ (__ ) -// |___/_/_/ \__/\__,_/\__,_/_/_/ /_/\__,_/_/\__,_/____/ -// -#ifdef VF_FETOL - -#ifndef FETOLTRANSMITTERBONDPOOL_H -#define FETOLTRANSMITTERBONDPOOL_H - -#include <iostream> -#include <sstream> -#include <iomanip> -#include <vector> -#include <map> - -#include <mpi.h> - -#include "fbond.h" -#include "Version.h" - -#include <basics/transmitter/TbTransmitter.h> -#include <basics/container/CbVector.h> -#include <basics/container/CbVectorPool.h> - -#include <memory> - -////////////////////////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////// -//TbCbVectorBondPoolSender/Receiver -//diese verschicken immer einen VectorPool. Letztlich einen langen vector, -//der eigentlich aus vielen kleinen besteht -//jeder BondPoolVector hat einen pointer auf die startadresse in diesem vector -//die informationen werden im TbBondVectorPool verwaltet -//BondPoolVector verhaelt sich nach aussen hin mit einschraenkungen wie ein std::vector -//und kann somit bei den vector connector verwendet werden -//man kann die klassen theoretisch verallgemeinern. - -template<typename T> class TbCbVectorSenderBondPool; -template<typename T> class TbCbVectorReceiverBondPool; - -/*==================================================================*/ -//! \brief The class sends always one VectorPool. -//! \details It is a long vector, which actually consists of many small. -//! Each BondPoolVector has a pointer to the start address in this vector. -//! The information is managed in TbCbBondVectorPool. -//! BondPool vectors behaves outwardly with limitations such as a std::vector -//! and can thus be used in the vector connector. -//! \author Kostyantyn Kucher - -template<typename T> -class TbCbVectorBondPool : public CbVectorPool<T> -{ -public: - typedef std::shared_ptr< TbCbVectorBondPool< T > > BondPoolPtr; - - ////////////////////////////////////////////////////////////////////////// - typedef std::map< int, BondPoolPtr > BondPoolPtrMap; - typedef typename BondPoolPtrMap::iterator BondPoolPtrMapIter; - - //da BasisKlasse templateKlasse ist MUSS man hier die typedefs nochmal wiederholen! - typedef typename CbVector<T>::value_type value_type; - typedef typename CbVector<T>::size_type size_type; - typedef std::vector< value_type > Pool; - - typedef unsigned CbVectorKey; - typedef std::map< CbVectorKey, CbVector< value_type >* /*ptrVector*/ > CbVectorMap; - typedef typename CbVectorMap::iterator CbVectorMapIter; - - ////////////////////////////////////////////////////////////////////////// - friend class TbCbVectorSenderBondPool< T >; - friend class TbCbVectorReceiverBondPool< T >; - -protected: - ////////////////////////////////////////////////////////////////////////// - static BondPoolPtrMap poolMap; -public: - ////////////////////////////////////////////////////////////////////////// - //STATIC MEMBERS - ////////////////////////////////////////////////////////////////////////// - //!createTbCbVectorBondPool: - //! \param poolKey : Schluessel fuer eindeutige Indizierung in Map - //! \param bondRemoteRank: bond-rank of receiver/sender - //! \param bondTag : with the bond-tag it is received/sent - -static BondPoolPtr createTbCbVectorBondPool(const int& poolKey, const int& bondRemoteRank, const int& bondTag, const size_type& startPoolSize = 20000 ) //startPoolSize*sizeof(T)/1024/1024 [MB] - { - if( poolMap.find(poolKey)!=poolMap.end() ) - { - throw UbException(UB_EXARGS,"es ist bereits ein Pool mit dem key vorhanden!!!"); - } - - //pool erstellen - BondPoolPtr bondPool(new TbCbVectorBondPool<T>(poolKey, bondRemoteRank, bondTag, startPoolSize) ); - - //pool "speichern" - TbCbVectorBondPool< value_type >::poolMap[poolKey] = bondPool; - - return bondPool; - } - static void deleteTbCbVectorBondPool(const int& poolKey) - { - BondPoolPtrMapIter it = TbCbVectorBondPool< value_type >::poolMap.find(poolKey); - if( it==poolMap.end() ) - { - throw UbException(UB_EXARGS,"kein Pool mit dem key vorhanden"); - } - TbCbVectorBondPool< value_type >::poolMap.erase(it); - } - /*==================================================================*/ - static BondPoolPtr getTbCbVectorBondPool(const int& poolKey) - { - BondPoolPtrMapIter it; - if( (it=TbCbVectorBondPool< T >::poolMap.find(poolKey))!=TbCbVectorBondPool< T >::poolMap.end() ) - { - return it->second; - } - return BondPoolPtr(); - } - /*==================================================================*/ - static std::string getInfoString() - { - std::stringstream out; - out<<"TbCbVectorBondPool<"<< typeid( T ).name() << ") - Info:"<<std::endl; - for(BondPoolPtrMapIter it=poolMap.begin(); it!=poolMap.end(); ++it) - out<<"pool with key(" <<std::setw(15)<<it->first<<") " - <<"stores " <<std::setw(12)<<it->second->getNofStoredVectors() <<" vectors " - <<", elements to transfer = "<<std::setw(15)<<it->second->getPoolSize() - <<" ( "<< it->second->getPoolSize()*sizeof( T ) / ( 1024.0 * 1024.0 ) << " MB )" <<std::endl; - return out.str(); - } - /*==================================================================*/ - //! checks if all vectors have one to one pool-entries - static bool consistencyCheck() - { - for(BondPoolPtrMapIter it=poolMap.begin(); it!=poolMap.end(); ++it) - { - if( !it->second-> CbVectorPool<T>::consistencyCheck() ) - { - return false; - } - } - - return true; - } - ////////////////////////////////////////////////////////////////////////// - static void eraseMap() - { - poolMap.clear(); - } -protected: - ////////////////////////////////////////////////////////////////////////// -TbCbVectorBondPool(const int& poolKey, const int& bondRemoteRank, const int& bondTag, const size_type& startPoolSize ) - : CbVectorPool< value_type >( startPoolSize ) - , poolKey(poolKey) - , nofStoredVectors(0) //=Anzahl an Vectoren im Pool, wird bei send/receiveDataOrder gesetzt - , counterPrepareReceiveDataOrder(0) - , counterSendDataOrder(0) - , counterReceiveDataOrder(0) - , counterPrepareForReceive(0) - , counterReceive(0) - , counterPrepareForSend(0) - , counterSend(0) - , bondRemoteRank(bondRemoteRank) - , bondTag(bondTag) - { - if ( (std::string)typeid(value_type).name()==(std::string)typeid(double).name() ) mpiDataType = MPI_DOUBLE; - else if( (std::string)typeid(value_type).name()==(std::string)typeid(float).name() ) mpiDataType = MPI_FLOAT; - else if( (std::string)typeid(value_type).name()==(std::string)typeid(int).name() ) mpiDataType = MPI_INT; - else throw UbException(UB_EXARGS,"no BondDataType for T"+(std::string)typeid(T).name()); - } -public: - /*==================================================================*/ - //!returns key of Pool in BondPoolMap - int getPoolKey() const { return this->poolKey; } - /*==================================================================*/ - //!returns rank of process pool data will be send to/received from - int getRemoteRank() const { return this->bondRemoteRank; } - /*==================================================================*/ - //!returns tag of process pool data will be send to/received from - int getRemoteTag() const { return this->bondTag; } - -protected: - /*==================================================================*/ - void sendDataOrder() - { - counterSendDataOrder++; - if(counterSendDataOrder==this->cbVectorMap.size()) - { - UBLOG(logDEBUG5, "TbCbVectorBondPool::sendDataOrder():start"<<" bondRemoteRank="<<bondRemoteRank<<" bondTag="<<bondTag); - unsigned nofElements = (unsigned)this->cbVectorMap.size()*3+1; - tmpSendOrderVec.resize(nofElements);//std::vector< unsigned > vec(nofElements); - unsigned index = 0; - tmpSendOrderVec[index++] = (unsigned)this->pool.size(); //= laenge des vectors - if(this->nextCbVectorStartIndexInPool != this->pool.size()) throw UbException(UB_EXARGS,"an dieser Stelle sollten nextStartIndex und pool.size() identisch sein!!!"); - for(CbVectorMapIter it = this->cbVectorMap.begin(); it!=this->cbVectorMap.end(); ++it) - { - CbVectorKey vectorKey=0; - size_type dataSize=0, startIndexInPool=0; - this->getCbVectorData(*it->second/*vec*/, vectorKey, startIndexInPool, dataSize ); - if(it->first != vectorKey) throw UbException(UB_EXARGS,"key mismatch!"); - - tmpSendOrderVec[index++] = (unsigned)vectorKey; //vectorKey == allocator.getAllocatorKey() - tmpSendOrderVec[index++] = (unsigned)startIndexInPool; //startIndex in poolVector - tmpSendOrderVec[index++] = (unsigned)dataSize; //dataSize - } - - try - { - sendRequest = bond::sendFuture(&tmpSendOrderVec[0], (int)tmpSendOrderVec.size(), MPI_UNSIGNED, bondRemoteRank, bondTag); - } - catch (...) - { - std::cerr << "it is bond exception in sendDataOrder()" << std::endl; - throw; - } - - counterSendDataOrder=0; - - nofStoredVectors = this->cbVectorMap.size(); - - UBLOG(logDEBUG5, "TbCbVectorBondPool::sendDataOrder():end"<<" bondRemoteRank="<<bondRemoteRank<<" bondTag="<<bondTag); - -#ifdef _DEBUG - orgPoolVectorStartPointer = &this->pool[0]; -#endif - } - } - /*==================================================================*/ - void receiveDataOrder() - { - counterReceiveDataOrder++; - if(counterReceiveDataOrder==this->cbVectorMap.size()) - { - UBLOG(logDEBUG5, "TbCbVectorBondPool::receiveDataOrder():start"<<" bondRemoteRank="<<bondRemoteRank<<" bondTag="<<bondTag); - - unsigned nofElements = (unsigned)this->cbVectorMap.size()*3+1; //map MUSS auf beiden seiten gleich gross sein, sonst hat man ein grundsaetzliches problem ;-) - - std::vector< unsigned > tmpRecvOrderVec; - tmpRecvOrderVec.resize(nofElements); - - try - { - bond::receiveComplete(&tmpRecvOrderVec[0], nofElements, MPI_UNSIGNED, bondRemoteRank, bondTag); - } - catch (...) - { - std::cerr << "it is bond exception in receiveDataOrder()" << std::endl; - throw; - } - - if(nofElements!=(unsigned)tmpRecvOrderVec.size()) - throw UbException(UB_EXARGS,"error... vec size stimmt nicht"); - - unsigned index = 0; - this->nextCbVectorStartIndexInPool = tmpRecvOrderVec[index++]; //= laenge des vectors - this->pool.resize(this->nextCbVectorStartIndexInPool); - CbVectorMapIter it = this->cbVectorMap.begin(); - for(/*index*/; index<nofElements; index+=3, ++it) - { - CbVectorKey vectorKey = (CbVectorKey)tmpRecvOrderVec.at(index ); - size_type startIndexInPool = (size_type)tmpRecvOrderVec.at(index+1); - size_type dataSize = (size_type)tmpRecvOrderVec.at(index+2); - - if(it==this->cbVectorMap.end() || it->first != vectorKey ) - throw UbException(UB_EXARGS,"entweder hat map nicht die gleiche reihenfolge oder vectorKey nicht vorhanden"); - - this->setCbVectorData(*it->second/*vec*/, vectorKey, startIndexInPool, dataSize ); - } - if(it!=this->cbVectorMap.end()) - throw UbException(UB_EXARGS,"error... in der map sind scheinbar noch weiter elemente vorhanden, die es auf der send seite nicht gibt..."); - - counterReceiveDataOrder = 0; - nofStoredVectors = this->cbVectorMap.size(); - - UBLOG(logDEBUG5, "TbCbVectorBondPool::receiveDataOrder():end"<<" bondRemoteRank="<<bondRemoteRank<<" bondTag="<<bondTag); - -#ifdef _DEBUG - orgPoolVectorStartPointer = &this->pool[0]; -#endif - } - } - /*==================================================================*/ - void prepareForSendData() - { - //da sendDataOrder einen request verwendet muss man hier immer abfragen - if(counterPrepareForSend==0) - { - UBLOG(logDEBUG5, "TbCbVectorBondPool::prepareForSendData():start"<<" bondRemoteRank="<<bondRemoteRank<<" bondTag="<<bondTag); - if (sendRequest) - { - try - { - sendRequest->complete(); - } - catch (...) - { - std::cerr << "it is bond exception in prepareForSendData()" << std::endl; - throw; - } - sendRequest = std::tr1::shared_ptr<bond::FutureSend>(); - } - UBLOG(logDEBUG5, "TbCbVectorBondPool::prepareForSendData():end"<<" bondRemoteRank="<<bondRemoteRank<<" bondTag="<<bondTag); - } - - counterPrepareForSend++; - - if(counterPrepareForSend==nofStoredVectors) - { - counterPrepareForSend=0; - } - } - /*==================================================================*/ - void sendData() - { - counterSend++; - if(counterSend==nofStoredVectors) - { -#ifdef _DEBUG - if(this->orgPoolVectorStartPointer != &this->pool[0] ) throw UbException(UB_EXARGS, "ups, pool array address changed - unknown behavior"); -#endif - UBLOG(logDEBUG5, "TbCbVectorBondPool::sendData():start"<<" bondRemoteRank="<<bondRemoteRank<<" bondTag="<<bondTag); - try - { - bond::sendComplete(&this->pool[0],(int)this->nextCbVectorStartIndexInPool, mpiDataType, bondRemoteRank, bondTag); - } - catch(...) - { - std::cerr << "it is bond exception in sendData()" << std::endl; - throw; - } - counterSend=0; - UBLOG(logDEBUG5, "TbCbVectorBondPool::sendData():end"<<" bondRemoteRank="<<bondRemoteRank<<" bondTag="<<bondTag); - } - } - /*==================================================================*/ - void prepareForReceiveData() - { - counterPrepareForReceive++; - if(counterPrepareForReceive==this->nofStoredVectors) - { - UBLOG(logDEBUG5, "TbCbVectorBondPool::prepareForReceiveData():start"<<" bondRemoteRank="<<bondRemoteRank<<" bondTag="<<bondTag); -#ifdef _DEBUG - if(this->orgPoolVectorStartPointer != &this->pool[0] ) throw UbException(UB_EXARGS, "ups, pool array adress changed - unknown behavoir"); -#endif - try - { - receiveRequest = bond::receiveFuture(&this->pool[0],(int)this->nextCbVectorStartIndexInPool, mpiDataType, bondRemoteRank, bondTag); - } - catch (...) - { - std::cerr << "it is bond exception in prepareForReceiveData()" << std::endl; - throw; - } - - - UBLOG(logDEBUG5, "TbCbVectorBondPool::prepareForReceiveData():end"<<" bondRemoteRank="<<bondRemoteRank<<" bondTag="<<bondTag); - counterPrepareForReceive=0; - } - } - /*==================================================================*/ - void receiveData() - { - if(counterReceive==0) - { - - UBLOG(logDEBUG5, "TbCbVectorBondPool::receiveData():start"<<" bondRemoteRank="<<bondRemoteRank<<" bondTag="<<bondTag); - - try - { - receiveRequest->complete(); - } - catch (...) - { - std::cerr << "it is bond exception in receiveData()" << std::endl; - throw; - } - UBLOG(logDEBUG5, "TbCbVectorBondPool::receiveData():end"<<" bondRemoteRank="<<bondRemoteRank<<" bondTag="<<bondTag); - } - counterReceive++; - if(counterReceive==this->nofStoredVectors) //alle receiver waren hier - { - counterReceive=0; - } - } - -protected: - int poolKey; //eindeutiger schluessel fuer pool - size_type nofStoredVectors; - - size_type counterPrepareReceiveDataOrder; - size_type counterSendDataOrder; - size_type counterReceiveDataOrder; - size_type counterPrepareForReceive; - size_type counterReceive; - size_type counterPrepareForSend; - size_type counterSend; - - std::vector< unsigned > tmpSendOrderVec; //wird zur temp speicherung der anordnung benoetigt - MPI_Datatype mpiDataType; - - std::tr1::shared_ptr<bond::FutureSend> sendRequest; - std::tr1::shared_ptr<bond::FutureReceive> receiveRequest; - - int bondRemoteRank, bondTag; - -#ifdef _DEBUG - T* orgPoolVectorStartPointer; -#endif -}; - -template<typename T> -typename TbCbVectorBondPool<T>::BondPoolPtrMap TbCbVectorBondPool<T>::poolMap; - -////////////////////////////////////////////////////////////////////////// -// TbSenderBondPool -////////////////////////////////////////////////////////////////////////// -template<typename T> -class TbCbVectorSenderBondPool : public TbTransmitter< CbVector< T > > -{ -public: - typedef CbVector< T > value_type; - -public: - TbCbVectorSenderBondPool(const unsigned int& cbVectorKey, TbCbVectorBondPool< T >* bondVectorPool) - : bondVectorPool(bondVectorPool) - { - this->getData().setAllocator( new CbVectorAllocatorPool<T>(cbVectorKey,this->bondVectorPool) ); - } - ~TbCbVectorSenderBondPool() - { - if( this->bondVectorPool->getNofStoredVectors()==1 ) //last entry! - { - TbCbVectorBondPool< T >::deleteTbCbVectorBondPool(this->bondVectorPool->getPoolKey()); - } - } - - bool isLocalTransmitter() const { return false; } - bool isRemoteTransmitter() const { return !this->isLocalTransmitter(); } - - void sendDataSize() { this->bondVectorPool->sendDataOrder(); } - void receiveDataSize() { throw UbException(UB_EXARGS,"TbBondPoolSender sends only"); } - CbVector< T >& receiveData() { throw UbException(UB_EXARGS,"TbBondPoolSender sends only"); } - void prepareForSend() { this->bondVectorPool->prepareForSendData(); } - void sendData() { this->bondVectorPool->sendData(); } - - //info-section (usable for remote transmitter) - int getSendTbRank() const { return this->bondVectorPool->getRemoteRank(); } - int getSendTbTag() const { return this->bondVectorPool->getRemoteTag(); } - int getRecvFromRank() const { throw UbException(UB_EXARGS,"TbCbVectorSenderBondPool sends only"); } - int getRecvFromTag() const { throw UbException(UB_EXARGS,"TbCbVectorSenderBondPool sends only"); } - - std::string toString() const { return "TbCbVectorSenderBondPool<"+(std::string)typeid(T).name()+" to rank (tag)"+UbSystem::toString(getSendTbRank())+"("+UbSystem::toString(getSendTbTag())+")"; } - -protected: - TbCbVectorBondPool<T>* bondVectorPool; -}; - - -/*==================================================================*/ -template<typename T> -class TbCbVectorReceiverBondPool : public TbTransmitter< CbVector< T > > -{ -public: - typedef CbVector< T > value_type; - -public: - TbCbVectorReceiverBondPool(const unsigned int& cbVectorKey, TbCbVectorBondPool< T >* bondVectorPool) - : bondVectorPool(bondVectorPool) - { - this->getData().setAllocator( new CbVectorAllocatorPool<T>(cbVectorKey, this->bondVectorPool) ); - } - ~TbCbVectorReceiverBondPool() - { - if( this->bondVectorPool->getNofStoredVectors()==1 ) //last entry! - { - TbCbVectorBondPool< T >::deleteTbCbVectorBondPool(this->bondVectorPool->getPoolKey()); - } - } - bool isLocalTransmitter() const { return false; } - bool isRemoteTransmitter() const { return !this->isLocalTransmitter(); } - - void sendDataSize() { throw UbException(UB_EXARGS,"TbCbVectorReceiverBondPool receives only"); } - void receiveDataSize() { this->bondVectorPool->receiveDataOrder(); } - void sendData() { throw UbException(UB_EXARGS,"TbCbVectorReceiverBondPool receives only"); } - void prepareForReceive() { this->bondVectorPool->prepareForReceiveData(); } - CbVector< T >& receiveData() - { - this->bondVectorPool->receiveData(); - return this->getData(); - } - - //info-section (usable for remote transmitter) - int getSendTbRank() const { throw UbException(UB_EXARGS,"TbCbVectorReceiverBondPool receives only"); } - int getSendTbTag() const { throw UbException(UB_EXARGS,"TbCbVectorReceiverBondPool receives only"); } - int getRecvFromRank() const { return this->bondVectorPool->getRemoteRank(); } - int getRecvFromTag() const { return this->bondVectorPool->getRemoteTag(); } - - std::string toString() const { return "TbCbVectorReceiverBondPool<"+(std::string)typeid(T).name()+" to rank (tag)"+UbSystem::toString(getRecvFromRank())+"("+UbSystem::toString(getRecvFromTag())+")"; } - -protected: - TbCbVectorBondPool<T>* bondVectorPool; -}; - - - -#endif //TBTRANSMITTERBONDPOOL_H - -#endif //VF_FETOL diff --git a/src/VirtualFluids/Geometry/VoxelMatrix.h b/src/VirtualFluids/Geometry/VoxelMatrix.h deleted file mode 100644 index c15294364..000000000 --- a/src/VirtualFluids/Geometry/VoxelMatrix.h +++ /dev/null @@ -1,57 +0,0 @@ -//template <class T> -//struct OriginVoxelMatrix -//{ -// CbArray3D<T> matrix; -//}; -//////////////////////////////////////////////////////////////////////////// -//template <class T> -//void GbVoxelMatrix3D::readOriginMatrixFromRawFile(std::string filename, GbVoxelMatrix3D::Endian endian) -//{ -// using namespace std; -// ifstream in(filename.c_str(), ios::binary); -// if (!in) throw UbException(UB_EXARGS, "could not open file "+filename); -// -// in.seekg(0, ios::end); //Ende springen -// fstream::off_type length = in.tellg(); //Position abfragen -// in.seekg(0, ios::beg); //An den Anfang springen -// -// unsigned long long nofn = (unsigned long long)nodesX1*(unsigned long long)nodesX2*(unsigned long long)nodesX3*(unsigned long long)sizeof(T); -// if (nofn!=(unsigned long long)length) -// { -// throw UbException(UB_EXARGS, "number of nodes("+UbSystem::toString(nofn)+") doesn't match file size("+UbSystem::toString((long)length)+")"); -// } -// -// GbVoxelMatrix3D::oVoxelMatrix3D<T> = CbArray3D<T>(nodesX1, nodesX2, nodesX3); -// -// T val; -// for (int x3 = 0; x3<nodesX3; x3++) -// for (int x2 = 0; x2<nodesX2; x2++) -// for (int x1 = 0; x1<nodesX1; x1++) -// { -// in.read((char*)&val, sizeof(T)); -// if (endian==BigEndian) -// UbSystem::swapByteOrder((unsigned char*)(&(val)), sizeof(T)); -// oVoxelMatrix3D<T>(x1, x2, x3) = val; -// } -//} -//////////////////////////////////////////////////////////////////////////// -//template <class T> -//void GbVoxelMatrix3D::writeOriginMatrixFromRawFile(std::string filename) -//{ -// using namespace std; -// -// string fn = filename; -// -// FILE *file; -// file = fopen(fn.c_str(), "wb"); -// -// if (file==NULL) -// { -// std::string pathf = UbSystem::getPathFromString(fn); -// if (fn.size()>0) { UbSystem::makeDirectory(pathf); file = fopen(fn.c_str(), "wb"); } -// if (file==NULL) throw UbException(UB_EXARGS, "can not open "+fn); -// } -// -// fwrite(GbVoxelMatrix3D::oVoxelMatrix3D<T>.getStartAdressOfSortedArray(0, 0, 0), sizeof(T), GbVoxelMatrix3D::oVoxelMatrix3D<T>.getDataVector().size(), file); -// fclose(file); -//} diff --git a/src/VirtualFluids/Grid/Block3D.cpp b/src/VirtualFluids/Grid/Block3D.cpp deleted file mode 100644 index 921426148..000000000 --- a/src/VirtualFluids/Grid/Block3D.cpp +++ /dev/null @@ -1,494 +0,0 @@ -#include "Block3D.h" - -#include "Grid3DSystem.h" -#include "Block3DConnector.h" -#include "LBMKernel.h" - - -int Block3D::counter = 0; -////////////////////////////////////////////////////////////////////////// -Block3D::Block3D() : x1(0),x2(0),x3(0) - ,active(true) - ,globalID(-1) - ,rank(-1),part(-1) - ,interpolationFlagCF(0) - ,interpolationFlagFC(0) - ,level(-1) - ,bundle(-1) -{ -} -////////////////////////////////////////////////////////////////////////// -Block3D::Block3D(int x1, int x2, int x3, int level) - : x1(x1), x2(x2), x3(x3) - ,active(true) - ,globalID(-1) - ,rank(0),part(0) - ,interpolationFlagCF(0) - ,interpolationFlagFC(0) - ,level(level) - ,bundle(0) -{ - globalID = counter++; -} -////////////////////////////////////////////////////////////////////////// -Block3D::~Block3D() -{ -} -////////////////////////////////////////////////////////////////////////// -bool Block3D::operator==(const Block3D& src) const -{ - return (x1==src.x1 && x2==src.x2 && x3==src.x3); -} -////////////////////////////////////////////////////////////////////////// -bool Block3D::operator!=(const Block3D& src) const -{ - return !(*this==src); -} -////////////////////////////////////////////////////////////////////////// -int Block3D::getX1() const -{ - return this->x1; -} -////////////////////////////////////////////////////////////////////////// -int Block3D::getX2() const -{ - return this->x2; -} -////////////////////////////////////////////////////////////////////////// -int Block3D::getX3() const -{ - return this->x3; -} -////////////////////////////////////////////////////////////////////////// -void Block3D::setActive(bool active) -{ - this->active = active; -} -////////////////////////////////////////////////////////////////////////// -bool Block3D::isActive() const -{ - return this->active; -} -////////////////////////////////////////////////////////////////////////// -bool Block3D::isNotActive() const -{ - return(!this->active); -} -////////////////////////////////////////////////////////////////////////// -void Block3D::setKernel(LBMKernelPtr kernel) -{ - this->kernel = kernel; -} -////////////////////////////////////////////////////////////////////////// -ILBMKernelPtr Block3D::getKernel() const -{ - return this->kernel; -} -////////////////////////////////////////////////////////////////////////// -void Block3D::deleteKernel() -{ - this->kernel = LBMKernelPtr(); -} -////////////////////////////////////////////////////////////////////////// -int Block3D::getBundle() const -{ - return bundle; -} -////////////////////////////////////////////////////////////////////////// -void Block3D::setBundle(int bundle) -{ - this->bundle = bundle; -} -////////////////////////////////////////////////////////////////////////// -void Block3D::setRank(int rank) -{ - this->rank = rank; -} -////////////////////////////////////////////////////////////////////////// -int Block3D::getRank() const -{ - return this->rank; -} -////////////////////////////////////////////////////////////////////////// -void Block3D::setLocalRank(int rank) -{ - this->lrank = rank; -} -////////////////////////////////////////////////////////////////////////// -int Block3D::getLocalRank() const -{ - return this->lrank; -} -////////////////////////////////////////////////////////////////////////// -int Block3D::getGlobalID() const -{ - return this->globalID; -} -////////////////////////////////////////////////////////////////////////// -void Block3D::setGlobalID(int id) -{ - this->globalID = id; -} -////////////////////////////////////////////////////////////////////////// -int Block3D::getLocalID() const -{ - return this->localID; -} -////////////////////////////////////////////////////////////////////////// -void Block3D::setLocalID(int id) -{ - this->localID = id; -} -////////////////////////////////////////////////////////////////////////// -int Block3D::getPart() const -{ - return this->part; -} -////////////////////////////////////////////////////////////////////////// -void Block3D::setPart(int part) -{ - this->part = part; -} -////////////////////////////////////////////////////////////////////////// -int Block3D::getLevel() const -{ - return this->level; -} -////////////////////////////////////////////////////////////////////////// -void Block3D::setLevel(int level) -{ - this->level = level; -} -////////////////////////////////////////////////////////////////////////// -Block3DConnectorPtr Block3D::getConnector(int dir) const -{ - for(Block3DConnectorPtr c : connectors) - { - if( c ) - { - if(c->getSendDir() == dir) return c; - } - } - return Block3DConnectorPtr(); -} -////////////////////////////////////////////////////////////////////////// -void Block3D::setConnector(Block3DConnectorPtr connector) -{ - connectors.push_back(connector); -} -////////////////////////////////////////////////////////////////////////// -void Block3D::deleteConnectors() -{ - connectors.clear(); -} -////////////////////////////////////////////////////////////////////////// -bool Block3D::hasConnectors() -{ - for(Block3DConnectorPtr c : connectors) - if( c ) return true; - - return false; -} -////////////////////////////////////////////////////////////////////////// -void Block3D::pushBackSameLevelConnectors( std::vector<Block3DConnectorPtr>& localSameLevelConnectors - , std::vector<Block3DConnectorPtr>& remoteSameLevelConnectors ) -{ - for(int i=0; i<(int)connectors.size(); i++) - { - Block3DConnectorPtr connector = this->connectors[i]; - if( this->connectors[i] ) - { - if( connector->isLocalConnector() && !connector->isInterpolationConnectorCF() && !connector->isInterpolationConnectorFC() ) - localSameLevelConnectors.push_back(this->connectors[i]); - else - remoteSameLevelConnectors.push_back(this->connectors[i]); - } - } -} -////////////////////////////////////////////////////////////////////////// -void Block3D::pushBackLocalSameLevelConnectors( std::vector<Block3DConnectorPtr>& localSameLevelConnectors ) -{ - for(int i=0; i<(int)connectors.size(); i++) - { - Block3DConnectorPtr connector = this->connectors[i]; - if( this->connectors[i] ) - { - if( connector->isLocalConnector() && !connector->isInterpolationConnectorCF() && !connector->isInterpolationConnectorFC() ) - localSameLevelConnectors.push_back(this->connectors[i]); - } - } -} -////////////////////////////////////////////////////////////////////////// -void Block3D::pushBackLocalSameLevelConnectors( std::vector<Block3DConnectorPtr>& localSameLevelConnectors, const int& dir) -{ - Block3DConnectorPtr connector = this->connectors[dir]; - if( this->connectors[dir] ) - { - if( connector->isLocalConnector() && !connector->isInterpolationConnectorCF() && !connector->isInterpolationConnectorFC() ) - localSameLevelConnectors.push_back(this->connectors[dir]); - } -} -////////////////////////////////////////////////////////////////////////// -void Block3D::pushBackRemoteSameLevelConnectors( std::vector<Block3DConnectorPtr>& remoteSameLevelConnectors ) -{ - for(int i=0; i<(int)connectors.size(); i++) - { - Block3DConnectorPtr connector = this->connectors[i]; - if( this->connectors[i] ) - { - if( connector->isRemoteConnector() && !connector->isInterpolationConnectorCF() && !connector->isInterpolationConnectorFC() ) - remoteSameLevelConnectors.push_back(this->connectors[i]); - } - } -} -////////////////////////////////////////////////////////////////////////// -void Block3D::pushBackRemoteSameLevelConnectors( std::vector<Block3DConnectorPtr>& remoteSameLevelConnectors, const int& dir ) -{ - Block3DConnectorPtr connector = this->connectors[dir]; - if( this->connectors[dir] ) - { - if( connector->isRemoteConnector() && !connector->isInterpolationConnectorCF() && !connector->isInterpolationConnectorFC() ) - remoteSameLevelConnectors.push_back(this->connectors[dir]); - } -} -////////////////////////////////////////////////////////////////////////// -void Block3D::pushBackLocalInterpolationConnectorsCF( std::vector<Block3DConnectorPtr>& localInterpolationConnectors ) -{ - for(int i=0; i<(int)connectors.size(); i++) - { - Block3DConnectorPtr connector = this->connectors[i]; - if( this->connectors[i] ) - { - if( connector->isLocalConnector() && connector->isInterpolationConnectorCF() ) - localInterpolationConnectors.push_back(this->connectors[i]); - } - } -} -////////////////////////////////////////////////////////////////////////// -void Block3D::pushBackRemoteInterpolationConnectorsCF( std::vector<Block3DConnectorPtr>& remoteInterpolationConnectors ) -{ - for(int i=0; i<(int)connectors.size(); i++) - { - Block3DConnectorPtr connector = this->connectors[i]; - if( this->connectors[i] ) - { - if( connector->isRemoteConnector() && connector->isInterpolationConnectorCF() ) - remoteInterpolationConnectors.push_back(this->connectors[i]); - } - } -} -////////////////////////////////////////////////////////////////////////// -void Block3D::pushBackLocalInterpolationConnectorsFC( std::vector<Block3DConnectorPtr>& localInterpolationConnectors ) -{ - for(int i=0; i<(int)connectors.size(); i++) - { - Block3DConnectorPtr connector = this->connectors[i]; - if( this->connectors[i] ) - { - if( connector->isLocalConnector() && connector->isInterpolationConnectorFC() ) - localInterpolationConnectors.push_back(this->connectors[i]); - } - } -} -////////////////////////////////////////////////////////////////////////// -void Block3D::pushBackRemoteInterpolationConnectorsFC( std::vector<Block3DConnectorPtr>& remoteInterpolationConnectors ) -{ - for(int i=0; i<(int)connectors.size(); i++) - { - Block3DConnectorPtr connector = this->connectors[i]; - if( this->connectors[i] ) - { - if( connector->isRemoteConnector() && connector->isInterpolationConnectorFC() ) - remoteInterpolationConnectors.push_back(this->connectors[i]); - } - } -} -////////////////////////////////////////////////////////////////////////// -int Block3D::getNumberOfLocalConnectors() -{ - int count = 0; - for(int i=0; i<(int)connectors.size(); i++) - { - Block3DConnectorPtr connector = this->connectors[i]; - if( this->connectors[i] ) - { - if( connector->isLocalConnector() ) count++; - } - } - return count; -} -////////////////////////////////////////////////////////////////////////// -int Block3D::getNumberOfRemoteConnectors() -{ - int count = 0; - for(int i=0; i<(int)connectors.size(); i++) - { - Block3DConnectorPtr connector = this->connectors[i]; - if( this->connectors[i] ) - { - if( connector->isRemoteConnector() ) count++; - } - } - return count; -} -////////////////////////////////////////////////////////////////////////// -int Block3D::getNumberOfLocalConnectorsForSurfaces() -{ - int count = 0; - - if(connectors.size() < 6) - return count; - - for(int dir=0; dir<=5; dir++) //Hard coding. It works if you have 0...5 for E, N ... B - { - Block3DConnectorPtr connector = this->connectors[dir]; - if( this->connectors[dir] ) - { - if( connector->isLocalConnector() ) count++; - } - } - return count; -} -////////////////////////////////////////////////////////////////////////// -int Block3D::getNumberOfRemoteConnectorsForSurfaces() -{ - int count = 0; - for(int dir=0; dir<=5; dir++) //Hard coding. It works if you have 0...5 for E, N ... B - { - Block3DConnectorPtr connector = this->connectors[dir]; - if( this->connectors[dir] ) - { - if( connector->isRemoteConnector() ) count++; - } - } - return count; -} -////////////////////////////////////////////////////////////////////////// -void Block3D::setInterpolationFlagCF(int dir) -{ - UbSystem::setBit(interpolationFlagCF, 1<<dir); -} -////////////////////////////////////////////////////////////////////////// -int Block3D::getInterpolationFlagCF() -{ - return interpolationFlagCF; -} -////////////////////////////////////////////////////////////////////////// -bool Block3D::hasInterpolationFlagCF(int dir) -{ - return UbSystem::bitCheck( interpolationFlagCF, 1<<dir ); -} -////////////////////////////////////////////////////////////////////////// -void Block3D::setInterpolationFlagFC(int dir) -{ - UbSystem::setBit(interpolationFlagFC, 1<<dir); -} -////////////////////////////////////////////////////////////////////////// -int Block3D::getInterpolationFlagFC() -{ - return interpolationFlagFC; -} -////////////////////////////////////////////////////////////////////////// -bool Block3D::hasInterpolationFlagFC(int dir) -{ - return UbSystem::bitCheck( interpolationFlagFC, 1<<dir ); -} -////////////////////////////////////////////////////////////////////////// -bool Block3D::hasInterpolationFlag() -{ - return(interpolationFlagCF!=0 || interpolationFlagFC!=0); -} -////////////////////////////////////////////////////////////////////////// -bool Block3D::hasInterpolationFlag(int direction) -{ - return(hasInterpolationFlagCF(direction) || hasInterpolationFlagFC(direction)); -} -////////////////////////////////////////////////////////////////////////// -bool Block3D::hasInterpolationFlagCF() -{ - return(interpolationFlagCF!=0); -} -////////////////////////////////////////////////////////////////////////// -bool Block3D::hasInterpolationFlagFC() -{ - return(interpolationFlagFC!=0); -} -////////////////////////////////////////////////////////////////////////// -void Block3D::deleteInterpolationFlag() -{ - interpolationFlagFC = 0; - interpolationFlagCF = 0; -} -////////////////////////////////////////////////////////////////////////// -double Block3D::getWorkLoad() -{ - double l = kernel->getCalculationTime(); - l *= static_cast<double>(1<<level); - return l; -} -////////////////////////////////////////////////////////////////////////// -std::string Block3D::toString() -{ - std::stringstream ss; - ss<<"Block3D[(x1,x2,x3,level),"; - ss<<" ("<<this->x1<<", "<<this->x2<<", "<<this->x3<<", "<<this->level<<"), id=" << globalID; - ss<< ", active="<<this->active<< ", bundle="<<this->bundle<< ", rank="<<this->rank<<"]"; - ss<<" connectors:"; - for(std::size_t i=0; i<connectors.size(); i++) - if( connectors[i] ) - { - if(connectors[i]->isLocalConnector()) - ss <<"l."<< Grid3DSystem::getDirectionString(connectors[i]->getSendDir()) << ", "; - if(connectors[i]->isRemoteConnector()) - ss <<"r."<< Grid3DSystem::getDirectionString(connectors[i]->getSendDir()) << ", "; - if(connectors[i]->isInterpolationConnectorCF()) - ss <<"cf."<< Grid3DSystem::getDirectionString(connectors[i]->getSendDir()) << ", "; - if(connectors[i]->isInterpolationConnectorFC()) - ss <<"fc."<< Grid3DSystem::getDirectionString(connectors[i]->getSendDir()) << ", "; - } - return ss.str(); -} -////////////////////////////////////////////////////////////////////////// -void Block3D::setWeight( int rank, int weight ) -{ - std::map<int, int>::iterator it; - if((it = this->weight.find(rank)) != this->weight.end()) - it->second = weight; - else - this->weight.insert(std::make_pair(rank, weight)); -} -////////////////////////////////////////////////////////////////////////// -int Block3D::getWeight( int rank ) -{ - std::map<int, int>::iterator it; - if((it = this->weight.find(rank)) != this->weight.end()) - return it->second; - else - return 0; -} -////////////////////////////////////////////////////////////////////////// -void Block3D::addWeight( int rank, int weight ) -{ - int weight_old = getWeight(rank); - weight += weight_old; - setWeight(rank, weight); -} -////////////////////////////////////////////////////////////////////////// -void Block3D::addWeightForAll( int weight ) -{ - typedef std::map<int, int> wMap; - for (wMap::value_type &w : this->weight) - { - w.second += weight; - } -} -////////////////////////////////////////////////////////////////////////// -void Block3D::clearWeight() -{ - this->weight.clear(); -} -////////////////////////////////////////////////////////////////////////// -int Block3D::getWeightSize() -{ - return static_cast<int>(this->weight.size()); -} diff --git a/src/VirtualFluids/Grid/Block3D.h b/src/VirtualFluids/Grid/Block3D.h deleted file mode 100644 index ddb95e511..000000000 --- a/src/VirtualFluids/Grid/Block3D.h +++ /dev/null @@ -1,160 +0,0 @@ -#ifndef BLOCK3D_H -#define BLOCK3D_H - -#include <boost/serialization/shared_ptr.hpp> -#include <boost/serialization/vector.hpp> -#include <memory> - -#include <VirtualFluidsDefinitions.h> - - -class Block3DConnector; -class LBMKernel; -class ILBMKernel; - -class Block3D; -typedef std::shared_ptr<Block3D> Block3DPtr; - -class VF_PUBLIC Block3D -{ -public: - Block3D(); - Block3D(int x1, int x2, int x3, int level); - virtual ~Block3D(); - bool operator==(const Block3D& src) const; - bool operator!=(const Block3D& src) const; - - int getX1() const; - int getX2() const; - int getX3() const; - - void setActive(bool active); - bool isActive() const; - bool isNotActive() const; - - void setKernel(std::shared_ptr<LBMKernel> kernel); - std::shared_ptr<ILBMKernel> getKernel() const; - void deleteKernel(); - - void setBundle(int bundle); - int getBundle() const; - - void setRank(int rank); - int getRank() const; - - void setLocalRank(int rank); - int getLocalRank() const; - - int getGlobalID() const; - void setGlobalID(int id); - - int getLocalID() const; - void setLocalID(int id); - - int getPart() const; - void setPart(int part); - - int getLevel() const; - void setLevel(int level); - - //Connector-Section - void setConnector(std::shared_ptr<Block3DConnector> connector); - std::shared_ptr<Block3DConnector> getConnector(int dir) const; - bool hasConnectors(); - void deleteConnectors(); - void pushBackSameLevelConnectors( std::vector<std::shared_ptr<Block3DConnector> >& localSameLevelConnectors - , std::vector<std::shared_ptr<Block3DConnector> >& remoteSameLevelConnectors ); - void pushBackLocalSameLevelConnectors( std::vector<std::shared_ptr<Block3DConnector> >& localSameLevelConnectors ); - void pushBackRemoteSameLevelConnectors( std::vector<std::shared_ptr<Block3DConnector> >& remoteSameLevelConnectors ); - void pushBackLocalInterpolationConnectorsCF( std::vector<std::shared_ptr<Block3DConnector> >& localInterpolationConnectors ); - void pushBackRemoteInterpolationConnectorsCF( std::vector<std::shared_ptr<Block3DConnector> >& remoteInterpolationConnectors ); - void pushBackLocalInterpolationConnectorsFC( std::vector<std::shared_ptr<Block3DConnector> >& localInterpolationConnectors ); - void pushBackRemoteInterpolationConnectorsFC( std::vector<std::shared_ptr<Block3DConnector> >& remoteInterpolationConnectors ); - void pushBackLocalSameLevelConnectors( std::vector<std::shared_ptr<Block3DConnector> >& localSameLevelConnectors, const int& dir); - void pushBackRemoteSameLevelConnectors( std::vector<std::shared_ptr<Block3DConnector> >& remoteSameLevelConnectors, const int& dir ); - int getNumberOfLocalConnectors(); - int getNumberOfRemoteConnectors(); - int getNumberOfLocalConnectorsForSurfaces(); - int getNumberOfRemoteConnectorsForSurfaces(); - - void setWeight(int rank, int weight); - int getWeight(int rank); - void addWeightForAll(int weight); - void addWeight(int rank, int weight); - void clearWeight(); - int getWeightSize(); - - //interpolation - bool hasInterpolationFlag(); - bool hasInterpolationFlag(int dir); - void deleteInterpolationFlag(); - - void setInterpolationFlagCF(int dir); - int getInterpolationFlagCF(); - bool hasInterpolationFlagCF(int dir); - bool hasInterpolationFlagCF(); - - void setInterpolationFlagFC(int dir); - int getInterpolationFlagFC(); - bool hasInterpolationFlagFC(int dir); - bool hasInterpolationFlagFC(); - - double getWorkLoad(); - - std::string toString() ; - - static int getMaxGlobalID() { return counter; } - static void setMaxGlobalID(int c) { counter = 0; } - -private: - int x1; - int x2; - int x3; - - bool active; - - int interpolationFlagCF; - int interpolationFlagFC; - - std::shared_ptr<LBMKernel> kernel; - std::vector<std::shared_ptr<Block3DConnector> > connectors; - std::map<int, int> weight; - - int bundle; - int rank; - int lrank; - int globalID; - int localID; - int part; - int level; - static int counter; - - friend class MPIIORestart1CoProcessor; - friend class MPIIORestart2CoProcessor; - friend class MPIIORestart11CoProcessor; - friend class MPIIORestart21CoProcessor; - - - friend class boost::serialization::access; - template<class Archive> - void serialize(Archive & ar, const unsigned int version) - { - ar & x1; - ar & x2; - ar & x3; - ar & active; - ar & bundle; - ar & rank; - ar & lrank; - ar & part; - ar & globalID; - ar & localID; - ar & level; - ar & kernel; - ar & interpolationFlagCF; - ar & interpolationFlagFC; - ar & counter; - } -}; - -#endif //BLOCK3D_H diff --git a/src/VirtualFluids/Grid/BoostSerializationClassExportHelper.h b/src/VirtualFluids/Grid/BoostSerializationClassExportHelper.h deleted file mode 100644 index 6e440b476..000000000 --- a/src/VirtualFluids/Grid/BoostSerializationClassExportHelper.h +++ /dev/null @@ -1,79 +0,0 @@ -#ifndef BOOSTSERIALIZATIONCLASSEXPORTHELPER_H -#define BOOSTSERIALIZATIONCLASSEXPORTHELPER_H - -#include <D3Q27EsoTwist3DSplittedVector.h> -#include <BCProcessor.h> -#include <BCProcessor.h> -#include <DataSet3D.h> -#include <CompressibleCumulantLBMKernel.h> -#include <IncompressibleCumulantLBMKernel.h> -#include <IncompressibleCumulantWithSpongeLayerLBMKernel.h> -#include <Interactor3D.h> -#include <D3Q27Interactor.h> -#include <Communicator.h> -#include <MPICommunicator.h> -#include <CoProcessor.h> -#include <WriteMacroscopicQuantitiesCoProcessor.h> -#include <ShearStressCoProcessor.h> -#include <AverageValuesCoProcessor.h> -#include <basics/container/CbArray4D.h> -#include <basics/writer/WbWriter.h> -#include <basics/writer/WbWriterVtkXmlASCII.h> -#include <basics/writer/WbWriterVtkXmlBinary.h> - -#include <BCAlgorithm.h> -#include <VelocityBCAlgorithm.h> -#include <NonEqDensityBCAlgorithm.h> -#include <EqDensityBCAlgorithm.h> -#include <NoSlipBCAlgorithm.h> -#include <HighViscosityNoSlipBCAlgorithm.h> -#include <SlipBCAlgorithm.h> -#include <NonReflectingOutflowBCAlgorithm.h> -#include <VelocityWithDensityBCAlgorithm.h> - -#include <BCAdapter.h> -#include <DensityBCAdapter.h> -#include <NoSlipBCAdapter.h> -#include <SlipBCAdapter.h> -#include <VelocityBCAdapter.h> -#include "ThinWallNoSlipBCAlgorithm.h" -#include "ThinWallBCProcessor.h" -#include "VoidLBMKernel.h" -#include "VoidData3D.h" -#include <boost/serialization/export.hpp> - -BOOST_CLASS_EXPORT(CompressibleCumulantLBMKernel) -BOOST_CLASS_EXPORT(IncompressibleCumulantLBMKernel) -BOOST_CLASS_EXPORT(IncompressibleCumulantWithSpongeLayerLBMKernel) -BOOST_CLASS_EXPORT(VoidLBMKernel) -BOOST_CLASS_EXPORT(VoidData3D) -BOOST_CLASS_EXPORT(D3Q27EsoTwist3DSplittedVector) -BOOST_CLASS_EXPORT(BCProcessor) -BOOST_CLASS_EXPORT(ThinWallBCProcessor) -BOOST_CLASS_EXPORT(DataSet3D) -BOOST_CLASS_EXPORT(Interactor3D) -BOOST_CLASS_EXPORT(D3Q27Interactor) -BOOST_CLASS_EXPORT(CoProcessor) -BOOST_CLASS_EXPORT(WriteMacroscopicQuantitiesCoProcessor) -BOOST_CLASS_EXPORT(ShearStressCoProcessor) -BOOST_CLASS_EXPORT(AverageValuesCoProcessor) -BOOST_CLASS_EXPORT(WbWriterVtkXmlASCII) -BOOST_CLASS_EXPORT(WbWriterVtkXmlBinary) - -//BOOST_CLASS_EXPORT(BCAlgorithm) -//BOOST_CLASS_EXPORT(VelocityBCAlgorithm) -//BOOST_CLASS_EXPORT(NonEqDensityBCAlgorithm) -//BOOST_CLASS_EXPORT(EqDensityBCAlgorithm) -//BOOST_CLASS_EXPORT(NoSlipBCAlgorithm) -//BOOST_CLASS_EXPORT(HighViscosityNoSlipBCAlgorithm) -//BOOST_CLASS_EXPORT(SlipBCAlgorithm) -//BOOST_CLASS_EXPORT(NonReflectingDensityBCAlgorithm) -//BOOST_CLASS_EXPORT(NonReflectingVelocityBCAlgorithm) -//BOOST_CLASS_EXPORT(ThinWallNoSlipBCAlgorithm) - -BOOST_CLASS_EXPORT(BCAdapter) -BOOST_CLASS_EXPORT(DensityBCAdapter) -BOOST_CLASS_EXPORT(NoSlipBCAdapter) -BOOST_CLASS_EXPORT(SlipBCAdapter) -BOOST_CLASS_EXPORT(VelocityBCAdapter) -#endif diff --git a/src/VirtualFluids/Grid/CMakePackage.txt b/src/VirtualFluids/Grid/CMakePackage.txt deleted file mode 100644 index 1b8416f01..000000000 --- a/src/VirtualFluids/Grid/CMakePackage.txt +++ /dev/null @@ -1,2 +0,0 @@ -GET_FILENAME_COMPONENT( CURRENT_DIR ${CMAKE_CURRENT_LIST_FILE} PATH) -COLLECT_PACKAGE_DATA_WITH_OPTION(${CURRENT_DIR} ALL_SOURCES) diff --git a/src/VirtualFluids/Grid/CalculationManager.cpp b/src/VirtualFluids/Grid/CalculationManager.cpp deleted file mode 100644 index 7a9c4a419..000000000 --- a/src/VirtualFluids/Grid/CalculationManager.cpp +++ /dev/null @@ -1,156 +0,0 @@ -#include "CalculationManager.h" - -#include <boost/thread.hpp> - -#include "CalculatorFactory.h" - -#include <Calculator.h> -#include <MPICalculator.h> -#if defined VF_FETOL -#include <FETOLCalculator.h> -#endif - -#include <Communicator.h> -#include "TimeAveragedValuesCoProcessor.h" -#include "Grid3D.h" -#include "LoadBalancer.h" - - -////////////////////////////////////////////////////////////////////////// -CalculationManager::CalculationManager(Grid3DPtr grid, int numOfThreads, double endTime, std::shared_ptr<CalculatorFactory> calculatorFactory, CalculatorType type) - : grid(grid), - numOfThreads(numOfThreads), - endTime(endTime), - calculatorFactory(calculatorFactory), - type(type) -{ - this->initCalcThreads(); -} -////////////////////////////////////////////////////////////////////////// -CalculationManager::CalculationManager(Grid3DPtr grid, int numOfThreads, double endTime, CommunicatorPtr comm, int endDir, std::shared_ptr<CalculatorFactory> calculatorFactory) - : grid(grid), - numOfThreads(numOfThreads), - endTime(endTime), - calculatorFactory(calculatorFactory), - type(type) -{ - this->initCalcThreads(); - loadBalancer = LoadBalancerPtr(new LoadBalancer(grid, comm, endDir)); -} -////////////////////////////////////////////////////////////////////////// -CalculationManager::~CalculationManager() -{ - -} -////////////////////////////////////////////////////////////////////////// -void CalculationManager::calculate() -{ - if (type == CalculatorType::MPI) - { - try - { - std::dynamic_pointer_cast<MPICalculator>(calcThreads[0])->calculate(endTime, shared_from_this()); - } - catch (std::exception& e) - { - UBLOG(logERROR, e.what()); - //throw e; - exit(EXIT_FAILURE); - } - } - else - { - try - { - boost::thread_group threads; - boost::exception_ptr error; - - for (int i = 1; i < calcThreads.size(); i++) - threads.create_thread(boost::bind(&Calculator::calculate, calcThreads[i], endTime, shared_from_this(), boost::ref(error))); - - calcThreads[0]->calculate(endTime, shared_from_this(), boost::ref(error)); - - threads.join_all(); - } - catch (std::exception& e) - { - UBLOG(logERROR, e.what()); - //throw e; - exit(EXIT_FAILURE); - } - } -} -////////////////////////////////////////////////////////////////////////// -void CalculationManager::initCalcThreads() -{ - UBLOG(logDEBUG1, "CalculationManager::initCalcThreads() - started"); - - SynchronizerPtr sync(new Synchronizer(numOfThreads)); - for (int i = 0; i < numOfThreads; i++) - calcThreads.push_back(this->calculatorFactory->makeCalculator(grid, sync, i == 0 ? true : false, type)); - - this->addBlocksToCalcThreads(); -} - -////////////////////////////////////////////////////////////////////////// -bool CalculationManager::balance() -{ - //if(loadBalancer->balance()) - // return true; - //else - //{ - // grid->deleteConnectors(); - - // for(CalculatorPtr calc, calcThreads) - // { - // calc->deleteConnectors(); - // } - - // TbCbVectorMpiPool<LBMReal>::eraseMap(); - - // D3Q27SetInterfaceBlocksPatchVisitor setInterfaceBlocksPatchVisitor(nue, comm); - // grid->accept(setInterfaceBlocksPatchVisitor); - - // D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR); - // grid->accept( setConnsVisitor ); - - // PQueuePartitioningPatchVisitor pqPartVisitor(numOfThreads); - // grid->accept(pqPartVisitor); - - // reinitCalcThreads(); - return false; - //} -} -////////////////////////////////////////////////////////////////////////// -void CalculationManager::reinitCalcThreads() -{ - for (std::shared_ptr<Calculator> c : calcThreads) - c->deleteBlocks(); - - addBlocksToCalcThreads(); - - for (std::shared_ptr<Calculator> c : calcThreads) - c->initConnectors(); -} -////////////////////////////////////////////////////////////////////////// -void CalculationManager::addBlocksToCalcThreads() -{ - const int gridRank = grid->getRank(); - const int minInitLevel = this->grid->getCoarsestInitializedLevel(); - const int maxInitLevel = this->grid->getFinestInitializedLevel(); - - for (int level = minInitLevel; level <= maxInitLevel; level++) - { - std::vector<Block3DPtr> blockVector; - grid->getBlocks(level, gridRank, true, blockVector); - for (Block3DPtr const block : blockVector) - if (block) - calcThreads[block->getPart()]->addBlock(block); - } -} - -////////////////////////////////////////////////////////////////////////// -void CalculationManager::setTimeAveragedValuesCoProcessor(TimeAveragedValuesCoProcessorPtr coProcessor) -{ - calcThreads[0]->setTimeAveragedValuesCoProcessor(coProcessor); -} diff --git a/src/VirtualFluids/Grid/CalculationManager.h b/src/VirtualFluids/Grid/CalculationManager.h deleted file mode 100644 index 340446ef3..000000000 --- a/src/VirtualFluids/Grid/CalculationManager.h +++ /dev/null @@ -1,51 +0,0 @@ -#ifndef CALCULATORMANAGER_H -#define CALCULATORMANAGER_H - - -#include <memory> -#include <vector> - -class CalculationManager; -typedef std::shared_ptr<CalculationManager> CalculationManagerPtr; - -class LoadBalancer; -class Communicator; -class Grid3D; -class Calculator; -class CalculatorFactory; -class TimeAveragedValuesCoProcessor; -enum class CalculatorType; - - -class CalculationManager : public std::enable_shared_from_this<CalculationManager> -{ - -public: - CalculationManager(std::shared_ptr<Grid3D> grid, int numOfThreads, double endTime, std::shared_ptr<CalculatorFactory> calculatorFactory, CalculatorType type); - CalculationManager(std::shared_ptr<Grid3D> grid, int numOfThreads, double endTime, std::shared_ptr<Communicator> comm, int endDir, std::shared_ptr<CalculatorFactory> calculatorFactory); - virtual ~CalculationManager(); - - void calculate(); - bool balance(); - void setTimeAveragedValuesCoProcessor(std::shared_ptr<TimeAveragedValuesCoProcessor> coProcessor); - -private: - void initCalcThreads(); - void reinitCalcThreads(); - void addBlocksToCalcThreads(); - - std::shared_ptr<Grid3D> grid; - int numOfThreads; - double endTime; - - std::vector<std::shared_ptr<Calculator> > calcThreads; - - std::shared_ptr<LoadBalancer> loadBalancer; - - std::shared_ptr<CalculatorFactory> calculatorFactory; - CalculatorType type; - -}; - -#endif - diff --git a/src/VirtualFluids/Grid/Calculator.cpp b/src/VirtualFluids/Grid/Calculator.cpp deleted file mode 100644 index b6b1e3b97..000000000 --- a/src/VirtualFluids/Grid/Calculator.cpp +++ /dev/null @@ -1,613 +0,0 @@ -#include "Calculator.h" -#include <basics/utilities/UbException.h> - -#include "Grid3D.h" -#include "Synchronizer.h" - -#include "basics/writer/WbWriterVtkXmlASCII.h" - -#include "LBMKernel.h" -#include "CalculationManager.h" -#include "Block3DConnector.h" -#include "Block3D.h" -#include "BCProcessor.h" -#include "TimeAveragedValuesCoProcessor.h" -#include "UbScheduler.h" -#include "Communicator.h" - -//#define TIMING -//#define PRECOLLISIONBC - -Calculator::Calculator() -{ - -} -////////////////////////////////////////////////////////////////////////// -Calculator::Calculator(Grid3DPtr grid, SynchronizerPtr sync, bool mainThread) : - grid(grid), - sync(sync), - mainThread(mainThread), - refinement(false) -{ - minLevel = grid->getCoarsestInitializedLevel(); - maxLevel = grid->getFinestInitializedLevel(); - if(maxLevel > 0) - refinement = true; - else - refinement = false; - blocks.resize(maxLevel+1); - localConns.resize(maxLevel+1); - remoteConns.resize(maxLevel+1); - localInterfaceBlockConns.resize(maxLevel+1); - remoteInterfaceBlockConns.resize(maxLevel+1); - localInterConns.resize(maxLevel); - remoteInterConns.resize(maxLevel); - loadBalancingComp = false; -} -////////////////////////////////////////////////////////////////////////// -void Calculator::calculate(const double& endTime, CalculationManagerPtr cm, boost::exception_ptr& error) -{ - UBLOG(logDEBUG1, "Calculator::calculate() - started"); - try - { - initConnectors(); - - int anzLevel = maxLevel-minLevel+1; - - int minInitLevel = minLevel; - int maxInitLevel = maxLevel-minLevel; - int straightStartLevel = minInitLevel; - int internalIterations = 1 << (maxInitLevel-minInitLevel); - int forwardStartLevel; - int threshold; - int startStep = int(grid->getTimeStep())+1; - - //UBLOG(logINFO, "startStep="<<startStep); - int anzCalcSteps = static_cast<int>(endTime); -#ifdef TIMING - UbTimer timer; - double time[6]; -#endif - -////////////////////////////////////////////////////////////////////////// -// UBLOG(logINFO, "Number of connectors = " <<this->localConns[0].size()); -////////////////////////////////////////////////////////////////////////// - - for(calcStep=startStep; calcStep<=anzCalcSteps+1; calcStep++) - { - - //exchange data between blocks for visualization - //sync->wait(); - ////if(visScheduler->isDue((double)(calcStep-1))) - ////{ - // //exchangeBlockData(minInitLevel, maxInitLevel, true); - ////} - - ////wait for write dump files - sync->wait(); - //write dump - if (mainThread) grid->coProcess((double)(calcStep-1)); - sync->wait(); - - -////////////////////////////////////////////////////////////////////////// -#ifdef TIMING - UBLOG(logINFO, "calcStep = " <<calcStep); -#endif -////////////////////////////////////////////////////////////////////////// - - for(int staggeredStep=1; staggeredStep<=internalIterations; staggeredStep++) - { - forwardStartLevel = straightStartLevel; - if(staggeredStep == internalIterations) straightStartLevel = minInitLevel; - else - { - for(straightStartLevel=maxInitLevel,threshold=1; - (staggeredStep&threshold)!=threshold; straightStartLevel--,threshold<<=1); - } -////////////////////////////////////////////////////////////////////////// -#ifdef TIMING - timer.resetAndStart(); -#endif -////////////////////////////////////////////////////////////////////////// - - //applyPreCollisionBC(straightStartLevel, maxInitLevel); - - - - calculateBlocks(straightStartLevel, maxInitLevel); - ////calculateBlocks(minInitLevel, maxInitLevel, staggeredStep); -////////////////////////////////////////////////////////////////////////// -#ifdef TIMING - time[0] = timer.stop(); - UBLOG(logINFO, "calculateBlocks time = " <<time[0]); -#endif -////////////////////////////////////////////////////////////////////////// - - //exchange data between blocks - //Sleep(10000); - exchangeBlockData(straightStartLevel, maxInitLevel); -////////////////////////////////////////////////////////////////////////// -#ifdef TIMING - time[1] = timer.stop(); - UBLOG(logINFO, "exchangeBlockData time = " <<time[1]); -#endif -////////////////////////////////////////////////////////////////////////// - //applyBCs(straightStartLevel, maxInitLevel); - applyPostCollisionBC(straightStartLevel, maxInitLevel); - -////////////////////////////////////////////////////////////////////////// -#ifdef TIMING - time[2] = timer.stop(); - UBLOG(logINFO, "applyBCs time = " <<time[2]); -#endif -////////////////////////////////////////////////////////////////////////// - - //swap distributions in kernel - swapDistributions(straightStartLevel, maxInitLevel); - -#ifdef PRECOLLISIONBC - exchangeBlockData(straightStartLevel, maxInitLevel); - applyPreCollisionBC(straightStartLevel, maxInitLevel); -#endif - - -////////////////////////////////////////////////////////////////////////// -#ifdef TIMING - time[3] = timer.stop(); - UBLOG(logINFO, "swapDistributions time = " <<time[3]); -#endif -////////////////////////////////////////////////////////////////////////// - - if (refinement) - { - // //exchange data between blocks for grid refinement - ////exchangeInterfaceBlockData(straightStartLevel, maxInitLevel, true); - //DOES NOT NEED - if(straightStartLevel<maxInitLevel) - exchangeBlockData(straightStartLevel, maxInitLevel); - // //exchangeInterfaceBlockData(straightStartLevel, maxInitLevel, true); -////////////////////////////////////////////////////////////////////////// -#ifdef TIMING - time[4] = timer.stop(); - UBLOG(logINFO, "refinement exchangeBlockData time = " <<time[4]); -#endif -////////////////////////////////////////////////////////////////////////// - //now ghost nodes have actual values - //interpolation of interface nodes between grid levels - interpolation(straightStartLevel, maxInitLevel); -////////////////////////////////////////////////////////////////////////// -#ifdef TIMING - time[5] = timer.stop(); - UBLOG(logINFO, "refinement interpolation time = " <<time[5]); -#endif -////////////////////////////////////////////////////////////////////////// - } - - sync->wait(); - if (taValuesCoProcessor && mainThread) - { - taValuesCoProcessor->calculateSubtotal(calcStep-1); - } - sync->wait(); - - } - //exchange data between blocks for visualization - if(mainThread) visScheduler->isDue((double)(calcStep-1)); - if((int)visScheduler->getNextDueTime() == calcStep) - { - exchangeBlockData(straightStartLevel, maxInitLevel); - } - //now ghost nodes have actual values - - //dynamic load balancing - //sync->wait(); - //if (mainThread && !loadBalancingComp) - //{ - // loadBalancingComp = cm->balance(); - //} - - } - error = boost::exception_ptr(); - UBLOG(logDEBUG1, "Calculator::calculate() - stoped"); - } - catch( std::exception& e ) - { - //error = boost::current_exception(); - UBLOG(logERROR, e.what()); - UBLOG(logERROR, " step = "<<calcStep); - Communicator::getInstance()->abort(1); - exit(EXIT_FAILURE); - } -} -////////////////////////////////////////////////////////////////////////// -void Calculator::calculateBlocks(int startLevel, int maxInitLevel) -{ - Block3DPtr blockTemp; - try - { - //startLevel bis maxInitLevel - for(int level = startLevel; level <= maxInitLevel; level++) - { - //timer.resetAndStart(); - //call LBM kernel - for(Block3DPtr block : blocks[level]) - { - blockTemp = block; - block->getKernel()->calculate(); - } - //timer.stop(); - //UBLOG(logINFO, "level = " << level << " blocks = " << blocks[level].size() << " collision time = " << timer.getTotalTime()); - } - } - catch( std::exception& e ) - { - //error = boost::current_exception(); - UBLOG(logERROR, e.what()); - UBLOG(logERROR, blockTemp->toString()<<" step = "<<calcStep); - exit(EXIT_FAILURE); - } -} -////////////////////////////////////////////////////////////////////////// -void Calculator::calculateBlocks(int minInitLevel, int maxInitLevel, int staggeredStep) -{ - int p, maxi, maxir, maxidp, start, end; - for(int level=minInitLevel; level<=maxInitLevel; level++) - { - p = 1<<(maxInitLevel-level); - maxi = maxir = static_cast<int>(blocks[level].size()); - maxidp = maxi/p; - if(p > maxi && maxi != 0){ - maxidp = 1; - maxi = p; - } - start = (staggeredStep-1)*maxidp; - if(start >= maxi) - start = 0; - end = start + maxidp; - if((end + p) >= maxi) - end = maxi; - for (int i = start; i < end; i++) - { - if(i < maxir) - blocks[level][i]->getKernel()->calculate(); - } - } - } -////////////////////////////////////////////////////////////////////////// -void Calculator::addBlock(Block3DPtr block) -{ - blocks[block->getLevel()].push_back(block); -} -////////////////////////////////////////////////////////////////////////// -void Calculator::initConnectors() -{ - UBLOG(logDEBUG1, "Calculator::initLocalConnectors() - start"); - - for (int l = minLevel; l <= maxLevel; l++) - { - for(Block3DPtr block : blocks[l]) - { - block->pushBackLocalSameLevelConnectors(localConns[l]); - - if(block->hasInterpolationFlag()) - block->pushBackLocalSameLevelConnectors(localInterfaceBlockConns[l]); - if (l != maxLevel) - block->pushBackLocalInterpolationConnectorsCF(localInterConns[l]); - } - if (l != maxLevel) - { - for(Block3DPtr block : blocks[l+1]) - { - block->pushBackLocalInterpolationConnectorsFC(localInterConns[l]); - } - } - UBLOG(logDEBUG5, "Calculator::initConnectors()-initConnectors(localConns["<<l<<"])"); - initConnectors(localConns[l]); - - if (l != maxLevel) - { - UBLOG(logDEBUG5, "Calculator::initConnectors()-initConnectors(localInterConns["<<l<<"])"); - initConnectors(localInterConns[l]); - } - } - - if (mainThread) - initRemoteConnectors(); - - UBLOG(logDEBUG1, "Calculator::initLocalConnectors() - end"); -} -////////////////////////////////////////////////////////////////////////// -void Calculator::initRemoteConnectors() -{ - std::vector< std::vector< Block3DConnectorPtr > > remoteInterConnsCF; - std::vector< std::vector< Block3DConnectorPtr > > remoteInterConnsFC; - remoteInterConnsCF.resize(maxLevel+1); - remoteInterConnsFC.resize(maxLevel+1); - - int minInitLevel = this->grid->getCoarsestInitializedLevel(); - int maxInitLevel = this->grid->getFinestInitializedLevel(); - int gridRank = grid->getRank(); - - for(int level = minInitLevel; level<=maxInitLevel;level++) - { - std::vector<Block3DPtr> blockVector; - //grid->getBlocks(level, gridRank, true, blockVector); - grid->getBlocks(level, blockVector); - for(Block3DPtr block : blockVector) - { - int l = block->getLevel(); - block->pushBackRemoteSameLevelConnectors(remoteConns[l]); - - //if(block->isInterface()) - // block->pushBackRemoteSameLevelConnectors(remoteInterfaceBlockConns[l]); - block->pushBackRemoteInterpolationConnectorsCF(remoteInterConnsCF[l]); - block->pushBackRemoteInterpolationConnectorsFC(remoteInterConnsFC[l]); - } - } - - for (int l = minLevel; l <= maxLevel; l++) - { - UBLOG(logDEBUG5, "Calculator::initRemoteConnectors()-initConnectors(remoteConns["<<l<<"])"); - initConnectors(remoteConns[l]); - if (l != maxLevel) - { - for(int i = 0; i < remoteInterConnsCF[l].size(); i++) - remoteInterConns[l].push_back(remoteInterConnsCF[l][i]); - for(int i = 0; i < remoteInterConnsFC[l+1].size(); i++) - remoteInterConns[l].push_back(remoteInterConnsFC[l+1][i]); - //UBLOG(logDEBUG5, "Calculator::initRemoteConnectors()-initConnectors(remoteInterConns["<<l<<"])"); - //initConnectors(remoteInterConns[l]); - } - } - ////////////////////////////////////////////////////////////////////////// - //UBLOG(logDEBUG5, "Calculator::initConnectors() - connectoren initialisieren - start"); - for (int l = minLevel; l <= maxLevel; l++) - { - if (l != maxLevel) - { - UBLOG(logDEBUG5, "Calculator::initRemoteConnectors()-initConnectors(remoteInterConns["<<l<<"])"); - for(Block3DConnectorPtr c : remoteInterConns[l] ) c->init(); - } - } - //UBLOG(logDEBUG5, "Calculator::initConnectors() - connectoren initialisieren - end"); - ////////////////////////////////////////////////////////////////////////// - //sendTransmitterDataSize - //UBLOG(logDEBUG5, "Calculator::initConnectors() - sendTransmitterDataSize - start"); - for (int l = minLevel; l <= maxLevel; l++) - { - if (l != maxLevel) - { - UBLOG(logDEBUG5, "Calculator::initRemoteConnectors()-sendTransmitterDataSize(remoteInterConns["<<l<<"])"); - for(Block3DConnectorPtr c : remoteInterConns[l] ) c->sendTransmitterDataSize(); - } - } - //UBLOG(logDEBUG5, "Calculator::initConnectors() - sendTransmitterDataSize - end"); - ////////////////////////////////////////////////////////////////////////// - //receiveTransmitterDataSize - //wenn er hier bei verteilten berechnungen stopped, dann ist vermutlich auf einer seite ein nicht aktiver block!!! - //UBLOG(logDEBUG5, "Calculator::initConnectors() - receiveTransmitterDataSize - start"); - for (int l = minLevel; l <= maxLevel; l++) - { - if (l != maxLevel) - { - UBLOG(logDEBUG5, "Calculator::initRemoteConnectors()-receiveTransmitterDataSize(remoteInterConns["<<l<<"])"); - for(Block3DConnectorPtr c : remoteInterConns[l] ) c->receiveTransmitterDataSize(); - } - } - //UBLOG(logDEBUG5, "Calculator::initConnectors() - receiveTransmitterDataSize - end"); - ////////////////////////////////////////////////////////////////////////// -} -////////////////////////////////////////////////////////////////////////// -void Calculator::initConnectors(std::vector<Block3DConnectorPtr>& connectors) -{ - UBLOG(logDEBUG1, "Calculator::initConnectors() - start"); - - //initialization - ////////////////////////////////////////////////////////////////////////// - //initialize connectors - UBLOG(logDEBUG5, "Calculator::initConnectors() - connectoren initialisieren - start"); - for(Block3DConnectorPtr c : connectors ) c->init(); - UBLOG(logDEBUG5, "Calculator::initConnectors() - connectoren initialisieren - end"); - ////////////////////////////////////////////////////////////////////////// - //sendTransmitterDataSize - UBLOG(logDEBUG5, "Calculator::initConnectors() - sendTransmitterDataSize - start"); - for(Block3DConnectorPtr c : connectors ) c->sendTransmitterDataSize(); - UBLOG(logDEBUG5, "Calculator::initConnectors() - sendTransmitterDataSize - end"); - ////////////////////////////////////////////////////////////////////////// - //receiveTransmitterDataSize - //wenn er hier bei verteilten berechnungen stopped, dann ist vermutlich auf einer seite ein nicht aktiver block!!! - UBLOG(logDEBUG5, "Calculator::initConnectors() - receiveTransmitterDataSize - start"); - for(Block3DConnectorPtr c : connectors ) c->receiveTransmitterDataSize(); - UBLOG(logDEBUG5, "Calculator::initConnectors() - receiveTransmitterDataSize - end"); - - UBLOG(logDEBUG1, "Calculator::initConnectors() - end"); -} -////////////////////////////////////////////////////////////////////////// -void Calculator::exchangeBlockData(int startLevel, int maxInitLevel) -{ - sync->wait(); - //startLevel bis maxInitLevel - for(int level=startLevel; level<=maxInitLevel; level++) - { - connectorsPrepare(localConns[level]); - connectorsPrepare(remoteConns[level]); - - connectorsSend(localConns[level]); - connectorsSend(remoteConns[level]); - - connectorsReceive(localConns[level]); - connectorsReceive(remoteConns[level]); - } - sync->wait(); -} -////////////////////////////////////////////////////////////////////////// -void Calculator::exchangeInterfaceBlockData(int startLevel, int maxInitLevel) -{ - sync->wait(); - //startLevel bis maxInitLevel - for(int level=startLevel; level<=maxInitLevel; level++) - { - connectorsPrepare(localInterfaceBlockConns[level]); - connectorsPrepare(remoteInterfaceBlockConns[level]); - - connectorsSend(localInterfaceBlockConns[level]); - connectorsSend(remoteInterfaceBlockConns[level]); - - connectorsReceive(localInterfaceBlockConns[level]); - connectorsReceive(remoteInterfaceBlockConns[level]); - } - sync->wait(); -} -////////////////////////////////////////////////////////////////////////// -void Calculator::swapDistributions(int startLevel, int maxInitLevel) -{ - //startLevel bis maxInitLevel - for(int level=startLevel; level<=maxInitLevel; level++) - { - for(Block3DPtr block : blocks[level]) - { - block->getKernel()->swapDistributions(); - } - } -} -////////////////////////////////////////////////////////////////////////// -void Calculator::connectorsPrepare(std::vector< Block3DConnectorPtr >& connectors) -{ - for(Block3DConnectorPtr c : connectors) - { - c->prepareForReceive(); - c->prepareForSend(); - } -} -////////////////////////////////////////////////////////////////////////// -void Calculator::connectorsSend(std::vector< Block3DConnectorPtr >& connectors) -{ - for(Block3DConnectorPtr c : connectors) - { - c->fillSendVectors(); - c->sendVectors(); - } -} -////////////////////////////////////////////////////////////////////////// -void Calculator::connectorsReceive(std::vector< Block3DConnectorPtr >& connectors) -{ - for(Block3DConnectorPtr c : connectors) - { - c->receiveVectors(); - c->distributeReceiveVectors(); - } -} -////////////////////////////////////////////////////////////////////////// -void Calculator::interpolation(int startLevel, int maxInitLevel) -{ - sync->wait(); - - for(int level=startLevel; level<maxInitLevel; level++) - { - connectorsPrepare(localInterConns[level]); - connectorsPrepare(remoteInterConns[level]); - } - - sync->wait(); - - for(int level=startLevel; level<maxInitLevel; level++) - { - connectorsSend(localInterConns[level]); - connectorsSend(remoteInterConns[level]); - } - - sync->wait(); - - for(int level=startLevel; level<maxInitLevel; level++) - { - connectorsReceive(localInterConns[level]); - connectorsReceive(remoteInterConns[level]); - } - - sync->wait(); - -} -////////////////////////////////////////////////////////////////////////// -void Calculator::setVisScheduler(UbSchedulerPtr s) -{ - visScheduler = s; -} -////////////////////////////////////////////////////////////////////////// -//double Calculator::getCalculationTime() -//{ -// return timer.getTotalTime(); -//} -////////////////////////////////////////////////////////////////////////// -std::vector< std::vector< Block3DPtr > > Calculator::getBlocks() const -{ - return blocks; -} -////////////////////////////////////////////////////////////////////////// -void Calculator::deleteBlocks() -{ - for(std::vector< Block3DPtr > &bs : blocks) - bs.resize(0); -} -////////////////////////////////////////////////////////////////////////// -void Calculator::deleteConnectors() -{ - deleteConnectors(localConns); - deleteConnectors(remoteConns); - - deleteConnectors(localInterfaceBlockConns); - deleteConnectors(remoteInterfaceBlockConns); - - deleteConnectors(localInterConns); - deleteConnectors(remoteInterConns); -} -////////////////////////////////////////////////////////////////////////// -void Calculator::deleteConnectors(std::vector< std::vector< Block3DConnectorPtr > >& conns) -{ - for(std::vector< Block3DConnectorPtr > &c : conns) - c.resize(0); -} -////////////////////////////////////////////////////////////////////////// -void Calculator::setTimeAveragedValuesCoProcessor(TimeAveragedValuesCoProcessorPtr coProcessor) -{ - taValuesCoProcessor = coProcessor; -} - -////////////////////////////////////////////////////////////////////////// -//void Calculator::applyBCs( int startLevel, int maxInitLevel ) -//{ -// //startLevel bis maxInitLevel -// for(int level=startLevel; level<=maxInitLevel; level++) -// { -// //call LBM kernel -// for(Block3DPtr block : blocks[level]) -// { -// block->getKernel()->getBCProcessor()->applyBC(); -// } -// } -//} -////////////////////////////////////////////////////////////////////////// -void Calculator::applyPreCollisionBC(int startLevel, int maxInitLevel) -{ - //startLevel bis maxInitLevel - for (int level = startLevel; level<=maxInitLevel; level++) - { - for(Block3DPtr block : blocks[level]) - { - block->getKernel()->getBCProcessor()->applyPreCollisionBC(); - } - } -} -////////////////////////////////////////////////////////////////////////// -void Calculator::applyPostCollisionBC(int startLevel, int maxInitLevel) -{ - //startLevel bis maxInitLevel - for (int level = startLevel; level<=maxInitLevel; level++) - { - for(Block3DPtr block : blocks[level]) - { - block->getKernel()->getBCProcessor()->applyPostCollisionBC(); - } - } -} - diff --git a/src/VirtualFluids/Grid/Calculator.h b/src/VirtualFluids/Grid/Calculator.h deleted file mode 100644 index 84c845b7b..000000000 --- a/src/VirtualFluids/Grid/Calculator.h +++ /dev/null @@ -1,93 +0,0 @@ -#ifndef CALCULATOR_H -#define CALCULATOR_H - -#include <memory> -#include <vector> - -class Grid3D; -class Synchronizer; -class UbScheduler; -class CalculationManager; -class Block3D; -class Block3DConnector; -class TimeAveragedValuesCoProcessor; - -#include <VirtualFluidsDefinitions.h> - - -#include <boost/thread/barrier.hpp> -#include <boost/exception_ptr.hpp> - -class Calculator; -typedef std::shared_ptr<Calculator> CalculatorPtr; - - -class VF_PUBLIC Calculator -{ -public: - Calculator(); - Calculator(std::shared_ptr<Grid3D> grid, std::shared_ptr<Synchronizer> sync, bool mainThread = true); - virtual ~Calculator(){} - virtual void calculate(const double& endTime, std::shared_ptr<CalculationManager> cm, boost::exception_ptr& error); - void addBlock(std::shared_ptr<Block3D> block); - void initConnectors(); - void setVisScheduler(std::shared_ptr<UbScheduler> s); - //double getCalculationTime(); - std::vector< std::vector< std::shared_ptr<Block3D> > > getBlocks() const; - void deleteBlocks(); - void deleteConnectors(); - - void setTimeAveragedValuesCoProcessor(std::shared_ptr<TimeAveragedValuesCoProcessor> coProcessor); - -protected: - void calculateBlocks(int startLevel, int maxInitLevel); - void calculateBlocks(int minInitLevel, int maxInitLevel, int staggeredStep); - void initConnectors(std::vector<std::shared_ptr<Block3DConnector> >& connectors); - virtual void initRemoteConnectors(); - void swapDistributions(int startLevel, int maxInitLevel); - virtual void exchangeBlockData(int startLevel, int maxInitLevel); - void exchangeInterfaceBlockData(int startLevel, int maxInitLevel); - virtual void connectorsPrepare(std::vector< std::shared_ptr<Block3DConnector> >& connectors); - virtual void connectorsSend(std::vector< std::shared_ptr<Block3DConnector> >& connectors); - virtual void connectorsReceive(std::vector< std::shared_ptr<Block3DConnector> >& connectors); - void interpolation(int startLevel, int maxInitLevel); - void deleteConnectors(std::vector< std::vector< std::shared_ptr<Block3DConnector> > >& conns); - //void applyBCs(int startLevel, int maxInitLevel); - void applyPreCollisionBC(int startLevel, int maxInitLevel); - void applyPostCollisionBC(int startLevel, int maxInitLevel); - int minLevel, maxLevel; - std::vector< std::vector< std::shared_ptr<Block3DConnector> > > localConns; - std::vector< std::vector< std::shared_ptr<Block3DConnector> > > remoteConns; - std::shared_ptr<Synchronizer> sync; - - boost::barrier* bar; - //double time; - - bool mainThread; - bool refinement; - std::shared_ptr<Grid3D> grid; - std::shared_ptr<UbScheduler> visScheduler; - int calcStep; - std::vector< std::vector<std::shared_ptr<Block3D> > > blocks; - - - std::vector< std::vector< std::shared_ptr<Block3DConnector> > > localInterfaceBlockConns; - std::vector< std::vector< std::shared_ptr<Block3DConnector> > > remoteInterfaceBlockConns; - - //localInterConns and remoteInterConns save interpolation connectors - //every element save CF connectors for current level and FC connectors for next level - //e.g. - //localInterConns[0] = CF(0), FC(1) - //localInterConns[1] = CF(1), FC(2) - //localInterConns[2] - std::vector< std::vector< std::shared_ptr<Block3DConnector> > > localInterConns; - std::vector< std::vector< std::shared_ptr<Block3DConnector> > > remoteInterConns; - - //UbTimer timer, timer2, timer3; - bool loadBalancingComp; - - std::shared_ptr<TimeAveragedValuesCoProcessor> taValuesCoProcessor; - -}; - -#endif diff --git a/src/VirtualFluids/Grid/CalculatorFactory.h b/src/VirtualFluids/Grid/CalculatorFactory.h deleted file mode 100644 index e530102ce..000000000 --- a/src/VirtualFluids/Grid/CalculatorFactory.h +++ /dev/null @@ -1,33 +0,0 @@ -/* -* Author: S. Peters -* mail: peters@irmb.tu-bs.de -*/ -#ifndef CalculatorFactory_H -#define CalculatorFactory_H - -#include <memory> - -class Calculator; -class UbScheduler; -class Synchronizer; -class Grid3D; - -enum class CalculatorType -{ - HYBRID, MPI, PREPOSTBC, FETOL, DEM -}; - -class CalculatorFactory -{ -public: - explicit CalculatorFactory(std::shared_ptr<UbScheduler> visScheduler) : visScheduler(visScheduler) { } - virtual ~CalculatorFactory() {} - - virtual std::shared_ptr<Calculator> makeCalculator(std::shared_ptr<Grid3D> grid, std::shared_ptr<Synchronizer> sync, bool isMainThread, CalculatorType type) = 0; - -protected: - std::shared_ptr<UbScheduler> visScheduler; -}; - -#endif - diff --git a/src/VirtualFluids/Grid/ConcreteCalculatorFactory.h b/src/VirtualFluids/Grid/ConcreteCalculatorFactory.h deleted file mode 100644 index 281b809bf..000000000 --- a/src/VirtualFluids/Grid/ConcreteCalculatorFactory.h +++ /dev/null @@ -1,55 +0,0 @@ -#ifndef ConcreteCalculatorFactory_H -#define ConcreteCalculatorFactory_H - - -#include <memory> - -#include "Grid3D.h" - -#include "Calculator.h" -#include "MPICalculator.h" -#include "PrePostBcCalculator.h" - -#include "CalculatorFactory.h" - - -class ConcreteCalculatorFactory : public CalculatorFactory -{ -public: - ConcreteCalculatorFactory(UbSchedulerPtr visScheduler) : CalculatorFactory(visScheduler){} - virtual ~ConcreteCalculatorFactory() {} - - std::shared_ptr<Calculator> makeCalculator(Grid3DPtr grid, SynchronizerPtr sync, bool isMainThread, CalculatorType type) override - { - std::shared_ptr<Calculator> calculator; - switch(type) - { - case CalculatorType::HYBRID: - calculator = std::make_shared<Calculator>(grid, sync, isMainThread); - break; - case CalculatorType::MPI: - calculator = std::make_shared<MPICalculator>(grid); - break; - case CalculatorType::PREPOSTBC: - calculator = std::make_shared<PrePostBcCalculator>(grid, sync, isMainThread); - break; - #if defined CalculatorType::VF_FETOL - case FETOL: - calculator = std::make_shared<FetolCalculator>(grid); - break; - #endif - default: - throw std::runtime_error("CalculatorType not valid in ConcreteCalculatorFactory"); - } - - calculator->setVisScheduler(visScheduler); - return calculator; - } - - -}; - - - -#endif - diff --git a/src/VirtualFluids/Grid/Grid3D.cpp b/src/VirtualFluids/Grid/Grid3D.cpp deleted file mode 100644 index 4fe023fcc..000000000 --- a/src/VirtualFluids/Grid/Grid3D.cpp +++ /dev/null @@ -1,2027 +0,0 @@ -#include "Grid3D.h" - -#include <set> - -#include <VirtualFluidsBasics/numerics/geometry3d/CoordinateTransformation3D.h> -#include <VirtualFluidsBasics/basics/writer/WbWriterVtkXmlASCII.h> - -#include "Grid3DVisitor.h" -#include "Block3DVisitor.h" -#include "Interactor3D.h" -#include "Grid3DSystem.h" -#include "LBMSystem.h" -#include <Block3D.h> -#include <Communicator.h> - - -using namespace std; - -Grid3D::Grid3D() : - rank(0), - bundle(0), - orgDeltaX(1.0), - periodicX1(false), - periodicX2(false), - periodicX3(false), - timeStep(0.0), - blockNx1(0), - blockNx2(0), - blockNx3(0), - nx1(0), - nx2(0), - nx3(0) -{ - levelSet.resize(Grid3DSystem::MAXLEVEL+1); -} -////////////////////////////////////////////////////////////////////////// -Grid3D::Grid3D(CommunicatorPtr comm) : - rank(0), - bundle(0), - orgDeltaX(1.0), - periodicX1(false), - periodicX2(false), - periodicX3(false), - timeStep(0.0), - blockNx1(0), - blockNx2(0), - blockNx3(0), - nx1(0), - nx2(0), - nx3(0) -{ - levelSet.resize(Grid3DSystem::MAXLEVEL+1); - bundle = comm->getBundleID(); - rank = comm->getProcessID(); -} -////////////////////////////////////////////////////////////////////////// -Grid3D::Grid3D( CommunicatorPtr comm, int blockNx1, int blockNx2, int blockNx3, int gridNx1, int gridNx2, int gridNx3 ) : - rank(0), - bundle(0), - orgDeltaX(1.0), - periodicX1(false), - periodicX2(false), - periodicX3(false), - timeStep(0.0), - blockNx1(blockNx1), - blockNx2(blockNx2), - blockNx3(blockNx2), - nx1(gridNx1), - nx2(gridNx2), - nx3(gridNx3) -{ - levelSet.resize(Grid3DSystem::MAXLEVEL+1); - bundle = comm->getBundleID(); - rank = comm->getProcessID(); - trafo = CoordinateTransformation3DPtr(new CoordinateTransformation3D(0.0, 0.0, 0.0, (double)blockNx1, (double)blockNx2, (double)blockNx3)); - UbTupleInt3 minInd(0, 0, 0); - UbTupleInt3 maxInd(gridNx1, gridNx2, gridNx3); - this->fillExtentWithBlocks(minInd, maxInd); -} -////////////////////////////////////////////////////////////////////////// -void Grid3D::addInteractor(Interactor3DPtr interactor) -{ - interactors.push_back(interactor); -} -////////////////////////////////////////////////////////////////////////// -void Grid3D::addAndInitInteractor(Interactor3DPtr interactor,double timestep) -{ - interactors.push_back(interactor); - interactor->initInteractor(timestep); -} -////////////////////////////////////////////////////////////////////////// -Grid3D::Interactor3DSet Grid3D::getInteractors() -{ - return interactors; -} -////////////////////////////////////////////////////////////////////////// -void Grid3D::accept(Block3DVisitor& blockVisitor) -{ - int startLevel = blockVisitor.getStartLevel(); - int stopLevel = blockVisitor.getStopLevel(); - - if(startLevel < 0 || stopLevel < 0 || startLevel > Grid3DSystem::MAXLEVEL || stopLevel > Grid3DSystem::MAXLEVEL) - throw UbException(UB_EXARGS,"not valid level!"); - - bool dir = startLevel < stopLevel; - if(dir) stopLevel += 1; - else stopLevel -= 1; - - -// for (int l = startLevel; l!=stopLevel;) -// { -// std::vector<Block3DPtr> blockVector; -// getBlocks(l, blockVector); -// int sizeb = (int)blockVector.size(); -//#pragma omp parallel -//#pragma omp for -// for(int i = 0; i < sizeb; i++) -// { -// blockVisitor.visit(shared_from_this(), blockVector[i]); -// } -// if (dir) l++; -// else l--; -// } - for(int l=startLevel; l!=stopLevel;) - { - std::vector<Block3DPtr> blockVector; - getBlocks(l, blockVector); - for(Block3DPtr b : blockVector) - { - blockVisitor.visit( shared_from_this(), b ); - } - if(dir) l++; - else l--; - } -} -////////////////////////////////////////////////////////////////////////// -void Grid3D::accept(Grid3DVisitor& gridVisitor) -{ - gridVisitor.visit( shared_from_this() ); -} -////////////////////////////////////////////////////////////////////////// -void Grid3D::accept(Grid3DVisitorPtr gridVisitor) -{ - gridVisitor->visit( shared_from_this() ); -} -////////////////////////////////////////////////////////////////////////// -void Grid3D::addBlock( Block3DPtr block ) -{ - if (block) - { - this->blockIdMap.insert( std::make_pair( block->getGlobalID(), block) ); - int level = block->getLevel(); - this->levelSet[level].insert( std::make_pair( Block3DKey( block->getX1(), block->getX2(), block->getX3() ), block) ).second; - } -} -////////////////////////////////////////////////////////////////////////// -bool Grid3D::deleteBlock( Block3DPtr block ) -{ - return this->deleteBlock(block->getX1(), block->getX2(), block->getX3(), block->getLevel()); -} -////////////////////////////////////////////////////////////////////////// -bool Grid3D::deleteBlock(int ix1, int ix2, int ix3, int level) -{ - Block3DPtr block = this->getBlock(ix1, ix2, ix3, level); - if(block) - { - this->blockIdMap.erase(block->getGlobalID()); - return this->levelSet[level].erase( Block3DKey(ix1, ix2, ix3) ) > 0; - } - else - { - return false; - } -} -////////////////////////////////////////////////////////////////////////// -void Grid3D::replaceBlock(Block3DPtr block) -{ - if (block) - { - this->deleteBlock(block); - this->addBlock(block); - } -} -////////////////////////////////////////////////////////////////////////// -Block3DPtr Grid3D::getBlock( int ix1, int ix2, int ix3, int level ) const -{ - if( !this->hasLevel(level) ) return Block3DPtr(); - - int N1 = (nx1<<level); - int N2 = (nx2<<level); - int N3 = (nx3<<level); - - if (!this->isPeriodicX1() && (ix1>N1-1 || ix1<0)) return Block3DPtr(); - else if( this->isPeriodicX1() && (ix1>=N1-1 || ix1<0)) { ix1=((ix1%N1)+N1)%N1; } - if (!this->isPeriodicX2() && (ix2>N2-1 || ix2<0)) return Block3DPtr(); - else if( this->isPeriodicX2() && (ix2>=N2-1 || ix2<0)) { ix2=((ix2%N2)+N2)%N2; } - if (!this->isPeriodicX3() && (ix3>N3-1 || ix3<0)) return Block3DPtr(); - else if( this->isPeriodicX3() && (ix3>=N3-1 || ix3<0)) { ix3=((ix3%N3)+N3)%N3; } - - Block3DMap::const_iterator it; - it = levelSet[level].find( Block3DKey(ix1,ix2,ix3) ); - if( it == levelSet[level].end() ) - return Block3DPtr(); - else - return it->second; -} -////////////////////////////////////////////////////////////////////////// -Block3DPtr Grid3D::getBlock(int id) const -{ - BlockIDMap::const_iterator it; - if( ( it=blockIdMap.find( id ) ) == blockIdMap.end() ) - { - return Block3DPtr(); - } - - return it->second; -} -////////////////////////////////////////////////////////////////////////// -//const Grid3D::Block3DMap& Grid3D::getBlocks(int level) -//{ -// return levelSet[level]; -//} -////////////////////////////////////////////////////////////////////////// -const Grid3D::BlockIDMap& Grid3D::getBlockIDs() -{ - return blockIdMap; -} -////////////////////////////////////////////////////////////////////////// -Block3DPtr Grid3D::getSuperBlock(Block3DPtr block) -{ - int ix1 = block->getX1(); - int ix2 = block->getX2(); - int ix3 = block->getX3(); - int level = block->getLevel(); - return getSuperBlock(ix1, ix2, ix3, level); -} -////////////////////////////////////////////////////////////////////////// -Block3DPtr Grid3D::getSuperBlock(int ix1, int ix2, int ix3, int level) -{ - if(!this->hasLevel(level)) return Block3DPtr(); - if(level < 1) throw UbException(UB_EXARGS,"level <1"); - - //from Lower Level to higher: >> 1 in x1,x2,x3 - Block3DPtr block; - for(int l=level-1; l>=0; l--) - { - ix1 = ix1 >> 1; - ix2 = ix2 >> 1; - ix3 = ix3 >> 1; - - block = this->getBlock(ix1, ix2, ix3, l); - if(block) return block; - } - return Block3DPtr(); -} -////////////////////////////////////////////////////////////////////////// -void Grid3D::getSubBlocks(Block3DPtr block, int levelDepth, std::vector<Block3DPtr>& blocks) -{ - int ix1 = block->getX1(); - int ix2 = block->getX2(); - int ix3 = block->getX3(); - int level = block->getLevel(); - getSubBlocks(ix1, ix2, ix3, level, levelDepth, blocks); -} -////////////////////////////////////////////////////////////////////////// -void Grid3D::getSubBlocks(int ix1, int ix2, int ix3, int level, int levelDepth, std::vector<Block3DPtr>& blocks) -{ - if(!this->getBlock(ix1, ix2, ix3, level)) return; - if(level > 0 && !this->getSuperBlock(ix1, ix2, ix3, level)) return; - if(level >= Grid3DSystem::MAXLEVEL) throw UbException(UB_EXARGS,"Level bigger then MAXLEVEL"); - - int x1[] = { ix1<<1, (ix1<<1)+1 }; - int x2[] = { ix2<<1, (ix2<<1)+1 }; - int x3[] = { ix3<<1, (ix3<<1)+1 }; - int l = level + 1; - - for(int i=0; i<2; i++) - for(int j=0; j<2; j++) - for(int k=0; k<2; k++) - { - Block3DPtr block = this->getBlock(x1[i], x2[j], x3[k], l); - if(block) blocks.push_back(block); - else if(l < levelDepth) this->getSubBlocks(x1[i], x2[j], x3[k], l, levelDepth, blocks); - } -} -////////////////////////////////////////////////////////////////////////// -bool Grid3D::expandBlock(int ix1, int ix2, int ix3, int level) -{ - this->checkLevel(level); - - Block3DPtr block = this->getBlock( ix1, ix2, ix3, level ); - if(!block) throw UbException(UB_EXARGS,"block(x1="+UbSystem::toString(ix1)+", x2="+UbSystem::toString(ix2)+", x3="+UbSystem::toString(ix3)+", l="+UbSystem::toString(level)+") is not exist"); - //if(!block->isActive()) throw UbException(UB_EXARGS,"block(x1="+UbSystem::toString(ix1)+", x2="+UbSystem::toString(ix2)+", x3="+UbSystem::toString(ix3)+", l="+UbSystem::toString(level)+") is not active"); - - //da bei periodic der eigentliche block andere indizes hat: - ix1 = block->getX1(); - ix2 = block->getX2(); - ix3 = block->getX3(); - - int l = level+1; - if( l>Grid3DSystem::MAXLEVEL ) throw UbException(UB_EXARGS,"level > Grid3D::MAXLEVEL"); - - int west = ix1<<1; - int east = west+1; - int south = ix2<<1; - int north = south+1; - int bottom = ix3<<1; - int top = bottom+1; - - Block3DPtr blockBSW = Block3DPtr(new Block3D(west, south, bottom, l)); - Block3DPtr blockBSE = Block3DPtr(new Block3D(east, south, bottom, l)); - Block3DPtr blockBNW = Block3DPtr(new Block3D(west, north, bottom, l)); - Block3DPtr blockBNE = Block3DPtr(new Block3D(east, north, bottom, l)); - Block3DPtr blockTSW = Block3DPtr(new Block3D(west, south, top , l)); - Block3DPtr blockTSE = Block3DPtr(new Block3D(east, south, top , l)); - Block3DPtr blockTNW = Block3DPtr(new Block3D(west, north, top , l)); - Block3DPtr blockTNE = Block3DPtr(new Block3D(east, north, top , l)); - - if( !this->deleteBlock( ix1, ix2, ix3, level ) ) - throw UbException(UB_EXARGS,"could not delete block"); - - this->addBlock(blockBSW); - this->addBlock(blockBSE); - this->addBlock(blockBNW); - this->addBlock(blockBNE); - this->addBlock(blockTSW); - this->addBlock(blockTSE); - this->addBlock(blockTNW); - this->addBlock(blockTNE); - - return true; -} -////////////////////////////////////////////////////////////////////////// -Block3DPtr Grid3D::collapseBlock(int fix1, int fix2, int fix3, int flevel, int levelDepth) -{ - using UbSystem::toString; - - Block3DPtr fblock = this->getBlock(fix1, fix2, fix3, flevel); - if( flevel < 1 ) throw UbException(UB_EXARGS,"level of block ("+toString(fix1)+","+toString(fix2)+","+toString(fix3)+","+toString(flevel)+") is < 1"); - if( !fblock ) - { - throw UbException(UB_EXARGS,"specific block("+toString(fix1)+","+toString(fix2)+","+toString(fix3)+","+toString(flevel)+") doesn't exists"); - } - if( !fblock->isActive() ) throw UbException(UB_EXARGS,"block("+toString(fix1)+","+toString(fix2)+","+toString(fix3)+","+toString(flevel)+") is not active"); - - //da bei periodic der eigentliche block andere indizes hat: - fix1 = fblock->getX1(); - fix2 = fblock->getX2(); - fix3 = fblock->getX3(); - - int cix1 = fblock->getX1() >> 1; - int cix2 = fblock->getX2() >> 1; - int cix3 = fblock->getX3() >> 1; - - int fx1[2] = { cix1<<1, (cix1<<1)+1 }; - int fx2[2] = { cix2<<1, (cix2<<1)+1 }; - int fx3[2] = { cix3<<1, (cix3<<1)+1 }; - int clevel = flevel - 1; - - vector<Block3DPtr> blocks; - for(int i=0; i<2; i++) - for(int k=0; k<2; k++) - for(int l=0; l<2; l++) - { - this->getSubBlocks(fx1[k], fx2[i], fx3[l], flevel, levelDepth, blocks); - while(!blocks.empty()) - { - //man muss nur eine von den moeglichen acht "collapsen", die anderen werden - //dann (rekursiv) collapsed, da die schleife oben alle vier abfragt - this->collapseBlock(blocks[0]->getX1(), blocks[0]->getX2(), blocks[0]->getX3(), blocks[0]->getLevel(), levelDepth); - this->getSubBlocks(fx1[k], fx2[i], fx3[l], flevel, levelDepth, blocks); - } - } - - vector<Block3DPtr> fineBlocks(8); - /*BSW*/fineBlocks[0] = this->getBlock( fx1[0], fx2[0], fx3[0], flevel ); - /*BSE*/fineBlocks[1] = this->getBlock( fx1[1], fx2[0], fx3[0], flevel ); - /*BNE*/fineBlocks[2] = this->getBlock( fx1[1], fx2[1], fx3[0], flevel ); - /*BNW*/fineBlocks[3] = this->getBlock( fx1[0], fx2[1], fx3[0], flevel ); - /*TSW*/fineBlocks[4] = this->getBlock( fx1[0], fx2[0], fx3[1], flevel ); - /*TSE*/fineBlocks[5] = this->getBlock( fx1[1], fx2[0], fx3[1], flevel ); - /*TNE*/fineBlocks[6] = this->getBlock( fx1[1], fx2[1], fx3[1], flevel ); - /*TNW*/fineBlocks[7] = this->getBlock( fx1[0], fx2[1], fx3[1], flevel ); - - Block3DPtr cblock = Block3DPtr(new Block3D(cix1, cix2, cix3, clevel)); - - for(int i=0; i<2; i++) - for(int k=0; k<2; k++) - for(int l=0; l<2; l++) - if( !this->deleteBlock( fx1[k], fx2[i], fx3[l], flevel ) ) - throw UbException(UB_EXARGS,"could not delete block"); - - this->addBlock(cblock); - - return cblock; -} -////////////////////////////////////////////////////////////////////////// -// TODO: make visitor for this -void Grid3D::deleteConnectors() -{ - for(Block3DMap blockMap : levelSet) - { - for(Block3DMap::value_type b : blockMap) - { - Block3DPtr block = b.second; - block->deleteConnectors(); - //block->deleteInterpolationConnectors(); - } - } -} -////////////////////////////////////////////////////////////////////////// -Grid3D::connection_t Grid3D::connect(Grid3D::signal_t::slot_function_type subscriber) -{ - return sig.connect(subscriber); -} -////////////////////////////////////////////////////////////////////////// -void Grid3D::disconnect(Grid3D::connection_t subscriber) -{ - subscriber.disconnect(); -} -////////////////////////////////////////////////////////////////////////// -void Grid3D::coProcess(double step) -{ - timeStep = step; - sig(step); -} -////////////////////////////////////////////////////////////////////////// -void Grid3D::setRank(int rank) -{ - this->rank = rank; -} -////////////////////////////////////////////////////////////////////////// -int Grid3D::getRank() const -{ - return rank; -} -////////////////////////////////////////////////////////////////////////// -int Grid3D::getBundle() const -{ - return bundle; -} -////////////////////////////////////////////////////////////////////////// -void Grid3D::setBundle(int bundle) -{ - this->bundle = bundle; -} -////////////////////////////////////////////////////////////////////////// -bool Grid3D::isPeriodicX1() const -{ - return this->periodicX1; -} -////////////////////////////////////////////////////////////////////////// -bool Grid3D::isPeriodicX2() const -{ - return this->periodicX2; -} -////////////////////////////////////////////////////////////////////////// -bool Grid3D::isPeriodicX3() const -{ - return this->periodicX3; -} -////////////////////////////////////////////////////////////////////////// -void Grid3D::setPeriodicX1(bool value) -{ - this->periodicX1 = value; -} -////////////////////////////////////////////////////////////////////////// -void Grid3D::setPeriodicX2(bool value) -{ - this->periodicX2 = value; -} -////////////////////////////////////////////////////////////////////////// -void Grid3D::setPeriodicX3(bool value) -{ - this->periodicX3 = value; -} -////////////////////////////////////////////////////////////////////////// -UbTupleInt3 Grid3D::getBlockIndexes(double blockX1Coord, double blockX2Coord, double blockX3Coord) const -{ - if(!trafo) - { - return makeUbTuple( (int)blockX1Coord, (int)blockX2Coord, (int)blockX3Coord ); - } - - return makeUbTuple( (int)trafo->transformForwardToX1Coordinate( blockX1Coord, blockX2Coord, blockX3Coord ) - , (int)trafo->transformForwardToX2Coordinate( blockX1Coord, blockX2Coord, blockX3Coord ) - , (int)trafo->transformForwardToX3Coordinate( blockX1Coord, blockX2Coord, blockX3Coord ) ); - -} -////////////////////////////////////////////////////////////////////////// -UbTupleInt3 Grid3D::getBlockIndexes(double blockX1Coord, double blockX2Coord, double blockX3Coord, int level) const -{ - if(!trafo) - { - return makeUbTuple( (int)blockX1Coord, (int)blockX2Coord, (int)blockX3Coord ); - } - - double dx = getDeltaX(level); - double blockLentghX1, blockLentghX2, blockLentghX3; - blockLentghX1 = blockNx1*dx; - blockLentghX2 = blockNx2*dx; - blockLentghX3 = blockNx3*dx; - UbTupleDouble3 org = getBlockWorldCoordinates(0, 0, 0, 0); - - CoordinateTransformation3DPtr trafo_temp(new CoordinateTransformation3D(val<1>(org),val<2>(org),val<3>(org),blockLentghX1,blockLentghX2,blockLentghX3)); - - if(!trafo_temp) - { - return makeUbTuple( (int)blockX1Coord, (int)blockX2Coord, (int)blockX3Coord ); - } - - return makeUbTuple( (int)trafo_temp->transformForwardToX1Coordinate( blockX1Coord, blockX2Coord, blockX3Coord ) - , (int)trafo_temp->transformForwardToX2Coordinate( blockX1Coord, blockX2Coord, blockX3Coord ) - , (int)trafo_temp->transformForwardToX3Coordinate( blockX1Coord, blockX2Coord, blockX3Coord ) ); - -} -////////////////////////////////////////////////////////////////////////// -UbTupleDouble3 Grid3D::getBlockLengths(const Block3DPtr block) const -{ - int level = block->getLevel(); - double delta = 1.0/(double)(1<<level); - - if(!trafo) makeUbTuple<double, double, double>(delta,delta,delta); - - return makeUbTuple( trafo->getX1CoordinateScaling()*delta, - trafo->getX2CoordinateScaling()*delta, - trafo->getX3CoordinateScaling()*delta ); -} -////////////////////////////////////////////////////////////////////////// -UbTupleDouble6 Grid3D::getBlockOversize() const -{ - return makeUbTuple(0.0,0.0,0.0,0.0,0.0,0.0); -} -////////////////////////////////////////////////////////////////////////// -void Grid3D::setCoordinateTransformator(CoordinateTransformation3DPtr trafo) -{ - this->trafo = trafo; -} -////////////////////////////////////////////////////////////////////////// -const CoordinateTransformation3DPtr Grid3D::getCoordinateTransformator() const -{ - return this->trafo; -} -////////////////////////////////////////////////////////////////////////// -void Grid3D::setDeltaX(double dx) -{ - this->orgDeltaX = dx; -} -////////////////////////////////////////////////////////////////////////// -void Grid3D::setDeltaX(double worldUnit, double gridUnit) -{ - this->orgDeltaX = worldUnit/gridUnit; -} -////////////////////////////////////////////////////////////////////////// -double Grid3D::getDeltaX(int level) const -{ - double delta = this->orgDeltaX/(double)(1<<level); - return delta; -} -////////////////////////////////////////////////////////////////////////// -double Grid3D::getDeltaX(Block3DPtr block) const -{ - return getDeltaX(block->getLevel()); -} -////////////////////////////////////////////////////////////////////////// -UbTupleDouble3 Grid3D::getNodeOffset(Block3DPtr block) const -{ - double delta = this->getDeltaX(block); - return makeUbTuple(OFFSET * delta, OFFSET * delta, OFFSET * delta); -} -//////////////////////////////////////////////////////////////////////////// -Vector3D Grid3D::getNodeCoordinates(Block3DPtr block, int ix1, int ix2, int ix3) const -{ - UbTupleDouble3 org = this->getBlockWorldCoordinates(block); - UbTupleDouble3 nodeOffset = this->getNodeOffset(block); - double deltaX = getDeltaX(block); - - double x1 = val<1>(org) - val<1>(nodeOffset) + (double)ix1*deltaX; - double x2 = val<2>(org) - val<2>(nodeOffset) + (double)ix2*deltaX; - double x3 = val<3>(org) - val<3>(nodeOffset) + (double)ix3*deltaX; - - return Vector3D(x1, x2, x3); -} -//////////////////////////////////////////////////////////////////////////// -UbTupleInt3 Grid3D::getNodeIndexes(Block3DPtr block, double nodeX1Coord, double nodeX2Coord, double nodeX3Coord) const -{ - UbTupleDouble3 org = this->getBlockWorldCoordinates(block); - UbTupleDouble3 nodeOffset = this->getNodeOffset(block); - double deltaX = getDeltaX(block); - - int ix1,ix2,ix3; - double ixx1=(abs(nodeX1Coord - val<1>(org) + val<1>(nodeOffset)) / deltaX); - double ixx2=(abs(nodeX2Coord - val<2>(org) + val<2>(nodeOffset)) / deltaX); - double ixx3=(abs(nodeX3Coord - val<3>(org) + val<3>(nodeOffset)) / deltaX); - if (ixx1-(int)ixx1>.9999999999) ix1=(int)ixx1+1;else ix1=(int)ixx1; - if (ixx2-(int)ixx2>.9999999999) ix2=(int)ixx2+1;else ix2=(int)ixx2; - if (ixx3-(int)ixx3>.9999999999) ix3=(int)ixx3+1;else ix3=(int)ixx3; - - return makeUbTuple(ix1, ix2, ix3); -} -////////////////////////////////////////////////////////////////////////// -//returns tuple with origin of block in world-coordinates -UbTupleDouble3 Grid3D::getBlockWorldCoordinates(Block3DPtr block) const -{ - if(!block) - throw UbException(UB_EXARGS,"block " + block->toString() + "is not exist"); - - int blockX1Index = block->getX1(); - int blockX2Index = block->getX2(); - int blockX3Index = block->getX3(); - int level = block->getLevel(); - - return this->getBlockWorldCoordinates(blockX1Index, blockX2Index, blockX3Index, level); -} -////////////////////////////////////////////////////////////////////////// -UbTupleDouble3 Grid3D::getBlockWorldCoordinates(int blockX1Index, int blockX2Index, int blockX3Index, int level) const -{ - double c1oShiftedLevel = 1.0/(double)(1<<level); - double x1 = (double)blockX1Index*c1oShiftedLevel; - double x2 = (double)blockX2Index*c1oShiftedLevel; - double x3 = (double)blockX3Index*c1oShiftedLevel; - - if(!trafo) return UbTupleDouble3( x1,x2,x3 ); - - return UbTupleDouble3( trafo->transformBackwardToX1Coordinate( x1,x2,x3 ) - ,trafo->transformBackwardToX2Coordinate( x1,x2,x3 ) - ,trafo->transformBackwardToX3Coordinate( x1,x2,x3 ) ); -} -////////////////////////////////////////////////////////////////////////// -//double Grid3D::getDeltaT(Block3DPtr block) const -//{ -// int level = block->getLevel(); -// double delta = 1.0/(double)(1<<level); -// return delta; -//} -////////////////////////////////////////////////////////////////////////// -void Grid3D::checkLevel(int level) -{ - if(level < 0) - { - throw UbException(UB_EXARGS,"l("+UbSystem::toString(level)+(string)")<0"); - } - if(level > Grid3DSystem::MAXLEVEL) - { - throw UbException(UB_EXARGS,"l("+UbSystem::toString(level)+(string)")>MAXLEVEL"); - } - if(this->levelSet[level].size() == 0) - { - throw UbException(UB_EXARGS,"levelMap for level("+UbSystem::toString(level)+(string)")==NULL"); - } -} -////////////////////////////////////////////////////////////////////////// -bool Grid3D::hasLevel(int level) const -{ - if(level < 0 ) return false; - if(level > Grid3DSystem::MAXLEVEL ) return false; - if(this->levelSet[level].size() == 0) return false; - - return true; -} -////////////////////////////////////////////////////////////////////////// -void Grid3D::setBlockNX( int nx1, int nx2, int nx3 ) -{ - blockNx1 = nx1; - blockNx2 = nx2; - blockNx3 = nx3; -} -////////////////////////////////////////////////////////////////////////// -UbTupleInt3 Grid3D::getBlockNX() const -{ - return makeUbTuple(blockNx1, blockNx2, blockNx3); -} -////////////////////////////////////////////////////////////////////////// - -Block3DPtr Grid3D::getNeighborBlock( int dir, int ix1, int ix2, int ix3, int level ) const -{ - return this->getBlock( ix1+Grid3DSystem::EX1[dir], ix2+Grid3DSystem::EX2[dir], ix3+Grid3DSystem::EX3[dir], level ); -} -////////////////////////////////////////////////////////////////////////// -Block3DPtr Grid3D::getNeighborBlock(int dir, Block3DPtr block) const -{ - int x1 = block->getX1(); - int x2 = block->getX2(); - int x3 = block->getX3(); - int level = block->getLevel(); - return this->getNeighborBlock( dir, x1, x2, x3, level); -} -////////////////////////////////////////////////////////////////////////// -void Grid3D::getAllNeighbors(int ix1, int ix2, int ix3, int level, int levelDepth, std::vector<Block3DPtr>& blocks) -{ - for(int dir=Grid3DSystem::STARTDIR; dir<=Grid3DSystem::ENDDIR; dir++) - //for (int dir = Grid3DSystem::STARTDIR; dir<=Grid3DSystem::TS; dir++) - { - this->getNeighborBlocksForDirection(dir,ix1,ix2,ix3,level,levelDepth,blocks); - } -} -////////////////////////////////////////////////////////////////////////// -void Grid3D::getAllNeighbors(Block3DPtr block, int level, int levelDepth, std::vector<Block3DPtr>& blocks) -{ - int x1 = block->getX1(); - int x2 = block->getX2(); - int x3 = block->getX3(); - getAllNeighbors(x1,x2,x3,level,levelDepth,blocks); -} -////////////////////////////////////////////////////////////////////////// - /** - * Returns all direct northern neighbor cells of the specified grid cell (may be NULL!). - * @param ix1 index in x1 direction - * @param ix2 index in x2 direction - * @param ix3 index in x3 direction - * @param level the level - */ -void Grid3D::getNeighborsNorth(int ix1, int ix2, int ix3, int level, int levelDepth, std::vector<Block3DPtr>& blocks) -{ - Block3DPtr block = this->getBlock(ix1, ix2+1, ix3, level); - if(block) { blocks.push_back(block); } - - if(level > 0) - { - block = this->getSuperBlock(ix1, ix2+1, ix3, level); - if(block) { blocks.push_back(block); } - } - this->getSubBlocksSouth(ix1, ix2+1, ix3, level, blocks, levelDepth); -} -////////////////////////////////////////////////////////////////////////// -void Grid3D::getNeighborsTop(int ix1, int ix2, int ix3, int level, int levelDepth, std::vector<Block3DPtr>& blocks) -{ - Block3DPtr block = this->getBlock(ix1, ix2, ix3+1, level); - if(block) { blocks.push_back(block); } - - if(level > 0) - { - block = this->getSuperBlock(ix1, ix2, ix3+1, level); - if(block) { blocks.push_back(block); } - } - this->getSubBlocksBottom(ix1, ix2, ix3+1, level, blocks, levelDepth); -} -////////////////////////////////////////////////////////////////////////// -void Grid3D::getNeighborsBottom(int ix1, int ix2, int ix3, int level, int levelDepth, std::vector<Block3DPtr>& blocks) -{ - Block3DPtr block = this->getBlock(ix1, ix2, ix3-1, level); - if(block) { blocks.push_back(block); } - - if(level > 0) - { - block = this->getSuperBlock(ix1, ix2, ix3-1, level); - if(block) { blocks.push_back(block); } - - } - this->getSubBlocksTop(ix1, ix2, ix3-1, level, blocks, levelDepth); -} -////////////////////////////////////////////////////////////////////////// -void Grid3D::getNeighborsSouth(int ix1, int ix2, int ix3, int level, int levelDepth, std::vector<Block3DPtr>& blocks) -{ - Block3DPtr block = this->getBlock(ix1, ix2-1, ix3, level); - if(block) { blocks.push_back(block); } - - if(level > 0) - { - block = this->getSuperBlock(ix1, ix2-1, ix3, level); - if(block) { blocks.push_back(block); } - - } - this->getSubBlocksNorth(ix1, ix2-1, ix3, level, blocks, levelDepth); -} -////////////////////////////////////////////////////////////////////////// -void Grid3D::getNeighborsEast(int ix1, int ix2, int ix3, int level, int levelDepth, std::vector<Block3DPtr>& blocks) -{ - Block3DPtr block = this->getBlock(ix1+1, ix2, ix3, level); - if(block) { blocks.push_back(block); } - - if(level > 0) - { - block = this->getSuperBlock(ix1+1, ix2, ix3, level); - if(block) { blocks.push_back(block); } - } - this->getSubBlocksWest(ix1+1, ix2, ix3, level, blocks, levelDepth); -} -////////////////////////////////////////////////////////////////////////// -void Grid3D::getNeighborsWest(int ix1, int ix2, int ix3, int level, int levelDepth, std::vector<Block3DPtr>& blocks) -{ - Block3DPtr block = this->getBlock(ix1-1, ix2, ix3, level); - if(block) { blocks.push_back(block); } - - - if(level > 0) - { - block = this->getSuperBlock(ix1-1, ix2, ix3, level); - if(block) { blocks.push_back(block); } - } - this->getSubBlocksEast(ix1-1, ix2, ix3, level, blocks, levelDepth); -} -////////////////////////////////////////////////////////////////////////// -// diagonals -////////////////////////////////////////////////////////////////////////// -void Grid3D::getNeighborsNorthEast(int ix1, int ix2, int ix3, int level, int levelDepth, std::vector<Block3DPtr>& blocks) -{ - Block3DPtr block = this->getBlock(ix1+1, ix2+1, ix3, level); - if(block) { blocks.push_back(block); } - - if(level > 0) - { - block = this->getSuperBlock(ix1+1, ix2+1, ix3, level); - if(block) { blocks.push_back(block); } - } - this->getSubBlocksSouthWest(ix1+1, ix2+1, ix3, level, blocks, levelDepth); -} -////////////////////////////////////////////////////////////////////////// -void Grid3D::getNeighborsNorthWest(int ix1, int ix2, int ix3, int level, int levelDepth, std::vector<Block3DPtr>& blocks) -{ - Block3DPtr block = this->getBlock(ix1-1, ix2+1, ix3, level); - if(block) { blocks.push_back(block); } - - if(level > 0) - { - block = this->getSuperBlock(ix1-1, ix2+1, ix3, level); - if(block) { blocks.push_back(block); } - } - this->getSubBlocksSouthEast(ix1-1, ix2+1, ix3, level, blocks, levelDepth); -} -////////////////////////////////////////////////////////////////////////// -void Grid3D::getNeighborsSouthEast(int ix1, int ix2, int ix3, int level, int levelDepth, std::vector<Block3DPtr>& blocks) -{ - Block3DPtr block = this->getBlock(ix1+1, ix2-1, ix3, level); - if(block) { blocks.push_back(block); } - - if(level > 0) - { - block = this->getSuperBlock(ix1+1, ix2-1, ix3, level); - if(block) { blocks.push_back(block); } - } - this->getSubBlocksNorthWest(ix1+1, ix2-1, ix3, level, blocks, levelDepth); -} -////////////////////////////////////////////////////////////////////////// -void Grid3D::getNeighborsSouthWest(int ix1, int ix2, int ix3, int level, int levelDepth, std::vector<Block3DPtr>& blocks) -{ - Block3DPtr block = this->getBlock(ix1-1, ix2-1, ix3, level); - if(block) { blocks.push_back(block); } - - if(level > 0) - { - block = this->getSuperBlock(ix1-1, ix2-1, ix3, level); - if(block) { blocks.push_back(block); } - } - this->getSubBlocksNorthEast(ix1-1, ix2-1, ix3, level, blocks, levelDepth); -} -////////////////////////////////////////////////////////////////////////// -// diagonals top -////////////////////////////////////////////////////////////////////////// -void Grid3D::getNeighborsTopEast(int ix1, int ix2, int ix3, int level, int levelDepth, std::vector<Block3DPtr>& blocks) -{ - Block3DPtr block = this->getBlock(ix1+1, ix2, ix3+1, level); - if(block) { blocks.push_back(block); } - - if(level > 0) - { - block = this->getSuperBlock(ix1+1, ix2, ix3+1, level); - if(block) { blocks.push_back(block); } - } - this->getSubBlocksBottomWest(ix1+1, ix2, ix3+1, level, blocks, levelDepth); -} -////////////////////////////////////////////////////////////////////////// -void Grid3D::getNeighborsTopWest(int ix1, int ix2, int ix3, int level, int levelDepth, std::vector<Block3DPtr>& blocks) -{ - Block3DPtr block = this->getBlock(ix1-1, ix2, ix3+1, level); - if(block) { blocks.push_back(block); } - - if(level > 0) - { - block = this->getSuperBlock(ix1-1, ix2, ix3+1, level); - if(block) { blocks.push_back(block); } - } - this->getSubBlocksBottomEast(ix1-1, ix2, ix3+1, level, blocks, levelDepth); -} -////////////////////////////////////////////////////////////////////////// -void Grid3D::getNeighborsTopNorth(int ix1, int ix2, int ix3, int level, int levelDepth, std::vector<Block3DPtr>& blocks) -{ - Block3DPtr block = this->getBlock(ix1, ix2+1, ix3+1, level); - if(block) { blocks.push_back(block); } - - if(level > 0) - { - block = this->getSuperBlock(ix1, ix2+1, ix3+1, level); - if(block) { blocks.push_back(block); } - } - this->getSubBlocksBottomSouth(ix1, ix2+1, ix3+1, level, blocks, levelDepth); -} -////////////////////////////////////////////////////////////////////////// -void Grid3D::getNeighborsTopSouth(int ix1, int ix2, int ix3, int level, int levelDepth, std::vector<Block3DPtr>& blocks) -{ - Block3DPtr block = this->getBlock(ix1, ix2-1, ix3+1, level); - if(block) { blocks.push_back(block); } - - if(level > 0) - { - block = this->getSuperBlock(ix1, ix2-1, ix3+1, level); - if(block) { blocks.push_back(block); } - } - this->getSubBlocksBottomNorth(ix1, ix2-1, ix3+1, level, blocks, levelDepth); -} -////////////////////////////////////////////////////////////////////////// -// diagonals bottom -////////////////////////////////////////////////////////////////////////// -void Grid3D::getNeighborsBottomEast(int ix1, int ix2, int ix3, int level, int levelDepth, std::vector<Block3DPtr>& blocks) -{ - Block3DPtr block = this->getBlock(ix1+1, ix2, ix3-1, level); - if(block) { blocks.push_back(block); } - - if(level > 0) - { - block = this->getSuperBlock(ix1+1, ix2, ix3-1, level); - if(block) { blocks.push_back(block); } - } - this->getSubBlocksTopWest(ix1+1, ix2, ix3-1, level, blocks, levelDepth); -} -////////////////////////////////////////////////////////////////////////// -void Grid3D::getNeighborsBottomWest(int ix1, int ix2, int ix3, int level, int levelDepth, std::vector<Block3DPtr>& blocks) -{ - Block3DPtr block = this->getBlock(ix1-1, ix2, ix3-1, level); - if(block) { blocks.push_back(block); } - - if(level > 0) - { - block = this->getSuperBlock(ix1-1, ix2, ix3-1, level); - if(block) { blocks.push_back(block); } - } - this->getSubBlocksTopEast(ix1-1, ix2, ix3-1, level, blocks, levelDepth); -} -////////////////////////////////////////////////////////////////////////// -void Grid3D::getNeighborsBottomNorth(int ix1, int ix2, int ix3, int level, int levelDepth, std::vector<Block3DPtr>& blocks) -{ - Block3DPtr block = this->getBlock(ix1, ix2+1, ix3-1, level); - if(block) { blocks.push_back(block); } - - if(level > 0) - { - block = this->getSuperBlock(ix1, ix2+1, ix3-1, level); - if(block) { blocks.push_back(block); } - } - this->getSubBlocksTopSouth(ix1, ix2+1, ix3-1, level, blocks, levelDepth); -} -////////////////////////////////////////////////////////////////////////// -void Grid3D::getNeighborsBottomSouth(int ix1, int ix2, int ix3, int level, int levelDepth, std::vector<Block3DPtr>& blocks) -{ - Block3DPtr block = this->getBlock(ix1, ix2-1, ix3-1, level); - if(block) { blocks.push_back(block); } - - if(level > 0) - { - block = this->getSuperBlock(ix1, ix2-1, ix3-1, level); - if(block) { blocks.push_back(block); } - } - this->getSubBlocksTopNorth(ix1, ix2-1, ix3-1, level, blocks, levelDepth); -} -////////////////////////////////////////////////////////////////////////// -void Grid3D::getNeighborsTopNorthEast(int ix1, int ix2, int ix3, int level, int levelDepth, std::vector<Block3DPtr>& blocks) -{ - Block3DPtr block = this->getBlock(ix1+1, ix2+1, ix3+1, level); - if(block) { blocks.push_back(block); } - - if(level > 0) - { - block = this->getSuperBlock(ix1+1, ix2+1, ix3+1, level); - if(block) { blocks.push_back(block); } - } - this->getSubBlocksBottomSouthWest(ix1+1, ix2+1, ix3+1, level, blocks, levelDepth); -} -////////////////////////////////////////////////////////////////////////// -void Grid3D::getNeighborsTopNorthWest(int ix1, int ix2, int ix3, int level, int levelDepth, std::vector<Block3DPtr>& blocks) -{ - Block3DPtr block = this->getBlock(ix1-1, ix2+1, ix3+1, level); - if(block) { blocks.push_back(block); } - - if(level > 0) - { - block = this->getSuperBlock(ix1-1, ix2+1, ix3+1, level); - if(block) { blocks.push_back(block); } - } - this->getSubBlocksBottomSouthEast(ix1-1, ix2+1, ix3+1, level, blocks, levelDepth); -} -////////////////////////////////////////////////////////////////////////// -void Grid3D::getNeighborsTopSouthEast(int ix1, int ix2, int ix3, int level, int levelDepth, std::vector<Block3DPtr>& blocks) -{ - Block3DPtr block = this->getBlock(ix1+1, ix2-1, ix3+1, level); - if(block) { blocks.push_back(block); } - - if(level > 0) - { - block = this->getSuperBlock(ix1+1, ix2-1, ix3+1, level); - if(block) { blocks.push_back(block); } - } - this->getSubBlocksBottomNorthWest(ix1+1, ix2-1, ix3+1, level, blocks, levelDepth); -} -////////////////////////////////////////////////////////////////////////// -void Grid3D::getNeighborsTopSouthWest(int ix1, int ix2, int ix3, int level, int levelDepth, std::vector<Block3DPtr>& blocks) -{ - Block3DPtr block = this->getBlock(ix1-1, ix2-1, ix3+1, level); - if(block) { blocks.push_back(block); } - - if(level > 0) - { - block = this->getSuperBlock(ix1-1, ix2-1, ix3+1, level); - if(block) { blocks.push_back(block); } - } - this->getSubBlocksBottomNorthEast(ix1-1, ix2-1, ix3+1, level, blocks, levelDepth); -} -////////////////////////////////////////////////////////////////////////// -void Grid3D::getNeighborsBottomNorthEast(int ix1, int ix2, int ix3, int level, int levelDepth, std::vector<Block3DPtr>& blocks) -{ - Block3DPtr block = this->getBlock(ix1+1, ix2+1, ix3-1, level); - if(block) { blocks.push_back(block); } - - if(level > 0) - { - block = this->getSuperBlock(ix1+1, ix2+1, ix3-1, level); - if(block) { blocks.push_back(block); } - } - this->getSubBlocksTopSouthWest(ix1+1, ix2+1, ix3-1, level, blocks, levelDepth); -} -////////////////////////////////////////////////////////////////////////// -void Grid3D::getNeighborsBottomNorthWest(int ix1, int ix2, int ix3, int level, int levelDepth, std::vector<Block3DPtr>& blocks) -{ - Block3DPtr block = this->getBlock(ix1-1, ix2+1, ix3-1, level); - if(block) { blocks.push_back(block); } - - if(level > 0) - { - block = this->getSuperBlock(ix1-1, ix2+1, ix3-1, level); - if(block) { blocks.push_back(block); } - } - this->getSubBlocksTopSouthEast(ix1-1, ix2+1, ix3-1, level, blocks, levelDepth); -} -////////////////////////////////////////////////////////////////////////// -void Grid3D::getNeighborsBottomSouthEast(int ix1, int ix2, int ix3, int level, int levelDepth, std::vector<Block3DPtr>& blocks) -{ - Block3DPtr block = this->getBlock(ix1+1, ix2-1, ix3-1, level); - if(block) { blocks.push_back(block); } - - if(level > 0) - { - block = this->getSuperBlock(ix1+1, ix2-1, ix3-1, level); - if(block) { blocks.push_back(block); } - } - this->getSubBlocksTopNorthWest(ix1+1, ix2-1, ix3-1, level, blocks, levelDepth); -} -////////////////////////////////////////////////////////////////////////// -void Grid3D::getNeighborsBottomSouthWest(int ix1, int ix2, int ix3, int level, int levelDepth, std::vector<Block3DPtr>& blocks) -{ - Block3DPtr block = this->getBlock(ix1-1, ix2-1, ix3-1, level); - if(block) { blocks.push_back(block); } - - if(level > 0) - { - block = this->getSuperBlock(ix1-1, ix2-1, ix3-1, level); - if(block) { blocks.push_back(block); } - } - this->getSubBlocksTopNorthEast(ix1-1, ix2-1, ix3-1, level, blocks, levelDepth); -} -////////////////////////////////////////////////////////////////////////// -void Grid3D::getNeighborBlocksForDirection(int dir, int ix1, int ix2, int ix3, int level, int levelDepth, std::vector<Block3DPtr>& blocks) -{ - switch(dir) - { - case Grid3DSystem::E : this->getNeighborsEast(ix1, ix2, ix3, level,levelDepth, blocks);break; - case Grid3DSystem::W : this->getNeighborsWest(ix1, ix2, ix3, level,levelDepth, blocks); break; - case Grid3DSystem::N : this->getNeighborsNorth(ix1, ix2, ix3, level,levelDepth, blocks); break; - case Grid3DSystem::S : this->getNeighborsSouth(ix1, ix2, ix3, level,levelDepth, blocks); break; - case Grid3DSystem::T : this->getNeighborsTop(ix1, ix2, ix3, level,levelDepth, blocks); break; - case Grid3DSystem::B : this->getNeighborsBottom(ix1, ix2, ix3, level,levelDepth, blocks); break; - case Grid3DSystem::NE : this->getNeighborsNorthEast(ix1, ix2, ix3, level,levelDepth, blocks); break; - case Grid3DSystem::SW : this->getNeighborsSouthWest(ix1, ix2, ix3, level,levelDepth, blocks); break; - case Grid3DSystem::SE : this->getNeighborsSouthEast(ix1, ix2, ix3, level,levelDepth, blocks); break; - case Grid3DSystem::NW : this->getNeighborsNorthWest(ix1, ix2, ix3, level,levelDepth, blocks); break; - case Grid3DSystem::TE : this->getNeighborsTopEast(ix1, ix2, ix3, level,levelDepth, blocks); break; - case Grid3DSystem::BW : this->getNeighborsBottomWest(ix1, ix2, ix3, level,levelDepth, blocks); break; - case Grid3DSystem::BE : this->getNeighborsBottomEast(ix1, ix2, ix3, level,levelDepth, blocks); break; - case Grid3DSystem::TW : this->getNeighborsTopWest(ix1, ix2, ix3, level,levelDepth, blocks); break; - case Grid3DSystem::TN : this->getNeighborsTopNorth(ix1, ix2, ix3, level,levelDepth, blocks); break; - case Grid3DSystem::BS : this->getNeighborsBottomSouth(ix1, ix2, ix3, level,levelDepth, blocks); break; - case Grid3DSystem::BN : this->getNeighborsBottomNorth(ix1, ix2, ix3, level,levelDepth, blocks); break; - case Grid3DSystem::TS : this->getNeighborsTopSouth(ix1, ix2, ix3, level,levelDepth, blocks); break; - case Grid3DSystem::TNE: this->getNeighborsTopNorthEast(ix1, ix2, ix3, level, levelDepth, blocks); break; - case Grid3DSystem::TNW: this->getNeighborsTopNorthWest(ix1, ix2, ix3, level, levelDepth, blocks); break; - case Grid3DSystem::TSE: this->getNeighborsTopSouthEast(ix1, ix2, ix3, level, levelDepth, blocks); break; - case Grid3DSystem::TSW: this->getNeighborsTopSouthWest(ix1, ix2, ix3, level, levelDepth, blocks); break; - case Grid3DSystem::BNE: this->getNeighborsBottomNorthEast(ix1, ix2, ix3, level, levelDepth, blocks); break; - case Grid3DSystem::BNW: this->getNeighborsBottomNorthWest(ix1, ix2, ix3, level, levelDepth, blocks); break; - case Grid3DSystem::BSE: this->getNeighborsBottomSouthEast(ix1, ix2, ix3, level, levelDepth, blocks); break; - case Grid3DSystem::BSW: this->getNeighborsBottomSouthWest(ix1, ix2, ix3, level, levelDepth, blocks); break; - default:throw UbException(UB_EXARGS,"direction "+UbSystem::toString(dir)+" is not exist"); - } -} -////////////////////////////////////////////////////////////////////////// -void Grid3D::getNeighborsZero(int ix1, int ix2, int ix3, int level, int levelDepth, std::vector<Block3DPtr>& blocks) -{ - Block3DPtr block = this->getBlock(ix1, ix2, ix3, level); - if(block) { blocks.push_back(block); } - - if(level > 0) - { - block = this->getSuperBlock(ix1, ix2, ix3, level); - if(block) { blocks.push_back(block); } - } - // this->getSubBlocksNull(ix1, ix2, ix3, level, blocks, levelDepth); - this->getSubBlocks(ix1, ix2, ix3, level, levelDepth, blocks); -} -////////////////////////////////////////////////////////////////////////// -void Grid3D::getSubBlocksZero(int ix1, int ix2, int ix3, int level,vector<Block3DPtr> &blockVector, int levelDepth) -{ - int x1E = (ix1 << 1) + 1; - int x1W = (ix1 << 1) ; - int x2S = ix2 << 1; - int x2N = x2S + 1; - int x3B = ix3 << 1; - int x3T = x3B + 1; - int l = level + 1; - - Block3DPtr block = this->getBlock(x1E, x2S, x3B, l); - if(block != NULL) blockVector.push_back(block); - else if(l < levelDepth) this->getSubBlocksEast(x1E, x2S, x3B, l, blockVector,levelDepth); - - block = this->getBlock(x1E, x2N, x3B, l); - if(block != NULL) blockVector.push_back(block); - else if(l < levelDepth) this->getSubBlocksEast(x1E, x2N, x3B, l, blockVector,levelDepth); - - block = this->getBlock(x1E, x2S, x3T, l); - if(block != NULL) blockVector.push_back(block); - else if(l < levelDepth) this->getSubBlocksEast(x1E, x2S, x3T, l, blockVector,levelDepth); - - block = this->getBlock(x1E, x2N, x3T, l); - if(block != NULL) blockVector.push_back(block); - else if(l < levelDepth) this->getSubBlocksEast(x1E, x2N, x3T, l, blockVector,levelDepth); - - block = this->getBlock(x1W, x2S, x3B, l); - if(block != NULL) blockVector.push_back(block); - else if(l < levelDepth) this->getSubBlocksEast(x1W, x2S, x3B, l, blockVector,levelDepth); - - block = this->getBlock(x1W, x2N, x3B, l); - if(block != NULL) blockVector.push_back(block); - else if(l < levelDepth) this->getSubBlocksEast(x1W, x2N, x3B, l, blockVector,levelDepth); - - block = this->getBlock(x1W, x2S, x3T, l); - if(block != NULL) blockVector.push_back(block); - else if(l < levelDepth) this->getSubBlocksEast(x1W, x2S, x3T, l, blockVector,levelDepth); - - block = this->getBlock(x1W, x2N, x3T, l); - if(block != NULL) blockVector.push_back(block); - else if(l < levelDepth) this->getSubBlocksEast(x1W, x2N, x3T, l, blockVector,levelDepth); -} -////////////////////////////////////////////////////////////////////////// -void Grid3D::getNeighborBlocksForDirectionWithDirZero(int dir, int ix1, int ix2, int ix3, int level, int levelDepth, std::vector<Block3DPtr>& blocks) -{ - switch(dir) - { - case Grid3DSystem::E : this->getNeighborsEast(ix1, ix2, ix3, level,levelDepth, blocks);break; - case Grid3DSystem::W : this->getNeighborsWest(ix1, ix2, ix3, level,levelDepth, blocks); break; - case Grid3DSystem::N : this->getNeighborsNorth(ix1, ix2, ix3, level,levelDepth, blocks); break; - case Grid3DSystem::S : this->getNeighborsSouth(ix1, ix2, ix3, level,levelDepth, blocks); break; - case Grid3DSystem::T : this->getNeighborsTop(ix1, ix2, ix3, level,levelDepth, blocks); break; - case Grid3DSystem::B : this->getNeighborsBottom(ix1, ix2, ix3, level,levelDepth, blocks); break; - case Grid3DSystem::NE : this->getNeighborsNorthEast(ix1, ix2, ix3, level,levelDepth, blocks); break; - case Grid3DSystem::SW : this->getNeighborsSouthWest(ix1, ix2, ix3, level,levelDepth, blocks); break; - case Grid3DSystem::SE : this->getNeighborsSouthEast(ix1, ix2, ix3, level,levelDepth, blocks); break; - case Grid3DSystem::NW : this->getNeighborsNorthWest(ix1, ix2, ix3, level,levelDepth, blocks); break; - case Grid3DSystem::TE : this->getNeighborsTopEast(ix1, ix2, ix3, level,levelDepth, blocks); break; - case Grid3DSystem::BW : this->getNeighborsBottomWest(ix1, ix2, ix3, level,levelDepth, blocks); break; - case Grid3DSystem::BE : this->getNeighborsBottomEast(ix1, ix2, ix3, level,levelDepth, blocks); break; - case Grid3DSystem::TW : this->getNeighborsTopWest(ix1, ix2, ix3, level,levelDepth, blocks); break; - case Grid3DSystem::TN : this->getNeighborsTopNorth(ix1, ix2, ix3, level,levelDepth, blocks); break; - case Grid3DSystem::BS : this->getNeighborsBottomSouth(ix1, ix2, ix3, level,levelDepth, blocks); break; - case Grid3DSystem::BN : this->getNeighborsBottomNorth(ix1, ix2, ix3, level,levelDepth, blocks); break; - case Grid3DSystem::TS : this->getNeighborsTopSouth(ix1, ix2, ix3, level,levelDepth, blocks); break; - case Grid3DSystem::TNE: this->getNeighborsTopNorthEast(ix1, ix2, ix3, level, levelDepth, blocks); break; - case Grid3DSystem::TNW: this->getNeighborsTopNorthWest(ix1, ix2, ix3, level, levelDepth, blocks); break; - case Grid3DSystem::TSE: this->getNeighborsTopSouthEast(ix1, ix2, ix3, level, levelDepth, blocks); break; - case Grid3DSystem::TSW: this->getNeighborsTopSouthWest(ix1, ix2, ix3, level, levelDepth, blocks); break; - case Grid3DSystem::BNE: this->getNeighborsBottomNorthEast(ix1, ix2, ix3, level, levelDepth, blocks); break; - case Grid3DSystem::BNW: this->getNeighborsBottomNorthWest(ix1, ix2, ix3, level, levelDepth, blocks); break; - case Grid3DSystem::BSE: this->getNeighborsBottomSouthEast(ix1, ix2, ix3, level, levelDepth, blocks); break; - case Grid3DSystem::BSW: this->getNeighborsBottomSouthWest(ix1, ix2, ix3, level, levelDepth, blocks); break; - case Grid3DSystem::ZERO: this->getNeighborsZero(ix1, ix2, ix3, level,levelDepth, blocks);break; - default:throw UbException(UB_EXARGS,"direction "+UbSystem::toString(dir)+" is not exist"); - } -} -////////////////////////////////////////////////////////////////////////// -void Grid3D::getSubBlocksEast(int ix1, int ix2, int ix3, int level,vector<Block3DPtr> &blockVector, int levelDepth) -{ - int x1 = (ix1 << 1) + 1; - int x2S = ix2 << 1; - int x2N = x2S + 1; - int x3B = ix3 << 1; - int x3T = x3B + 1; - int l = level + 1; - - Block3DPtr block = this->getBlock(x1, x2S, x3B, l); - if(block != NULL) blockVector.push_back(block); - else if(l < levelDepth) this->getSubBlocksEast(x1, x2S, x3B, l, blockVector,levelDepth); - - block = this->getBlock(x1, x2N, x3B, l); - if(block != NULL) blockVector.push_back(block); - else if(l < levelDepth) this->getSubBlocksEast(x1, x2N, x3B, l, blockVector,levelDepth); - - block = this->getBlock(x1, x2S, x3T, l); - if(block != NULL) blockVector.push_back(block); - else if(l < levelDepth) this->getSubBlocksEast(x1, x2S, x3T, l, blockVector,levelDepth); - - block = this->getBlock(x1, x2N, x3T, l); - if(block != NULL) blockVector.push_back(block); - else if(l < levelDepth) this->getSubBlocksEast(x1, x2N, x3T, l, blockVector,levelDepth); -} - -////////////////////////////////////////////////////////////////////////// -void Grid3D::getSubBlocksWest(int ix1, int ix2, int ix3, int level,vector<Block3DPtr> &blockVector, int levelDepth) -{ - int x1 = ix1 << 1; - int x2S = ix2 << 1; - int x2N = x2S + 1; - int x3B = ix3 << 1; - int x3T = x3B + 1; - int l = level + 1; - - Block3DPtr block = this->getBlock(x1, x2S, x3B, l); - if(block != NULL) blockVector.push_back(block); - else if(l < levelDepth) this->getSubBlocksWest(x1, x2S, x3B, l, blockVector,levelDepth); - - block = this->getBlock(x1, x2N, x3B, l); - if(block != NULL) blockVector.push_back(block); - else if(l < levelDepth) this->getSubBlocksWest(x1, x2N, x3B, l, blockVector,levelDepth); - - block = this->getBlock(x1, x2S, x3T, l); - if(block != NULL) blockVector.push_back(block); - else if(l < levelDepth) this->getSubBlocksWest(x1, x2S, x3T, l, blockVector,levelDepth); - - block = this->getBlock(x1, x2N, x3T, l); - if(block != NULL) blockVector.push_back(block); - else if(l < levelDepth) this->getSubBlocksWest(x1, x2N, x3T, l, blockVector,levelDepth); -} -////////////////////////////////////////////////////////////////////////// -void Grid3D::getSubBlocksNorth(int ix1, int ix2, int ix3, int level,vector<Block3DPtr> &blockVector, int levelDepth) -{ - int x1W = ix1 << 1; - int x1E = x1W + 1; - int x2 = (ix2 << 1) + 1; - int x3B = ix3 << 1; - int x3T = x3B + 1; - int l = level + 1; - - Block3DPtr block = this->getBlock(x1W, x2, x3B, l); - if(block != NULL) blockVector.push_back(block); - else if(l < levelDepth) this->getSubBlocksNorth(x1W, x2, x3B, l, blockVector,levelDepth); - - block = this->getBlock(x1E, x2, x3B, l); - if(block != NULL) blockVector.push_back(block); - else if(l < levelDepth) this->getSubBlocksNorth(x1E, x2, x3B, l, blockVector,levelDepth); - - block = this->getBlock(x1W, x2, x3T, l); - if(block != NULL) blockVector.push_back(block); - else if(l < levelDepth) this->getSubBlocksNorth(x1W, x2, x3T, l, blockVector,levelDepth); - - block = this->getBlock(x1E, x2, x3T, l); - if(block != NULL) blockVector.push_back(block); - else if(l < levelDepth) this->getSubBlocksNorth(x1E, x2, x3T, l, blockVector,levelDepth); -} -////////////////////////////////////////////////////////////////////////// -void Grid3D::getSubBlocksSouth(int ix1, int ix2, int ix3, int level,vector<Block3DPtr> &blockVector, int levelDepth) -{ - int x1W = ix1 << 1; - int x1E = x1W + 1; - int x2 = ix2 << 1; - int x3B = ix3 << 1; - int x3T = x3B + 1; - int l = level + 1; - - Block3DPtr block = this->getBlock(x1W, x2, x3B, l); - if(block != NULL) blockVector.push_back(block); - else if(l < levelDepth) this->getSubBlocksSouth(x1W, x2, x3B, l, blockVector,levelDepth); - - block = this->getBlock(x1E, x2, x3B, l); - if(block != NULL) blockVector.push_back(block); - else if(l < levelDepth) this->getSubBlocksSouth(x1E, x2, x3B, l, blockVector,levelDepth); - - block = this->getBlock(x1W, x2, x3T, l); - if(block != NULL) blockVector.push_back(block); - else if(l < levelDepth) this->getSubBlocksSouth(x1W, x2, x3T, l, blockVector,levelDepth); - - block = this->getBlock(x1E, x2, x3T, l); - if(block != NULL) blockVector.push_back(block); - else if(l < levelDepth) this->getSubBlocksSouth(x1E, x2, x3T, l, blockVector,levelDepth); -} -////////////////////////////////////////////////////////////////////////// -void Grid3D::getSubBlocksTop(int ix1, int ix2, int ix3, int level,vector<Block3DPtr> &blockVector, int levelDepth) -{ - int x1W = ix1 << 1; - int x1E = x1W + 1; - int x2S = ix2 << 1; - int x2N = x2S + 1; - int x3 = (ix3 << 1) + 1; - int l = level + 1; - - Block3DPtr block = this->getBlock(x1W, x2N, x3, l); - if(block != NULL) blockVector.push_back(block); - else if(l < levelDepth) this->getSubBlocksTop(x1W, x2N, x3, l, blockVector,levelDepth); - - block = this->getBlock(x1E, x2N, x3, l); - if(block != NULL) blockVector.push_back(block); - else if(l < levelDepth) this->getSubBlocksTop(x1E, x2N, x3, l, blockVector,levelDepth); - - block = this->getBlock(x1W, x2S, x3, l); - if(block != NULL) blockVector.push_back(block); - else if(l < levelDepth) this->getSubBlocksTop(x1W, x2S, x3, l, blockVector,levelDepth); - - block = this->getBlock(x1E, x2S, x3, l); - if(block != NULL) blockVector.push_back(block); - else if(l < levelDepth) this->getSubBlocksTop(x1E, x2S, x3, l, blockVector,levelDepth); -} -////////////////////////////////////////////////////////////////////////// -void Grid3D::getSubBlocksBottom(int ix1, int ix2, int ix3, int level,vector<Block3DPtr> &blockVector, int levelDepth) -{ - int x1W = ix1 << 1; - int x1E = x1W + 1; - int x2S = ix2 << 1; - int x2N = x2S + 1; - int x3 = ix3 << 1; - int l = level + 1; - - Block3DPtr block = this->getBlock(x1W, x2N, x3, l); - if(block != NULL) blockVector.push_back(block); - else if(l < levelDepth) this->getSubBlocksBottom(x1W, x2N, x3, l, blockVector,levelDepth); - - block = this->getBlock(x1E, x2N, x3, l); - if(block != NULL) blockVector.push_back(block); - else if(l < levelDepth) this->getSubBlocksBottom(x1E, x2N, x3, l, blockVector,levelDepth); - - block = this->getBlock(x1W, x2S, x3, l); - if(block != NULL) blockVector.push_back(block); - else if(l < levelDepth) this->getSubBlocksBottom(x1W, x2S, x3, l, blockVector,levelDepth); - - block = this->getBlock(x1E, x2S, x3, l); - if(block != NULL) blockVector.push_back(block); - else if(l < levelDepth) this->getSubBlocksBottom(x1E, x2S, x3, l, blockVector,levelDepth); -} -////////////////////////////////////////////////////////////////////////// -// diagonals -////////////////////////////////////////////////////////////////////////// -void Grid3D::getSubBlocksNorthEast(int ix1, int ix2, int ix3, int level, vector<Block3DPtr>& blockVector, int levelDepth) -{ - int x1 = (ix1 << 1) + 1; - int x2 = (ix2 << 1) + 1; - int x3B = (ix3 << 1); - int x3T = x3B+1; - int l = level + 1; - - Block3DPtr blockB = this->getBlock(x1, x2, x3B, l); - if(blockB) blockVector.push_back(blockB); - else if(l < levelDepth) this->getSubBlocksNorthEast(x1, x2, x3B, l, blockVector, levelDepth); - - Block3DPtr blockT = this->getBlock(x1, x2, x3T, l); - if(blockT) blockVector.push_back(blockT); - else if(l < levelDepth) this->getSubBlocksNorthEast(x1, x2, x3T, l, blockVector, levelDepth); -} -////////////////////////////////////////////////////////////////////////// -void Grid3D::getSubBlocksNorthWest(int ix1, int ix2, int ix3, int level, vector<Block3DPtr>& blockVector, int levelDepth) -{ - int x1 = (ix1 << 1); - int x2 = (ix2 << 1) + 1; - int x3B = (ix3 << 1); - int x3T = x3B+1; - int l = level + 1; - - Block3DPtr blockB = this->getBlock(x1, x2,x3B, l); - if(blockB) blockVector.push_back(blockB); - else if(l < levelDepth) this->getSubBlocksNorthWest(x1, x2, x3B, l, blockVector, levelDepth); - - Block3DPtr blockT = this->getBlock(x1, x2,x3T, l); - if(blockT) blockVector.push_back(blockT); - else if(l < levelDepth) this->getSubBlocksNorthWest(x1, x2, x3T, l, blockVector, levelDepth); -} -////////////////////////////////////////////////////////////////////////// -void Grid3D::getSubBlocksSouthWest(int ix1, int ix2, int ix3, int level, vector<Block3DPtr>& blockVector, int levelDepth) -{ - int x1 = ix1 << 1; - int x2 = ix2 << 1; - int x3B = (ix3 << 1); - int x3T = x3B+1; - int l = level + 1; - - Block3DPtr blockB = this->getBlock(x1, x2,x3B, l); - if(blockB) blockVector.push_back(blockB); - else if(l < levelDepth) this->getSubBlocksSouthWest(x1, x2, x3B, l, blockVector, levelDepth); - - Block3DPtr blockT = this->getBlock(x1, x2,x3T, l); - if(blockT) blockVector.push_back(blockT); - else if(l < levelDepth) this->getSubBlocksSouthWest(x1, x2, x3T, l, blockVector, levelDepth); -} -////////////////////////////////////////////////////////////////////////// -void Grid3D::getSubBlocksSouthEast(int ix1, int ix2, int ix3, int level, vector<Block3DPtr>& blockVector, int levelDepth) -{ - int x1 = (ix1 << 1) + 1; - int x2 = ix2 << 1; - int x3B = (ix3 << 1); - int x3T = x3B+1; - int l = level + 1; - - Block3DPtr blockB = this->getBlock(x1, x2,x3B, l); - if(blockB) blockVector.push_back(blockB); - else if(l < levelDepth) this->getSubBlocksSouthEast(x1, x2, x3B, l, blockVector, levelDepth); - - Block3DPtr blockT = this->getBlock(x1, x2,x3T, l); - if(blockT) blockVector.push_back(blockT); - else if(l < levelDepth) this->getSubBlocksSouthEast(x1, x2, x3T, l, blockVector, levelDepth); -} -////////////////////////////////////////////////////////////////////////// -// diagonals -////////////////////////////////////////////////////////////////////////// -void Grid3D::getSubBlocksTopEast(int ix1, int ix2, int ix3, int level, vector<Block3DPtr>& blockVector, int levelDepth) -{ - int x1 = (ix1 << 1) + 1; - int x2S = (ix2 << 1); - int x2N = x2S + 1; - int x3 = (ix3 << 1)+1; - int l = level + 1; - - Block3DPtr blockN = this->getBlock(x1, x2N, x3, l); - if(blockN) blockVector.push_back(blockN); - else if(l < levelDepth) this->getSubBlocksTopEast(x1, x2N, x3, l, blockVector, levelDepth); - - Block3DPtr blockS = this->getBlock(x1, x2S, x3, l); - if(blockS) blockVector.push_back(blockS); - else if(l < levelDepth) this->getSubBlocksTopEast(x1, x2S, x3, l, blockVector, levelDepth); -} -////////////////////////////////////////////////////////////////////////// -void Grid3D::getSubBlocksTopWest(int ix1, int ix2, int ix3, int level, vector<Block3DPtr>& blockVector, int levelDepth) -{ - int x1 = ix1 << 1; - int x2S = ix2 << 1; - int x2N = x2S + 1; - int x3 = (ix3 << 1)+1; - int l = level + 1; - - Block3DPtr blockN = this->getBlock(x1, x2N, x3, l); - if(blockN) blockVector.push_back(blockN); - else if(l < levelDepth) this->getSubBlocksTopEast(x1, x2N, x3, l, blockVector, levelDepth); - - Block3DPtr blockS = this->getBlock(x1, x2S, x3, l); - if(blockS) blockVector.push_back(blockS); - else if(l < levelDepth) this->getSubBlocksTopEast(x1, x2S, x3, l, blockVector, levelDepth); -} -////////////////////////////////////////////////////////////////////////// -void Grid3D::getSubBlocksBottomEast(int ix1, int ix2, int ix3, int level, vector<Block3DPtr>& blockVector, int levelDepth) -{ - int x1 = (ix1 << 1) + 1; - int x2S = ix2 << 1; - int x2N = x2S + 1; - int x3 = ix3 << 1; - int l = level + 1; - - Block3DPtr blockN = this->getBlock(x1, x2N, x3, l); - if(blockN) blockVector.push_back(blockN); - else if(l < levelDepth) this->getSubBlocksTopEast(x1, x2N, x3, l, blockVector, levelDepth); - - Block3DPtr blockS = this->getBlock(x1, x2S, x3, l); - if(blockS) blockVector.push_back(blockS); - else if(l < levelDepth) this->getSubBlocksTopEast(x1, x2S, x3, l, blockVector, levelDepth); -} -////////////////////////////////////////////////////////////////////////// -void Grid3D::getSubBlocksBottomWest(int ix1, int ix2, int ix3, int level, vector<Block3DPtr>& blockVector, int levelDepth) -{ - int x1 = (ix1 << 1); - int x2S = (ix2 << 1); - int x2N = x2S + 1; - int x3 = ix3 << 1; - int l = level + 1; - - Block3DPtr blockN = this->getBlock(x1, x2N, x3, l); - if(blockN) blockVector.push_back(blockN); - else if(l < levelDepth) this->getSubBlocksTopEast(x1, x2N, x3, l, blockVector, levelDepth); - - Block3DPtr blockS = this->getBlock(x1, x2S, x3, l); - if(blockS) blockVector.push_back(blockS); - else if(l < levelDepth) this->getSubBlocksTopEast(x1, x2S, x3, l, blockVector, levelDepth); -} - -////////////////////////////////////////////////////////////////////////// -// edge-diagonals -////////////////////////////////////////////////////////////////////////// -void Grid3D::getSubBlocksTopNorth(int ix1, int ix2, int ix3, int level, vector<Block3DPtr>& blockVector, int levelDepth) -{ - int x1E = (ix1 << 1); - int x1W = x1E + 1; - int x2 = (ix2 << 1)+1; - int x3 = (ix3 << 1)+1; - int l = level + 1; - - Block3DPtr blockE = this->getBlock(x1E, x2, x3, l); - if(blockE) blockVector.push_back(blockE); - else if(l < levelDepth) this->getSubBlocksTopNorth(x1E, x2, x3, l, blockVector, levelDepth); - - Block3DPtr blockW = this->getBlock(x1W, x2, x3, l); - if(blockW) blockVector.push_back(blockW); - else if(l < levelDepth) this->getSubBlocksTopNorth(x1W, x2, x3, l, blockVector, levelDepth); -} -////////////////////////////////////////////////////////////////////////// -void Grid3D::getSubBlocksTopSouth(int ix1, int ix2, int ix3, int level, vector<Block3DPtr>& blockVector, int levelDepth) -{ - int x1E = (ix1 << 1); - int x1W = x1E + 1; - int x2 = (ix2 << 1); - int x3 = (ix3 << 1)+1; - int l = level + 1; - - Block3DPtr blockE = this->getBlock(x1E, x2, x3, l); - if(blockE) blockVector.push_back(blockE); - else if(l < levelDepth) this->getSubBlocksTopSouth(x1E, x2, x3, l, blockVector, levelDepth); - - Block3DPtr blockW = this->getBlock(x1W, x2, x3, l); - if(blockW) blockVector.push_back(blockW); - else if(l < levelDepth) this->getSubBlocksTopSouth(x1W, x2, x3, l, blockVector, levelDepth); -} -////////////////////////////////////////////////////////////////////////// -void Grid3D::getSubBlocksBottomNorth(int ix1, int ix2, int ix3, int level, vector<Block3DPtr>& blockVector, int levelDepth) -{ - int x1E = ix1 << 1; - int x1W = x1E + 1; - int x2 = (ix2 << 1)+1; - int x3 = ix3 << 1; - int l = level + 1; - - Block3DPtr blockE = this->getBlock(x1E, x2, x3, l); - if(blockE) blockVector.push_back(blockE); - else if(l < levelDepth) this->getSubBlocksBottomNorth(x1E, x2, x3, l, blockVector, levelDepth); - - Block3DPtr blockW = this->getBlock(x1W, x2, x3, l); - if(blockW) blockVector.push_back(blockW); - else if(l < levelDepth) this->getSubBlocksBottomNorth(x1W, x2, x3, l, blockVector, levelDepth); -} -////////////////////////////////////////////////////////////////////////// -void Grid3D::getSubBlocksBottomSouth(int ix1, int ix2, int ix3, int level, vector<Block3DPtr>& blockVector, int levelDepth) -{ - int x1E = (ix1 << 1); - int x1W = x1E + 1; - int x2 = ix2 << 1; - int x3 = ix3 << 1; - int l = level + 1; - - Block3DPtr blockE = this->getBlock(x1E, x2, x3, l); - if(blockE) blockVector.push_back(blockE); - else if(l < levelDepth) this->getSubBlocksBottomSouth(x1E, x2, x3, l, blockVector, levelDepth); - - Block3DPtr blockW = this->getBlock(x1W, x2, x3, l); - if(blockW) blockVector.push_back(blockW); - else if(l < levelDepth) this->getSubBlocksBottomSouth(x1W, x2, x3, l, blockVector, levelDepth); -} -////////////////////////////////////////////////////////////////////////// -// space-diagonals -////////////////////////////////////////////////////////////////////////// -void Grid3D::getSubBlocksTopNorthEast(int ix1, int ix2, int ix3, int level, std::vector<Block3DPtr>& blockVector, int levelDepth) -{ - int x1 = (ix1 << 1) + 1; - int x2 = (ix2 << 1) + 1; - int x3 = (ix3 << 1) + 1; - int l = level + 1; - - Block3DPtr blockTNE = this->getBlock(x1, x2, x3, l); - if(blockTNE) blockVector.push_back(blockTNE); - else if(l < levelDepth) this->getSubBlocksTopNorthEast(x1, x2, x3, l, blockVector, levelDepth); -} -////////////////////////////////////////////////////////////////////////// -void Grid3D::getSubBlocksTopNorthWest(int ix1, int ix2, int ix3, int level, std::vector<Block3DPtr>& blockVector, int levelDepth) -{ - int x1 = ix1 << 1; - int x2 = (ix2 << 1) + 1; - int x3 = (ix3 << 1) + 1; - int l = level + 1; - - Block3DPtr blockTNW = this->getBlock(x1, x2, x3, l); - if(blockTNW) blockVector.push_back(blockTNW); - else if(l < levelDepth) this->getSubBlocksTopNorthWest(x1, x2, x3, l, blockVector, levelDepth); -} -////////////////////////////////////////////////////////////////////////// -void Grid3D::getSubBlocksTopSouthEast(int ix1, int ix2, int ix3, int level, std::vector<Block3DPtr>& blockVector, int levelDepth) -{ - int x1 = (ix1 << 1) + 1; - int x2 = ix2 << 1; - int x3 = (ix3 << 1) + 1; - int l = level + 1; - - Block3DPtr blockTNW = this->getBlock(x1, x2, x3, l); - if(blockTNW) blockVector.push_back(blockTNW); - else if(l < levelDepth) this->getSubBlocksTopSouthEast(x1, x2, x3, l, blockVector, levelDepth); -} -////////////////////////////////////////////////////////////////////////// -void Grid3D::getSubBlocksTopSouthWest(int ix1, int ix2, int ix3, int level, std::vector<Block3DPtr>& blockVector, int levelDepth) -{ - int x1 = ix1 << 1; - int x2 = ix2 << 1; - int x3 = (ix3 << 1) + 1; - int l = level + 1; - - Block3DPtr blockTSW = this->getBlock(x1, x2, x3, l); - if(blockTSW) blockVector.push_back(blockTSW); - else if(l < levelDepth) this->getSubBlocksTopSouthWest(x1, x2, x3, l, blockVector, levelDepth); -} -////////////////////////////////////////////////////////////////////////// -void Grid3D::getSubBlocksBottomNorthEast(int ix1, int ix2, int ix3, int level, std::vector<Block3DPtr>& blockVector, int levelDepth) -{ - int x1 = (ix1 << 1) + 1; - int x2 = (ix2 << 1) + 1; - int x3 = ix3 << 1; - int l = level + 1; - - Block3DPtr blockBNE = this->getBlock(x1, x2, x3, l); - if(blockBNE) blockVector.push_back(blockBNE); - else if(l < levelDepth) this->getSubBlocksBottomNorthEast(x1, x2, x3, l, blockVector, levelDepth); -} -////////////////////////////////////////////////////////////////////////// -void Grid3D::getSubBlocksBottomNorthWest(int ix1, int ix2, int ix3, int level, std::vector<Block3DPtr>& blockVector, int levelDepth) -{ - int x1 = ix1 << 1; - int x2 = (ix2 << 1) + 1; - int x3 = ix3 << 1; - int l = level + 1; - - Block3DPtr blockBNW = this->getBlock(x1, x2, x3, l); - if(blockBNW) blockVector.push_back(blockBNW); - else if(l < levelDepth) this->getSubBlocksBottomNorthWest(x1, x2, x3, l, blockVector, levelDepth); -} -////////////////////////////////////////////////////////////////////////// -void Grid3D::getSubBlocksBottomSouthEast(int ix1, int ix2, int ix3, int level, std::vector<Block3DPtr>& blockVector, int levelDepth) -{ - int x1 = (ix1 << 1) + 1; - int x2 = ix2 << 1; - int x3 = ix3 << 1; - int l = level + 1; - - Block3DPtr blockBSE = this->getBlock(x1, x2, x3, l); - if(blockBSE) blockVector.push_back(blockBSE); - else if(l < levelDepth) this->getSubBlocksBottomSouthEast(x1, x2, x3, l, blockVector, levelDepth); -} -////////////////////////////////////////////////////////////////////////// -void Grid3D::getSubBlocksBottomSouthWest(int ix1, int ix2, int ix3, int level, std::vector<Block3DPtr>& blockVector, int levelDepth) -{ - int x1 = ix1 << 1; - int x2 = ix2 << 1; - int x3 = ix3 << 1; - int l = level + 1; - - Block3DPtr blockBSW = this->getBlock(x1, x2, x3, l); - if(blockBSW) blockVector.push_back(blockBSW); - else if(l < levelDepth) this->getSubBlocksBottomSouthWest(x1, x2, x3, l, blockVector, levelDepth); -} -////////////////////////////////////////////////////////////////////////// -void Grid3D::getBlocks(int level, std::vector<Block3DPtr>& blockVector) -{ - for(Block3DMap::value_type b : levelSet[level]) - { - blockVector.push_back(b.second); - } -} -////////////////////////////////////////////////////////////////////////// -void Grid3D::getBlocks(int level, int rank, std::vector<Block3DPtr>& blockVector) -{ - for(Block3DMap::value_type b : levelSet[level]) - { - Block3DPtr block = b.second; - int blockRank = block->getRank(); - if (blockRank == rank) - { - blockVector.push_back(b.second); - } - } -} -////////////////////////////////////////////////////////////////////////// -void Grid3D::getBlocks(int level, int rank, bool active, std::vector<Block3DPtr>& blockVector) -{ - for(Block3DMap::value_type b : levelSet[level]) - { - Block3DPtr block = b.second; - int blockRank = block->getRank(); - - if (blockRank == rank && active ? block->isActive() : block->isNotActive()) - { - blockVector.push_back(b.second); - } - } -} -////////////////////////////////////////////////////////////////////////// -int Grid3D::getFinestInitializedLevel() -{ - for(int i=Grid3DSystem::MAXLEVEL; i>=0; i--) if(this->levelSet[i].size() > 0) return(i); - return(-1); -} -////////////////////////////////////////////////////////////////////////// -int Grid3D::getCoarsestInitializedLevel() -{ - for(int i=0; i<=Grid3DSystem::MAXLEVEL; i++) if(this->levelSet[i].size() > 0) return(i); - return(-1); -} -////////////////////////////////////////////////////////////////////////// -void Grid3D::setNX1(int nx1) -{ - this->nx1 = nx1; -} -////////////////////////////////////////////////////////////////////////// -void Grid3D::setNX2(int nx2) -{ - this->nx2 = nx2; -} -////////////////////////////////////////////////////////////////////////// -void Grid3D::setNX3(int nx3) -{ - this->nx3 = nx3; -} -////////////////////////////////////////////////////////////////////////// -int Grid3D::getNX1() const -{ - return this->nx1; -} -////////////////////////////////////////////////////////////////////////// -int Grid3D::getNX2() const -{ - return this->nx2; -} -////////////////////////////////////////////////////////////////////////// -int Grid3D::getNX3() const -{ - return this->nx3; -} -////////////////////////////////////////////////////////////////////////// -void Grid3D::deleteBlocks( const std::vector<int>& ids ) -{ - for(int i : ids) - { - Block3DPtr block = getBlock(i); - if(block) this->deleteBlock(block); - } -} -////////////////////////////////////////////////////////////////////////// -int Grid3D::getNumberOfBlocks() -{ - int c = 0; - for(Block3DMap l : levelSet) - { - c += (int)l.size(); - } - return c; -} -////////////////////////////////////////////////////////////////////////// -int Grid3D::getNumberOfBlocks(int level) -{ - return (int)levelSet[level].size(); -} -////////////////////////////////////////////////////////////////////////// -void Grid3D::getBlocksByCuboid( double minX1, double minX2, double minX3, double maxX1, double maxX2, double maxX3, std::vector<Block3DPtr>& blocks ) -{ - int coarsestLevel = this->getCoarsestInitializedLevel(); - int finestLevel = this->getFinestInitializedLevel(); - - ////////////////////////////////////////////////////////////////////////// - //MINIMALE BLOCK-INDIZES BESTIMMEN - // - //min: - double dMinX1 = trafo->transformForwardToX1Coordinate( minX1,minX2,minX3 )*(1<<finestLevel); - double dMinX2 = trafo->transformForwardToX2Coordinate( minX1,minX2,minX3 )*(1<<finestLevel); - double dMinX3 = trafo->transformForwardToX3Coordinate( minX1,minX2,minX3 )*(1<<finestLevel); - - //Achtung, wenn minX1 genau auf grenze zwischen zwei bloecken -> der "kleinere" muss genommen werden, - //da beim Transformieren der "groessere" Index rauskommt - int iMinX1 = (int)dMinX1; if( UbMath::zero(dMinX1-iMinX1) ) iMinX1-=1; - int iMinX2 = (int)dMinX2; if( UbMath::zero(dMinX2-iMinX2) ) iMinX2-=1; - int iMinX3 = (int)dMinX3; if( UbMath::zero(dMinX3-iMinX3) ) iMinX3-=1; - - //max (hier kann die Zusatzabfrage vernachlaessigt werden): - int iMaxX1 = (int)(trafo->transformForwardToX1Coordinate( maxX1,maxX2,maxX3 )*(1<<finestLevel)); - int iMaxX2 = (int)(trafo->transformForwardToX2Coordinate( maxX1,maxX2,maxX3 )*(1<<finestLevel)); - int iMaxX3 = (int)(trafo->transformForwardToX3Coordinate( maxX1,maxX2,maxX3 )*(1<<finestLevel)); - - Block3DPtr block; - - //set, um doppelte bloecke zu vermeiden, die u.U. bei periodic auftreten koennen - std::set<Block3DPtr> blockset; - for(int level=coarsestLevel; level<=finestLevel; level++) - { - //damit bei negativen werten auch der "kleinere" genommen wird -> floor! - int minx1 = (int)std::floor( (double)iMinX1/(1<<(finestLevel-level)) ); - int minx2 = (int)std::floor( (double)iMinX2/(1<<(finestLevel-level)) ); - int minx3 = (int)std::floor( (double)iMinX3/(1<<(finestLevel-level)) ); - - int maxx1 = iMaxX1/(1<<(finestLevel-level)); - int maxx2 = iMaxX2/(1<<(finestLevel-level)); - int maxx3 = iMaxX3/(1<<(finestLevel-level)); - - for(int ix1=minx1; ix1<=maxx1; ix1++) - for(int ix2=minx2; ix2<=maxx2; ix2++) - for(int ix3=minx3; ix3<=maxx3; ix3++) - if( (block=this->getBlock(ix1,ix2,ix3,level)) ) - { - if (block->getRank() == rank) - { - blockset.insert(block); - } - } - } - - blocks.resize(blockset.size()); - std::copy(blockset.begin(), blockset.end(), blocks.begin()); -} -////////////////////////////////////////////////////////////////////////// -void Grid3D::getBlocksByCuboid( int level, double minX1, double minX2, double minX3, double maxX1, double maxX2, double maxX3, std::vector<Block3DPtr>& blocks ) -{ - ////////////////////////////////////////////////////////////////////////// - //MINIMALE BLOCK-INDIZES BESTIMMEN - // - //min: - double dMinX1 = trafo->transformForwardToX1Coordinate( minX1,minX2,minX3 )*(1<<level); - double dMinX2 = trafo->transformForwardToX2Coordinate( minX1,minX2,minX3 )*(1<<level); - double dMinX3 = trafo->transformForwardToX3Coordinate( minX1,minX2,minX3 )*(1<<level); - - //Achtung, wenn minX1 genau auf grenze zwischen zwei bloecken -> der "kleinere" muss genommen werden: - int iMinX1 = (int)dMinX1; if( UbMath::zero(dMinX1-iMinX1) ) iMinX1-=1; - int iMinX2 = (int)dMinX2; if( UbMath::zero(dMinX2-iMinX2) ) iMinX2-=1; - int iMinX3 = (int)dMinX3; if( UbMath::zero(dMinX3-iMinX3) ) iMinX3-=1; - - //max: - int iMaxX1 = (int)(trafo->transformForwardToX1Coordinate( maxX1,maxX2,maxX3 )*(1<<level)); - int iMaxX2 = (int)(trafo->transformForwardToX2Coordinate( maxX1,maxX2,maxX3 )*(1<<level)); - int iMaxX3 = (int)(trafo->transformForwardToX3Coordinate( maxX1,maxX2,maxX3 )*(1<<level)); - - - //set, um doppelte bloecke zu vermeiden, die u.U. bei periodic auftreten koennen - std::set<Block3DPtr> blockset; - Block3DPtr block; - - for(int ix1=iMinX1; ix1<=iMaxX1; ix1++) - for(int ix2=iMinX2; ix2<=iMaxX2; ix2++) - for(int ix3=iMinX3; ix3<=iMaxX3; ix3++) - if( (block=this->getBlock(ix1,ix2,ix3,level)) ) - { - if (block->getRank() == rank) - { - blockset.insert(block); - } - } - - blocks.resize(blockset.size()); - std::copy(blockset.begin(), blockset.end(), blocks.begin()); -} -////////////////////////////////////////////////////////////////////////// -void Grid3D::calcStartCoordinatesAndDelta(Block3DPtr block, double& worldX1, double& worldX2, double& worldX3, double& deltaX) -{ - int blocklevel = block->getLevel(); - worldX1 = block->getX1()/(float)(1<<blocklevel); - worldX2 = block->getX2()/(float)(1<<blocklevel); - worldX3 = block->getX3()/(float)(1<<blocklevel); - deltaX = (double)1.0/(double)(this->blockNx1*(double)(1<<blocklevel)); - - if(this->trafo) - { - double x1tmp = worldX1, x2tmp = worldX2, x3tmp = worldX3; - worldX1 = this->trafo->transformBackwardToX1Coordinate(x1tmp, x2tmp, x3tmp); - worldX2 = this->trafo->transformBackwardToX2Coordinate(x1tmp, x2tmp, x3tmp); - worldX3 = this->trafo->transformBackwardToX3Coordinate(x1tmp, x2tmp, x3tmp); - deltaX = this->trafo->getX1CoordinateScaling()/(double)(this->blockNx1*(double)(1<<blocklevel)); - } -} -////////////////////////////////////////////////////////////////////////// -void Grid3D::calcStartCoordinatesWithOutOverlap(Block3DPtr block, double& worldX1, double& worldX2, double& worldX3) -{ - int blocklevel = block->getLevel(); - worldX1 = block->getX1()/(float)(1<<blocklevel); - worldX2 = block->getX2()/(float)(1<<blocklevel); - worldX3 = block->getX3()/(float)(1<<blocklevel); - - if(this->trafo) - { - double x1tmp = worldX1, x2tmp = worldX2, x3tmp = worldX3; - worldX1 = this->trafo->transformBackwardToX1Coordinate(x1tmp, x2tmp, x3tmp); - worldX2 = this->trafo->transformBackwardToX2Coordinate(x1tmp, x2tmp, x3tmp); - worldX3 = this->trafo->transformBackwardToX3Coordinate(x1tmp, x2tmp, x3tmp); - } -} -////////////////////////////////////////////////////////////////////////// -void Grid3D::setTimeStep( double step ) -{ - timeStep = step; -} -////////////////////////////////////////////////////////////////////////// -double Grid3D::getTimeStep() const -{ - return timeStep; -} -////////////////////////////////////////////////////////////////////////// -void Grid3D::fillExtentWithBlocks( UbTupleInt3 minInd, UbTupleInt3 maxInd ) -{ - for(int x3 = val<3>(minInd); x3 < val<3>(maxInd); x3++) - { - for(int x2 = val<2>(minInd); x2 < val<2>(maxInd); x2++) - { - for(int x1 = val<1>(minInd); x1 < val<1>(maxInd); x1++) - { - Block3DPtr block( new Block3D(x1,x2,x3,0) ); - this->addBlock(block); - } - } - } -} -////////////////////////////////////////////////////////////////////////// -//void Grid3D::notifyObservers( double step ) -//{ -// for(ObserverPtr o, observers) -// { -// o->update(step); -// } -// -// //std::list<ObserverWeakPtr>::iterator iter = observers.begin(); -// -// //GridObserversSet::iterator iter = observers.begin(); -// //while(iter != observers.end()) -// //{ -// // if ((*iter).expired()) -// // { -// // iter = observers.erase(iter); -// // } -// // else -// // { -// // ObserverPtr observer = (*iter).lock(); // create a shared_ptr from the weak_ptr -// // observer->update(step); -// // ++iter; -// // } -// //} -// -//} -////////////////////////////////////////////////////////////////////////// -//void Grid3D::addObserver( ObserverPtr observer ) -//{ -// observers.insert(observer); -// //observers.push_back(observer); -//} -//////////////////////////////////////////////////////////////////////////// -//void Grid3D::removeObserver( ObserverPtr observer ) -//{ -// observers.erase(observer); -// //observers.remove(observer); -//} -////////////////////////////////////////////////////////////////////////// -void Grid3D::deleteBlockIDs() -{ - this->blockIdMap.clear(); -} -////////////////////////////////////////////////////////////////////////// -void Grid3D::renumberBlockIDs() -{ - deleteBlockIDs(); - - int startLevel = getCoarsestInitializedLevel(); - int stopLevel = getFinestInitializedLevel(); - int counter = 0; - - for (int l = startLevel; l <= stopLevel; l++) - { - std::vector<Block3DPtr> blockVector; - getBlocks(l, blockVector); - for(Block3DPtr block : blockVector) - { - block->setGlobalID(counter); - blockIdMap.insert(std::make_pair(counter, block)); - Block3D::setMaxGlobalID(counter); - counter++; - } - } -} - - -////////////////////////////////////////////////////////////////////////// -void Grid3D::updateDistributedBlocks(CommunicatorPtr comm) -{ - - std::vector<int> blocks; - - if (comm->isRoot()) - { - int startLevel = getCoarsestInitializedLevel(); - int stopLevel = getFinestInitializedLevel(); - - for (int l = startLevel; l <= stopLevel; l++) - { - std::vector<Block3DPtr> blockVector; - getBlocks(l, blockVector); - for(Block3DPtr block : blockVector) - { - blocks.push_back(block->getX1()); - blocks.push_back(block->getX2()); - blocks.push_back(block->getX3()); - blocks.push_back(l); - blocks.push_back(block->getGlobalID()); - } - } - } - - comm->broadcast(blocks); - - if (!comm->isRoot()) - { - int startLevel = getCoarsestInitializedLevel(); - int stopLevel = getFinestInitializedLevel(); - - blockIdMap.clear(); - - for (int l = startLevel; l<=stopLevel; l++) - { - levelSet[l].clear(); - } - this->levelSet.clear(); - levelSet.resize(Grid3DSystem::MAXLEVEL+1); - - int rsize = (int)blocks.size(); - for (int i = 0; i < rsize; i+=5) - { - Block3DPtr block(new Block3D(blocks[i], blocks[i+1], blocks[i+2], blocks[i+3])); - block->setGlobalID(blocks[i+4]); - this->addBlock(block); - } - - } - -} - -////////////////////////////////////////////////////////////////////////// diff --git a/src/VirtualFluids/Grid/Grid3D.h b/src/VirtualFluids/Grid/Grid3D.h deleted file mode 100644 index 55af26e45..000000000 --- a/src/VirtualFluids/Grid/Grid3D.h +++ /dev/null @@ -1,283 +0,0 @@ -#ifndef GRID3D_H -#define GRID3D_H - -#include <vector> -#include <map> -#include <memory> - -#include <boost/signals2/signal.hpp> -#include <boost/serialization/vector.hpp> - -#include <VirtualFluidsBasics/basics/utilities/Vector3D.h> -#include <VirtualFluidsBasics/basics/utilities/UbTuple.h> -#include <VirtualFluidsBasics/basics/utilities/UbKeys.h> - -#include <VirtualFluidsDefinitions.h> - -class CoordinateTransformation3D; - -class Grid3D; -typedef std::shared_ptr<Grid3D> Grid3DPtr; -typedef std::weak_ptr<Grid3D> Grid3DWeakPtr; - -#include <Block3DVisitor.h> -#include <Grid3DVisitor.h> - -class Communicator; -class Block3D; -class Interactor3D; -//class Grid3DVisitor; - -#define OFFSET 0.5 - -////////////////////////////////////////////////////////////////////////// -class VF_PUBLIC Grid3D : public std::enable_shared_from_this<Grid3D> -{ -public: - typedef UbKeys::Key3<int> Block3DKey; - typedef std::map< Block3DKey, std::shared_ptr<Block3D> > Block3DMap; - typedef std::map< int, std::shared_ptr<Block3D> > BlockIDMap; - typedef std::vector<Block3DMap> LevelSet; - typedef std::vector<std::shared_ptr<Interactor3D> > Interactor3DSet; - //typedef std::set<ObserverPtr> GridObserversSet; - - typedef boost::signals2::signal<void (double)> signal_t; - typedef boost::signals2::connection connection_t; - -public: - Grid3D(); - Grid3D(std::shared_ptr<Communicator> comm); - Grid3D(std::shared_ptr<Communicator> comm, int blockNx1, int blockNx2, int blockNx3, int gridNx1, int gridNx2, int gridNx3); - virtual ~Grid3D(){} - ////////////////////////////////////////////////////////////////////////// - //blocks control - void addBlock(std::shared_ptr<Block3D> block); - bool deleteBlock(std::shared_ptr<Block3D> block); - bool deleteBlock(int ix1, int ix2, int ix3, int level); - void deleteBlocks(const std::vector<int>& ids); - void replaceBlock(std::shared_ptr<Block3D> block); - std::shared_ptr<Block3D> getBlock(int ix1, int ix2, int ix3, int level) const; - std::shared_ptr<Block3D> getBlock(int id) const; - void getBlocksByCuboid(double minX1, double minX2, double minX3, - double maxX1, double maxX2, double maxX3, - std::vector<std::shared_ptr<Block3D>>& blocks); - void getBlocksByCuboid(int level, double minX1, double minX2, double minX3, - double maxX1, double maxX2, double maxX3, - std::vector<std::shared_ptr<Block3D>>& blocks); - //!get blocks for level - void getBlocks(int level, std::vector<std::shared_ptr<Block3D>>& blockVector); - //!get blocks for level with current rank - void getBlocks(int level, int rank, std::vector<std::shared_ptr<Block3D>>& blockVector); - //!get only active or not active blocks - void getBlocks(int level, int rank, bool active, std::vector<std::shared_ptr<Block3D>>& blockVector); - int getNumberOfBlocks(); - int getNumberOfBlocks(int level); - //const Block3DMap& getBlocks(int level); - const BlockIDMap& getBlockIDs(); - void deleteBlockIDs(); - void renumberBlockIDs(); - void updateDistributedBlocks(std::shared_ptr<Communicator> comm); - std::shared_ptr<Block3D> getSuperBlock(std::shared_ptr<Block3D> block); - std::shared_ptr<Block3D> getSuperBlock(int ix1, int ix2, int ix3, int level); - void getSubBlocks(std::shared_ptr<Block3D> block, int levelDepth, std::vector<std::shared_ptr<Block3D>>& blocks); - void getSubBlocks(int ix1, int ix2, int ix3, int level, int levelDepth, std::vector<std::shared_ptr<Block3D>>& blockVector); - std::shared_ptr<Block3D> getNeighborBlock(int dir, int ix1, int ix2, int ix3, int level) const; - std::shared_ptr<Block3D> getNeighborBlock(int dir, std::shared_ptr<Block3D> block) const; - bool expandBlock(int ix1, int ix2, int ix3, int level); - std::shared_ptr<Block3D> collapseBlock(int fix1, int fix2, int fix3, int flevel, int levelDepth); - void getAllNeighbors(int ix1, int ix2, int ix3, int level, int levelDepth, std::vector<std::shared_ptr<Block3D>>& blocks); - void getAllNeighbors(std::shared_ptr<Block3D> block, int level, int levelDepth, std::vector<std::shared_ptr<Block3D>>& blocks); - void getNeighborBlocksForDirection(int dir, int ix1, int ix2, int ix3, int level, int levelDepth, std::vector<std::shared_ptr<Block3D>>& blocks); - void getNeighborBlocksForDirectionWithDirZero(int dir, int ix1, int ix2, int ix3, int level, int levelDepth, std::vector<std::shared_ptr<Block3D>>& blocks); - - void getNeighborsZero(int ix1, int ix2, int ix3, int level, int levelDepth, std::vector<std::shared_ptr<Block3D>>& blocks); - void getNeighborsNorth(int ix1, int ix2, int ix3, int level, int levelDepth, std::vector<std::shared_ptr<Block3D>>& blocks); - void getNeighborsSouth(int ix1, int ix2, int ix3, int level, int levelDepth, std::vector<std::shared_ptr<Block3D>>& blocks); - void getNeighborsEast(int ix1, int ix2, int ix3, int level, int levelDepth, std::vector<std::shared_ptr<Block3D>>& blocks); - void getNeighborsWest(int ix1, int ix2, int ix3, int level, int levelDepth, std::vector<std::shared_ptr<Block3D>>& blocks); - void getNeighborsTop(int ix1, int ix2, int ix3, int level, int levelDepth, std::vector<std::shared_ptr<Block3D>>& blocks); - void getNeighborsBottom(int ix1, int ix2, int ix3, int level, int levelDepth, std::vector<std::shared_ptr<Block3D>>& blocks); - - void getNeighborsNorthWest(int ix1, int ix2, int ix3, int level, int levelDepth, std::vector<std::shared_ptr<Block3D>>& blocks); - void getNeighborsNorthEast(int ix1, int ix2, int ix3, int level, int levelDepth, std::vector<std::shared_ptr<Block3D>>& blocks); - void getNeighborsSouthWest(int ix1, int ix2, int ix3, int level, int levelDepth, std::vector<std::shared_ptr<Block3D>>& blocks); - void getNeighborsSouthEast(int ix1, int ix2, int ix3, int level, int levelDepth, std::vector<std::shared_ptr<Block3D>>& blocks); - - void getNeighborsTopNorth(int ix1, int ix2, int ix3, int level, int levelDepth, std::vector<std::shared_ptr<Block3D>>& blocks); - void getNeighborsTopSouth(int ix1, int ix2, int ix3, int level, int levelDepth, std::vector<std::shared_ptr<Block3D>>& blocks); - void getNeighborsTopEast(int ix1, int ix2, int ix3, int level, int levelDepth, std::vector<std::shared_ptr<Block3D>>& blocks); - void getNeighborsTopWest(int ix1, int ix2, int ix3, int level, int levelDepth, std::vector<std::shared_ptr<Block3D>>& blocks); - - void getNeighborsBottomNorth(int ix1, int ix2, int ix3, int level, int levelDepth, std::vector<std::shared_ptr<Block3D>>& blocks); - void getNeighborsBottomSouth(int ix1, int ix2, int ix3, int level, int levelDepth, std::vector<std::shared_ptr<Block3D>>& blocks); - void getNeighborsBottomEast(int ix1, int ix2, int ix3, int level, int levelDepth, std::vector<std::shared_ptr<Block3D>>& blocks); - void getNeighborsBottomWest(int ix1, int ix2, int ix3, int level, int levelDepth, std::vector<std::shared_ptr<Block3D>>& blocks); - - void getNeighborsTopNorthEast(int ix1, int ix2, int ix3, int level, int levelDepth, std::vector<std::shared_ptr<Block3D>>& blocks); - void getNeighborsTopNorthWest(int ix1, int ix2, int ix3, int level, int levelDepth, std::vector<std::shared_ptr<Block3D>>& blocks); - void getNeighborsTopSouthEast(int ix1, int ix2, int ix3, int level, int levelDepth, std::vector<std::shared_ptr<Block3D>>& blocks); - void getNeighborsTopSouthWest(int ix1, int ix2, int ix3, int level, int levelDepth, std::vector<std::shared_ptr<Block3D>>& blocks); - void getNeighborsBottomNorthEast(int ix1, int ix2, int ix3, int level, int levelDepth, std::vector<std::shared_ptr<Block3D>>& blocks); - void getNeighborsBottomNorthWest(int ix1, int ix2, int ix3, int level, int levelDepth, std::vector<std::shared_ptr<Block3D>>& blocks); - void getNeighborsBottomSouthEast(int ix1, int ix2, int ix3, int level, int levelDepth, std::vector<std::shared_ptr<Block3D>>& blocks); - void getNeighborsBottomSouthWest(int ix1, int ix2, int ix3, int level, int levelDepth, std::vector<std::shared_ptr<Block3D>>& blocks); - ////////////////////////////////////////////////////////////////////////// - //level control - int getFinestInitializedLevel(); - int getCoarsestInitializedLevel(); - ////////////////////////////////////////////////////////////////////////// - void deleteConnectors(); - ////////////////////////////////////////////////////////////////////////// - //interactors control - void addInteractor(std::shared_ptr<Interactor3D> interactor); - void addAndInitInteractor(std::shared_ptr<Interactor3D> interactor, double timestep=0); - Interactor3DSet getInteractors(); - ////////////////////////////////////////////////////////////////////////// - //visitors - void accept(Block3DVisitor& blockVisitor); - void accept(Grid3DVisitor& gridVisitor); - void accept(std::shared_ptr<Grid3DVisitor> gridVisitor); - ////////////////////////////////////////////////////////////////////////// - //post processing - connection_t connect(signal_t::slot_function_type subscriber); - void disconnect(connection_t subscriber); - void coProcess(double step); - ////////////////////////////////////////////////////////////////////////// - //bundle and rank for distributed memory - void setBundle(int bundle); - int getBundle() const; - int getRank() const; - void setRank(int rank); - ////////////////////////////////////////////////////////////////////////// - //periodic boundary - bool isPeriodicX1() const; - bool isPeriodicX2() const; - bool isPeriodicX3() const; - void setPeriodicX1(bool value); - void setPeriodicX2(bool value); - void setPeriodicX3(bool value); - ////////////////////////////////////////////////////////////////////////// - //Topology - UbTupleInt3 getBlockIndexes(double blockX1Coord, double blockX2Coord, double blockX3Coord) const; - UbTupleInt3 getBlockIndexes(double blockX1Coord, double blockX2Coord, double blockX3Coord, int level) const; - UbTupleDouble3 getBlockLengths(std::shared_ptr<Block3D> block) const; - UbTupleDouble6 getBlockOversize() const ; - void setCoordinateTransformator(std::shared_ptr<CoordinateTransformation3D> trafo); - const std::shared_ptr<CoordinateTransformation3D> getCoordinateTransformator() const ; - void setDeltaX(double dx); - void setDeltaX(double worldUnit, double gridUnit); - double getDeltaX(int level) const; - double getDeltaX(std::shared_ptr<Block3D> block) const; - UbTupleDouble3 getNodeOffset(std::shared_ptr<Block3D> block) const ; - Vector3D getNodeCoordinates(std::shared_ptr<Block3D> block, int ix1, int ix2, int ix3) const; - UbTupleInt3 getNodeIndexes(std::shared_ptr<Block3D> block, double nodeX1Coord, double nodeX2Coord, double nodeX3Coord) const; - void setBlockNX(int nx1, int nx2, int nx3); - UbTupleInt3 getBlockNX() const; - UbTupleDouble3 getBlockWorldCoordinates(std::shared_ptr<Block3D> block) const; - UbTupleDouble3 getBlockWorldCoordinates(int blockX1Index, int blockX2Index, int blockX3Index, int level) const; - void setNX1(int nx1); - void setNX2(int nx2); - void setNX3(int nx3); - int getNX1() const; - int getNX2() const; - int getNX3() const; - void calcStartCoordinatesAndDelta(std::shared_ptr<Block3D> block, double& worldX1, double& worldX2, double& worldX3, double& deltaX); - void calcStartCoordinatesWithOutOverlap(std::shared_ptr<Block3D> block, double& worldX1, double& worldX2, double& worldX3); - ////////////////////////////////////////////////////////////////////////// - //LBM - //double getDeltaT(std::shared_ptr<Block3D>) const; - ////////////////////////////////////////////////////////////////////////// - void setTimeStep(double step); - double getTimeStep() const; - -protected: - void checkLevel(int level); - bool hasLevel(int level) const; - - void fillExtentWithBlocks( UbTupleInt3 minInd, UbTupleInt3 maxInd ); - - void getSubBlocksZero(int ix1, int ix2, int ix3, int level,std::vector<std::shared_ptr<Block3D>>& blockVector, int levelDepth); - - void getSubBlocksEast(int ix1, int ix2, int ix3, int level, std::vector<std::shared_ptr<Block3D>>& blockVector, int levelDepth); - void getSubBlocksWest(int ix1, int ix2, int ix3, int level, std::vector<std::shared_ptr<Block3D>>& blockVector, int levelDepth); - void getSubBlocksNorth(int ix1, int ix2, int ix3, int level, std::vector<std::shared_ptr<Block3D>>& blockVector, int levelDepth); - void getSubBlocksSouth(int ix1, int ix2, int ix3, int level, std::vector<std::shared_ptr<Block3D>>& blockVector, int levelDepth); - void getSubBlocksTop(int ix1, int ix2, int ix3, int level, std::vector<std::shared_ptr<Block3D>>& blockVector, int levelDepth); - void getSubBlocksBottom(int ix1, int ix2, int ix3, int level, std::vector<std::shared_ptr<Block3D>>& blockVector, int levelDepth); - - void getSubBlocksSouthEast(int ix1, int ix2, int ix3, int level, std::vector<std::shared_ptr<Block3D>>& blockVector, int levelDepth); - void getSubBlocksSouthWest(int ix1, int ix2, int ix3, int level, std::vector<std::shared_ptr<Block3D>>& blockVector, int levelDepth); - void getSubBlocksNorthEast(int ix1, int ix2, int ix3, int level, std::vector<std::shared_ptr<Block3D>>& blockVector, int levelDepth); - void getSubBlocksNorthWest(int ix1, int ix2, int ix3, int level, std::vector<std::shared_ptr<Block3D>>& blockVector, int levelDepth); - - void getSubBlocksTopEast(int ix1, int ix2, int ix3, int level, std::vector<std::shared_ptr<Block3D>>& blockVector, int levelDepth); - void getSubBlocksTopWest(int ix1, int ix2, int ix3, int level, std::vector<std::shared_ptr<Block3D>>& blockVector, int levelDepth); - void getSubBlocksTopNorth(int ix1, int ix2, int ix3, int level, std::vector<std::shared_ptr<Block3D>>& blockVector, int levelDepth); - void getSubBlocksTopSouth(int ix1, int ix2, int ix3, int level, std::vector<std::shared_ptr<Block3D>>& blockVector, int levelDepth); - - void getSubBlocksBottomEast(int ix1, int ix2, int ix3, int level, std::vector<std::shared_ptr<Block3D>>& blockVector, int levelDepth); - void getSubBlocksBottomWest(int ix1, int ix2, int ix3, int level, std::vector<std::shared_ptr<Block3D>>& blockVector, int levelDepth); - void getSubBlocksBottomNorth(int ix1, int ix2, int ix3, int level, std::vector<std::shared_ptr<Block3D>>& blockVector, int levelDepth); - void getSubBlocksBottomSouth(int ix1, int ix2, int ix3, int level, std::vector<std::shared_ptr<Block3D>>& blockVector, int levelDepth); - - void getSubBlocksTopNorthEast(int ix1, int ix2, int ix3, int level, std::vector<std::shared_ptr<Block3D>>& blockVector, int levelDepth); - void getSubBlocksTopNorthWest(int ix1, int ix2, int ix3, int level, std::vector<std::shared_ptr<Block3D>>& blockVector, int levelDepth); - void getSubBlocksTopSouthEast(int ix1, int ix2, int ix3, int level, std::vector<std::shared_ptr<Block3D>>& blockVector, int levelDepth); - void getSubBlocksTopSouthWest(int ix1, int ix2, int ix3, int level, std::vector<std::shared_ptr<Block3D>>& blockVector, int levelDepth); - void getSubBlocksBottomNorthEast(int ix1, int ix2, int ix3, int level, std::vector<std::shared_ptr<Block3D>>& blockVector, int levelDepth); - void getSubBlocksBottomNorthWest(int ix1, int ix2, int ix3, int level, std::vector<std::shared_ptr<Block3D>>& blockVector, int levelDepth); - void getSubBlocksBottomSouthEast(int ix1, int ix2, int ix3, int level, std::vector<std::shared_ptr<Block3D>>& blockVector, int levelDepth); - void getSubBlocksBottomSouthWest(int ix1, int ix2, int ix3, int level, std::vector<std::shared_ptr<Block3D>>& blockVector, int levelDepth); - -private: - LevelSet levelSet; - BlockIDMap blockIdMap; - Interactor3DSet interactors; - //GridObserversSet observers; - - signal_t sig; - int rank; - int bundle; - - bool periodicX1; - bool periodicX2; - bool periodicX3; - - int blockNx1; - int blockNx2; - int blockNx3; - - int nx1; - int nx2; - int nx3; - - std::shared_ptr<CoordinateTransformation3D> trafo; - double orgDeltaX; - - double timeStep; - - friend class boost::serialization::access; - template<class Archive> - void serialize(Archive & ar, const unsigned int version) - { - ar & nx1; - ar & nx2; - ar & nx3; - ar & orgDeltaX; - ar & trafo; - ar & blockNx1; - ar & blockNx2; - ar & blockNx3; - ar & rank; - ar & bundle; - ar & periodicX1; - ar & periodicX2; - ar & periodicX3; - ar & levelSet; - ar & blockIdMap; - ar & timeStep; - ar & interactors; - } -}; - -#endif diff --git a/src/VirtualFluids/Grid/Grid3DSystem.cpp b/src/VirtualFluids/Grid/Grid3DSystem.cpp deleted file mode 100644 index c7f92c3e9..000000000 --- a/src/VirtualFluids/Grid/Grid3DSystem.cpp +++ /dev/null @@ -1,48 +0,0 @@ -#include <Grid3DSystem.h> - -namespace Grid3DSystem -{ - const int INVDIR[] = { INV_E , - INV_W , - INV_N , - INV_S , - INV_T , - INV_B , - INV_NE , - INV_NW , - INV_SE , - INV_SW , - INV_TE , - INV_TW , - INV_BE , - INV_BW , - INV_TN , - INV_TS , - INV_BN , - INV_BS , - INV_TNE, - INV_TNW, - INV_TSE, - INV_TSW, - INV_BNE, - INV_BNW, - INV_BSE, - INV_BSW }; - - //index 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 - //direction: E, W, N, S, T, B, NE, SW, SE, NW, TE, BW, BE, TW, TN, BS, BN, TS, TNE TNW TSE TSW BNE BNW BSE BSW - const int EX1[] = { 1, -1, 0, 0, 0, 0, 1, -1, 1, -1, 1, -1, 1, -1, 0, 0, 0, 0, 1, -1, 1, -1, 1, -1, 1, -1 }; - const int EX2[] = { 0, 0, 1, -1, 0, 0, 1, -1, -1, 1, 0, 0, 0, 0, 1, -1, 1, -1, 1, 1, -1, -1, 1, 1, -1, -1 }; - const int EX3[] = { 0, 0, 0, 0, 1, -1, 0, 0, 0, 0, 1, -1, -1, 1, 1, -1, -1, 1, 1, 1, 1, 1, -1, -1, -1, -1 }; -} - -////////////////////////////////////////////////////////////////////////// -const int& Grid3DSystem::getInvertDirection(const int& direction) -{ -#ifdef _DEBUG - if(direction<STARTDIR || direction>ENDDIR) - throw UbException(UB_EXARGS,"unknown direction"); -#endif - return INVDIR[direction]; -} - diff --git a/src/VirtualFluids/Grid/Grid3DSystem.h b/src/VirtualFluids/Grid/Grid3DSystem.h deleted file mode 100644 index d5c027e26..000000000 --- a/src/VirtualFluids/Grid/Grid3DSystem.h +++ /dev/null @@ -1,158 +0,0 @@ -// _ ___ __ __________ _ __ -// | | / (_)____/ /___ ______ _/ / ____/ /_ __(_)___/ /____ -// | | / / / ___/ __/ / / / __ `/ / /_ / / / / / / __ / ___/ -// | |/ / / / / /_/ /_/ / /_/ / / __/ / / /_/ / / /_/ (__ ) -// |___/_/_/ \__/\__,_/\__,_/_/_/ /_/\__,_/_/\__,_/____/ -// -#ifndef Grid3DSystem_H -#define Grid3DSystem_H - -#include <cmath> -#include <iostream> -#include <string> - -#include <basics/utilities/UbMath.h> -#include <basics/utilities/UbException.h> - - -namespace Grid3DSystem -{ - static const int STARTDIR = 0; - - static const int E /*f1 */ = 0; - static const int W /*f2 */ = 1; - static const int N /*f3 */ = 2; - static const int S /*f4 */ = 3; - static const int T /*f5 */ = 4; - static const int B /*f6 */ = 5; - static const int NE /*f7 */ = 6; - static const int SW /*f8 */ = 7; - static const int SE /*f9 */ = 8; - static const int NW /*f10*/ = 9; - static const int TE /*f11*/ = 10; - static const int BW /*f12*/ = 11; - static const int BE /*f13*/ = 12; - static const int TW /*f14*/ = 13; - static const int TN /*f15*/ = 14; - static const int BS /*f16*/ = 15; - static const int BN /*f17*/ = 16; - static const int TS /*f18*/ = 17; - static const int TNE = 18; - static const int TNW = 19; - static const int TSE = 20; - static const int TSW = 21; - static const int BNE = 22; - static const int BNW = 23; - static const int BSE = 24; - static const int BSW = 25; - static const int ZERO /*f0 */ = 26; - - static const int ENDDIR = 25; - - static const int INV_E = W; - static const int INV_W = E; - static const int INV_N = S; - static const int INV_S = N; - static const int INV_T = B; - static const int INV_B = T; - static const int INV_NE = SW; - static const int INV_NW = SE; - static const int INV_SE = NW; - static const int INV_SW = NE; - static const int INV_TE = BW; - static const int INV_TW = BE; - static const int INV_BE = TW; - static const int INV_BW = TE; - static const int INV_TN = BS; - static const int INV_TS = BN; - static const int INV_BN = TS; - static const int INV_BS = TN; - static const int INV_TNE = BSW; - static const int INV_TNW = BSE; - static const int INV_TSE = BNW; - static const int INV_TSW = BNE; - static const int INV_BNE = TSW; - static const int INV_BNW = TSE; - static const int INV_BSE = TNW; - static const int INV_BSW = TNE; - - extern const int INVDIR[ENDDIR+1]; - - static const int MAXLEVEL = 25; - - extern const int EX1[ENDDIR+1]; - extern const int EX2[ENDDIR+1]; - extern const int EX3[ENDDIR+1]; - - inline std::string getDirectionString(int direction) - { - switch(direction) - { - case E : return "E"; - case W : return "W"; - case N : return "N"; - case S : return "S"; - case T : return "T"; - case B : return "B"; - case NE : return "NE"; - case NW : return "NW"; - case SE : return "SE"; - case SW : return "SW"; - case TE : return "TE"; - case TW : return "TW"; - case BE : return "BE"; - case BW : return "BW"; - case TN : return "TN"; - case TS : return "TS"; - case BN : return "BN"; - case BS : return "BS"; - case TNE : return "TNE"; - case TNW : return "TNW"; - case TSE : return "TSE"; - case TSW : return "TSW"; - case BNE : return "BNE"; - case BNW : return "BNW"; - case BSE : return "BSE"; - case BSW : return "BSW"; - default : return "Cell3DSystem::getDrectionString(...) - unknown dir"; - } - } - static const int& getInvertDirection(const int& direction); - -////////////////////////////////////////////////////////////////////////// - static inline void setNeighborCoordinatesForDirection(int &x1, int &x2,int &x3, const int& direction) - { - switch(direction) - { - case Grid3DSystem::E : x1++; break; - case Grid3DSystem::N : x2++; break; - case Grid3DSystem::T : x3++; break; - case Grid3DSystem::W : x1--; break; - case Grid3DSystem::S : x2--; break; - case Grid3DSystem::B : x3--; break; - case Grid3DSystem::NE : x1++; x2++; break; - case Grid3DSystem::NW : x1--; x2++; break; - case Grid3DSystem::SW : x1--; x2--; break; - case Grid3DSystem::SE : x1++; x2--; break; - case Grid3DSystem::TE : x1++; x3++; break; - case Grid3DSystem::BW : x1--; x3--; break; - case Grid3DSystem::BE : x1++; x3--; break; - case Grid3DSystem::TW : x1--; x3++; break; - case Grid3DSystem::TN : x2++; x3++; break; - case Grid3DSystem::BS : x2--; x3--; break; - case Grid3DSystem::BN : x2++; x3--; break; - case Grid3DSystem::TS : x2--; x3++; break; - case Grid3DSystem::TNE: x1++; x2++; x3++; break; - case Grid3DSystem::TNW: x1--; x2++; x3++; break; - case Grid3DSystem::TSE: x1++; x2--; x3++; break; - case Grid3DSystem::TSW: x1--; x2--; x3++; break; - case Grid3DSystem::BNE: x1++; x2++; x3--; break; - case Grid3DSystem::BNW: x1--; x2++; x3--; break; - case Grid3DSystem::BSE: x1++; x2--; x3--; break; - case Grid3DSystem::BSW: x1--; x2--; x3--; break; - default: throw UbException(UB_EXARGS,"no direction ..."); - } - } -} - -#endif diff --git a/src/VirtualFluids/Grid/Grid3DTest.cpp b/src/VirtualFluids/Grid/Grid3DTest.cpp deleted file mode 100644 index 788b9f85e..000000000 --- a/src/VirtualFluids/Grid/Grid3DTest.cpp +++ /dev/null @@ -1,30 +0,0 @@ -#include "gmock/gmock.h" - -#include "Block3D.h" -#include "Grid3D.h" -#include "UbTuple.h" - - -TEST(BlockTest, transBlockToWorldCoordinates) -{ - const int worldPositionX1 = 0; - const int worldPositionX2 = 0; - const int worldPositionX3 = 0; - const int level = 0; - - Block3DPtr block = Block3DPtr( new Block3D(worldPositionX1, worldPositionX2, worldPositionX3, level)); - - int blockCoordX1 = 4; - int blockCoordX2 = 4; - int blockCoordX3 = 4; - - Grid3D grid; - grid.setDeltaX(1); - - Vector3D worldCoords = grid.getNodeCoordinates(block, blockCoordX1, blockCoordX2, blockCoordX3); - - EXPECT_THAT(worldCoords[0], testing::DoubleEq(blockCoordX1 - OFFSET)); - EXPECT_THAT(worldCoords[1], testing::DoubleEq(blockCoordX1 - OFFSET)); - EXPECT_THAT(worldCoords[2], testing::DoubleEq(blockCoordX3 - OFFSET)); -} - diff --git a/src/VirtualFluids/Grid/MPICalculator.cpp b/src/VirtualFluids/Grid/MPICalculator.cpp deleted file mode 100644 index 06efb714a..000000000 --- a/src/VirtualFluids/Grid/MPICalculator.cpp +++ /dev/null @@ -1,372 +0,0 @@ -#include "MPICalculator.h" -#include <basics/utilities/UbException.h> - -#include "MathUtil.hpp" -#include "basics/writer/WbWriterVtkXmlASCII.h" - -#include "BCProcessor.h" -#include "LBMKernel.h" -//#define TIMING -//#define PRECOLLISIONBC - -#include "Block3DConnector.h" - -MPICalculator::MPICalculator() -{ - -} -////////////////////////////////////////////////////////////////////////// -MPICalculator::MPICalculator(Grid3DPtr grid) : -Calculator(grid, SynchronizerPtr(), true) -{ - -} -////////////////////////////////////////////////////////////////////////// -void MPICalculator::calculate(const double& endTime, CalculationManagerPtr cm) -{ - UBLOG(logDEBUG1, "MPICalculator::calculate() - started"); - try - { - initConnectors(); - - int anzLevel = maxLevel-minLevel+1; - - int minInitLevel = minLevel; - int maxInitLevel = maxLevel-minLevel; - int straightStartLevel = minInitLevel; - int internalIterations = 1<<(maxInitLevel-minInitLevel); - int forwardStartLevel; - int threshold; - int startStep = int(grid->getTimeStep())+1; - - //UBLOG(logINFO, "startStep="<<startStep); - int anzCalcSteps = static_cast<int>(endTime); -#ifdef TIMING - UbTimer timer; - double time[6]; -#endif - - ////////////////////////////////////////////////////////////////////////// - // UBLOG(logINFO, "Number of connectors = " <<this->localConns[0].size()); - ////////////////////////////////////////////////////////////////////////// - - for (calcStep = startStep; calcStep<=anzCalcSteps+1; calcStep++) - { - - //exchange data between blocks for visualization - //sync->wait(); - ////if(visScheduler->isDue((double)(calcStep-1))) - ////{ - // //exchangeBlockData(minInitLevel, maxInitLevel, true); - ////} - - ////wait for write dump files - //write dump - grid->coProcess((double)(calcStep-1)); - - ////////////////////////////////////////////////////////////////////////// -#ifdef TIMING - UBLOG(logINFO, "calcStep = "<<calcStep); -#endif - ////////////////////////////////////////////////////////////////////////// - - for (int staggeredStep = 1; staggeredStep<=internalIterations; staggeredStep++) - { - forwardStartLevel = straightStartLevel; - if (staggeredStep==internalIterations) straightStartLevel = minInitLevel; - else - { - for (straightStartLevel = maxInitLevel, threshold = 1; - (staggeredStep&threshold)!=threshold; straightStartLevel--, threshold <<= 1); - } - ////////////////////////////////////////////////////////////////////////// -#ifdef TIMING - timer.resetAndStart(); -#endif - ////////////////////////////////////////////////////////////////////////// - applyPreCollisionBC(straightStartLevel, maxInitLevel); - - calculateBlocks(straightStartLevel, maxInitLevel); - ////calculateBlocks(minInitLevel, maxInitLevel, staggeredStep); -////////////////////////////////////////////////////////////////////////// -#ifdef TIMING - time[0] = timer.stop(); - UBLOG(logINFO, "calculateBlocks time = "<<time[0]); -#endif - ////////////////////////////////////////////////////////////////////////// - - //exchange data between blocks - //Sleep(10000); - exchangeBlockData(straightStartLevel, maxInitLevel); - ////////////////////////////////////////////////////////////////////////// -#ifdef TIMING - time[1] = timer.stop(); - UBLOG(logINFO, "exchangeBlockData time = "<<time[1]); -#endif - ////////////////////////////////////////////////////////////////////////// - //applyBCs(straightStartLevel, maxInitLevel); - applyPostCollisionBC(straightStartLevel, maxInitLevel); - - ////////////////////////////////////////////////////////////////////////// -#ifdef TIMING - time[2] = timer.stop(); - UBLOG(logINFO, "applyBCs time = "<<time[2]); -#endif - ////////////////////////////////////////////////////////////////////////// - - //swap distributions in kernel - swapDistributions(straightStartLevel, maxInitLevel); - -#ifdef PRECOLLISIONBC - exchangeBlockData(straightStartLevel, maxInitLevel); - applyPreCollisionBC(straightStartLevel, maxInitLevel); -#endif - - - ////////////////////////////////////////////////////////////////////////// -#ifdef TIMING - time[3] = timer.stop(); - UBLOG(logINFO, "swapDistributions time = "<<time[3]); -#endif - ////////////////////////////////////////////////////////////////////////// - - if (refinement) - { - // //exchange data between blocks for grid refinement - ////exchangeInterfaceBlockData(straightStartLevel, maxInitLevel, true); - //DOES NOT NEED - if (straightStartLevel<maxInitLevel) - exchangeBlockData(straightStartLevel, maxInitLevel); - // //exchangeInterfaceBlockData(straightStartLevel, maxInitLevel, true); - ////////////////////////////////////////////////////////////////////////// -#ifdef TIMING - time[4] = timer.stop(); - UBLOG(logINFO, "refinement exchangeBlockData time = "<<time[4]); -#endif - ////////////////////////////////////////////////////////////////////////// - //now ghost nodes have actual values - //interpolation of interface nodes between grid levels - interpolation(straightStartLevel, maxInitLevel); - ////////////////////////////////////////////////////////////////////////// -#ifdef TIMING - time[5] = timer.stop(); - UBLOG(logINFO, "refinement interpolation time = "<<time[5]); -#endif - ////////////////////////////////////////////////////////////////////////// - } - - if (taValuesCoProcessor) - { - taValuesCoProcessor->calculateSubtotal(calcStep-1); - } - - - } - //exchange data between blocks for visualization - if (mainThread) visScheduler->isDue((double)(calcStep-1)); - if ((int)visScheduler->getNextDueTime()==calcStep) - { - exchangeBlockData(straightStartLevel, maxInitLevel); - } - //now ghost nodes have actual values - - //dynamic load balancing - //sync->wait(); - //if (mainThread && !loadBalancingComp) - //{ - // loadBalancingComp = cm->balance(); - //} - - } - UBLOG(logDEBUG1, "MPICalculator::calculate() - stoped"); - } - catch (std::exception& e) - { - //error = boost::current_exception(); - UBLOG(logERROR, e.what()); - UBLOG(logERROR, " step = "<<calcStep); - } -} -////////////////////////////////////////////////////////////////////////// -void MPICalculator::calculateBlocks(int startLevel, int maxInitLevel) -{ - Block3DPtr blockTemp; - try - { - //startLevel bis maxInitLevel - for (int level = startLevel; level<=maxInitLevel; level++) - { - //timer.resetAndStart(); - //call LBM kernel - for(Block3DPtr block : blocks[level]) - { - blockTemp = block; - block->getKernel()->calculate(); - } - //timer.stop(); - //UBLOG(logINFO, "level = " << level << " blocks = " << blocks[level].size() << " collision time = " << timer.getTotalTime()); - } - } - catch (std::exception& e) - { - //error = boost::current_exception(); - UBLOG(logERROR, e.what()); - UBLOG(logERROR, blockTemp->toString()<<" step = "<<calcStep); - exit(EXIT_FAILURE); - } -} -////////////////////////////////////////////////////////////////////////// -void MPICalculator::calculateBlocks(int minInitLevel, int maxInitLevel, int staggeredStep) -{ - int p, maxi, maxir, maxidp, start, end; - for (int level = minInitLevel; level<=maxInitLevel; level++) - { - p = 1<<(maxInitLevel-level); - maxi = maxir = static_cast<int>(blocks[level].size()); - maxidp = maxi/p; - if (p>maxi && maxi!=0) { - maxidp = 1; - maxi = p; - } - start = (staggeredStep-1)*maxidp; - if (start>=maxi) - start = 0; - end = start+maxidp; - if ((end+p)>=maxi) - end = maxi; - for (int i = start; i<end; i++) - { - if (i<maxir) - blocks[level][i]->getKernel()->calculate(); - } - } -} -////////////////////////////////////////////////////////////////////////// - -////////////////////////////////////////////////////////////////////////// -void MPICalculator::exchangeBlockData(int startLevel, int maxInitLevel) -{ - //startLevel bis maxInitLevel - for (int level = startLevel; level<=maxInitLevel; level++) - { - connectorsPrepare(localConns[level]); - connectorsPrepare(remoteConns[level]); - - connectorsSend(localConns[level]); - connectorsSend(remoteConns[level]); - - connectorsReceive(localConns[level]); - connectorsReceive(remoteConns[level]); - } -} -////////////////////////////////////////////////////////////////////////// -void MPICalculator::exchangeInterfaceBlockData(int startLevel, int maxInitLevel) -{ - //startLevel bis maxInitLevel - for (int level = startLevel; level<=maxInitLevel; level++) - { - connectorsPrepare(localInterfaceBlockConns[level]); - connectorsPrepare(remoteInterfaceBlockConns[level]); - - connectorsSend(localInterfaceBlockConns[level]); - connectorsSend(remoteInterfaceBlockConns[level]); - - connectorsReceive(localInterfaceBlockConns[level]); - connectorsReceive(remoteInterfaceBlockConns[level]); - } -} -////////////////////////////////////////////////////////////////////////// -void MPICalculator::swapDistributions(int startLevel, int maxInitLevel) -{ - //startLevel bis maxInitLevel - for (int level = startLevel; level<=maxInitLevel; level++) - { - for(Block3DPtr block : blocks[level]) - { - block->getKernel()->swapDistributions(); - } - } -} -////////////////////////////////////////////////////////////////////////// -void MPICalculator::connectorsPrepare(std::vector< Block3DConnectorPtr >& connectors) -{ - for(Block3DConnectorPtr c : connectors) - { - c->prepareForReceive(); - c->prepareForSend(); - } -} -////////////////////////////////////////////////////////////////////////// -void MPICalculator::connectorsSend(std::vector< Block3DConnectorPtr >& connectors) -{ - for(Block3DConnectorPtr c : connectors) - { - c->fillSendVectors(); - c->sendVectors(); - } -} -////////////////////////////////////////////////////////////////////////// -void MPICalculator::connectorsReceive(std::vector< Block3DConnectorPtr >& connectors) -{ - for(Block3DConnectorPtr c : connectors) - { - c->receiveVectors(); - c->distributeReceiveVectors(); - } -} -////////////////////////////////////////////////////////////////////////// -void MPICalculator::interpolation(int startLevel, int maxInitLevel) -{ - - - for (int level = startLevel; level<maxInitLevel; level++) - { - connectorsPrepare(localInterConns[level]); - connectorsPrepare(remoteInterConns[level]); - } - - - - for (int level = startLevel; level<maxInitLevel; level++) - { - connectorsSend(localInterConns[level]); - connectorsSend(remoteInterConns[level]); - } - - - - for (int level = startLevel; level<maxInitLevel; level++) - { - connectorsReceive(localInterConns[level]); - connectorsReceive(remoteInterConns[level]); - } - - - -} -////////////////////////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////// -void MPICalculator::applyPreCollisionBC(int startLevel, int maxInitLevel) -{ - //startLevel bis maxInitLevel - for (int level = startLevel; level<=maxInitLevel; level++) - { - for(Block3DPtr block : blocks[level]) - { - block->getKernel()->getBCProcessor()->applyPreCollisionBC(); - } - } -} -////////////////////////////////////////////////////////////////////////// -void MPICalculator::applyPostCollisionBC(int startLevel, int maxInitLevel) -{ - //startLevel bis maxInitLevel - for (int level = startLevel; level<=maxInitLevel; level++) - { - for(Block3DPtr block : blocks[level]) - { - block->getKernel()->getBCProcessor()->applyPostCollisionBC(); - } - } -} - diff --git a/src/VirtualFluids/Grid/MPICalculator.h b/src/VirtualFluids/Grid/MPICalculator.h deleted file mode 100644 index d5170e5f8..000000000 --- a/src/VirtualFluids/Grid/MPICalculator.h +++ /dev/null @@ -1,49 +0,0 @@ -#ifndef MPICALCULATOR_H -#define MPICALCULATOR_H - -#include "Grid3D.h" -#include "Block3D.h" -#include "Synchronizer.h" -#include "MathUtil.hpp" -#include "basics/utilities/UbScheduler.h" -#include "basics/utilities/UbTiming.h" -#include "LoadBalancer.h" -#include "TimeAveragedValuesCoProcessor.h" - -#include "Calculator.h" - -class MPICalculator; -typedef std::shared_ptr<MPICalculator> MPICalculatorPtr; - -#include "CalculationManager.h" - -class Block3DConnector; - -class MPICalculator : public Calculator -{ -public: - MPICalculator(); - MPICalculator(Grid3DPtr grid); - virtual ~MPICalculator() {} - virtual void calculate(const double& endTime, CalculationManagerPtr cm); - -protected: - void calculateBlocks(int startLevel, int maxInitLevel); - void calculateBlocks(int minInitLevel, int maxInitLevel, int staggeredStep); - void swapDistributions(int startLevel, int maxInitLevel); - virtual void exchangeBlockData(int startLevel, int maxInitLevel); - void exchangeInterfaceBlockData(int startLevel, int maxInitLevel); - virtual void connectorsPrepare(std::vector< std::shared_ptr<Block3DConnector> >& connectors); - virtual void connectorsSend(std::vector< std::shared_ptr<Block3DConnector> >& connectors); - virtual void connectorsReceive(std::vector< std::shared_ptr<Block3DConnector> >& connectors); - void interpolation(int startLevel, int maxInitLevel); - void deleteConnectors(std::vector< std::vector< std::shared_ptr<Block3DConnector> > >& conns); - void applyPreCollisionBC(int startLevel, int maxInitLevel); - void applyPostCollisionBC(int startLevel, int maxInitLevel); -private: - - -}; - -#endif - diff --git a/src/VirtualFluids/Grid/PrePostBcCalculator.cpp b/src/VirtualFluids/Grid/PrePostBcCalculator.cpp deleted file mode 100644 index 40bd90e2e..000000000 --- a/src/VirtualFluids/Grid/PrePostBcCalculator.cpp +++ /dev/null @@ -1,197 +0,0 @@ -#include "PrePostBcCalculator.h" -#include <basics/utilities/UbException.h> - -#include "MathUtil.hpp" -#include "basics/writer/WbWriterVtkXmlASCII.h" - -#include "LBMKernel.h" -#include "BCProcessor.h" -//#define TIMING - -PrePostBcCalculator::PrePostBcCalculator() -{ - -} -////////////////////////////////////////////////////////////////////////// -PrePostBcCalculator::PrePostBcCalculator(Grid3DPtr grid, SynchronizerPtr sync, bool mainThread) : -Calculator(grid, sync, mainThread) -{ - -} -////////////////////////////////////////////////////////////////////////// -void PrePostBcCalculator::calculate(const double& endTime, CalculationManagerPtr cm, boost::exception_ptr& error) -{ - UBLOG(logDEBUG1, "PrePostBcCalculator::calculate() - started"); - try - { - initConnectors(); - - int anzLevel = maxLevel-minLevel+1; - - int minInitLevel = minLevel; - int maxInitLevel = maxLevel-minLevel; - int straightStartLevel = minInitLevel; - int internalIterations = 1 << (maxInitLevel-minInitLevel); - int forwardStartLevel; - int threshold; - int startStep = int(grid->getTimeStep())+1; - - //UBLOG(logINFO, "startStep="<<startStep); - int anzCalcSteps = static_cast<int>(endTime); -#ifdef TIMING - UbTimer timer; - double time[6]; -#endif - -////////////////////////////////////////////////////////////////////////// -// UBLOG(logINFO, "Number of connectors = " <<this->localConns[0].size()); -////////////////////////////////////////////////////////////////////////// - - for(calcStep=startStep; calcStep<=anzCalcSteps+1; calcStep++) - { - ////wait for write dump files - //sync->wait(); - //write dump - if (mainThread) grid->coProcess((double)(calcStep-1)); - sync->wait(); - - -////////////////////////////////////////////////////////////////////////// -#ifdef TIMING - //UBLOG(logINFO, "calcStep = " <<calcStep); -#endif -////////////////////////////////////////////////////////////////////////// - - for(int staggeredStep=1; staggeredStep<=internalIterations; staggeredStep++) - { - forwardStartLevel = straightStartLevel; - if(staggeredStep == internalIterations) straightStartLevel = minInitLevel; - else - { - for(straightStartLevel=maxInitLevel,threshold=1; - (staggeredStep&threshold)!=threshold; straightStartLevel--,threshold<<=1); - } -////////////////////////////////////////////////////////////////////////// -#ifdef TIMING - timer.resetAndStart(); -#endif -////////////////////////////////////////////////////////////////////////// - - applyPreCollisionBC(straightStartLevel, maxInitLevel); - - calculateBlocks(straightStartLevel, maxInitLevel); - ////calculateBlocks(minInitLevel, maxInitLevel, staggeredStep); -////////////////////////////////////////////////////////////////////////// -#ifdef TIMING - time[0] = timer.stop(); - //UBLOG(logINFO, "calculateBlocks time = " <<time); -#endif -////////////////////////////////////////////////////////////////////////// - - //exchange data between blocks - //Sleep(10000); - exchangeBlockData(straightStartLevel, maxInitLevel); -////////////////////////////////////////////////////////////////////////// -#ifdef TIMING - time[1] = timer.stop(); - //UBLOG(logINFO, "exchangeBlockData time = " <<time); -#endif -////////////////////////////////////////////////////////////////////////// - - applyPostCollisionBC(straightStartLevel, maxInitLevel); - -////////////////////////////////////////////////////////////////////////// -#ifdef TIMING - time[2] = timer.stop(); - //UBLOG(logINFO, "applyBCs time = " <<time); -#endif -////////////////////////////////////////////////////////////////////////// - - //swap distributions in kernel - swapDistributions(straightStartLevel, maxInitLevel); - -////////////////////////////////////////////////////////////////////////// -#ifdef TIMING - time[3] = timer.stop(); - //UBLOG(logINFO, "swapDistributions time = " <<time); -#endif -////////////////////////////////////////////////////////////////////////// - - if (refinement) - { - // //exchange data between blocks for grid refinement - ////exchangeInterfaceBlockData(straightStartLevel, maxInitLevel, true); - //DOES NOT NEED - if(straightStartLevel<maxInitLevel) - exchangeBlockData(straightStartLevel, maxInitLevel); - // //exchangeInterfaceBlockData(straightStartLevel, maxInitLevel, true); -////////////////////////////////////////////////////////////////////////// -#ifdef TIMING - time[4] = timer.stop(); - UBLOG(logINFO, "refinement exchangeBlockData time = " <<time); -#endif -////////////////////////////////////////////////////////////////////////// - //now ghost nodes have actual values - //interpolation of interface nodes between grid levels - interpolation(straightStartLevel, maxInitLevel); -////////////////////////////////////////////////////////////////////////// -#ifdef TIMING - time[5] = timer.stop(); - UBLOG(logINFO, "refinement interpolation time = " <<time); -#endif -////////////////////////////////////////////////////////////////////////// - } - - } - //exchange data between blocks for visualization - if(mainThread) visScheduler->isDue((double)(calcStep-1)); - if((int)visScheduler->getNextDueTime() == calcStep) - { - exchangeBlockData(straightStartLevel, maxInitLevel); - } - //now ghost nodes have actual values - - //dynamic load balancing - //sync->wait(); - //if (mainThread && !loadBalancingComp) - //{ - // loadBalancingComp = cm->balance(); - //} - } - error = boost::exception_ptr(); - UBLOG(logDEBUG1, "PrePostBcCalculator::calculate() - stoped"); - } - catch( std::exception& e ) - { - //error = boost::current_exception(); - UBLOG(logERROR, e.what()); - UBLOG(logERROR, " step = "<<calcStep); - std::dynamic_pointer_cast<MPICommunicator>(Communicator::getInstance())->~MPICommunicator(); - exit(EXIT_FAILURE); - } -} -////////////////////////////////////////////////////////////////////////// -void PrePostBcCalculator::applyPreCollisionBC(int startLevel, int maxInitLevel) -{ - //startLevel bis maxInitLevel - for (int level = startLevel; level<=maxInitLevel; level++) - { - for(Block3DPtr block : blocks[level]) - { - block->getKernel()->getBCProcessor()->applyPreCollisionBC(); - } - } -} -////////////////////////////////////////////////////////////////////////// -void PrePostBcCalculator::applyPostCollisionBC(int startLevel, int maxInitLevel) -{ - //startLevel bis maxInitLevel - for (int level = startLevel; level<=maxInitLevel; level++) - { - for(Block3DPtr block : blocks[level]) - { - block->getKernel()->getBCProcessor()->applyPostCollisionBC(); - } - } -} - diff --git a/src/VirtualFluids/Grid/PrePostBcCalculator.h b/src/VirtualFluids/Grid/PrePostBcCalculator.h deleted file mode 100644 index 36ad9a20e..000000000 --- a/src/VirtualFluids/Grid/PrePostBcCalculator.h +++ /dev/null @@ -1,33 +0,0 @@ -#ifndef PrePostBcCalculator_h -#define PrePostBcCalculator_h - -#include "Grid3D.h" -#include "Block3D.h" -#include "Synchronizer.h" -#include "MathUtil.hpp" -#include "basics/utilities/UbScheduler.h" -#include "basics/utilities/UbTiming.h" -#include "LoadBalancer.h" - -#include "Calculator.h" - -class PrePostBcCalculator; -typedef std::shared_ptr<PrePostBcCalculator> PrePostBcCalculatorPtr; - -#include "CalculationManager.h" - -class PrePostBcCalculator : public Calculator -{ -public: - PrePostBcCalculator(); - PrePostBcCalculator(Grid3DPtr grid, SynchronizerPtr sync, bool mainThread = true); - virtual ~PrePostBcCalculator(){} - virtual void calculate(const double& endTime, CalculationManagerPtr cm, boost::exception_ptr& error); -protected: - void applyPreCollisionBC(int startLevel, int maxInitLevel); - void applyPostCollisionBC(int startLevel, int maxInitLevel); -private: - -}; - -#endif diff --git a/src/VirtualFluids/Grid/package.include b/src/VirtualFluids/Grid/package.include deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/VirtualFluids/Interactors/CMakePackage.txt b/src/VirtualFluids/Interactors/CMakePackage.txt deleted file mode 100644 index 1b8416f01..000000000 --- a/src/VirtualFluids/Interactors/CMakePackage.txt +++ /dev/null @@ -1,2 +0,0 @@ -GET_FILENAME_COMPONENT( CURRENT_DIR ${CMAKE_CURRENT_LIST_FILE} PATH) -COLLECT_PACKAGE_DATA_WITH_OPTION(${CURRENT_DIR} ALL_SOURCES) diff --git a/src/VirtualFluids/Interactors/D3Q27Interactor.cpp b/src/VirtualFluids/Interactors/D3Q27Interactor.cpp deleted file mode 100644 index afe893dba..000000000 --- a/src/VirtualFluids/Interactors/D3Q27Interactor.cpp +++ /dev/null @@ -1,782 +0,0 @@ -#include "D3Q27Interactor.h" -#include <basics/utilities/UbMath.h> -#include <basics/utilities/UbLogger.h> - -#include <basics/writer/WbWriterVtkXmlBinary.h> - -#include <numerics/geometry3d/GbCuboid3D.h> -#include <numerics/geometry3d/GbLine3D.h> -#include "Block3D.h" -#include "Grid3D.h" -#include "BCArray3D.h" -#include "BoundaryConditions.h" -#include "LBMKernel.h" -#include "BCProcessor.h" -#include "BCAdapter.h" - -//#include <3rdParty/MarchingCubes/MarchingCubes.h> - - - - -using namespace std; - -////////////////////////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////// -D3Q27Interactor::D3Q27Interactor() : Interactor3D() -{ - this->reinitWithStoredQsFlag = false; - this->initRayVectors(); -} -////////////////////////////////////////////////////////////////////////// -D3Q27Interactor::D3Q27Interactor(GbObject3DPtr geoObject3D, Grid3DPtr grid, int type) -: Interactor3D(geoObject3D, grid, type), relevantForForces(false) -{ - this->reinitWithStoredQsFlag = false; - this->initRayVectors(); -} -////////////////////////////////////////////////////////////////////////// -D3Q27Interactor::D3Q27Interactor(GbObject3DPtr geoObject3D, Grid3DPtr grid, BCAdapterPtr bcAdapter, int type) - : Interactor3D(geoObject3D, grid, type), relevantForForces(false) -{ - this->reinitWithStoredQsFlag = false; - this->addBCAdapter(bcAdapter); - this->initRayVectors(); -} -////////////////////////////////////////////////////////////////////////// -D3Q27Interactor::D3Q27Interactor(GbObject3DPtr geoObject3D, Grid3DPtr grid, BCAdapterPtr bcAdapter, int type, Interactor3D::Accuracy a) - : Interactor3D(geoObject3D, grid, type, a), relevantForForces(false) -{ - this->reinitWithStoredQsFlag = false; - this->addBCAdapter(bcAdapter); - this->initRayVectors(); -} -////////////////////////////////////////////////////////////////////////// -D3Q27Interactor::~D3Q27Interactor() -{ - -} -////////////////////////////////////////////////////////////////////////// -void D3Q27Interactor::initRayVectors() -{ - int fdir; double c1oS2 = UbMath::one_over_sqrt2; - fdir = D3Q27System::E; rayX1[fdir] = 1.0; rayX2[fdir] = 0.0; rayX3[fdir] = 0.0; - fdir = D3Q27System::W; rayX1[fdir] = -1.0; rayX2[fdir] = 0.0; rayX3[fdir] = 0.0; - fdir = D3Q27System::N; rayX1[fdir] = 0.0; rayX2[fdir] = 1.0; rayX3[fdir] = 0.0; - fdir = D3Q27System::S; rayX1[fdir] = 0.0; rayX2[fdir] = -1.0; rayX3[fdir] = 0.0; - fdir = D3Q27System::T; rayX1[fdir] = 0.0; rayX2[fdir] = 0.0; rayX3[fdir] = 1.0; - fdir = D3Q27System::B; rayX1[fdir] = 0.0; rayX2[fdir] = 0.0; rayX3[fdir] = -1.0; - fdir = D3Q27System::NE; rayX1[fdir] = c1oS2; rayX2[fdir] = c1oS2; rayX3[fdir] = 0.0; - fdir = D3Q27System::SW; rayX1[fdir] = -c1oS2; rayX2[fdir] = -c1oS2; rayX3[fdir] = 0.0; - fdir = D3Q27System::SE; rayX1[fdir] = c1oS2; rayX2[fdir] = -c1oS2; rayX3[fdir] = 0.0; - fdir = D3Q27System::NW; rayX1[fdir] = -c1oS2; rayX2[fdir] = c1oS2; rayX3[fdir] = 0.0; - fdir = D3Q27System::TE; rayX1[fdir] = c1oS2; rayX2[fdir] = 0.0; rayX3[fdir] = c1oS2; - fdir = D3Q27System::BW; rayX1[fdir] = -c1oS2; rayX2[fdir] = 0.0; rayX3[fdir] = -c1oS2; - fdir = D3Q27System::BE; rayX1[fdir] = c1oS2; rayX2[fdir] = 0.0; rayX3[fdir] = -c1oS2; - fdir = D3Q27System::TW; rayX1[fdir] = -c1oS2; rayX2[fdir] = 0.0; rayX3[fdir] = c1oS2; - fdir = D3Q27System::TN; rayX1[fdir] = 0.0; rayX2[fdir] = c1oS2; rayX3[fdir] = c1oS2; - fdir = D3Q27System::BS; rayX1[fdir] = 0.0; rayX2[fdir] =-c1oS2; rayX3[fdir] = -c1oS2; - fdir = D3Q27System::BN; rayX1[fdir] = 0.0; rayX2[fdir] = c1oS2; rayX3[fdir] = -c1oS2; - fdir = D3Q27System::TS; rayX1[fdir] = 0.0; rayX2[fdir] =-c1oS2; rayX3[fdir] = c1oS2; - - fdir = D3Q27System::TNW; rayX1[fdir] = -c1oS2; rayX2[fdir] = c1oS2; rayX3[fdir] = c1oS2;; - fdir = D3Q27System::TNE; rayX1[fdir] = c1oS2; rayX2[fdir] = c1oS2; rayX3[fdir] = c1oS2; - fdir = D3Q27System::TSW; rayX1[fdir] = -c1oS2; rayX2[fdir] =-c1oS2; rayX3[fdir] = c1oS2; - fdir = D3Q27System::TSE; rayX1[fdir] = c1oS2; rayX2[fdir] =-c1oS2; rayX3[fdir] = c1oS2; - fdir = D3Q27System::BNW; rayX1[fdir] = -c1oS2; rayX2[fdir] = c1oS2; rayX3[fdir] = -c1oS2; - fdir = D3Q27System::BNE; rayX1[fdir] = c1oS2; rayX2[fdir] = c1oS2; rayX3[fdir] = -c1oS2; - fdir = D3Q27System::BSW; rayX1[fdir] = -c1oS2; rayX2[fdir] =-c1oS2; rayX3[fdir] = -c1oS2; - fdir = D3Q27System::BSE; rayX1[fdir] = c1oS2; rayX2[fdir] =-c1oS2; rayX3[fdir] = -c1oS2; -} -////////////////////////////////////////////////////////////////////////// -void D3Q27Interactor::initInteractor(const double& timeStep) -{ - UBLOG(logDEBUG5,"D3Q27Interactor::initInteractor - "<<" for timestep = "<<timeStep); - - ////////////////////////////////////////////////////////////////////////// - //init bcs - int nofAdapter = (int)bcAdapters.size(); - if(nofAdapter==0) UBLOG(logWARNING,"WARNING - D3Q27Interactor::initInteractor Warning - no nodeAdapter available"); - bool needTimeDependence = false; - for(int pos=0; pos<nofAdapter; ++pos) - { - bcAdapters[pos]->init(this,timeStep); - if(bcAdapters[pos]->isTimeDependent()) needTimeDependence = true; - } - if(needTimeDependence) this->setTimeDependent(); - else this->unsetTimeDependent(); - - Interactor3D::initInteractor(timeStep); - - ////calcForces arbeitet nicht korrekt, wenn Geo mit Bloecken - // //unterschiedlicher Leveltiefe diskretisiert -> exception - // //abfrage steht hier, weil es theoretisch sein kann, dass bei parallelen rechnungen - // //genau der block mit dem anderen level auf einem anderen prozess liegt... - // //Update: es kann u.U. passieren, dass Bl�cke in der Liste nicht aktiv sin - // //(falls diese z.B. duch andere Interactoren solid gesetzt wurden) - // //diese werden nicht ber�cksichtigt (auch nicht beid er kraftauswertung sp�ter) - // if(this->isRelevantForForces() ) - // { - // int level = -1; - // for( vector<Block3D*>::const_iterator pos = transBlockSet->begin(); pos!=transBlockSet->end(); ++pos) - // if( (*pos)->isActive() ) - // { - // level = (*pos)->getLevel(); - // break; - // } - // - // bool check = false; - // for( vector<Block3D*>::const_iterator pos = transBlockSet->begin(); pos!=transBlockSet->end(); ++pos) - // if( (*pos)->isActive() && (*pos)->getLevel()!=level) - // { - // throw UbException(UB_EXARGS,"interactor is relevant for forces," - // +(string)" but has transblocks with different levels" - // +(string)" -> not supportet by D3Q27Interactor::getForces()" - // +(string)" -> increase refineWidth"); - // } - // } -} -////////////////////////////////////////////////////////////////////////// -void D3Q27Interactor::updateInteractor(const double& timestep) -{ - //UB_THROW( UbException(UB_EXARGS,"toDo") ); - //if(this->isFluid()) return; - - UBLOG(logDEBUG5,"D3Q27Interactor::updateInteractor - for timestep = "<<timestep); - - ////////////////////////////////////////////////////////////////////////// - //update bcs - int nofAdapter = (int)bcAdapters.size(); - if(nofAdapter==0) UBLOG(logERROR,"WARNING - D3Q27Interactor::updateInteractor Warning - no nodeAdapter available for "); - - bool needTimeDependence = false; - - for(int pos=0; pos<nofAdapter; ++pos) - { - bcAdapters[pos]->update(this,timestep); - if(bcAdapters[pos]->isTimeDependent()) needTimeDependence = true; - } - if(needTimeDependence) this->setTimeDependent(); - else this->unsetTimeDependent(); - - //UBLOG(logINFO, "transNodeIndicesMap = "<<transNodeIndicesMap.size()); - - for(BcNodeIndicesMap::value_type t : bcNodeIndicesMap) - { - Block3DPtr block = t.first; - std::set< std::vector<int> >& transNodeIndicesSet = t.second; - - //UBLOG(logINFO, "transNodeIndicesSet = "<<transNodeIndicesSet.size()); - - if(block->isNotActive() || !block) continue; - - ILBMKernelPtr kernel = block->getKernel(); - BCArray3DPtr bcArray = kernel->getBCProcessor()->getBCArray(); - - set< std::vector<int> >::iterator setPos; - - for(setPos=transNodeIndicesSet.begin(); setPos!=transNodeIndicesSet.end(); ++setPos) - { - int x1 = (*setPos)[0]; - int x2 = (*setPos)[1]; - int x3 = (*setPos)[2]; - Vector3D coords = grid.lock()->getNodeCoordinates(block, x1, x2, x3); - double worldX1 = coords[0]; - double worldX2 = coords[1]; - double worldX3 = coords[2]; - - BoundaryConditionsPtr bc = bcArray->getBC(x1,x2,x3); - if(bc) //kann sein, dass die BC durch das solid setzen eines andern interactors geloescht wurde - { - for(size_t i=0; i<bcAdapters.size(); i++) - bcAdapters[i]->adaptBC(*this,bc,worldX1,worldX2,worldX3,timestep); - } - //else - //{ - // UBLOG(logERROR,"D3Q27Interactor.updateInteractor (Z."<<__LINE__<<"): da ist kein BC dran ... kann aber korrekt sein s.h. code"); - //} - } - } -} -////////////////////////////////////////////////////////////////////////// -// Berechnung findet im realen Koordinatensystem statt !!! -// nicht im normierten ! -//x1,x2,x3 sind die Koordinaten unten links vom "System" -//extendedBoundingGeoOfGeoObject MUSS bereits um delta_x_level in jede richtung vergroesert worden sein fuer SOLID -bool D3Q27Interactor::setDifferencesToGbObject3D(const Block3DPtr block/*,const double& orgX1,const double& orgX2,const double& orgX3,const double& blockLengthX1,const double& blockLengthX2,const double& blockLengthX3, const double& timestep*/) -{ - if(!block) return false; - - if(block->isNotActive()) return false;//continue; - - bcNodeIndicesMap[block] = set< std::vector<int> >(); - set< std::vector<int> >& transNodeIndices = bcNodeIndicesMap[block]; - solidNodeIndicesMap[block] = set< UbTupleInt3 >(); - set< UbTupleInt3 >& solidNodeIndices = solidNodeIndicesMap[block]; - - - double timestep = 0; - bool oneEntryGotBC = false; //ob ueberhaupt ein eintrag ein BC zugewiesen wurde - bool gotQs = false; //true, wenn "difference" gesetzt wurde - BoundaryConditionsPtr bc; - - ILBMKernelPtr kernel = block->getKernel(); - BCArray3DPtr bcArray = kernel->getBCProcessor()->getBCArray(); - - double internX1,internX2,internX3; - - - //width of ghost layer - int gl = kernel->getGhostLayerWidth(); - - int startIX1 = 0; - int startIX2 = 0; - int startIX3 = 0; - int stopIX1 = (int)bcArray->getNX1(); - int stopIX2 = (int)bcArray->getNX2(); - int stopIX3 = (int)bcArray->getNX3(); - - double dx = grid.lock()->getDeltaX(block); - UbTupleDouble3 orgDelta = grid.lock()->getNodeOffset(block); - - //anderes boundingRect als in init, da hier das boundrect um ein dx vergroessert werden muss - GbCuboid3D extendedBoundingGeoOfGeoObject( geoObject3D->getX1Minimum()-1.02*dx - , geoObject3D->getX2Minimum()-1.02*dx - , geoObject3D->getX3Minimum()-1.02*dx - , geoObject3D->getX1Maximum()+1.02*dx - , geoObject3D->getX2Maximum()+1.02*dx - , geoObject3D->getX3Maximum()+1.02*dx ); - - double deltaX1=dx, deltaX2 =dx, deltaX3=dx; - - if( geoObject3D->hasRaytracing() - || (this->isInverseSolid() && geoObject3D->raytracingSupportsPointsInside() ) ) - { - //wenn deltaX1==deltaX2==deltaX3 (muss fuer LB!!) - if(!UbMath::zero( deltaX1-deltaX2 + deltaX1-deltaX3 + deltaX2-deltaX3 ) ) - throw UbException(UB_EXARGS,"fuer den bei LB nicht vorkommenden Fall deltaX1!=deltaX2!=deltaX3 nicht implementiert "); - - vector<double> distNeigh(D3Q27System::FENDDIR+1, UbMath::sqrt2*deltaX1); - distNeigh[D3Q27System::E] = distNeigh[D3Q27System::W] = distNeigh[D3Q27System::N] = deltaX1; - distNeigh[D3Q27System::S] = distNeigh[D3Q27System::T] = distNeigh[D3Q27System::B] = deltaX1; - - double q; - bool pointOnBoundary = false; - -//#ifdef _OPENMP -// #pragma omp parallel for private(internX1,internX2,internX3,gotQs,bc,q ) -//#endif - for(int ix3=startIX3; ix3<stopIX3; ix3++) - { - for(int ix2=startIX2; ix2<stopIX2; ix2++) - { - for(int ix1=startIX1; ix1<stopIX1; ix1++) - { - //TODO weiter untersuchen, ob das nicht ein Fehler ist - if(bcArray->isUndefined(ix1, ix2, ix3)) continue; - - Vector3D coords = grid.lock()->getNodeCoordinates(block, ix1, ix2, ix3); - internX1 = coords[0]; - internX2 = coords[1]; - internX3 = coords[2]; - - //point in object test ist ueberfluessig, weil die start und stop indices bereits zuvor - //ermittelt werden -> es werden nur point-IN-cube indizes betrachtet - if(extendedBoundingGeoOfGeoObject.isPointInGbObject3D(internX1,internX2,internX3)) - { - if(this->isSolid() ) - { - if(this->geoObject3D->isPointInGbObject3D(internX1, internX2, internX3)) - { -//#ifdef _OPENMP -// #pragma omp critical (SOLIDNODE_SET_CHANGE) -//#endif - { - solidNodeIndices.insert(UbTupleInt3(ix1, ix2, ix3)); - bcArray->setSolid(ix1,ix2,ix3); - } - continue; - } - } - else if( this->isInverseSolid() ) - { - //bei inverse solid sind alle Knoten AUSSERHALB und auf der boundary SOLID - if( !this->geoObject3D->isPointInGbObject3D(internX1, internX2, internX3, pointOnBoundary) - || pointOnBoundary == true ) - { -//#ifdef _OPENMP -// #pragma omp critical (SOLID_SET_CHANGE) -//#endif - { - solidNodeIndices.insert(UbTupleInt3(ix1, ix2, ix3)); - bcArray->setSolid(ix1,ix2,ix3); - } - continue; - } - } - - //evtl wurde node von anderen interactoren solid gesetzt (muss hie rein->sonst evtl bei - //ueberschneidender geo -> solidNodeIndicesMap unvollstaendig) - if(bcArray->isSolid(ix1,ix2,ix3)) - continue; - - gotQs = false; - - //TODO: prüfen was passiert wenn ein Geoobjekt zwischen zwei knoten rausguckt - // * / - //< - // * \ // - //sollen dann keine qs gesetzt werden - for(int fdir=D3Q27System::FSTARTDIR; fdir<=D3Q27System::FENDDIR; fdir++) - { - q = geoObject3D->getIntersectionRaytraceFactor(internX1,internX2,internX3,rayX1[fdir],rayX2[fdir],rayX3[fdir]); - q /= distNeigh[fdir]; - - //assert(UbMath::lessEqual(q, 1.0)); - - if( UbMath::inClosedInterval(q, 1.0, 1.0) ) q = 1.0; - if( UbMath::greater(q, 0.0) && UbMath::lessEqual(q, 1.0) ) - { - #pragma omp critical (BC_CHANGE) - { - bc = bcArray->getBC(ix1,ix2,ix3); - if(!bc) - { - //bc = bvd->createD3Q27BoundaryCondition(); //= new D3Q27BoundaryCondition(); - bc = BoundaryConditionsPtr(new BoundaryConditions); - bcArray->setBC(ix1,ix2,ix3,bc); - } - //TODO: man muss ueberlegen, wie kann man, dass die Geschwindigkeit auf 0.0 gesetzt werden, vermeiden - //das folgt zu unguenstigen "design rules" - //SG 31.08.2010 das Problem - bewegter Interactor angrenzend an stehenden noslip interactor - // hier sollte die Geschwindigkeit auf 0.0 gesetzt werden - if(bc->hasNoSlipBoundary()) - { - bc->setBoundaryVelocityX1(0.0); - bc->setBoundaryVelocityX2(0.0); - bc->setBoundaryVelocityX3(0.0); - } - //SG 31.08.2010 - - for(int index=(int)bcAdapters.size()-1; index>=0; --index) - bcAdapters[index]->adaptBCForDirection(*this,bc,internX1,internX2,internX3,q,fdir, timestep); - } - - gotQs=true; - } - } - - if(gotQs) - { -#ifdef _OPENMP - #pragma omp critical (TRANSNODE_SET_CHANGE) -#endif - { - oneEntryGotBC = true; - - std::vector<int> p(3); - p[0]=ix1; p[1]=ix2; p[2]=ix3; - transNodeIndices.insert(p); - - for(int index=(int)bcAdapters.size()-1; index>=0; --index) - bcAdapters[index]->adaptBC(*this,bc,internX1,internX2,internX3, timestep); - } - } - } - else if( this->isInverseSolid() ) - { - //bei inverse solid sind alle Knoten AUSSERHALB und auf der boundary SOLID - if( !this->geoObject3D->isPointInGbObject3D(internX1, internX2, internX3, pointOnBoundary) - || pointOnBoundary == true ) - { -#ifdef _OPENMP - #pragma omp critical (SOLID_SET_CHANGE) -#endif - { - solidNodeIndices.insert(UbTupleInt3(ix1, ix2, ix3)); - bcArray->setSolid(ix1,ix2,ix3); - } - continue; - } - } - } - } - } - } - else //clipping -> langsamer (wird derzeit auch fuer alle inverseSolid objekte verwendet deren raytracing nicht fuer nodes INNERHALB der geo funzt) - { - bool pointOnBoundary = false; - #pragma omp parallel for private(internX1,internX2,internX3,gotQs,bc,pointOnBoundary ) - for(int ix1=startIX1; ix1<stopIX1; ix1++) - { - for(int ix2=startIX2; ix2<stopIX2; ix2++) - { - for(int ix3=startIX3; ix3<stopIX3; ix3++) - { - if(bcArray->isSolid(ix1,ix2,ix3) || bcArray->isUndefined(ix1, ix2, ix3)) continue; - - Vector3D coords = grid.lock()->getNodeCoordinates(block, ix1, ix2, ix3); - internX1 = coords[0]; - internX2 = coords[1]; - internX3 = coords[2]; - - if(extendedBoundingGeoOfGeoObject.isPointInGbObject3D(internX1,internX2,internX3)) - { - if( this->isSolid() && this->geoObject3D->isPointInGbObject3D(internX1, internX2, internX3) ) - { - #pragma omp critical (SOLID_SET_CHANGE) - { - solidNodeIndices.insert(UbTupleInt3(ix1, ix2, ix3)); - bcArray->setSolid(ix1,ix2,ix3); - } - continue; - } - else if( this->isInverseSolid() ) - { - //bei inverse solid sind alle Knoten AUSSERHALB und auf der boundary SOLID - if( !this->geoObject3D->isPointInGbObject3D(internX1, internX2, internX3, pointOnBoundary) - || pointOnBoundary == true ) - { - #pragma omp critical (SOLID_SET_CHANGE) - { - solidNodeIndices.insert(UbTupleInt3(ix1, ix2, ix3)); - bcArray->setSolid(ix1,ix2,ix3); - } - continue; - } - } - - gotQs = false; - - GbPoint3D pointA(internX1,internX2,internX3); - for(int fdir=D3Q27System::FSTARTDIR; fdir<=D3Q27System::FENDDIR; fdir++) - { - double x1B = internX1+D3Q27System::DX1[fdir]*deltaX1; - double x2B = internX2+D3Q27System::DX2[fdir]*deltaX2; - double x3B = internX3+D3Q27System::DX3[fdir]*deltaX3; - - GbPoint3D pointB(x1B,x2B,x3B); - GbLine3D* clippedLine = this->geoObject3D->createClippedLine3D(pointA, pointB); - - if(clippedLine) - { - double q=0.0; - if( !this->isInverseSolid() ) //A liegt auf jeden Fall aussen - { - double distanceAB = pointA.getDistance(&pointB); //pointA to B - double distanceAP = UbMath::min(pointA.getDistance(clippedLine->getPoint1()), - pointA.getDistance(clippedLine->getPoint2()) ); - q = distanceAP/distanceAB; - } - else - { - bool pointIsOnBoundary = false; - if( !clippedLine->getPoint1()->equals(&pointB) - && !clippedLine->getPoint2()->equals(&pointB) ) - { - //A liegt auf jeden Fall drinnen, clipped line darf B nicht enthalten - double distanceAB = pointA.getDistance(&pointB); //pointA to B - double distanceAP = clippedLine->getLength(); - q = distanceAP/distanceAB; - } - else if( this->geoObject3D->isPointInGbObject3D( pointB.getX1Coordinate() - ,pointB.getX2Coordinate() - ,pointB.getX3Coordinate() - ,pointIsOnBoundary ) - && pointIsOnBoundary ) - { - //A liegt auf jeden Fall drinnen, B liegt genau auf ObjektBoundary => q=1.0 - q=1.0; - } - else - { - q = 0.0; - } - } - - if(UbMath::inClosedInterval(q, 1.0, 1.0)) q = 1.0; - if(UbMath::lessEqual(q, 1.0) && UbMath::greater(q, 0.0)) - { - #pragma omp critical (BC_CHANGE) - { - bc = bcArray->getBC(ix1,ix2,ix3); - if(!bc) - { - //bc = bvd->createD3Q27BoundaryCondition(); //= new D3Q27BoundaryCondition(); - bc = BoundaryConditionsPtr(new BoundaryConditions); - bcArray->setBC(ix1,ix2,ix3,bc); - } - for(int index=(int)bcAdapters.size()-1; index>=0; --index) - bcAdapters[index]->adaptBCForDirection(*this,bc,internX1,internX2,internX3,q,fdir,timestep); - } - - gotQs=true; - } - - clippedLine->deletePoint1(); - clippedLine->deletePoint2(); - delete clippedLine; - } - } - - if(gotQs) - { - #pragma omp critical (TRANSNODE_SET_CHANGE) - { - oneEntryGotBC = true; - - std::vector<int> p(3); - p[0]=ix1; p[1]=ix2; p[2]=ix3; - transNodeIndices.insert(p); - - for(int index=(int)bcAdapters.size()-1; index>=0; --index) - bcAdapters[index]->adaptBC(*this,bc,internX1,internX2,internX3,timestep); - } - } - } - } - } - } - } - - return oneEntryGotBC; -} -////////////////////////////////////////////////////////////////////////// -void D3Q27Interactor::addQsLineSet(std::vector<UbTupleFloat3 >& nodes, std::vector<UbTupleInt2 >& lines) -{ - for(Block3DPtr block : bcBlocks) - { - if(!block) continue; - - double dx = grid.lock()->getDeltaX(block); - UbTupleDouble3 orgDelta = grid.lock()->getNodeOffset(block); - - ILBMKernelPtr kernel = block->getKernel(); - BCArray3DPtr bcArray = kernel->getBCProcessor()->getBCArray(); - - map<Block3DPtr, set< std::vector<int> > >::iterator pos = bcNodeIndicesMap.find(block); - if(pos==bcNodeIndicesMap.end()) - { - UB_THROW( UbException(UB_EXARGS,"block nicht in indizes map!!!") ); - } - set< std::vector<int> >& transNodeIndicesSet = pos->second; - set< std::vector<int> >::iterator setPos; - - std::size_t node1Index, node2Index; - - UbTupleDouble3 blockOrg = grid.lock()->getBlockWorldCoordinates(block); - - for(setPos=transNodeIndicesSet.begin(); setPos!=transNodeIndicesSet.end(); ++setPos) - { - int ix1 = (*setPos)[0]; - int ix2 = (*setPos)[1]; - int ix3 = (*setPos)[2]; - - if(bcArray->isFluid(ix1,ix2,ix3)) //es kann sein, dass der node von einem anderen interactor z.B. als solid gemarkt wurde!!! - { - if( !bcArray->hasBC(ix1,ix2,ix3) ) continue; - BoundaryConditionsPtr bc = bcArray->getBC(ix1,ix2,ix3); - - double x1a = val<1>(blockOrg) - val<1>(orgDelta) + ix1 * dx; - double x2a = val<2>(blockOrg) - val<2>(orgDelta) + ix2 * dx; - double x3a = val<3>(blockOrg) - val<3>(orgDelta) + ix3 * dx; - nodes.push_back( makeUbTuple( (float)x1a, (float)x2a, (float)x3a ) ); - node1Index = nodes.size()-1; - - for(int dir = D3Q27System::FSTARTDIR; dir<=D3Q27System::FENDDIR; dir++) - { - if (bc->hasBoundaryConditionFlag(D3Q27System::INVDIR[dir])) - { - double x1b, x2b, x3b, q = bc->getQ(dir); - switch(dir) - { - case D3Q27System::E : x1b = x1a+q*dx; x2b = x2a ; x3b = x3a ; break; - case D3Q27System::N : x1b = x1a ; x2b = x2a+q*dx; x3b = x3a ; break; - case D3Q27System::W : x1b = x1a-q*dx; x2b = x2a ; x3b = x3a ; break; - case D3Q27System::S : x1b = x1a ; x2b = x2a-q*dx; x3b = x3a ; break; - case D3Q27System::NE: x1b = x1a+q*dx; x2b = x2a+q*dx; x3b = x3a ; break; - case D3Q27System::NW: x1b = x1a-q*dx; x2b = x2a+q*dx; x3b = x3a ; break; - case D3Q27System::SW: x1b = x1a-q*dx; x2b = x2a-q*dx; x3b = x3a ; break; - case D3Q27System::SE: x1b = x1a+q*dx; x2b = x2a-q*dx; x3b = x3a ; break; - case D3Q27System::T : x1b = x1a ; x2b = x2a ; x3b = x3a+q*dx; break; - case D3Q27System::TE: x1b = x1a+q*dx; x2b = x2a ; x3b = x3a+q*dx; break; - case D3Q27System::TN: x1b = x1a ; x2b = x2a+q*dx; x3b = x3a+q*dx; break; - case D3Q27System::TW: x1b = x1a-q*dx; x2b = x2a ; x3b = x3a+q*dx; break; - case D3Q27System::TS: x1b = x1a ; x2b = x2a-q*dx; x3b = x3a+q*dx; break; - case D3Q27System::B : x1b = x1a ; x2b = x2a ; x3b = x3a-q*dx; break; - case D3Q27System::BE: x1b = x1a+q*dx; x2b = x2a ; x3b = x3a-q*dx; break; - case D3Q27System::BN: x1b = x1a ; x2b = x2a+q*dx; x3b = x3a-q*dx; break; - case D3Q27System::BW: x1b = x1a-q*dx; x2b = x2a ; x3b = x3a-q*dx; break; - case D3Q27System::BS: x1b = x1a ; x2b = x2a-q*dx; x3b = x3a-q*dx; break; - case D3Q27System::TNE : x1b = x1a+q*dx ; x2b = x2a+q*dx; x3b = x3a+q*dx; break; - case D3Q27System::BSW : x1b = x1a-q*dx ; x2b = x2a-q*dx; x3b = x3a-q*dx; break; - case D3Q27System::BNE : x1b = x1a+q*dx ; x2b = x2a+q*dx; x3b = x3a-q*dx; break; - case D3Q27System::TSW : x1b = x1a-q*dx ; x2b = x2a-q*dx; x3b = x3a+q*dx; break; - case D3Q27System::TSE : x1b = x1a+q*dx ; x2b = x2a-q*dx; x3b = x3a+q*dx; break; - case D3Q27System::BNW : x1b = x1a-q*dx ; x2b = x2a+q*dx; x3b = x3a-q*dx; break; - case D3Q27System::BSE : x1b = x1a+q*dx ; x2b = x2a-q*dx; x3b = x3a-q*dx; break; - case D3Q27System::TNW : x1b = x1a-q*dx ; x2b = x2a+q*dx; x3b = x3a+q*dx; break; - default: throw UbException(UB_EXARGS,"unknown direction"); - } - - nodes.push_back( makeUbTuple( (float)x1b, (float)x2b, (float)x3b ) ); - node2Index = nodes.size()-1; - - lines.push_back( makeUbTuple( (int)node1Index, (int)node2Index) ); - } - } - } - } - } -} -//////////////////////////////////////////////////////////////////////////// -vector< pair<GbPoint3D,GbPoint3D> > D3Q27Interactor::getQsLineSet() -{ - vector< pair<GbPoint3D,GbPoint3D> > QsLineSet; - pair<GbPoint3D,GbPoint3D> pointpair; - - UbTupleInt3 blocknx = grid.lock()->getBlockNX(); - - int blocknx1 = val<1>(blocknx); - int blocknx2 = val<2>(blocknx); - int blocknx3 = val<3>(blocknx); - // vector<double> deltaT = grid->getD3Q27Calculator()->getDeltaT(); - - for(Block3DPtr block : bcBlocks) - { - ILBMKernelPtr kernel = block->getKernel(); - BCArray3DPtr bcMatrix = kernel->getBCProcessor()->getBCArray(); - UbTupleDouble3 nodeOffset = grid.lock()->getNodeOffset(block); - - //double collFactor = ((LbD3Q27Calculator*)grid->getCalculator())->getCollisionsFactors()[block->getLevel()]; - //checken ob obere reihe doppelt im system vorhanden oder nicht - bool include_N_Face = false; //x1=[0..blocknx1[ && x3=[0..blocknx3[ - bool include_E_Face = false; //x2=[0..blocknx2[ && x3=[0..blocknx3[ - bool include_T_Face = false; //x1=[0..blocknx1[ && x2=[0..blocknx2[ - bool include_NE_Edge = false; //(x1/x2/x3)=(blocknx1/blocknx2/[0..blocknx3[) - bool include_TN_Edge = false; //(x1/x2/x3)=([0..blocknx1[/blocknx2/blocknx1) - bool include_TE_Edge = false; //(x1/x2/x3)=(blocknx1/[0..blocknx2[/blocknx2) - if(block) - { - if( !block->getConnector(D3Q27System::N ) ) include_N_Face = true; - if( !block->getConnector(D3Q27System::E ) ) include_E_Face = true; - if( !block->getConnector(D3Q27System::T ) ) include_T_Face = true; - if( !block->getConnector(D3Q27System::NE) && include_N_Face && include_E_Face ) include_NE_Edge = true; - if( !block->getConnector(D3Q27System::TN) && include_T_Face && include_N_Face ) include_TN_Edge = true; - if( !block->getConnector(D3Q27System::TE) && include_T_Face && include_E_Face ) include_TE_Edge = true; - } - - // double dT = deltaT[block->getLevel()]; - - map<Block3DPtr, set< std::vector<int> > >::iterator pos = bcNodeIndicesMap.find(block); - if(pos==bcNodeIndicesMap.end()) throw UbException(UB_EXARGS,"block nicht in indizes map!!!"+block->toString()); - set< std::vector<int> >& transNodeIndicesSet = pos->second; - set< std::vector<int> >::iterator setPos; - - double x1,x2,x3,dx; - grid.lock()->calcStartCoordinatesAndDelta(block,x1,x2,x3,dx); - - //cout<<"getQs: "<<transBlockSet->size()<<" "<<transNodeIndicesVec.size()<<endl; - - for(setPos=transNodeIndicesSet.begin(); setPos!=transNodeIndicesSet.end(); ++setPos) - { - int ix1 = (*setPos)[0]; - int ix2 = (*setPos)[1]; - int ix3 = (*setPos)[2]; - - if( ( ix1<blocknx1 && ix2<blocknx2 && ix3<blocknx3 ) //std fall - || ( include_E_Face && ix1==blocknx1 && ix2<blocknx2 && ix3<blocknx3 ) - || ( include_N_Face && ix2==blocknx2 && ix1<blocknx1 && ix3<blocknx3 ) - || ( include_T_Face && ix3==blocknx3 && ix1<blocknx1 && ix2<blocknx2 ) - || ( include_NE_Edge && ix1==blocknx1 && ix2==blocknx2 ) - || ( include_TN_Edge && ix2==blocknx2 && ix3==blocknx3 ) - || ( include_TE_Edge && ix1==blocknx1 && ix3==blocknx3 ) ) //ansonsten doppelt im kraftwert - { - if(bcMatrix->isFluid(ix1,ix2,ix3)) //es kann sein, dass der node von einem anderen interactor z.B. als solid gemarkt wurde!!! - { - if( !bcMatrix->hasBC(ix1,ix2,ix3) ) continue; - BoundaryConditionsPtr bc = bcMatrix->getBC(ix1,ix2,ix3); - double x1a = x1-val<1>(nodeOffset)+dx * ix1; - double x2a = x2-val<2>(nodeOffset)+dx * ix2; - double x3a = x3-val<3>(nodeOffset)+dx * ix3; - pointpair.first.setX1(x1a); - pointpair.first.setX2(x2a); - pointpair.first.setX3(x3a); - for(int dir = D3Q27System::FSTARTDIR; dir<=D3Q27System::FENDDIR; dir++) - { - if (bc->hasBoundaryConditionFlag(D3Q27System::INVDIR[dir])) - { - double x1b, x2b, x3b, q = bc->getQ(dir); - switch(dir) - { - case D3Q27System::E : x1b = x1a+q*dx; x2b = x2a ; x3b = x3a ; break; - case D3Q27System::N : x1b = x1a ; x2b = x2a+q*dx; x3b = x3a ; break; - case D3Q27System::W : x1b = x1a-q*dx; x2b = x2a ; x3b = x3a ; break; - case D3Q27System::S : x1b = x1a ; x2b = x2a-q*dx; x3b = x3a ; break; - case D3Q27System::NE: x1b = x1a+q*dx; x2b = x2a+q*dx; x3b = x3a ; break; - case D3Q27System::NW: x1b = x1a-q*dx; x2b = x2a+q*dx; x3b = x3a ; break; - case D3Q27System::SW: x1b = x1a-q*dx; x2b = x2a-q*dx; x3b = x3a ; break; - case D3Q27System::SE: x1b = x1a+q*dx; x2b = x2a-q*dx; x3b = x3a ; break; - case D3Q27System::T : x1b = x1a ; x2b = x2a ; x3b = x3a+q*dx; break; - case D3Q27System::TE: x1b = x1a+q*dx; x2b = x2a ; x3b = x3a+q*dx; break; - case D3Q27System::TN: x1b = x1a ; x2b = x2a+q*dx; x3b = x3a+q*dx; break; - case D3Q27System::TW: x1b = x1a-q*dx; x2b = x2a ; x3b = x3a+q*dx; break; - case D3Q27System::TS: x1b = x1a ; x2b = x2a-q*dx; x3b = x3a+q*dx; break; - case D3Q27System::B : x1b = x1a ; x2b = x2a ; x3b = x3a-q*dx; break; - case D3Q27System::BE: x1b = x1a+q*dx; x2b = x2a ; x3b = x3a-q*dx; break; - case D3Q27System::BN: x1b = x1a ; x2b = x2a+q*dx; x3b = x3a-q*dx; break; - case D3Q27System::BW: x1b = x1a-q*dx; x2b = x2a ; x3b = x3a-q*dx; break; - case D3Q27System::BS: x1b = x1a ; x2b = x2a-q*dx; x3b = x3a-q*dx; break; - case D3Q27System::TNE : x1b = x1a+q*dx ; x2b = x2a+q*dx; x3b = x3a+q*dx; break; - case D3Q27System::BSW : x1b = x1a-q*dx ; x2b = x2a-q*dx; x3b = x3a-q*dx; break; - case D3Q27System::BNE : x1b = x1a+q*dx ; x2b = x2a+q*dx; x3b = x3a-q*dx; break; - case D3Q27System::TSW : x1b = x1a-q*dx ; x2b = x2a-q*dx; x3b = x3a+q*dx; break; - case D3Q27System::TSE : x1b = x1a+q*dx ; x2b = x2a-q*dx; x3b = x3a+q*dx; break; - case D3Q27System::BNW : x1b = x1a-q*dx ; x2b = x2a+q*dx; x3b = x3a-q*dx; break; - case D3Q27System::BSE : x1b = x1a+q*dx ; x2b = x2a-q*dx; x3b = x3a-q*dx; break; - case D3Q27System::TNW : x1b = x1a-q*dx ; x2b = x2a+q*dx; x3b = x3a+q*dx; break; - default: throw UbException(UB_EXARGS,"unknown direction"); - } - pointpair.second.setX1(x1b); - pointpair.second.setX2(x2b); - pointpair.second.setX3(x3b); - QsLineSet.push_back(pointpair); - } - } - - } - } - } - } - //cout<<"getQs: "<<QsLineSet.size()<<endl; - return QsLineSet; -} - -void D3Q27Interactor::writeValidationAVSFile(string filename) -{ - UBLOG(logINFO,"D3Q27Interactor::writeValidationAVSFile("<<filename<<") - start "); - ofstream out(filename.c_str(),ios::out); - if(!out) throw UbException(UB_EXARGS,"couldn't open file "+filename); - - int numpoints, numlines; - vector< pair<GbPoint3D,GbPoint3D> > qsLineSet = this->getQsLineSet(); - numlines = (unsigned)qsLineSet.size(); - numpoints = numlines*2; - - out<<"# UCD-File created by D3Q27Interactor\n"; - out<<numpoints<<" "<<numlines<<" 0 0 0 "<<endl; - int nr=1; - for (int i=0; i<numlines; i++) - { - out<<nr++<<" "<<qsLineSet[i].first.getX1Coordinate() <<" " <<qsLineSet[i].first.getX2Coordinate() <<" " <<qsLineSet[i].first.getX3Coordinate() <<" \n"; - out<<nr++<<" "<<qsLineSet[i].second.getX1Coordinate()<<" " <<qsLineSet[i].second.getX2Coordinate()<<" " <<qsLineSet[i].second.getX3Coordinate() <<" \n"; - } - nr = 1; - for (int i=0; i<numlines; i++) - { - int el = nr+1; - out<<i+1<<" "<<2<<" line "<<nr<<" "<<el<<" "<<endl; - nr=el+1; - } - UBLOG(logINFO,"D3Q27Interactor::writeValidationAVSFile("<<filename<<") - end"); -} diff --git a/src/VirtualFluids/Interactors/D3Q27Interactor.h b/src/VirtualFluids/Interactors/D3Q27Interactor.h deleted file mode 100644 index 9c1f4193a..000000000 --- a/src/VirtualFluids/Interactors/D3Q27Interactor.h +++ /dev/null @@ -1,106 +0,0 @@ -// _ ___ __ __________ _ __ -// | | / (_)____/ /___ ______ _/ / ____/ /_ __(_)___/ /____ -// | | / / / ___/ __/ / / / __ `/ / /_ / / / / / / __ / ___/ -// | |/ / / / / /_/ /_/ / /_/ / / __/ / / /_/ / / /_/ (__ ) -// |___/_/_/ \__/\__,_/\__,_/_/_/ /_/\__,_/_/\__,_/____/ -// -#ifndef D3Q27INTERACTOR_H -#define D3Q27INTERACTOR_H - -#include <string> -#include <vector> -#include <map> -#include <set> -#include <memory> - -#include <boost/serialization/base_object.hpp> -#include <boost/serialization/set.hpp> - -#include <VirtualFluidsDefinitions.h> - -#include "UbException.h" -#include "UbTuple.h" -#include "GbPoint3D.h" -#include "Interactor3D.h" -#include "D3Q27System.h" - -class D3Q27Interactor; -typedef std::shared_ptr<D3Q27Interactor> D3Q27InteractorPtr; - -class BCAdapter; -class Block3D; -class Grid3D; -class GbObject3D; - -typedef std::map<std::shared_ptr<Block3D>, std::set< std::vector<int> > > BcNodeIndicesMap; -typedef std::map<std::shared_ptr<Block3D>, std::set< UbTupleInt3 > > SolidNodeIndicesMap; - -class VF_PUBLIC D3Q27Interactor : public Interactor3D -{ -public: - D3Q27Interactor(); - D3Q27Interactor(std::shared_ptr<GbObject3D> geoObject3D, std::shared_ptr<Grid3D> grid, int type); - D3Q27Interactor(std::shared_ptr<GbObject3D> geoObject3D, std::shared_ptr<Grid3D> grid, std::shared_ptr<BCAdapter> bcAdapter, int type); - D3Q27Interactor(std::shared_ptr<GbObject3D> geoObject3D, std::shared_ptr<Grid3D> grid, std::shared_ptr<BCAdapter> bcAdapter, int type, Interactor3D::Accuracy a); - - virtual ~D3Q27Interactor(); - - void setRelevantForForces(const bool& value) { this->relevantForForces = value; } - bool isRelevantForForces() { return this->relevantForForces; } - - virtual void addBCAdapter(const std::shared_ptr<BCAdapter> bcAdapter) { bcAdapters.push_back(bcAdapter); } - void deleteBCAdapter() { bcAdapters.clear(); } - - - virtual void initInteractor(const double& timeStep=0); - void updateInteractor(const double& timestep=0); - - void setReinitWithStoredQs(bool reinitWithStoredQsFlag) { this->reinitWithStoredQsFlag = reinitWithStoredQsFlag; } - - void removeSolidBlocks() { Interactor3D::removeSolidBlocks(); solidNodeIndicesMap.clear(); } - void removeBcBlocks() { Interactor3D::removeBcBlocks(); bcNodeIndicesMap.clear(); } - - bool setDifferencesToGbObject3D(const std::shared_ptr<Block3D> block/*, const double& x1, const double& x2, const double& x3, const double& blockLengthX1, const double& blockLengthX2, const double& blockLengthX3, const double& timestep=0*/); - - ObObject* clone() { throw UbException(UB_EXARGS,"not implemented"); } - ObObjectCreator* getCreator(); - - - void writeValidationAVSFile(std::string filename); - virtual std::vector< std::pair<GbPoint3D,GbPoint3D> > getQsLineSet(); - - void addQsLineSet(std::vector<UbTupleFloat3 >& nodes, std::vector<UbTupleInt2 >& lines); - - const BcNodeIndicesMap& getBcNodeIndicesMap() const { return bcNodeIndicesMap; } - -protected: - bool relevantForForces; - bool reinitWithStoredQsFlag; - - std::vector<std::shared_ptr<BCAdapter> > bcAdapters; - - - SolidNodeIndicesMap solidNodeIndicesMap; - BcNodeIndicesMap bcNodeIndicesMap; - //!!! es kann sein, dass in diesem interactor - //an eine rpos eine BC gesetzt wurde, aber derselbe node in - //in einem anderen in einen anderen Typ (z.B. Solid) geaendert - //wurde --> es ist keine BC mehr an der stelle! - - void initRayVectors(); - double rayX1[D3Q27System::FENDDIR+1]; - double rayX2[D3Q27System::FENDDIR+1]; - double rayX3[D3Q27System::FENDDIR+1]; - - friend class boost::serialization::access; - template<class Archive> - void serialize(Archive & ar, const unsigned int version) - { - ar & boost::serialization::base_object<Interactor3D>(*this); - ar & bcNodeIndicesMap; - ar & bcAdapters; - } -}; - - -#endif diff --git a/src/VirtualFluids/Interactors/D3Q27TriFaceMeshInteractor.cpp b/src/VirtualFluids/Interactors/D3Q27TriFaceMeshInteractor.cpp deleted file mode 100644 index ea9a6478d..000000000 --- a/src/VirtualFluids/Interactors/D3Q27TriFaceMeshInteractor.cpp +++ /dev/null @@ -1,1837 +0,0 @@ -#include "D3Q27TriFaceMeshInteractor.h" -#include <basics/utilities/UbMath.h> -#include <basics/utilities/UbLogger.h> -#include <basics/utilities/UbStaticPathMap.h> - -#include <basics/writer/WbWriterVtkBinary.h> -#include <basics/writer/WbWriterVtkXmlBinary.h> -#include <basics/writer/WbWriterVtkASCII.h> -#include "basics/writer/WbWriterVtkXmlASCII.h" - -#include <numerics/geometry3d/GbSystem3D.h> -#include <numerics/geometry3d/GbCuboid3D.h> -#include <numerics/geometry3d/GbHalfSpace3D.h> -#include <numerics/geometry3d/GbMeshTools3D.h> -#include "Block3D.h" -#include "Grid3D.h" -#include "BCArray3D.h" -#include "BoundaryConditions.h" -#include "VelocityBCAdapter.h" -#include "LBMKernel.h" -#include "BCProcessor.h" -#include "basics/utilities/UbTiming.h" - -#include <numerics/geometry3d/GbTriFaceMesh3D.h> - -//#include <omp.h> - -#include <stack> -#include "CoordinateTransformation3D.h" - -using namespace std; - -D3Q27TriFaceMeshInteractor::D3Q27TriFaceMeshInteractor() -: D3Q27Interactor(), forceshift(0.0), velocityshift(0.0), forceshiftpolicy(false), velocityshiftpolicy(false), useHalfSpace(true), regardPIOTest(true) -{ - this->stressMode = STRESSNORMAL; -} -////////////////////////////////////////////////////////////////////////// -D3Q27TriFaceMeshInteractor::D3Q27TriFaceMeshInteractor(Grid3DPtr grid, std::string name) -{ - this->stressMode = STRESSNORMAL; -} -////////////////////////////////////////////////////////////////////////// -D3Q27TriFaceMeshInteractor::D3Q27TriFaceMeshInteractor(GbTriFaceMesh3DPtr triFaceMesh, Grid3DPtr grid, BCAdapterPtr bcAdapter, int type) -: D3Q27Interactor(triFaceMesh, grid, bcAdapter, type), forceshift(0.0), velocityshift(0.0), forceshiftpolicy(false), velocityshiftpolicy(false), useHalfSpace(true), regardPIOTest(true) -{ - this->stressMode = STRESSNORMAL; -} -////////////////////////////////////////////////////////////////////////// -D3Q27TriFaceMeshInteractor::D3Q27TriFaceMeshInteractor(GbTriFaceMesh3DPtr triFaceMesh, Grid3DPtr grid, BCAdapterPtr bcAdapter, int type, Interactor3D::Accuracy a) - : D3Q27Interactor(triFaceMesh, grid, bcAdapter, type, a), forceshift(0.0), velocityshift(0.0), forceshiftpolicy(false), velocityshiftpolicy(false), useHalfSpace(true), regardPIOTest(true) -{ - this->stressMode = STRESSNORMAL; -} -////////////////////////////////////////////////////////////////////////// -D3Q27TriFaceMeshInteractor::~D3Q27TriFaceMeshInteractor() -{ - -} -////////////////////////////////////////////////////////////////////////// -void D3Q27TriFaceMeshInteractor::initInteractor(const double& timeStep) -{ - Interactor3D::initInteractor(timeStep); - setQs(timeStep); -} -////////////////////////////////////////////////////////////////////////// -bool D3Q27TriFaceMeshInteractor::setDifferencesToGbObject3D(const Block3DPtr block/*,const double& orgX1,const double& orgX2,const double& orgX3,const double& blockLengthX1,const double& blockLengthX2,const double& blockLengthX3, const double& timestep*/) -{ - if(!block) return false; - - bcNodeIndicesMap[block] = set< std::vector<int> >(); - set< std::vector<int> >& transNodeIndices = bcNodeIndicesMap[block]; - solidNodeIndicesMap[block] = set< UbTupleInt3 >(); - set< UbTupleInt3 >& solidNodeIndices = solidNodeIndicesMap[block]; - - - bool oneEntryGotBC = false; //ob ueberhaupt ein eintrag ein BC zugewiesen wurde - bool gotQs = false; //true, wenn "difference" gesetzt wurde - BoundaryConditionsPtr bc; - - ILBMKernelPtr kernel = block->getKernel(); - BCArray3DPtr bcArray = kernel->getBCProcessor()->getBCArray(); - - double internX1,internX2,internX3; - - int startIX1 = 0, startIX2 = 0, startIX3 = 0; - int stopIX1 = (int)bcArray->getNX1(), stopIX2 = (int)bcArray->getNX2(), stopIX3 = (int)bcArray->getNX3(); - - double dx = grid.lock()->getDeltaX(block); - UbTupleDouble3 orgDelta = grid.lock()->getNodeOffset(block); - - bool pointOnBoundary = false; - - for(int ix3=startIX3; ix3<stopIX3; ix3++) - { - for(int ix2=startIX2; ix2<stopIX2; ix2++) - { - for(int ix1=startIX1; ix1<stopIX1; ix1++) - { - Vector3D coords = grid.lock()->getNodeCoordinates(block, ix1, ix2, ix3); - internX1 = coords[0]; - internX2 = coords[1]; - internX3 = coords[2]; - - if(this->isSolid() ) - { - if(this->geoObject3D->isPointInGbObject3D(internX1, internX2, internX3)) - { - if(bcArray->isFluid(ix1,ix2,ix3)) - { - solidNodeIndices.insert(UbTupleInt3(ix1, ix2, ix3)); - bcArray->setSolid(ix1,ix2,ix3); - } - } - } - else if( this->isInverseSolid() ) - { - //bei inverse solid sind alle Knoten AUSSERHALB und auf der boundary SOLID - if( !this->geoObject3D->isPointInGbObject3D(internX1, internX2, internX3, pointOnBoundary) || pointOnBoundary == true ) - { - if(bcArray->isFluid(ix1,ix2,ix3)) - { - solidNodeIndices.insert(UbTupleInt3(ix1, ix2, ix3)); - bcArray->setSolid(ix1,ix2,ix3); - } - } - } - } - } - } - - return oneEntryGotBC; -} -////////////////////////////////////////////////////////////////////////// -//E.F. /4/16/2013 -void D3Q27TriFaceMeshInteractor::setQs(const double& timeStep) -{ - UBLOGML(logDEBUG1,"\nLBMTriFaceMeshInteractor - setQs start "); - if( !this->grid.lock() ) throw UbException(UB_EXARGS,"ups, no grid.lock()!!"); - - if( this->reinitWithStoredQsFlag && !bcNodeIndicesAndQsMap.empty() ) - { - this->reinitWithStoredQs(timeStep); - return; - } - - GbTriFaceMesh3D* mesh = dynamic_cast<GbTriFaceMesh3D*>(this->geoObject3D.get()); - - ////////////////////////////////////////////////////////////////////////// - //init bcs - ////////////////////////////////////////////////////////////////////////// - int nofAdapter = (int)this->bcAdapters.size(); - if(nofAdapter==0) std::cout<<"WARNING - D3Q27TriFaceMeshInteractor::initInteractor Warning - no nodeAdapter available for "/*<<this->getName()*/<<std::endl; - bool needTimeDependence = false; - for(int pos=0; pos<nofAdapter; ++pos) - { - this->bcAdapters[pos]->init(this,timeStep); - if(this->bcAdapters[pos]->isTimeDependent()) needTimeDependence = true; - } - if(needTimeDependence) this->setTimeDependent(); - else this->unsetTimeDependent(); - - ////////////////////////////////////////////////////////////////////////// - //grid.lock() info - ////////////////////////////////////////////////////////////////////////// - int coarsestInitLevel = grid.lock()->getCoarsestInitializedLevel(); - int finestInitLevel = grid.lock()->getFinestInitializedLevel(); - - UbTupleInt3 blocknx = grid.lock()->getBlockNX(); - int blocknx1 = val<1>(blocknx); //gilt fuer alle Level - int blocknx2 = val<2>(blocknx); //gilt fuer alle Level - int blocknx3 = val<3>(blocknx); //gilt fuer alle Level - - //grobe Blocklaengen - CoordinateTransformation3DPtr trafo = grid.lock()->getCoordinateTransformator(); - double cblockDeltaX1,cblockDeltaX2,cblockDeltaX3, delta ; - cblockDeltaX1 = cblockDeltaX2 = cblockDeltaX3 = delta = 1.0/(double)(1<<coarsestInitLevel); - if(trafo) - { - cblockDeltaX1 = trafo->getX1CoordinateScaling()*delta; - cblockDeltaX2 = trafo->getX2CoordinateScaling()*delta; - cblockDeltaX3 = trafo->getX3CoordinateScaling()*delta; - } - //levelspezifische blocklaengen und knotenabstaende - std::vector< std::vector<double> > nodeDeltaToNeigh(finestInitLevel+1); - std::vector<float> deltaMinX1(finestInitLevel+1),deltaMinX2(finestInitLevel+1),deltaMinX3(finestInitLevel+1); - std::vector<float> deltaMaxX1(finestInitLevel+1),deltaMaxX2(finestInitLevel+1),deltaMaxX3(finestInitLevel+1); - - //Im Boltzmankontext muss dx1==dx2==dx3 sein!! - assert( UbMath::equal(cblockDeltaX1/(double)blocknx1, cblockDeltaX2/(double)blocknx2 ) ); - assert( UbMath::equal(cblockDeltaX1/(double)blocknx1, cblockDeltaX3/(double)blocknx3 ) ); - - for(int level = coarsestInitLevel; level<=finestInitLevel; level++) - { - double nodeDeltaX1 = cblockDeltaX1/(double)(blocknx1*(1<<(level-coarsestInitLevel))); - double nodeDeltaX2 = cblockDeltaX2/(double)(blocknx2*(1<<(level-coarsestInitLevel))); - double nodeDeltaX3 = cblockDeltaX3/(double)(blocknx3*(1<<(level-coarsestInitLevel))); - - std::vector<double> distNeigh(D3Q27System::FENDDIR+1, 0.0); - D3Q27System::calcDistanceToNeighbors(distNeigh, nodeDeltaX1,nodeDeltaX2,nodeDeltaX3); - //D3Q27System::calcDistanceToNeighbors(distNeigh, nodeDeltaX1); - - - nodeDeltaToNeigh[level].resize(D3Q27System::ENDDIR+1,0.0); - for(int fdir=D3Q27System::FSTARTDIR; fdir<=D3Q27System::FENDDIR; fdir++) - { - nodeDeltaToNeigh[level][fdir] = distNeigh[fdir]; - } - - //im gegensatz zum allg. Cell3DInteractor kann man hier auf max(0.02*blockDeltaX1[level],fabs(...)) verzichten - //da dies nur für blockDeltaCalculator->getMinX1Delta(level)==0.0 benötigt wird. ist im D3Q19... aber nie so - //Geller: kann man nicht diesen befuckten DeltaCalculator weglassen und hier einfach die Formel zum Delta rechnen reinpacken - //SirAnn: klar, mann kann auch weißwuerste am Alex verkaufen... aber zum einen ist das Ding dazu da - // und zum anderen sollt eman mal überlegen: "Formel zum Delta rechnen"->man muss rechnen - // blockDeltaCalculator->getMinX1Delta(level) -> ein geinlinter wert wird geholt - - //TODO: set 5.0 as variable parameter in constructor, default 2.0 - deltaMinX1[level] = (float)( 5.0*nodeDeltaX1); //kein minus da unten -deltaMin - deltaMinX2[level] = (float)( 5.0*nodeDeltaX2); - deltaMinX3[level] = (float)( 5.0*nodeDeltaX3); - deltaMaxX1[level] = (float)( 5.0*nodeDeltaX1); - deltaMaxX2[level] = (float)( 5.0*nodeDeltaX2); - deltaMaxX3[level] = (float)( 5.0*nodeDeltaX3); - } - - ////////////////////////////////////////////////////////////////////////// - //bounding cubes des TriFaceMesh ermitteln (pro level) - ////////////////////////////////////////////////////////////////////////// - //min/max Werte des Dreiecksnetzes holen - double geoMinX1(0.0), geoMinX2(0.0), geoMinX3(0.0), geoMaxX1(0.0), geoMaxX2(0.0), geoMaxX3(0.0); - - geoMinX1 = this->geoObject3D->getX1Minimum(); geoMaxX1 = this->geoObject3D->getX1Maximum(); - geoMinX2 = this->geoObject3D->getX2Minimum(); geoMaxX2 = this->geoObject3D->getX2Maximum(); - geoMinX3 = this->geoObject3D->getX3Minimum(); geoMaxX3 = this->geoObject3D->getX3Maximum(); - - - ////////////////////////////////////////////////////////////////////////// - //DREIECKE: q-Bestimmung - ////////////////////////////////////////////////////////////////////////// - - //notwendige variablen initialisieren (u.a. blockDeltas des groben levels) - float triPoints[3][3]; - float vx1=0.0, vx2=0.0, vx3=0.0; - unsigned counterTriBoxOverlap=0, counterAABBTriFace=0, counterHalfspace=0, counterBilligOBB=0; - std::vector<GbTriFaceMesh3D::TriFace>& triangles = *mesh->getTriangles(); - std::vector<GbTriFaceMesh3D::Vertex>& nodes = *mesh->getNodes(); - std::map< Block3DPtr, std::set< UbTupleInt3 > > tmpSolidNodesFromOtherInteractors; - - int onePercent = UbMath::integerRounding(triangles.size()*0.01); - if(onePercent==0) onePercent=1; - UbTimer setQTimer; setQTimer.start(); - UBLOG(logDEBUG3, " - setQs for "<<(int)triangles.size()<<" triangles"); - - bool solidFromOtherInteractor = false; - float blockMinX[3],blockMaxX[3],boxCenter[3],halfBoxSize[3]; - - for(size_t t=0; t<triangles.size(); t++) - { - ////////////////////////////////////////////////////////////////////////// - // Halfspace zum Dreieck generieren und min/max des Dreiecks ermitteln - ////////////////////////////////////////////////////////////////////////// - GbTriFaceMesh3D::TriFace& triangle = triangles[t]; - - GbTriFaceMesh3D::Vertex& v1 = nodes[triangle.v1]; - GbTriFaceMesh3D::Vertex& v2 = nodes[triangle.v2]; - GbTriFaceMesh3D::Vertex& v3 = nodes[triangle.v3]; - - if(this->isInverseSolid() ) - { - triangle.nx*=(-1); - triangle.ny*=(-1); - triangle.nz*=(-1); - } - GbHalfSpace3D halfSpace( v1.x,v1.y,v1.z,triangle.nx,triangle.ny,triangle.nz ); - - ////////////////////////////////////////////////////////////////////////// - //fuer GbMeshTools3D::triBoxOverlap - ////////////////////////////////////////////////////////////////////////// - triPoints[0][0] = v1.x; triPoints[0][1] = v1.y; triPoints[0][2] = v1.z; - triPoints[1][0] = v2.x; triPoints[1][1] = v2.y; triPoints[1][2] = v2.z; - triPoints[2][0] = v3.x; triPoints[2][1] = v3.y; triPoints[2][2] = v3.z; - - double minX1 = triangle.getMinX(nodes); double maxX1 = triangle.getMaxX(nodes); - double minX2 = triangle.getMinY(nodes); double maxX2 = triangle.getMaxY(nodes); - double minX3 = triangle.getMinZ(nodes); double maxX3 = triangle.getMaxZ(nodes); - - ////////////////////////////////////////////////////////////////////////// - // Schleife ueber alle Level - ////////////////////////////////////////////////////////////////////////// - double e1x1,e1x2,e1x3,e2x1,e2x2,e2x3,px1,px2,px3,a,f,sx1,sx2,sx3,u,qx1,qx2,qx3,v; - bool gotQs = false; - BoundaryConditionsPtr bc; - - for(int level=coarsestInitLevel; level<=finestInitLevel; level++) - { - ////////////////////////////////////////////////////////////////////////// - // levelspezifisches BoundCube des Dreicks ermitteln und zugehörige Bloecke beziehen - ////////////////////////////////////////////////////////////////////////// - double boundCubeTriangleMinX1 = minX1-deltaMinX1[level]; double boundCubeTriangleMaxX1 = maxX1+deltaMaxX1[level]; - double boundCubeTriangleMinX2 = minX2-deltaMinX2[level]; double boundCubeTriangleMaxX2 = maxX2+deltaMaxX2[level]; - double boundCubeTriangleMinX3 = minX3-deltaMinX3[level]; double boundCubeTriangleMaxX3 = maxX3+deltaMaxX3[level]; - - GbCuboid3D boundingCubeTriangle( boundCubeTriangleMinX1, boundCubeTriangleMinX2, boundCubeTriangleMinX3 - , boundCubeTriangleMaxX1, boundCubeTriangleMaxX2, boundCubeTriangleMaxX3 ); - - std::vector<Block3DPtr> triBlocks; - grid.lock()->getBlocksByCuboid(level, boundCubeTriangleMinX1, boundCubeTriangleMinX2, boundCubeTriangleMinX3 - , boundCubeTriangleMaxX1, boundCubeTriangleMaxX2, boundCubeTriangleMaxX3, triBlocks ); - - ////////////////////////////////////////////////////////////////////////// - // Schleife ueber bloecke des level, die das dreieck beinhalten - ////////////////////////////////////////////////////////////////////////// - for(std::size_t b=0; b<triBlocks.size(); b++) - { - Block3DPtr block = triBlocks[b]; - - //////////////////////////////////////////////////////////////////////////// - //// Block Dreieck-/test - //////////////////////////////////////////////////////////////////////////// - UbTupleDouble3 coords = grid.lock()->getBlockWorldCoordinates(block); - UbTupleDouble3 deltas = grid.lock()->getBlockLengths(block); - - blockMinX[0] = (float)(val<1>(coords)-deltaMinX1[level]); - blockMinX[1] = (float)(val<2>(coords)-deltaMinX2[level]); - blockMinX[2] = (float)(val<3>(coords)-deltaMinX3[level]); - - blockMaxX[0] = (float)(val<1>(coords)+val<1>(deltas)+deltaMaxX1[level]); - blockMaxX[1] = (float)(val<2>(coords)+val<2>(deltas)+deltaMaxX2[level]); - blockMaxX[2] = (float)(val<3>(coords)+val<3>(deltas)+deltaMaxX3[level]); - - boxCenter[0] = (float)(0.5*(blockMaxX[0]+blockMinX[0])); - boxCenter[1] = (float)(0.5*(blockMaxX[1]+blockMinX[1])); - boxCenter[2] = (float)(0.5*(blockMaxX[2]+blockMinX[2])); - - halfBoxSize[0] = (float)(0.5*(blockMaxX[0]-blockMinX[0])); - halfBoxSize[1] = (float)(0.5*(blockMaxX[1]-blockMinX[1])); - halfBoxSize[2] = (float)(0.5*(blockMaxX[2]-blockMinX[2])); - - //wenn dreieck "vergroesserten cube" nicht schneidet/beruehrt -> keine BC moeglich -> continue - if( !GbMeshTools3D::triBoxOverlap(boxCenter,halfBoxSize,triPoints) ) - { - counterTriBoxOverlap++; - continue; - } - - ////////////////////////////////////////////////////////////////////////// - //Untersuchung der einzelnen nodes - ////////////////////////////////////////////////////////////////////////// - bool blockGotBCs = false; - - ILBMKernelPtr kernel = block->getKernel(); - BCArray3DPtr bcMatrix = kernel->getBCProcessor()->getBCArray(); - - int indexMinX1 = 0; - int indexMinX2 = 0; - int indexMinX3 = 0; - - int indexMaxX1 = (int)bcMatrix->getNX1(); - int indexMaxX2 = (int)bcMatrix->getNX2(); - int indexMaxX3 = (int)bcMatrix->getNX3(); - - std::set< std::vector<int> >& bcNodeIndices = this->bcNodeIndicesMap[block]; - std::set< UbTupleInt3 >& solidsFromOtherInteractors = tmpSolidNodesFromOtherInteractors[block]; - double q, distance; - - double& nodeDx1 = nodeDeltaToNeigh[level][D3Q27System::E]; - double& nodeDx2 = nodeDeltaToNeigh[level][D3Q27System::N]; - double& nodeDx3 = nodeDeltaToNeigh[level][D3Q27System::T]; - - //fuer OBB-Test - double qEinflussDelta = 1.1 * sqrt( nodeDx1*nodeDx1 + nodeDx2*nodeDx2 + nodeDx3*nodeDx3); - - for(int ix3=indexMinX3; ix3<indexMaxX3; ix3++) - { - for(int ix2=indexMinX2; ix2<indexMaxX2; ix2++) - { - for(int ix1=indexMinX1; ix1<indexMaxX1; ix1++) - { - Vector3D pointplane1 = grid.lock()->getNodeCoordinates(block, ix1,ix2,ix3); - double internX1 = pointplane1[0]; - double internX2 = pointplane1[1]; - double internX3 = pointplane1[2]; - - int blx1 = block->getX1(); - int blx2 = block->getX2(); - int blx3 = block->getX3(); - - if(bcMatrix->isSolid(ix1,ix2,ix3) || bcMatrix->isUndefined(ix1,ix2,ix3)) - { - continue; - } - - ////////////////////////////////////////////////////////////////////////// - //Punkt in AABB von Dreieck? - ////////////////////////////////////////////////////////////////////////// - //ehsan changed - bool pointIsOnBoundary = true; - if( !boundingCubeTriangle.isPointInGbObject3D(internX1, internX2, internX3,pointIsOnBoundary) ) - { - counterAABBTriFace++; - continue; - } - //std::cout<<"internX3 "<<internX3<<" internX2"<<internX2<<" internX1 "<<internX1<<"\n"; - ////////////////////////////////////////////////////////////////////////// - // Halbebenentests - ////////////////////////////////////////////////////////////////////////// - distance = halfSpace.getDistance( internX1, internX2, internX3 ); - //Punkt in Halbebene? (nein, wenn distance<0) - if(useHalfSpace && UbMath::less(distance, 0.0) )//== !halfSpace.ptInside(internX1,internX2,internX3) ) - { - counterHalfspace++; - continue; - } - - //BilligOBB-Test: wenn distance > qEinflussDelta -> kein q - if( UbMath::greater( fabs(distance), qEinflussDelta ) ) - { - counterBilligOBB++; - continue; - } - - ///////////////////////////////////////////////////////////////////////////// - //Raytracingfür diskrete Boltzmannrichtungen - ///////////////////////////////////////////////////////////////////////////// - gotQs = false; - bc = BoundaryConditionsPtr(); - - //RAYTRACING - diskrete LB-dir zu Dreick - //e1 = v1 - v0 - e1x1 = v2.x-v1.x; - e1x2 = v2.y-v1.y; - e1x3 = v2.z-v1.z; - - //e2 = v2 - v0 - e2x1 = v3.x-v1.x; - e2x2 = v3.y-v1.y; - e2x3 = v3.z-v1.z; - - //s = o - v0 - sx1 = internX1 - v1.x; - sx2 = internX2 - v1.y; - sx3 = internX3 - v1.z; - - for(int fdir=D3Q27System::FSTARTDIR; fdir<=D3Q27System::FENDDIR; fdir++) - { - //p = d x e2 - px1 = this->rayX2[fdir]*e2x3 - this->rayX3[fdir]*e2x2; - px2 = this->rayX3[fdir]*e2x1 - this->rayX1[fdir]*e2x3; - px3 = this->rayX1[fdir]*e2x2 - this->rayX2[fdir]*e2x1; - - //a = e1 dot p - a = e1x1*px1 + e1x2*px2 + e1x3*px3; - if(fabs(a)<1.E-10) continue; - f = 1.0/a; - - //u = f * ( s dot p) - u = f * ( sx1*px1 + sx2*px2 + sx3*px3 ); - if(u<-1.E-10 || u>1.0+1.E-10) continue; - - //q = s x e1 - qx1 = sx2*e1x3 - sx3*e1x2; - qx2 = sx3*e1x1 - sx1*e1x3; - qx3 = sx1*e1x2 - sx2*e1x1; - - //v = f*(e2 dot q) - v = f * (this->rayX1[fdir]*qx1 + this->rayX2[fdir]*qx2 + this->rayX3[fdir]*qx3); - if(v<-1.E-10 || (u+v)>1.0+1.E-10) continue; - - //t = f * (e2 dot q) - q = f * (e2x1*qx1 + e2x2*qx2 + e2x3*qx3); - q /= nodeDeltaToNeigh[level][fdir]; - /////ehsan q///////////////////////////////////////////////////////////////////// - double det=triangle.nx * this->rayX1[fdir]+ triangle.ny * this->rayX2[fdir]+ triangle.nz * this->rayX3[fdir]; - - if(det>-1.E-10) continue; - double d=triangle.nx*v1.x+triangle.ny*v1.y+triangle.nz*v1.z; - double x1= -((-d* this->rayX1[fdir] - triangle.ny *this->rayX2[fdir]* internX1 - triangle.nz *this->rayX3[fdir]* internX1 + triangle.ny *this->rayX1[fdir]* internX2 + triangle.nz* this->rayX1[fdir]* internX3))/det; - double y1= -((-d* this->rayX2[fdir] + triangle.nx* this->rayX2[fdir]* internX1 - triangle.nx* this->rayX1[fdir]* internX2 - triangle.nz* this->rayX3[fdir] *internX2 + triangle.nz* this->rayX2[fdir]* internX3))/det; - double z1= -((-d* this->rayX3[fdir] + triangle.nx* this->rayX3[fdir]* internX1 + triangle.ny* this->rayX3[fdir]* internX2 - triangle.nx* this->rayX1[fdir]* internX3 - triangle.ny* this->rayX2[fdir]* internX3))/det; - double q_ehsan=sqrt((x1-internX1)*(x1-internX1)+(y1-internX2)*(y1-internX2)+(z1-internX3)*(z1-internX3)); - q_ehsan /= nodeDeltaToNeigh[level][fdir]; - q=q_ehsan; - if( UbMath::greater(q, 1.0) || UbMath::lessEqual(q, 0.0) )continue; - - //gefundenes q auf gueltigkeit pruefen - if( UbMath::zero(q) ) - { - //neu (18.05.2010) - //es kann vorkommen, dass bei dünnwandigen geos punkte, die auf einem dreieck liegen, qs bekommen, die durch die geo - //durchgehen. diese punkte werden später jedoch nicht mehr auf solid getestet, da sie ja ne BC bekommen haben - //--> da mind ein q==0.0 für eines der dreiecke -> dort solid setzen - this->solidNodeIndicesMap[block].insert( UbTupleInt3(ix1,ix2,ix3) ); - bcMatrix->setSolid( ix1, ix2, ix3 ); - continue; - } - - if( UbMath::inClosedInterval(q, 1.0, 1.0) ) q = 1.0; - if( UbMath::greater(q, 0.0) && UbMath::lessEqual(q, 1.0) ) - { - gotQs=blockGotBCs=true; - - bc = bcMatrix->getBC(ix1,ix2,ix3); - - //SG 26.08.2010 if(!bc && !bcMatrix->isSolid()) - if(!bc) - { - bc = BoundaryConditionsPtr(new BoundaryConditions);; - bcMatrix->setBC(ix1,ix2,ix3,bc); - } - else if( UbMath::less( bc->getQ(fdir), q ) ) //schon ein kuerzeres q voehanden? - { - //neu:: 18.05.2010 - //um falsche qs die evtl durch die "wand" gehen zu vermeiden - //q nur dann neu setzen, wenn neues q kleiner als vorhandenes! - //Zudem: insbesondere an ecken mit zwei BC geos ist nur das - //naehere gueltig - continue; - } - - bc->setBoundaryVelocityX1(vx1); - bc->setBoundaryVelocityX2(vx2); - bc->setBoundaryVelocityX3(vx3); - - for(int index=(int)this->bcAdapters.size()-1; index>=0; --index) - this->bcAdapters[index]->adaptBCForDirection(*this,bc,internX1,internX2,internX3,q,fdir); - - //fuer beschleunigtes wiedereinlesen - if(this->reinitWithStoredQsFlag) - { - bcNodeIndicesAndQsMap[block][ UbTupleInt3(ix1, ix2, ix3) ].resize(D3Q27System::FENDDIR+1+3, -1.0f); - bcNodeIndicesAndQsMap[block][ UbTupleInt3(ix1, ix2, ix3) ][fdir ] = float(q); - bcNodeIndicesAndQsMap[block][ UbTupleInt3(ix1, ix2, ix3) ][D3Q27System::FENDDIR+1+0] = float(internX1); - bcNodeIndicesAndQsMap[block][ UbTupleInt3(ix1, ix2, ix3) ][D3Q27System::FENDDIR+1+1] = float(internX2); - bcNodeIndicesAndQsMap[block][ UbTupleInt3(ix1, ix2, ix3) ][D3Q27System::FENDDIR+1+2] = float(internX3); - } - } - } - - if(gotQs) - { - std::vector<int> p(3); - p[0]=ix1; p[1]=ix2; p[2]=ix3; - bcNodeIndices.insert(p); - - for(int index=(int)this->bcAdapters.size()-1; index>=0; --index) - this->bcAdapters[index]->adaptBC(*this,bc,internX1,internX2,internX3); - } - } - } - } - } - //dynamische Punkte des GbCuboids muessen leider per "Hand" geloescht werden :-( - boundingCubeTriangle.finalize(); - } - } - UBLOGML(logDEBUG1,"\nLBMTriFaceMeshInteractor - setQs end "); -} -////////////////////////////////////////////////////////////////////////// -//Vorgehesnweise -//A – Bestimmung der q's -// 1. fuer jeden Bounding cube eines Dreiecks des netzes werden die Bloecke des Blockgitter ermittelt -// 2. mittels eines Dreieck/Block Verschneidungstest werden weitere nicht relevante Bloecke aussortiert -// (fuer lange „schief“ im Raum stehende Dreicke, bei denen das Bounding Cube suboptimal ist) -// 3. jeder Knoten dieser blöcke wird gegen das bound cube des dreiecks getestet -// 4. Knoten die innerhalb des Cubes aber „innerhalb“ des Netzes liegen werden mittels Halbebenentest aussoriert -// 5. fuer die restliche Knoten erfolgt die q bestimmung mittels effizienter raytracing algorithmen -// fuer die diskreten Boltzmannrichtungen -//B – Setzen der nicht aktiven Bloecke und Solid Nodes -// alle Bloecke des Bounding Cube des Netzes, die mind eine BC erhielten, wurden in A markiert -// 1. fuer nicht markierte Bloecke genuegt EIN pointInObject(Dreicksnetz)-Test um den gesamten Block bei Erfolg als „not active“ zu markieren -// 2. fuer markiertre Bloecke wird ein rekursiver Fuellalgorithmus durchgefuehrt -void D3Q27TriFaceMeshInteractor::initInteractor2(const double& timeStep) -{ - UBLOGML(logDEBUG1,"\nLBMTriFaceMeshInteractor - initInteractor start "); - if( !this->grid.lock() ) throw UbException(UB_EXARGS,"ups, no grid.lock()!!"); - - if( this->reinitWithStoredQsFlag && !bcNodeIndicesAndQsMap.empty() ) - { - this->reinitWithStoredQs(timeStep); - return; - } - - GbTriFaceMesh3D* mesh = dynamic_cast<GbTriFaceMesh3D*>(this->geoObject3D.get()); - - UBLOGML(logDEBUG1,"\nLBMTriFaceMeshInteractor - initInteractor for \""<<mesh->getName()<<" \" t="<<timeStep); - //cout<<" - init basics ..."; - - this->removeBcBlocks(); //hier wird auch die nodeIndicesMap geloescht! - this->removeSolidBlocks(); - - ////////////////////////////////////////////////////////////////////////// - //init bcs - ////////////////////////////////////////////////////////////////////////// - int nofAdapter = (int)this->bcAdapters.size(); - if(nofAdapter==0) std::cout<<"WARNING - D3Q27TriFaceMeshInteractor::initInteractor Warning - no nodeAdapter available for "/*<<this->getName()*/<<std::endl; - bool needTimeDependence = false; - for(int pos=0; pos<nofAdapter; ++pos) - { - this->bcAdapters[pos]->init(this,timeStep); - if(this->bcAdapters[pos]->isTimeDependent()) needTimeDependence = true; - } - if(needTimeDependence) this->setTimeDependent(); - else this->unsetTimeDependent(); - - ////////////////////////////////////////////////////////////////////////// - //grid.lock() info - ////////////////////////////////////////////////////////////////////////// - int coarsestInitLevel = grid.lock()->getCoarsestInitializedLevel(); - int finestInitLevel = grid.lock()->getFinestInitializedLevel(); - - UbTupleInt3 blocknx = grid.lock()->getBlockNX(); - int blocknx1 = val<1>(blocknx); //gilt fuer alle Level - int blocknx2 = val<2>(blocknx); //gilt fuer alle Level - int blocknx3 = val<3>(blocknx); //gilt fuer alle Level - - //grobe Blocklaengen - CoordinateTransformation3DPtr trafo = grid.lock()->getCoordinateTransformator(); - double cblockDeltaX1,cblockDeltaX2,cblockDeltaX3, delta ; - cblockDeltaX1 = cblockDeltaX2 = cblockDeltaX3 = delta = 1.0/(double)(1<<coarsestInitLevel); - if(trafo) - { - cblockDeltaX1 = trafo->getX1CoordinateScaling()*delta; - cblockDeltaX2 = trafo->getX2CoordinateScaling()*delta; - cblockDeltaX3 = trafo->getX3CoordinateScaling()*delta; - } - //levelspezifische blocklaengen und knotenabstaende - std::vector< std::vector<double> > nodeDeltaToNeigh(finestInitLevel+1); - //vector<double> blockDeltaX1(finestInitLevel+1), blockDeltaX2(finestInitLevel+1), blockDeltaX3(finestInitLevel+1); - std::vector<float> deltaMinX1(finestInitLevel+1),deltaMinX2(finestInitLevel+1),deltaMinX3(finestInitLevel+1); - std::vector<float> deltaMaxX1(finestInitLevel+1),deltaMaxX2(finestInitLevel+1),deltaMaxX3(finestInitLevel+1); - - //Im Boltzmankontext muss dx1==dx2==dx3 sein!! - assert( UbMath::equal(cblockDeltaX1/(double)blocknx1, cblockDeltaX2/(double)blocknx2 ) ); - assert( UbMath::equal(cblockDeltaX1/(double)blocknx1, cblockDeltaX3/(double)blocknx3 ) ); - - for(int level = coarsestInitLevel; level<=finestInitLevel; level++) - { - double nodeDelta = cblockDeltaX1/(double)(blocknx1*(1<<(level-coarsestInitLevel))); - - std::vector<double> distNeigh(D3Q27System::FENDDIR+1, 0.0); - D3Q27System::calcDistanceToNeighbors(distNeigh, nodeDelta); - - nodeDeltaToNeigh[level].resize(D3Q27System::ENDDIR+1,0.0); - for(int fdir=D3Q27System::FSTARTDIR; fdir<=D3Q27System::FENDDIR; fdir++) - { - nodeDeltaToNeigh[level][fdir] = distNeigh[fdir]; - } - - //im gegensatz zum allg. Cell3DInteractor kann man hier auf max(0.02*blockDeltaX1[level],fabs(...)) verzichten - //da dies nur für blockDeltaCalculator->getMinX1Delta(level)==0.0 benötigt wird. ist im D3Q19... aber nie so - //Geller: kann man nicht diesen befuckten DeltaCalculator weglassen und hier einfach die Formel zum Delta rechnen reinpacken - //SirAnn: klar, mann kann auch weißwuerste am Alex verkaufen... aber zum einen ist das Ding dazu da - // und zum anderen sollt eman mal überlegen: "Formel zum Delta rechnen"->man muss rechnen - // blockDeltaCalculator->getMinX1Delta(level) -> ein geinlinter wert wird geholt - - deltaMinX1[level] = (float)( 1.2*nodeDelta); //kein minus da unten -deltaMin - deltaMinX2[level] = (float)( 1.2*nodeDelta); - deltaMinX3[level] = (float)( 1.2*nodeDelta); - deltaMaxX1[level] = (float)( 1.2*nodeDelta); - deltaMaxX2[level] = (float)( 1.2*nodeDelta); - deltaMaxX3[level] = (float)( 1.2*nodeDelta); - } - - ////////////////////////////////////////////////////////////////////////// - //bounding cubes des TriFaceMesh ermitteln (pro level) - ////////////////////////////////////////////////////////////////////////// - //min/max Werte des Dreiecksnetzes holen - double geoMinX1(0.0), geoMinX2(0.0), geoMinX3(0.0), geoMaxX1(0.0), geoMaxX2(0.0), geoMaxX3(0.0); - if(this->isSolid() || this->isMoveable()) - { - geoMinX1 = this->geoObject3D->getX1Minimum(); geoMaxX1 = this->geoObject3D->getX1Maximum(); - geoMinX2 = this->geoObject3D->getX2Minimum(); geoMaxX2 = this->geoObject3D->getX2Maximum(); - geoMinX3 = this->geoObject3D->getX3Minimum(); geoMaxX3 = this->geoObject3D->getX3Maximum(); - } - else throw UbException(UB_EXARGS,"only TYPE==SOLID is implemented" ); - - std::map<Block3DPtr,SolidCheckMethod> blocksForSolidCheck; - - for(int level = coarsestInitLevel; level<=finestInitLevel; level++) - { - if(this->isSolid() || this->isMoveable()) - { - //bloecke fuer "bounding cube gesamt" - std::vector<Block3DPtr> tmpblocks; - grid.lock()->getBlocksByCuboid(level,geoMinX1-deltaMinX1[level], geoMinX2-deltaMinX2[level], geoMinX3-deltaMinX3[level], - geoMaxX1+deltaMaxX1[level], geoMaxX2+deltaMaxX2[level], geoMaxX3+deltaMaxX3[level],tmpblocks ); - - for( size_t i=0; i<tmpblocks.size(); i++ ) - blocksForSolidCheck[tmpblocks[i]] = PointInObject; - } - } - - ////////////////////////////////////////////////////////////////////////// - //FE-specific - ////////////////////////////////////////////////////////////////////////// - //bool calcVelocities = false; - //FeTriFaceMesh3D* feMesh = dynamic_cast<FeTriFaceMesh3D*>(mesh); - //std::vector<FeTriFaceMesh3D::VertexAttributes>* attributes = NULL; - //if(feMesh) - //{ - // calcVelocities = true; - // attributes = feMesh->getAttributes(); - //} - - ////////////////////////////////////////////////////////////////////////// - //DREIECKE: q-Bestimmung - ////////////////////////////////////////////////////////////////////////// - - //notwendige variablen initialisieren (u.a. blockDeltas des groben levels) - float triPoints[3][3]; - float vx1=0.0, vx2=0.0, vx3=0.0; - unsigned counterTriBoxOverlap=0, counterAABBTriFace=0, counterHalfspace=0, counterBilligOBB=0; - std::vector<GbTriFaceMesh3D::TriFace>& triangles = *mesh->getTriangles(); - std::vector<GbTriFaceMesh3D::Vertex>& nodes = *mesh->getNodes(); - std::map< Block3DPtr, std::set< std::vector<int> > > tmpSolidNodesFromOtherInteractors; - - int onePercent = UbMath::integerRounding(triangles.size()*0.01); - if(onePercent==0) onePercent=1; - UbTimer setQTimer; setQTimer.start(); - UBLOG(logDEBUG3, " - setQs for "<<(int)triangles.size()<<" triangles"); - - bool solidFromOtherInteractor = false; - float blockMinX[3],blockMaxX[3],boxCenter[3],halfBoxSize[3]; - - for(size_t t=0; t<triangles.size(); t++) - { - //if (t==10577) - //{ - // int ehsan=0; - //} - ////////////////////////////////////////////////////////////////////////// - // Halfspace zum Dreieck generieren und min/max des Dreiecks ermitteln - ////////////////////////////////////////////////////////////////////////// - GbTriFaceMesh3D::TriFace& triangle = triangles[t]; - - GbTriFaceMesh3D::Vertex& v1 = nodes[triangle.v1]; - GbTriFaceMesh3D::Vertex& v2 = nodes[triangle.v2]; - GbTriFaceMesh3D::Vertex& v3 = nodes[triangle.v3]; - - GbHalfSpace3D halfSpace( v1.x,v1.y,v1.z,v2.x,v2.y,v2.z,v3.x,v3.y,v3.z ); - - //if(calcVelocities) - //{ - // FeTriFaceMesh3D::VertexAttributes& vAttribut1 = (*attributes)[triangle.v1]; - // FeTriFaceMesh3D::VertexAttributes& vAttribut2 = (*attributes)[triangle.v2]; - // FeTriFaceMesh3D::VertexAttributes& vAttribut3 = (*attributes)[triangle.v3]; - // vx1 = (float)(UbMath::c1o3*(vAttribut1.getVelocityX()+vAttribut2.getVelocityX()+vAttribut3.getVelocityX())); - // vx2 = (float)(UbMath::c1o3*(vAttribut1.getVelocityY()+vAttribut2.getVelocityY()+vAttribut3.getVelocityY())); - // vx3 = (float)(UbMath::c1o3*(vAttribut1.getVelocityZ()+vAttribut2.getVelocityZ()+vAttribut3.getVelocityZ())); - //} - - ////////////////////////////////////////////////////////////////////////// - //fuer GbMeshTools3D::triBoxOverlap - ////////////////////////////////////////////////////////////////////////// - triPoints[0][0] = v1.x; triPoints[0][1] = v1.y; triPoints[0][2] = v1.z; - triPoints[1][0] = v2.x; triPoints[1][1] = v2.y; triPoints[1][2] = v2.z; - triPoints[2][0] = v3.x; triPoints[2][1] = v3.y; triPoints[2][2] = v3.z; - - double minX1 = triangle.getMinX(nodes); double maxX1 = triangle.getMaxX(nodes); - double minX2 = triangle.getMinY(nodes); double maxX2 = triangle.getMaxY(nodes); - double minX3 = triangle.getMinZ(nodes); double maxX3 = triangle.getMaxZ(nodes); - - ////////////////////////////////////////////////////////////////////////// - // Schleife ueber alle Level - ////////////////////////////////////////////////////////////////////////// - double e1x1,e1x2,e1x3,e2x1,e2x2,e2x3,px1,px2,px3,a,f,sx1,sx2,sx3,u,qx1,qx2,qx3,v; - bool gotQs = false; - BoundaryConditionsPtr bc; - - for(int level=coarsestInitLevel; level<=finestInitLevel; level++) - { - ////////////////////////////////////////////////////////////////////////// - // levelspezifisches BoundCube des Dreicks ermitteln und zugehörige Bloecke beziehen - ////////////////////////////////////////////////////////////////////////// - double boundCubeTriangleMinX1 = minX1-deltaMinX1[level]; double boundCubeTriangleMaxX1 = maxX1+deltaMaxX1[level]; - double boundCubeTriangleMinX2 = minX2-deltaMinX2[level]; double boundCubeTriangleMaxX2 = maxX2+deltaMaxX2[level]; - double boundCubeTriangleMinX3 = minX3-deltaMinX3[level]; double boundCubeTriangleMaxX3 = maxX3+deltaMaxX3[level]; - - GbCuboid3D boundingCubeTriangle( boundCubeTriangleMinX1, boundCubeTriangleMinX2, boundCubeTriangleMinX3 - , boundCubeTriangleMaxX1, boundCubeTriangleMaxX2, boundCubeTriangleMaxX3 ); - - std::vector<Block3DPtr> triBlocks; - grid.lock()->getBlocksByCuboid(level, boundCubeTriangleMinX1, boundCubeTriangleMinX2, boundCubeTriangleMinX3 - , boundCubeTriangleMaxX1, boundCubeTriangleMaxX2, boundCubeTriangleMaxX3, triBlocks ); - - ////////////////////////////////////////////////////////////////////////// - // Schleife ueber bloecke des level, die das dreieck beinhalten - ////////////////////////////////////////////////////////////////////////// - for(std::size_t b=0; b<triBlocks.size(); b++) - { - Block3DPtr block = triBlocks[b]; - - //////////////////////////////////////////////////////////////////////////// - //// Block Dreieck-/test - //////////////////////////////////////////////////////////////////////////// - UbTupleDouble3 coords = grid.lock()->getBlockWorldCoordinates(block); - UbTupleDouble3 deltas = grid.lock()->getBlockLengths(block); - - blockMinX[0] = (float)(val<1>(coords)-deltaMinX1[level]); - blockMinX[1] = (float)(val<2>(coords)-deltaMinX2[level]); - blockMinX[2] = (float)(val<3>(coords)-deltaMinX3[level]); - - blockMaxX[0] = (float)(val<1>(coords)+val<1>(deltas)+deltaMaxX1[level]); - blockMaxX[1] = (float)(val<2>(coords)+val<2>(deltas)+deltaMaxX2[level]); - blockMaxX[2] = (float)(val<3>(coords)+val<3>(deltas)+deltaMaxX3[level]); - - boxCenter[0] = (float)(0.5*(blockMaxX[0]+blockMinX[0])); - boxCenter[1] = (float)(0.5*(blockMaxX[1]+blockMinX[1])); - boxCenter[2] = (float)(0.5*(blockMaxX[2]+blockMinX[2])); - - halfBoxSize[0] = (float)(0.5*(blockMaxX[0]-blockMinX[0])); - halfBoxSize[1] = (float)(0.5*(blockMaxX[1]-blockMinX[1])); - halfBoxSize[2] = (float)(0.5*(blockMaxX[2]-blockMinX[2])); - - //wenn dreieck "vergroesserten cube" nicht schneidet/beruehrt -> keine BC moeglich -> continue - if( !GbMeshTools3D::triBoxOverlap(boxCenter,halfBoxSize,triPoints) ) - { - counterTriBoxOverlap++; - continue; - } - - ////////////////////////////////////////////////////////////////////////// - //Untersuchung der einzelnen nodes - ////////////////////////////////////////////////////////////////////////// - bool blockGotBCs = false; - - ILBMKernelPtr kernel = block->getKernel(); - BCArray3DPtr bcMatrix = kernel->getBCProcessor()->getBCArray(); - - int indexMinX1 = 0; - int indexMinX2 = 0; - int indexMinX3 = 0; - - int indexMaxX1 = (int)bcMatrix->getNX1(); - int indexMaxX2 = (int)bcMatrix->getNX2(); - int indexMaxX3 = (int)bcMatrix->getNX3(); - - std::set< std::vector<int> >& bcNodeIndices = this->bcNodeIndicesMap[block]; - std::set< std::vector<int> >& solidsFromOtherInteractors = tmpSolidNodesFromOtherInteractors[block]; - double q, internX1, internX2, internX3,distance; - - double& nodeDx1 = nodeDeltaToNeigh[level][D3Q27System::E]; - double& nodeDx2 = nodeDeltaToNeigh[level][D3Q27System::N]; - double& nodeDx3 = nodeDeltaToNeigh[level][D3Q27System::T]; - - //fuer OBB-Test - double qEinflussDelta = 1.1 * sqrt( nodeDx1*nodeDx1 + nodeDx2*nodeDx2 + nodeDx3*nodeDx3); - - for(int ix3=indexMinX3; ix3<indexMaxX3; ix3++) - { - internX3 = val<3>(coords)+nodeDx3*ix3-0.5*nodeDx3; - for(int ix2=indexMinX2; ix2<indexMaxX2; ix2++) - { - internX2 = val<2>(coords)+nodeDx2*ix2-0.5*nodeDx2; - for(int ix1=indexMinX1; ix1<indexMaxX1; ix1++) - { - - int blx1 =block->getX1(); - int blx2 = block->getX2(); - int blx3 = block->getX3(); - - if (blx1==0&&blx2==1&&blx3==0) - { - //if (ix2==39&&ix3==4) - if (ix2==39&&ix3==4) - { - int seb=0; - } - - } - //Problem: wenn voher der punkt durch eine andere geo not active gesetzt wird und - //dieser nun uebersprungen wird, dann hat man spaeter beim fuellalgorithmus luecken - //in der front und der block wird u.U. faelschlicher weise komplett solid markiert - //Lsg: positionen merken und erst Nach dem fuellarlgo wieder auf not active setzen :-) - solidFromOtherInteractor = false; - if(bcMatrix->isSolid(ix1,ix2,ix3)) - { - if(this->reinitWithStoredQsFlag) - { - solidFromOtherInteractor = true; //hier muss man weitermachen - //SG //oje - std::vector<int> p(3); - p[0]=ix1; p[1]=ix2; p[2]=ix3; - solidsFromOtherInteractors.insert( p ); - } - else - { - //SG //oje - std::vector<int> p(3); - p[0]=ix1; p[1]=ix2; p[2]=ix3; - solidsFromOtherInteractors.insert(p); - //SG continue; - solidFromOtherInteractor = true; - } - } - - internX1 = val<1>(coords)+nodeDx1*ix1-0.5*nodeDx1; - - ////////////////////////////////////////////////////////////////////////// - //Punkt in AABB von Dreieck? - ////////////////////////////////////////////////////////////////////////// - //ehsan changed◘ - bool pointIsOnBoundary = false; - if( !boundingCubeTriangle.isPointInGbObject3D(internX1, internX2, internX3,pointIsOnBoundary) ) - // if( !boundingCubeTriangle.isPointInGbObject3D(internX1, internX2, internX3) ) - { - counterAABBTriFace++; - continue; - } - - ////////////////////////////////////////////////////////////////////////// - // Halbebenentests - ////////////////////////////////////////////////////////////////////////// - distance = halfSpace.getDistance( internX1, internX2, internX3 ); - - //Punkt in Halbebene? (nein, wenn distance<0) - if(useHalfSpace && UbMath::less(distance, 0.0) )//== !halfSpace.ptInside(internX1,internX2,internX3) ) - { - counterHalfspace++; - continue; - } - - //BilligOBB-Test: wenn distance > qEinflussDelta -> kein q - if( UbMath::greater( fabs(distance), qEinflussDelta ) ) - { - counterBilligOBB++; - continue; - } - - ///////////////////////////////////////////////////////////////////////////// - //Raytracingfür diskrete Boltzmannrichtungen - ///////////////////////////////////////////////////////////////////////////// - gotQs = false; - bc = BoundaryConditionsPtr(); - - //RAYTRACING - diskrete LB-dir zu Dreick - //e1 = v1 - v0 - e1x1 = v2.x-v1.x; - e1x2 = v2.y-v1.y; - e1x3 = v2.z-v1.z; - - //e2 = v2 - v0 - e2x1 = v3.x-v1.x; - e2x2 = v3.y-v1.y; - e2x3 = v3.z-v1.z; - - //s = o - v0 - sx1 = internX1 - v1.x; - sx2 = internX2 - v1.y; - sx3 = internX3 - v1.z; - - for(int fdir=D3Q27System::FSTARTDIR; fdir<=D3Q27System::FENDDIR; fdir++) - { - //p = d x e2 - px1 = this->rayX2[fdir]*e2x3 - this->rayX3[fdir]*e2x2; - px2 = this->rayX3[fdir]*e2x1 - this->rayX1[fdir]*e2x3; - px3 = this->rayX1[fdir]*e2x2 - this->rayX2[fdir]*e2x1; - - //a = e1 dot p - a = e1x1*px1 + e1x2*px2 + e1x3*px3; - if(fabs(a)<1.E-10) continue; - f = 1.0/a; - - //u = f * ( s dot p) - u = f * ( sx1*px1 + sx2*px2 + sx3*px3 ); - if(u<-1.E-10 || u>1.0+1.E-10) continue; - - //q = s x e1 - qx1 = sx2*e1x3 - sx3*e1x2; - qx2 = sx3*e1x1 - sx1*e1x3; - qx3 = sx1*e1x2 - sx2*e1x1; - - //v = f*(e2 dot q) - v = f * (this->rayX1[fdir]*qx1 + this->rayX2[fdir]*qx2 + this->rayX3[fdir]*qx3); - if(v<-1.E-10 || (u+v)>1.0+1.E-10) continue; - - //t = f * (e2 dot q) - q = f * (e2x1*qx1 + e2x2*qx2 + e2x3*qx3); - q /= nodeDeltaToNeigh[level][fdir]; - - //gefundenes q auf gueltigkeit pruefen - if( UbMath::zero(q) ) - { - //neu (18.05.2010) - //es kann vorkommen, dass bei dünnwandigen geos punkte, die auf einem dreieck liegen, qs bekommen, die durch die geo - //durchgehen. diese punkte werden später jedoch nicht mehr auf solid getestet, da sie ja ne BC bekommen haben - //--> da mind ein q==0.0 für eines der dreiecke -> dort solid setzen - this->solidNodeIndicesMap[block].insert( UbTupleInt3(ix1,ix2,ix3) ); - bcMatrix->setSolid( ix1, ix2, ix3 ); - continue; - } - - if( UbMath::inClosedInterval(q, 1.0, 1.0) ) q = 1.0; - if( UbMath::greater(q, 0.0) && UbMath::lessEqual(q, 1.0) ) - { - //if( !solidFromOtherInteractor ) //--> Knoten schon solid-->BC setzen ueberfluessig - //SG changed to - //if( solidFromOtherInteractor ) //--> Knoten schon solid-->BC setzen ueberfluessig - { - //SG 26.08.2010 muss bereits hierhin, da das continue sonst den Knoten nicht als transNode fürs - //markiert - gotQs=blockGotBCs=true; - - bc = bcMatrix->getBC(ix1,ix2,ix3); - - //SG 26.08.2010 if(!bc && !bcMatrix->isSolid()) - if(!bc) - { - bc = BoundaryConditionsPtr(new BoundaryConditions);; - bcMatrix->setBC(ix1,ix2,ix3,bc); - } - else if( UbMath::less( bc->getQ(fdir), q ) ) //schon ein kuerzeres q voehanden? - { - //neu:: 18.05.2010 - //um falsche qs die evtl durch die "wand" gehen zu vermeiden - //q nur dann neu setzen, wenn neues q kleiner als vorhandenes! - //Zudem: insbesondere an ecken mit zwei BC geos ist nur das - //naehere gueltig - continue; - } - - bc->setBoundaryVelocityX1(vx1); - bc->setBoundaryVelocityX2(vx2); - bc->setBoundaryVelocityX3(vx3); - - for(int index=(int)this->bcAdapters.size()-1; index>=0; --index) - this->bcAdapters[index]->adaptBCForDirection(*this,bc,internX1,internX2,internX3,q,fdir); - - //SG 26.08.2010 gotQs=blockGotBCs=true; - } - //fuer beschleunigtes wiedereinlesen - if(this->reinitWithStoredQsFlag) - { - bcNodeIndicesAndQsMap[block][ UbTupleInt3(ix1, ix2, ix3) ].resize(D3Q27System::FENDDIR+1+3, -1.0f); - bcNodeIndicesAndQsMap[block][ UbTupleInt3(ix1, ix2, ix3) ][fdir ] = float(q); - bcNodeIndicesAndQsMap[block][ UbTupleInt3(ix1, ix2, ix3) ][D3Q27System::FENDDIR+1+0] = float(internX1); - bcNodeIndicesAndQsMap[block][ UbTupleInt3(ix1, ix2, ix3) ][D3Q27System::FENDDIR+1+1] = float(internX2); - bcNodeIndicesAndQsMap[block][ UbTupleInt3(ix1, ix2, ix3) ][D3Q27System::FENDDIR+1+2] = float(internX3); - } - } - } - - if(gotQs) - { - std::vector<int> p(3); - p[0]=ix1; p[1]=ix2; p[2]=ix3; - bcNodeIndices.insert(p); - - for(int index=(int)this->bcAdapters.size()-1; index>=0; --index) - this->bcAdapters[index]->adaptBC(*this,bc,internX1,internX2,internX3); - } - } - } - } - //Block wird für scanline-check "anmelden", dieser wird dann spaeter zu "transBlocks" hinzugefuegt - if(blockGotBCs) - { - blocksForSolidCheck[block] = ScanLine; - } - // bvd->getTimer().stop(); - } - //dynamische Punkte des GbCuboids muessen leider per "Hand" geloescht werden :-( - boundingCubeTriangle.finalize(); - } - } - setQTimer.stop(); - - UBLOG(logDEBUG1," - setQs for "/*<< this->getName()*/ << " - " <<(int)triangles.size()<<" triangles: 100% done in "<<setQTimer.getTotalTime()<<"sec"); - UBLOG(logDEBUG1," * rejected blocks with tribox overlap test : " << counterTriBoxOverlap); - UBLOG(logDEBUG1," * rejected nodes with AABB test : " << counterAABBTriFace); - UBLOG(logDEBUG1," * rejected nodes with halfspace test : " << counterHalfspace); - UBLOG(logDEBUG1," * rejected nodes with OBB test : " << counterBilligOBB); - - typedef std::map<Block3DPtr,SolidCheckMethod>::iterator BlockSolidCheckMethodIterator; - - ////////////////////////////////////////////////////////////////////////// - // SOLID checks - ////////////////////////////////////////////////////////////////////////// - if( regardPIOTest ) - { - int pointInObjectCounter = 0; - int scanlineCounter = 0; - int counter = 0; - - //sollte die matrix groesse zu gross sein und der rekursive floodFill mehr speicher - //benoetigen als der Stack hergibt -> keinen floodFill verwenden! - void (D3Q27TriFaceMeshInteractor::*gridFill)(CbArray3D<FLAGS>&, const short&, const short&, const short&, const FLAGS&) = NULL; - /*if(blocknx1*blocknx2*blocknx3 < 200000 ) gridFill = &D3Q27TriFaceMeshInteractor::recursiveGridFill;*/ - /*else */ gridFill = &D3Q27TriFaceMeshInteractor::iterativeGridFill; - - UBLOG(logDEBUG1," - setSolids for "<< blocksForSolidCheck.size() << " blocks"); - - UbTimer scanLineTimer; - UbTimer solidTimer; - solidTimer.start(); - - for(BlockSolidCheckMethodIterator pos=blocksForSolidCheck.begin(); pos!=blocksForSolidCheck.end(); ++pos) - { - Block3DPtr const& block = pos->first; - int level = block->getLevel(); - - UbTupleDouble3 coords = grid.lock()->getBlockWorldCoordinates(block); - - //Bloecke, die keinerlei Verschneidung mit Dreicken bzw. deren BoundCubes hatten - //hier: durch inside/outside Tests EINES knotens gilt fuer ALLE Knoten des blockes - if( pos->second == PointInObject ) - { - pointInObjectCounter++; - if(mesh->isPointInGbObject3D(val<1>(coords),val<2>(coords),val<3>(coords)) ) - { - //block->setActive(false); - //this->solidBlocks.push_back(block); - } - } - //Bloecke, die Verschneidung mit Dreicken bzw. deren BoundCubes hatten - //scanline algortihmus. dieser berücksichtigt durch weitere tests, dass innerhalb evtl schon andere - //geos bcs gesetzt haben. es werden ausschließelich solids gesetzt (also keine FLUIDS oder neuen BCs) - else if( pos->second == ScanLine ) - { - scanlineCounter++; - scanLineTimer.start(); - - ILBMKernelPtr kernel = block->getKernel(); - if(!kernel) throw UbException(UB_EXARGS,"na sowas kein kernel bzw. kernel=NULL (2)"); - BCArray3DPtr bcMatrix = kernel->getBCProcessor()->getBCArray(); - - // bvd->getTimer().start(); - int indexMinX1 = 0; - int indexMinX2 = 0; - int indexMinX3 = 0; - int indexMaxX1 = (int)bcMatrix->getNX1(); - int indexMaxX2 = (int)bcMatrix->getNX2(); - int indexMaxX3 = (int)bcMatrix->getNX3(); - - //quick and dirty - blocknx1 = indexMaxX1; - blocknx2 = indexMaxX2; - blocknx3 = indexMaxX3; - - std::set< UbTupleInt3 >& solidNodeIndices = this->solidNodeIndicesMap[block]; - - float nodeDeltaX1 = (float)nodeDeltaToNeigh[level][D3Q27System::E]; - float nodeDeltaX2 = (float)nodeDeltaToNeigh[level][D3Q27System::N]; - float nodeDeltaX3 = (float)nodeDeltaToNeigh[level][D3Q27System::T]; - - //flagfield matrix initialisieren - CbArray3D<FLAGS> flagField(blocknx1,blocknx2,blocknx3,UNDEF_FLAG); - - //hier gesetzte bcs markieren - std::set< std::vector<int> >& transNodeIndices = this->bcNodeIndicesMap[block]; - std::set< std::vector<int> >::iterator setPos; - for(setPos=transNodeIndices.begin(); setPos!=transNodeIndices.end(); ++setPos) - flagField( (*setPos)[0], (*setPos)[1], (*setPos)[2] ) = BC_FLAG; - - //solids die bereits durch andere interaktoren gesetzt wurden (wurden oben gespeichert) - //ist EMPTY bei reinitWithStoredQsFlag == true - //SG 28.08.2010 std::set< UbTupleInt3 >& tmpSolidNodeIndices = tmpSolidNodesFromOtherInteractors[block]; - //SG 28.08.2010 if(reinitWithStoredQsFlag && !tmpSolidNodeIndices.empty() ) throw UbException(UB_EXARGS, "tmpSolidNodeIndices darf bei reinitWithStoredQsFlag==true keine Knoten enthalten"); - //SG 28.08.2010 for(setPos=tmpSolidNodeIndices.begin(); setPos!=tmpSolidNodeIndices.end(); ++setPos) - //SG 28.08.2010 flagField( val<1>(*setPos), val<2>(*setPos), val<3>(*setPos) ) = OLDSOLID_FLAG; - - //flagfield matrix belegen - for(int bx3=0; bx3<blocknx3; ++bx3) - { - for(int bx2=0; bx2<blocknx2; ++bx2) - { - for(int bx1=0; bx1<blocknx1; ++bx1) - { - - if (bx2==9&&bx3==29) - { - int ride=0; - } - if( flagField(bx1,bx2,bx3)==UNDEF_FLAG ) - { - if( mesh->isPointInGbObject3D( val<1>(coords) + bx1*nodeDeltaX1 - 0.5*nodeDeltaX1 - , val<2>(coords) + bx2*nodeDeltaX2 - 0.5*nodeDeltaX2 - , val<3>(coords) + bx3*nodeDeltaX3 - 0.5*nodeDeltaX3) ) - { - (this->*gridFill)(flagField,bx1,bx2,bx3,SOLID_FLAG); - } - else - { - (this->*gridFill)(flagField,bx1,bx2,bx3,FLUID_FLAG); - } - } - - if( flagField(bx1,bx2,bx3)==SOLID_FLAG ) - { - //hier ist noch das Problem, das "alle" solid in die solidNodeIndices kommen - //evtl. Abhilfe durch einführen eines anderen Flags bei tmpSolidNodeIndices .. - solidNodeIndices.insert(UbTupleInt3(bx1,bx2,bx3)); - bcMatrix->setSolid(bx1,bx2,bx3); - } - //SG 28.08.2010 else if( flagField(bx1,bx2,bx3)==OLDSOLID_FLAG ) - //SG 28.08.2010 { - //SG 28.08.2010 bcMatrix->setSolid(bx1,bx2,bx3); - //SG 28.08.2010 } - } - } - } - - //SG 28.08.2010 halt danach setzen, damit die BCs die fälschlicherweise gesetzt wurden korrigiert werden - std::set< std::vector<int> >& tmpSolidNodeIndices = tmpSolidNodesFromOtherInteractors[block]; - for(setPos=tmpSolidNodeIndices.begin(); setPos!=tmpSolidNodeIndices.end(); ++setPos) - bcMatrix->setSolid((*setPos)[0], (*setPos)[1], (*setPos)[2] ); - - //block hat in initInteractor mind eine BC erhalten -> transBlock - this->bcBlocks.push_back(block); - scanLineTimer.stop(); - - // bvd->getTimer().stop(); - } - else throw UbException(UB_EXARGS,"unknown option for in object test"); - } - - solidTimer.stop(); - - UBLOG(logDEBUG1, " - setSolids for "<<blocksForSolidCheck.size()<<" blocks: 100% done in "<<solidTimer.getTotalTime()<<"s"); - UBLOG(logDEBUG1, " * pointInObject for "<<pointInObjectCounter<<" blocks in "<<solidTimer.getTotalTime()-scanLineTimer.getTotalTime()<<"s"); - UBLOG(logDEBUG1, " * flood fill for "<<scanlineCounter <<" blocks in "<<scanLineTimer.getTotalTime()<<" secs"); - UBLOG(logDEBUG1, "LBMTriFaceMeshInteractor::initInteractor for \""<<mesh->getName()<<"\" done in "<<setQTimer.getTotalTime()+solidTimer.getTotalTime()<<"s"); - } - - //calcForces arbeitet nicht korrekt, wenn Geo mit Bloecken - //unterschiedlicher Leveltiefe diskretisiert -> exception - //abfrage steht hier, weil es theoretisch sein kann, dass bei parallelen rechnungen - //genau der block mit dem anderen level auf einem anderen prozess liegt... - //Update: es kann u.U. passieren, dass Blöcke in der Liste nicht aktiv sin - //(falls diese z.B. duch andere Interactoren solid gesetzt wurden) - //diese werden nicht berücksichtigt (auch nicht beid er kraftauswertung später) - //if( this->isRelevantForForces() ) - //{ - // int level = -1; - // for( std::vector<Block3DPtr>::const_iterator pos = this->transBlocks.begin(); pos!=this->transBlocks.end(); ++pos) - // if( (*pos)->isActive() ) - // { - // level = (*pos)->getLevel(); - // break; - // } - - // bool check = false; - // for( std::vector<Block3DPtr>::const_iterator pos = this->transBlocks.begin(); pos!=this->transBlocks.end(); ++pos) - // if( (*pos)->isActive() && (*pos)->getLevel()!=level) - // { - // (*pos)->setRank(1000); - // check = true; - // UbTupleDouble3 coords = grid.lock()->getBlockWorldCoordinates((*pos)); - // std::cout<<(*pos)->getLevel()<<","<<(*pos)->getX1()<<","<<(*pos)->getX2()<<","<<(*pos)->getX3()<<std::endl; - // std::cout<<std::setprecision(15)<<val<1>(coords)<<","<<val<2>(coords)<<","<<val<3>(coords)<<std::endl<<std::endl; - - // } - // if(check) - // { - // //this->grid.lock()->writeBlocks(UbStaticPathMap::getPath(UbStaticPathMap::GLOBAL)+"/error_grid",0, WbWriterVtkXmlASCII::getInstance(), false); - - // throw UbException(UB_EXARGS,"interactor is relevant for forces," - // +(std::string)" but has transblocks with different levels (wrote error_grid)" - // +(std::string)" -> not supportet by LBMInteractor::getForces()" - // +(std::string)" -> increase refineWidth"); - - // } - //} -} -////////////////////////////////////////////////////////////////////////// -void D3Q27TriFaceMeshInteractor::refineBlockGridToLevel(int level, double startDistance, double stopDistance) -{ - UBLOG(logDEBUG1, "D3Q27TriFaceMeshInteractor::refineBlockGridToLevel - start"); - - //ToDo: evtl checken, ob man noch einen HalbraumCheck für StopDistance einbaut - // oder ob man schneller ist, wenn man gar keinen halbraum test macht... - if(!grid.lock()) - throw UbException(UB_EXARGS,"Grid isn't exist!"); - if( UbMath::greater(startDistance,0.0) ) - throw UbException(UB_EXARGS,"startDistance>0.0 not supported by this interactor"); - if( UbMath::less(stopDistance,0.0) ) - throw UbException(UB_EXARGS,"stopDistance<0.0 not supported by this interactor"); - - Grid3DPtr bgrid = this->grid.lock(); - GbTriFaceMesh3D& mesh = dynamic_cast<GbTriFaceMesh3D&>(*this->geoObject3D.get()); - - int coarsestLevel = bgrid->getCoarsestInitializedLevel(); - - std::vector<GbTriFaceMesh3D::TriFace>& triangles = *mesh.getTriangles(); - std::vector<GbTriFaceMesh3D::Vertex>& nodes = *mesh.getNodes(); - - double minX1,minX2,minX3,maxX1,maxX2,maxX3; - float blockMinX[3],blockMaxX[3],boxCenter[3],halfBoxSize[3]; - float triPoints[3][3]; - - size_t nofTriangles = (int)triangles.size(); - -//#pragma omp parallel -//#pragma omp for - for(size_t i=0; i<nofTriangles; i++) - //for(int i=0; i<nofTriangles; i++) - { -//#pragma omp master - //{ - // printf_s("num_threads=%d\n", omp_get_num_threads( )); - //} - - - GbTriFaceMesh3D::TriFace& triangle = triangles[i]; - - GbTriFaceMesh3D::Vertex& v1 = nodes[triangle.v1]; - GbTriFaceMesh3D::Vertex& v2 = nodes[triangle.v2]; - GbTriFaceMesh3D::Vertex& v3 = nodes[triangle.v3]; - - //dreick muss normal besitzen! - assert( !UbMath::zero(triangle.nx) || !UbMath::zero(triangle.ny) || !UbMath::zero(triangle.nz) ); - //Normale muss normiert sein! - assert( (fabs(std::sqrt( triangle.nx*triangle.nx + triangle.ny*triangle.ny + triangle.nz*triangle.nz ))-1.0f)<1.0E-6); - - //Halfspace um startDistance entgegen normale verscheiebn, ansonsten werden spaeter - //zu testende bloecke auf der dreicksrueckseite nicht getestet!!! - GbHalfSpace3D halfSpace( v1.x+startDistance*triangle.nx, v1.y+startDistance*triangle.ny, v1.z+startDistance*triangle.nz - , v2.x+startDistance*triangle.nx, v2.y+startDistance*triangle.ny, v2.z+startDistance*triangle.nz - , v3.x+startDistance*triangle.nx, v3.y+startDistance*triangle.ny, v3.z+startDistance*triangle.nz ); - - //Boundingbox um massgebliches dx erweitern -> zur Bestimmung der zu testenden Bloecke - if( triangle.nx>1.0E-8 ) { minX1 = triangle.getMinX(nodes)+1.05*triangle.nx*startDistance; - maxX1 = triangle.getMaxX(nodes)+1.05*triangle.nx*stopDistance; } - else { minX1 = triangle.getMinX(nodes)+1.05*triangle.nx*stopDistance; - maxX1 = triangle.getMaxX(nodes)+1.05*triangle.nx*startDistance; } - - if( triangle.ny>1.0E-8 ) { minX2 = triangle.getMinY(nodes)+1.05*triangle.ny*startDistance; - maxX2 = triangle.getMaxY(nodes)+1.05*triangle.ny*stopDistance; } - else { minX2 = triangle.getMinY(nodes)+1.05*triangle.ny*stopDistance; - maxX2 = triangle.getMaxY(nodes)+1.05*triangle.ny*startDistance; } - - if( triangle.nz>1.0E-8 ) { minX3 = triangle.getMinZ(nodes)+1.05*triangle.nz*startDistance; - maxX3 = triangle.getMaxZ(nodes)+1.05*triangle.nz*stopDistance; } - else { minX3 = triangle.getMinZ(nodes)+1.05*triangle.nz*stopDistance; - maxX3 = triangle.getMaxZ(nodes)+1.05*triangle.nz*startDistance; } - - - int flag = 0; - //Levelweise alle Bloecke holen, die erweiterte BB schneiden - //und bearbeiten - for(int l=coarsestLevel; l<level; l++) - { - std::vector<Block3DPtr> consideredBlocks; - bgrid->getBlocksByCuboid(l,minX1, minX2, minX3, maxX1, maxX2, maxX3, consideredBlocks); - double x1a,x2a,x3a,x1b,x2b,x3b; - - for(size_t b=0; b<consideredBlocks.size(); b++) - { - Block3DPtr block = consideredBlocks[b]; - if(block->getLevel()>=level) continue; - - //start coordinaten des blocks ermitteln - UbTupleDouble3 coords = bgrid->getBlockWorldCoordinates(block); - UbTupleDouble3 deltas = bgrid->getBlockLengths(block); - - //Check, ob block komplett im Halbraum - x1a = val<1>(coords); x1b = val<1>(coords)+val<1>(deltas); - x2a = val<2>(coords); x2b = val<2>(coords)+val<2>(deltas); - x3a = val<3>(coords); x3b = val<3>(coords)+val<3>(deltas); - - flag = 0; - if( !halfSpace.ptInside(x1a,x2a,x3a) ) flag |= (1<<0); //1 - if( !halfSpace.ptInside(x1b,x2a,x3a) ) flag |= (1<<1); //2 - if( !halfSpace.ptInside(x1b,x2b,x3a) ) flag |= (1<<2); //4 - if( !halfSpace.ptInside(x1a,x2b,x3a) ) flag |= (1<<3); //8 - if( !halfSpace.ptInside(x1a,x2a,x3b) ) flag |= (1<<4); //16 - if( !halfSpace.ptInside(x1b,x2a,x3b) ) flag |= (1<<5); //32 - if( !halfSpace.ptInside(x1b,x2b,x3b) ) flag |= (1<<6); //64 - if( !halfSpace.ptInside(x1a,x2b,x3b) ) flag |= (1<<7); //128 - - - if( true && flag!=255 ) - { - //blockseite ermitteln (skalarprodukt dreiecks-normale, vector (midTri->midCub) ) - //je nachdem muss für den massgeblichen block start oder stopdistance verwendet werden - //liegt block auf pos seite -> stopdistance ansonsten startdistance - double skalarprod = triangle.nx * ( 0.5*(x1a+x1b)-triangle.getX1Centroid(nodes) ) - + triangle.ny * ( 0.5*(x2a+x2b)-triangle.getX2Centroid(nodes) ) - + triangle.nz * ( 0.5*(x3a+x3b)-triangle.getX3Centroid(nodes) ); - - double blockdelta = 1.05*stopDistance; - if (skalarprod<1.E-8 ) blockdelta = -1.05*startDistance; //startDistance<0!! - else if( fabs(skalarprod)<1.E-8) blockdelta = 1.05*UbMath::max(-startDistance,stopDistance); - - //block anpassen - blockMinX[0] = (float)(val<1>(coords)-blockdelta ); - blockMinX[1] = (float)(val<2>(coords)-blockdelta ); - blockMinX[2] = (float)(val<3>(coords)-blockdelta ); - - blockMaxX[0] = (float)(val<1>(coords)+val<1>(deltas)+blockdelta ); - blockMaxX[1] = (float)(val<2>(coords)+val<2>(deltas)+blockdelta ); - blockMaxX[2] = (float)(val<3>(coords)+val<3>(deltas)+blockdelta ); - - boxCenter[0] = (float)(0.5*(blockMaxX[0]+blockMinX[0])); - boxCenter[1] = (float)(0.5*(blockMaxX[1]+blockMinX[1])); - boxCenter[2] = (float)(0.5*(blockMaxX[2]+blockMinX[2])); - - halfBoxSize[0] = (float)(0.5*(blockMaxX[0]-blockMinX[0])); - halfBoxSize[1] = (float)(0.5*(blockMaxX[1]-blockMinX[1])); - halfBoxSize[2] = (float)(0.5*(blockMaxX[2]-blockMinX[2])); - - GbTriFaceMesh3D::Vertex& v1 = nodes[triangle.v1]; - GbTriFaceMesh3D::Vertex& v2 = nodes[triangle.v2]; - GbTriFaceMesh3D::Vertex& v3 = nodes[triangle.v3]; - - triPoints[0][0] = v1.x; triPoints[0][1] = v1.y; triPoints[0][2] = v1.z; - triPoints[1][0] = v2.x; triPoints[1][1] = v2.y; triPoints[1][2] = v2.z; - triPoints[2][0] = v3.x; triPoints[2][1] = v3.y; triPoints[2][2] = v3.z; - - //wenn block dreick schneidet, dann muss er verfeinert werden - if( GbMeshTools3D::triBoxOverlap(boxCenter,halfBoxSize,triPoints) ) - { - bgrid->expandBlock(block->getX1(), block->getX2(),block->getX3(),block->getLevel()); - } - } - } - } - } - UBLOG(logDEBUG1, " - refine done"); -} -////////////////////////////////////////////////////////////////////////// -void D3Q27TriFaceMeshInteractor::updateMovedGeometry(const double& timeStep) -{ - -} -//////////////////////////////////////////////////////////////////////////// -void D3Q27TriFaceMeshInteractor::recursiveGridFill(CbArray3D<FLAGS>& flagfield, const short& xs, const short& ys, const short& zs, const FLAGS& type) -{ - // Algorithmus zum Füllen eines Polyeders, ausgehend vom Saatpunkt xs,ys,zs - - //Saatknoten einfärben - if( flagfield(xs,ys,zs)==UNDEF_FLAG ) - { - flagfield(xs,ys,zs) = type; - - if ( flagfield.indicesInRange( xs+1, ys , zs ) ) this->recursiveGridFill(flagfield,xs+1, ys , zs ,type); - if ( flagfield.indicesInRange( xs , ys+1, zs ) ) this->recursiveGridFill(flagfield,xs , ys+1, zs ,type); - if ( flagfield.indicesInRange( xs , ys , zs+1 ) ) this->recursiveGridFill(flagfield,xs , ys , zs+1,type); - if ( flagfield.indicesInRange( xs-1, ys , zs ) ) this->recursiveGridFill(flagfield,xs-1, ys , zs ,type); - if ( flagfield.indicesInRange( xs , ys-1, zs ) ) this->recursiveGridFill(flagfield,xs , ys-1, zs ,type); - if ( flagfield.indicesInRange( xs , ys , zs-1 ) ) this->recursiveGridFill(flagfield,xs , ys , zs-1,type); - } -} -////////////////////////////////////////////////////////////////////////// -void D3Q27TriFaceMeshInteractor::iterativeGridFill(CbArray3D<FLAGS>& flagfield, const short& xs, const short& ys, const short& zs, const FLAGS& type) -{ - std::stack< UbTupleInt3 > stck; - stck.push( UbTupleInt3(xs,ys,zs) ); - - int x,y,z; - - while( !stck.empty() ) - { - x = val<1>( stck.top() ); - y = val<2>( stck.top() ); - z = val<3>( stck.top() ); - stck.pop(); - - FLAGS& flagType = flagfield( x, y, z ); - - if( flagType == UNDEF_FLAG ) - { - flagType = type; - - if ( flagfield.indicesInRange( x+1, y , z ) ) stck.push( UbTupleInt3( x+1, y , z ) ); - if ( flagfield.indicesInRange( x , y+1, z ) ) stck.push( UbTupleInt3( x , y+1, z ) ); - if ( flagfield.indicesInRange( x , y , z+1 ) ) stck.push( UbTupleInt3( x , y , z+1 ) ); - if ( flagfield.indicesInRange( x-1, y , z ) ) stck.push( UbTupleInt3( x-1, y , z ) ); - if ( flagfield.indicesInRange( x , y-1, z ) ) stck.push( UbTupleInt3( x , y-1, z ) ); - if ( flagfield.indicesInRange( x , y , z-1 ) ) stck.push( UbTupleInt3( x , y , z-1 ) ); - } - } - return; -} -////////////////////////////////////////////////////////////////////////// -UbTupleDouble3 D3Q27TriFaceMeshInteractor::getForces() -{ - //FeTriFaceMesh3D* feMesh = dynamic_cast<FeTriFaceMesh3D*>(this->geoObject3D.get()); - //if(!feMesh) - //{ - // return D3Q19AMRInteractor::getForces(); - //} - ////return getForcesTriangle(); - //this->calculateForces(); - - double forceX1=0.0; - double forceX2=0.0; - double forceX3=0.0; - - //double area = 0.0; - - //vector<FeTriFaceMesh3D::VertexAttributes>* attributes = feMesh->getAttributes(); - - //for(size_t i=0; i<attributes->size(); i++) - //{ - // FeTriFaceMesh3D::VertexAttributes& attribut = (*attributes)[i]; - // area = attribut.getArea(); - // forceX1 += attribut.getFX()*area; - // forceX2 += attribut.getFY()*area; - // forceX3 += attribut.getFZ()*area; - //} - return UbTupleDouble3(forceX1,forceX2,forceX3); -} -////////////////////////////////////////////////////////////////////////// -UbTupleDouble3 D3Q27TriFaceMeshInteractor::getForcesTriangle() -{ - double forceX1=0.0; - double forceX2=0.0; - double forceX3=0.0; - - //D3Q19BlockGrid& grid.lock() = dynamic_cast<D3Q19BlockGrid&>(*this->grid.lock()); - //// CoordinateTransformation3D *trafo = this->grid.lock()->getTransformation(); - //// int minLevel = this->grid.lock()->getFinestInitializedLevel(); - //// double scaleX = trafo->getX1CoordinateScaling()/(1<<minLevel); - //// double scaleY = trafo->getX2CoordinateScaling()/(1<<minLevel); - //// double scaleZ = trafo->getX3CoordinateScaling()/(1<<minLevel); - //// int blocknx1 = grid.lock()->getBlockNX1(); - //// int blocknx2 = grid.lock()->getBlockNX2(); - //// int blocknx3 = grid.lock()->getBlockNX3(); - //// double xOffset = trafo->getX1CoordinateOffset(); - //// double yOffset = trafo->getX2CoordinateOffset(); - //// double zOffset = trafo->getX3CoordinateOffset(); - //vector<D3Q19Real> collFactors = ((D3Q19Calculator*)grid.lock()->getCalculator())->getCollisionsFactors(); - - ////for (int i=0;i<(int)gbTriangle3DInteractors.size(); i++) - ////{ - //// GbTriangle3D* tri = (GbTriangle3D*)gbTriangle3DInteractors[i]->getGbObject3D(); - - //// double px0 = tri->getX1Centroid(); - //// double py0 = tri->getX2Centroid(); - //// double pz0 = tri->getX3Centroid(); - //// double px = px0-xOffset; - //// double py = py0-yOffset; - //// double pz = pz0-zOffset; - //// px = px/scaleX; - //// py = py/scaleY; - //// pz = pz/scaleZ; - //// int x1 = (int)px; - //// int y1 = (int)py; - //// int z1 = (int)pz; - //// AMR3DBlock* block = this->grid.lock()->getBlock(x1,y1,z1,minLevel); - //// if(!block) block = this->grid.lock()->getSuperBlock(x1,y1,z1,minLevel); - //// if(!block) throw UbException(__FILE__,__LINE__,"kein Block ..."); - - //// double collFactor = collFactors[block->getLevel()]; - //// double nodeDistance = grid.lock()->getNodeDeltaX(block->getLevel()); - //// double bertX1 = ((px0-xOffset)/(1000.*nodeDistance)); - //// double bertX2 = ((py0-yOffset)/(1000.*nodeDistance)); - //// double bertX3 = ((pz0-zOffset)/(1000.*nodeDistance)); - //// int abstaendeX1 = (int)(bertX1*1000.); - //// int abstaendeX2 = (int)(bertX2*1000.); - //// int abstaendeX3 = (int)(bertX3*1000.); - //// int posW = abstaendeX1 - block->getX1Index()*blocknx1; - //// int posS = abstaendeX2 - block->getX2Index()*blocknx2; - //// int posB = abstaendeX3 - block->getX3Index()*blocknx3; - //// int posE=posW+1; - //// int posN=posS+1; - //// int posT=posB+1; - - //// D3Q19BlockDescriptor *bvd = dynamic_cast<D3Q19BlockDescriptor*>(block->getBlockDescriptor()); - //// if(!bvd) throw UbException(__FILE__,__LINE__,"kein Bvd ..."); - - //// CbUniformMatrix4D<double,IndexerX1X2X3X4>* tempdistributions = bvd->getTempDistributionMatrix(); - //// D3Q19BCMatrix<D3Q19BoundaryCondition> *bcMatrix = bvd->getBcMatrix(); - - //// UbTupleDouble6 stresses; - //// double dX = px0-this->geoObject3D->getX1Centroid(); - //// double dY = py0-this->geoObject3D->getX2Centroid(); - //// double dZ = pz0-this->geoObject3D->getX3Centroid(); - //// if(dX<=0.0 && dY<=0.0 && dZ<=0.0) - //// { - //// double *fWSB = tempdistributions->getStartAdressOfSortedArray(posW,posS,posB,0); - //// if(bcMatrix->isFluid(posW,posS,posB)) stresses = D3Q19System::getIncompStresses(fWSB, collFactor ); - //// else cout<<__LINE__<<" nicht fluid ..."; - //// } - //// else if(dX<=0.0 && dY>0.0 && dZ<=0.0) - //// { - //// double *fWNB = tempdistributions->getStartAdressOfSortedArray(posW,posN,posB,0); - //// if(bcMatrix->isFluid(posW,posN,posB)) stresses = D3Q19System::getIncompStresses(fWNB, collFactor ); - //// else cout<<__LINE__<<" nicht fluid ..."; - //// } - //// else if(dX<=0.0 && dY<=0.0 && dZ>0.0) - //// { - //// double *fWST = tempdistributions->getStartAdressOfSortedArray(posW,posS,posT,0); - //// if(bcMatrix->isFluid(posW,posS,posT)) stresses = D3Q19System::getIncompStresses(fWST, collFactor ); - //// else cout<<__LINE__<<" nicht fluid ..."; - //// } - //// else if(dX<=0.0 && dY>0.0 && dZ>0.0) - //// { - //// double *fWNT = tempdistributions->getStartAdressOfSortedArray(posW,posN,posT,0); - //// if(bcMatrix->isFluid(posW,posN,posT)) stresses = D3Q19System::getIncompStresses(fWNT, collFactor ); - //// else cout<<__LINE__<<" nicht fluid ..."; - //// } - //// else if(dX>0.0 && dY<=0.0 && dZ<=0.0) - //// { - //// double *fESB = tempdistributions->getStartAdressOfSortedArray(posE,posS,posB,0); - //// if(bcMatrix->isFluid(posE,posS,posB)) stresses = D3Q19System::getIncompStresses(fESB, collFactor ); - //// else cout<<__LINE__<<" nicht fluid ..."; - //// } - //// else if(dX>0.0 && dY>0.0 && dZ<=0.0) - //// { - //// double *fENB = tempdistributions->getStartAdressOfSortedArray(posE,posN,posB,0); - //// if(bcMatrix->isFluid(posE,posN,posB)) stresses = D3Q19System::getIncompStresses(fENB, collFactor ); - //// else cout<<__LINE__<<" nicht fluid ..."; - //// } - //// else if(dX>0.0 && dY<=0.0 && dZ>0.0) - //// { - //// double *fEST = tempdistributions->getStartAdressOfSortedArray(posE,posS,posT,0); - //// if(bcMatrix->isFluid(posE,posS,posT)) stresses = D3Q19System::getIncompStresses(fEST, collFactor ); - //// else cout<<__LINE__<<" nicht fluid ..."; - //// } - //// else if(dX>0.0 && dY>0.0 && dZ>0.0) - //// { - //// double *fENT = tempdistributions->getStartAdressOfSortedArray(posE,posN,posT,0); - //// if(bcMatrix->isFluid(posE,posN,posT)) stresses = D3Q19System::getIncompStresses(fENT, collFactor ); - //// else cout<<__LINE__<<" nicht fluid ..."; - //// } - //// else cout<<"punkt mit:"<<dX<<" "<<dY<<" "<<dZ<<" ist nicht bei \n"; - - //// double S11 = val<1>(stresses); - //// double S22 = val<2>(stresses); - //// double S33 = val<3>(stresses); - //// double S12 = val<4>(stresses); - //// double S13 = val<5>(stresses); - //// double S23 = val<6>(stresses); - - //// GbVector3D normal = tri->getNormal(); - //// double nx = normal.X1(); - //// double ny = normal.X2(); - //// double nz = normal.X3(); - //// double area = tri->getArea(); - - //// double Fx1 = area*(S11*nx+S12*ny+S13*nz); - //// double Fy1 = area*(S12*nx+S22*ny+S23*nz); - //// double Fz1 = area*(S13*nx+S23*ny+S33*nz); - //// forceX1 += Fx1; - //// forceX2 += Fy1; - //// forceX3 += Fz1; - ////} - return UbTupleDouble3(forceX1,forceX2,forceX3); -} -////////////////////////////////////////////////////////////////////////// -void D3Q27TriFaceMeshInteractor::calculateForces() -{ - //FeTriFaceMesh3D* feMesh = dynamic_cast<FeTriFaceMesh3D*>(this->geoObject3D.get()); - //if(!feMesh) throw UbException(UB_EXARGS,"geoObject is not a FeTriFaceMesh3D!"); - - //if(this->stressMode == STRESSNORMAL) this->calculateStresses(); - //else if(this->stressMode == STRESSALTERNATIV) this->calculateStressesAlternativ(); - - //vector<FeTriFaceMesh3D::VertexAttributes>* attributes = feMesh->getAttributes(); - - //for (int i=0;i<(int)attributes->size() ;i++) - //{ - // FeTriFaceMesh3D::VertexAttributes& attribut = (*attributes)[i]; - // attribut.setFX(0.0); - // attribut.setFY(0.0); - // attribut.setFZ(0.0); - // attribut.setArea(0.0); - //} - //vector<GbTriFaceMesh3D::TriFace>& triangles = *feMesh->getTriangles(); - //vector<GbTriFaceMesh3D::Vertex>& nodes = *feMesh->getNodes(); - //for (size_t i=0; i<triangles.size(); i++) - //{ - // GbTriFaceMesh3D::TriFace& triangle = triangles[i]; - // FeTriFaceMesh3D::VertexAttributes& vAttribut1 = (*attributes)[triangle.v1]; - // FeTriFaceMesh3D::VertexAttributes& vAttribut2 = (*attributes)[triangle.v2]; - // FeTriFaceMesh3D::VertexAttributes& vAttribut3 = (*attributes)[triangle.v3]; - // UbTupleDouble6& stressesP1 = vAttribut1.getStresses(); - // UbTupleDouble6& stressesP2 = vAttribut2.getStresses(); - // UbTupleDouble6& stressesP3 = vAttribut3.getStresses(); - // double p1S11 = val<1>(stressesP1); double p2S11 = val<1>(stressesP2); double p3S11 = val<1>(stressesP3); - // double p1S22 = val<2>(stressesP1); double p2S22 = val<2>(stressesP2); double p3S22 = val<2>(stressesP3); - // double p1S33 = val<3>(stressesP1); double p2S33 = val<3>(stressesP2); double p3S33 = val<3>(stressesP3); - // double p1S12 = val<4>(stressesP1); double p2S12 = val<4>(stressesP2); double p3S12 = val<4>(stressesP3); - // double p1S13 = val<5>(stressesP1); double p2S13 = val<5>(stressesP2); double p3S13 = val<5>(stressesP3); - // double p1S23 = val<6>(stressesP1); double p2S23 = val<6>(stressesP2); double p3S23 = val<6>(stressesP3); - - // triangle.calculateNormal(nodes); - // double nx = triangle.nx; - // double ny = triangle.ny; - // double nz = triangle.nz; - // double area = 0.3333*triangle.getArea(nodes); - - // if(UbMath::lessEqual(area,0.0)) cout<<__FILE__<<" "<<__LINE__<<" area <= 0 "<<endl; - - // double Fx1 = area*(0.333*(p1S11*nx+p1S12*ny+p1S13*nz)+0.333*(p2S11*nx+p2S12*ny+p2S13*nz)+0.333*(p3S11*nx+p3S12*ny+p3S13*nz)); - // double Fx2 = Fx1; - // double Fx3 = Fx1; - - // double Fy1 = area*(0.333*(p1S12*nx+p1S22*ny+p1S23*nz)+0.333*(p2S12*nx+p2S22*ny+p2S23*nz)+0.333*(p3S12*nx+p3S22*ny+p3S23*nz)); - // double Fy2 = Fy1; - // double Fy3 = Fy1; - - // double Fz1 = area*(0.333*(p1S13*nx+p1S23*ny+p1S33*nz)+0.333*(p2S13*nx+p2S23*ny+p2S33*nz)+0.333*(p3S13*nx+p3S23*ny+p3S33*nz)); - // double Fz2 = Fz1; - // double Fz3 = Fz1; - // // cout<<Fx1<<" "<<Fy1<<" "<<Fz1<<endl; - // vAttribut1.addFX(Fx1); vAttribut2.addFX(Fx2); vAttribut3.addFX(Fx3); - // vAttribut1.addFY(Fy1); vAttribut2.addFY(Fy2); vAttribut3.addFY(Fy3); - // vAttribut1.addFZ(Fz1); vAttribut2.addFZ(Fz2); vAttribut3.addFZ(Fz3); - // vAttribut1.addArea(area); vAttribut2.addArea(area); vAttribut3.addArea(area); - //} - //for (size_t i=0; i<attributes->size(); i++) - //{ - // FeTriFaceMesh3D::VertexAttributes& attribut = (*attributes)[i]; - - // double newFX = attribut.getFX()/attribut.getArea(); - // double newFY = attribut.getFY()/attribut.getArea(); - // double newFZ = attribut.getFZ()/attribut.getArea(); - // //if(i==100) cout<<"F:"<<newFX<<" "<<newFY<<" "<<newFZ<<endl; - // //double oldFX = p->getOldFX(); - // //double oldFY = p->getOldFY(); - // //int alphaSteps = p->getFilteringSteps(); - // //double alpha = 1.0; - // //if(alphaSteps != 0) - // //{ - // // alpha = (1.0-alphaSteps*0.1); - // // // cout<<p->toString()<<" alpha:"<<alpha<<" steps:"<<alphaSteps<<endl; - // // p->reduceFilteringSteps(); - // //} - // //newFX = (1.-alpha)*oldFX+alpha*newFX; - // //newFY = (1.-alpha)*oldFY+alpha*newFY; - - // attribut.setFX(newFX); - // attribut.setFY(newFY); - // attribut.setFZ(newFZ); - // //cout<<i<<" "<<newFX<<" "<<newFY<<" "<<newFZ<<endl; - // //cout<<i<<" "<<p->toString()<<endl; - - //} -} -////////////////////////////////////////////////////////////////////////// -string D3Q27TriFaceMeshInteractor::toString() -{ - stringstream ss; - ss<< "D3Q27TriFaceMeshInteractor[label=D3Q27TriFaceMeshInteractor"; - if(this->isSolid()) ss<<", solid"; - if(this->isInverseSolid()) ss<<", inversesolid"; - if(this->isTimeDependent()) ss<<", timedependent"; - if(geoObject3D!=NULL) ss<<", AMR3DInteractor: "<<geoObject3D->toString(); - ss<<"]"; - - return ss.str(); -} -////////////////////////////////////////////////////////////////////////// -void D3Q27TriFaceMeshInteractor::reinitWithStoredQs( const double& timeStep ) -{ - //alle solid Bloecke wieder solid setzen - std::vector<Block3DPtr>& solidBlocks = this->getSolidBlockSet(); - for(size_t i=0; i<solidBlocks.size(); i++) - { - solidBlocks[i]->setActive(false); //<- quick n dirty - } - - //alle solid-nodes wieder solid setzen (solids die quasi in den TransBloecken liegen) - std::map<Block3DPtr, std::set< UbTupleInt3 > >::iterator it1; - for( it1=this->solidNodeIndicesMap.begin(); it1!=this->solidNodeIndicesMap.end(); ++it1 ) - { - Block3DPtr block = it1->first; - - ILBMKernelPtr kernel = block->getKernel(); - BCArray3DPtr bcMatrix = kernel->getBCProcessor()->getBCArray(); - std::set< UbTupleInt3 >& indicesSet = it1->second; - - for( std::set< UbTupleInt3 >::iterator setIt=indicesSet.begin(); setIt!=indicesSet.end(); ++setIt ) - { - bcMatrix->setSolid( val<1>(*setIt), val<2>(*setIt), val<3>(*setIt) ); - } - } - - //BCS WIEDERHERSTELLEN - std::map<Block3DPtr, std::map< UbTupleInt3, std::vector<float> > >::iterator it; - for( it=bcNodeIndicesAndQsMap.begin(); it!=bcNodeIndicesAndQsMap.end(); ++it ) - { - Block3DPtr block = it->first; - ILBMKernelPtr kernel = block->getKernel(); - BCArray3DPtr bcMatrix = kernel->getBCProcessor()->getBCArray(); - - std::map< UbTupleInt3, std::vector<float> >::iterator it2; - for( it2=it->second.begin(); it2!=it->second.end(); ++it2 ) - { - const UbTupleInt3& pos = it2->first; - std::vector< float > qs = it2->second; - - //SG_27.08.2010 - if(bcMatrix->isSolid(val<1>(pos), val<2>(pos), val<3>(pos))) continue; - - BoundaryConditionsPtr bc = bcMatrix->getBC( val<1>(pos), val<2>(pos), val<3>(pos) ); - if(!bc) - { - bc = BoundaryConditionsPtr(new BoundaryConditions); - bcMatrix->setBC( val<1>(pos), val<2>(pos), val<3>(pos), bc ); - } - - double x1w = qs[D3Q27System::FENDDIR+1+0]; - double x2w = qs[D3Q27System::FENDDIR+1+1]; - double x3w = qs[D3Q27System::FENDDIR+1+2]; - - - //TODO: HACK GEHOERT NICHT HIERHIER!!! - start - //es handelt sich un ein statisches Objekt und beim Propeller gibt - // es Schwierigkeiten an den Flügelspitzen, dass kann daher kommen, - //dass dort zuviel bc-flaggs sind und mit Geschwindigkeit ergibt dies ziemlich grosse Werte - bc->setBoundaryVelocityX1(0.0); - bc->setBoundaryVelocityX2(0.0); - bc->setBoundaryVelocityX3(0.0); - //TODO: HACK GEHOERT NICHT HIERHIER!!! - end - - bool gotQs = false; - for(int fdir=D3Q27System::FSTARTDIR; fdir<=D3Q27System::FENDDIR; fdir++) - { - if( UbMath::greater(qs[fdir], -1.0) && UbMath::less( qs[fdir], bc->getQ(fdir) ) ) - { - gotQs = true; - for(size_t index=0; index<this->bcAdapters.size(); index++) - this->bcAdapters[index]->adaptBCForDirection( *this, bc, x1w, x2w, x3w, qs[fdir], fdir); - } - } - - if(gotQs) - for(size_t index=0; index<this->bcAdapters.size(); index++) - this->bcAdapters[index]->adaptBC( *this, bc, x1w, x2w, x3w); - } - } -} -////////////////////////////////////////////////////////////////////////// -void D3Q27TriFaceMeshInteractor::updateInteractor( const double& timestep/*=0*/ ) -{ - UB_THROW( UbException("D3Q27TriFaceMeshInteractor::updateInteractor - toDo") ); -} - - - - - - diff --git a/src/VirtualFluids/Interactors/D3Q27TriFaceMeshInteractor.h b/src/VirtualFluids/Interactors/D3Q27TriFaceMeshInteractor.h deleted file mode 100644 index 6bf0bc78d..000000000 --- a/src/VirtualFluids/Interactors/D3Q27TriFaceMeshInteractor.h +++ /dev/null @@ -1,118 +0,0 @@ -#ifndef D3Q19AMRTRIFACEMESHINTERACTOR_H -#define D3Q19AMRTRIFACEMESHINTERACTOR_H - -#include <string> -#include <vector> -#include <map> -#include <memory> - -#include "D3Q27Interactor.h" -#include "CbArray3D.h" - -class D3Q27TriFaceMeshInteractor; -typedef std::shared_ptr<D3Q27TriFaceMeshInteractor> D3Q27TriFaceMeshInteractorPtr; - - -class GbObject3D; -class Grid3D; -class BCAdapter; -class GbTriFaceMesh3D; -class Block3D; - - -class D3Q27TriFaceMeshInteractor : public D3Q27Interactor -{ -public: - static const int STRESSNORMAL=0; - static const int STRESSALTERNATIV=1; - - D3Q27TriFaceMeshInteractor(); - D3Q27TriFaceMeshInteractor(std::shared_ptr<Grid3D> grid, std::string name="D3Q27TriFaceMeshInteractor"); - D3Q27TriFaceMeshInteractor(std::shared_ptr<GbObject3D> geoObject3D, std::shared_ptr<Grid3D> grid, int type); - D3Q27TriFaceMeshInteractor(std::shared_ptr<GbTriFaceMesh3D> triFaceMesh, std::shared_ptr<Grid3D> grid, std::shared_ptr<BCAdapter> bcAdapter, int type); - D3Q27TriFaceMeshInteractor(std::shared_ptr<GbTriFaceMesh3D> triFaceMesh, std::shared_ptr<Grid3D> grid, std::shared_ptr<BCAdapter> bcAdapter, int type, Interactor3D::Accuracy a); - //D3Q27TriFaceMeshInteractor(GbTriFaceMesh3DPtr triFaceMesh, D3Q27BoundaryConditionAdapterPtr bcAdapter, int type, std::string name="D3Q27TriFaceMeshInteractor"); - - ~D3Q27TriFaceMeshInteractor(); - - virtual void initInteractor(const double& timeStep=0); - virtual void initInteractor2(const double& timeStep=0); - - void updateInteractor(const double& timestep=0); - - void updateMovedGeometry(const double& timeStep=0); - void setQs(const double& timeStep); - void refineBlockGridToLevel(int level, double startDistance, double stopDistance); - - bool setDifferencesToGbObject3D(const std::shared_ptr<Block3D> block/*,const double& orgX1,const double& orgX2,const double& orgX3,const double& blockLengthX1,const double& blockLengthX2,const double& blockLengthX3, const double& timestep=0*/); - - void setRegardPointInObjectTest( bool opt ) { this->regardPIOTest = opt; } - - ObObject* clone() { throw UbException(UB_EXARGS,"not implemented"); } - ObObjectCreator* getCreator(); - - UbTupleDouble3 getForces(); - UbTupleDouble3 getForcesTriangle(); - - void setStressMode(int stressMode) { this->stressMode = stressMode; } - void setUseHalfSpaceCheck(bool useHalfSpace ) { this->useHalfSpace = useHalfSpace; } - //void setReinitWithStoredQs(bool reinitWithStoredQsFlag) { this->reinitWithStoredQsFlag = reinitWithStoredQsFlag; } - - void calculateForces(); - void calculateStresses(); - void calculateStressesAlternativ(); - - void calcStressesLine(UbTupleDouble6& stresses, const double& weight, const UbTupleDouble6& stvW, const UbTupleDouble6& stvE ); - void calcStressesFace(UbTupleDouble6& stresses, const double& weightX, const double& weightY, const UbTupleDouble6& stvSW, const UbTupleDouble6& stvSE, const UbTupleDouble6& stvNE, const UbTupleDouble6& stvNW ); - void calcStressesCube(UbTupleDouble6& stresses, const double& weightX, const double& weightY, const double& weightZ, const UbTupleDouble6& stvBSW, const UbTupleDouble6& stvBSE, const UbTupleDouble6& stvBNE, const UbTupleDouble6& stvBNW, const UbTupleDouble6& stvTSW, const UbTupleDouble6& stvTSE, const UbTupleDouble6& stvTNE, const UbTupleDouble6& stvTNW ); - - void calculatePressure(); - void calcPressureLine(double &p, const double& weight, const double& pW, const double& pE ); - void calcPressureFace(double &p, const double& weightX, const double& weightY, const double& pSW, const double& pSE, const double& pNE, const double& pNW ); - void calcPressureCube(double &p, const double& weightX, const double& weightY, const double& weightZ, const double& pBSW, const double& pBSE, const double& pBNE, const double& pBNW, const double& pTSW, const double& pTSE, const double& pTNE, const double& pTNW ); - - void setForceShift(double forceshift) { this->forceshift = forceshift; this->forceshiftpolicy = true; } - void setVelocityShift(double velocityshift) { this->velocityshift = velocityshift; this->velocityshiftpolicy = true; } - double getForceShift() { return this->forceshift; } - double getVelocityShift() { return this->velocityshift; } - bool getForceShiftPolicy() { return forceshiftpolicy;} - bool getVelocityShiftPolicy() { return velocityshiftpolicy;} - - void clearBcNodeIndicesAndQsMap() { this->bcNodeIndicesAndQsMap.clear();} - - virtual std::string toString(); - - -protected: - int stressMode; - - double forceshift; - double velocityshift; - bool forceshiftpolicy; - bool velocityshiftpolicy; - bool useHalfSpace; - bool regardPIOTest; - - void reinitWithStoredQs(const double& timeStep); - // bool reinitWithStoredQsFlag; - std::map< std::shared_ptr<Block3D>, std::map < UbTupleInt3, std::vector< float > > > bcNodeIndicesAndQsMap; //!!! es kann sein, dass in diesem interactor - //an eine rpos eine BC gesetzt wurde, aber derselbe node in - //in einem anderen in einen anderen Typ (z.B. Solid) geaendert - //wurde --> es ist keine BC mehr an der stelle! - - enum SolidCheckMethod { ScanLine, PointInObject }; - - enum FLAGS { BC_FLAG, UNDEF_FLAG, FLUID_FLAG, SOLID_FLAG, OLDSOLID_FLAG }; - void recursiveGridFill(CbArray3D<FLAGS>& flagfield, const short& xs, const short& ys, const short& zs, const FLAGS& type); - void iterativeGridFill(CbArray3D<FLAGS>& flagfield, const short& xs, const short& ys, const short& zs, const FLAGS& type); - - friend class boost::serialization::access; - template<class Archive> - void serialize(Archive & ar, const unsigned int version) - { - ar & boost::serialization::base_object<D3Q27Interactor>(*this); - } -}; - - -#endif diff --git a/src/VirtualFluids/Interactors/Interactor3D.cpp b/src/VirtualFluids/Interactors/Interactor3D.cpp deleted file mode 100644 index 20bbfc46b..000000000 --- a/src/VirtualFluids/Interactors/Interactor3D.cpp +++ /dev/null @@ -1,288 +0,0 @@ -#include "Interactor3D.h" - - - -#include <fstream> -#include <numerics/geometry3d/GbCuboid3D.h> -#include <basics/utilities/UbMath.h> -#include <basics/utilities/UbFileOutput.h> -#include "UbException.h" - -#include "Grid3D.h" -#include "Block3D.h" -#include "GbObject3D.h" - - -using namespace std; - -const int Interactor3D::SOLID = (1<<0); //1 -const int Interactor3D::INVERSESOLID = (1<<1); //2 -const int Interactor3D::TIMEDEPENDENT = (1<<2); //4 //zeitlich -const int Interactor3D::FLUID = (1<<3); //8 -const int Interactor3D::MOVEABLE = (1<<4); //16 // geometrisch -const int Interactor3D::CHANGENOTNECESSARY = (1<<5); //32 - -////////////////////////////////////////////////////////////////////////// -Interactor3D::Interactor3D() - : type(SOLID) -{ - -} -////////////////////////////////////////////////////////////////////////// -Interactor3D::Interactor3D(Grid3DPtr grid, int type) - : type(type) - , grid(grid) -{ -} -////////////////////////////////////////////////////////////////////////// -Interactor3D::Interactor3D(GbObject3DPtr geoObject3D, Grid3DPtr grid, int type) - : geoObject3D(geoObject3D) - , grid(grid) - , type(type) - , accuracy(SIMPLE) -{ -} -////////////////////////////////////////////////////////////////////////// -Interactor3D::Interactor3D(GbObject3DPtr geoObject3D, Grid3DPtr grid, int type, Interactor3D::Accuracy a) - : geoObject3D(geoObject3D) - , grid(grid) - , type(type) - , accuracy(a) -{ -} -////////////////////////////////////////////////////////////////////////// -Interactor3D::~Interactor3D() -{ -} -////////////////////////////////////////////////////////////////////////// -bool Interactor3D::arePointsInsideGeoObject(double minX1, double minX2, double minX3, double maxX1, double maxX2, double maxX3, double delta) -{ - bool result = true; - for (double ix3=minX3; ix3<=maxX3; ix3+=delta) - for (double ix2=minX2; ix2<=maxX2; ix2+=delta) - for (double ix1=minX1; ix1<=maxX1; ix1+=delta) - result = result && this->geoObject3D->isPointInGbObject3D(ix1, ix2, ix3); - - return result; -} -////////////////////////////////////////////////////////////////////////// -bool Interactor3D::arePointsOutsideGeoObject(double minX1, double minX2, double minX3, double maxX1, double maxX2, double maxX3, double delta) -{ - bool result = true; - for (double ix3=minX3; ix3<=maxX3; ix3+=delta) - for (double ix2=minX2; ix2<=maxX2; ix2+=delta) - for (double ix1=minX1; ix1<=maxX1; ix1+=delta) - result = result && (!this->geoObject3D->isPointInGbObject3D(ix1, ix2, ix3)); - - return result; -} -////////////////////////////////////////////////////////////////////////// -bool Interactor3D::arePointsCuttingGeoObject(double minX1, double minX2, double minX3, double maxX1, double maxX2, double maxX3, double delta) -{ - bool result = true; - for (double ix3=minX3; ix3<=maxX3; ix3+=delta) - for (double ix2=minX2; ix2<=maxX2; ix2+=delta) - for (double ix1=minX1; ix1<=maxX1; ix1+=delta) - result = result || this->geoObject3D->isPointInGbObject3D(ix1, ix2, ix3); - - return result; -} -////////////////////////////////////////////////////////////////////////// -bool Interactor3D::isBlockOutsideGeoObject(double minX1, double minX2, double minX3, double maxX1, double maxX2, double maxX3, double delta) -{ - switch (accuracy) - { - //simple duff - case SIMPLE: - return !this->geoObject3D->isCellInsideOrCuttingGbObject3D(minX1,minX2,minX3,maxX1,maxX2,maxX3); - //test only edges - case EDGES: - return arePointsOutsideGeoObject(minX1, minX2, minX3, maxX1, minX2, minX3, delta) && - arePointsOutsideGeoObject(minX1, maxX2, minX3, maxX1, maxX2, minX3, delta) && - arePointsOutsideGeoObject(minX1, minX2, maxX3, maxX1, minX2, maxX3, delta) && - arePointsOutsideGeoObject(minX1, maxX2, maxX3, maxX1, maxX2, maxX3, delta) && - - arePointsOutsideGeoObject(minX1, minX2, minX3, minX1, maxX2, minX3, delta) && - arePointsOutsideGeoObject(maxX1, minX2, minX3, maxX1, maxX2, minX3, delta) && - arePointsOutsideGeoObject(minX1, minX2, maxX3, maxX1, minX2, maxX3, delta) && - arePointsOutsideGeoObject(maxX1, minX2, maxX3, maxX1, maxX2, maxX3, delta) && - - arePointsOutsideGeoObject(minX1, minX2, minX3, minX1, maxX2, maxX3, delta) && - arePointsOutsideGeoObject(maxX1, minX2, minX3, maxX1, maxX2, maxX3, delta) && - arePointsOutsideGeoObject(minX1, maxX2, minX3, maxX1, minX2, maxX3, delta) && - arePointsOutsideGeoObject(maxX1, maxX2, minX3, maxX1, maxX2, maxX3, delta); - //test only faces - case FACES: - return arePointsOutsideGeoObject(minX1, minX2, minX3, minX1, maxX2, maxX3, delta) && - arePointsOutsideGeoObject(maxX1, minX2, minX3, maxX1, maxX2, maxX3, delta) && - arePointsOutsideGeoObject(minX1, minX2, minX3, maxX1, minX2, maxX3, delta) && - arePointsOutsideGeoObject(minX1, maxX2, minX3, maxX1, maxX2, maxX3, delta) && - arePointsOutsideGeoObject(minX1, minX2, minX3, maxX1, maxX2, minX3, delta) && - arePointsOutsideGeoObject(minX1, minX2, maxX3, maxX1, maxX2, maxX3, delta); - //test all points - case POINTS: - return arePointsOutsideGeoObject(minX1, minX2, minX3, maxX1, maxX2, maxX3, delta); - default: - UB_THROW( UbException(UB_EXARGS, "Accuracy isn't correct") ); - break; - } -} -////////////////////////////////////////////////////////////////////////// -bool Interactor3D::isBlockInsideGeoObject(double minX1, double minX2, double minX3, double maxX1, double maxX2, double maxX3, double delta) -{ - switch (accuracy) - { - //simple duff - case SIMPLE: - return this->geoObject3D->isCellInsideGbObject3D(minX1,minX2,minX3,maxX1,maxX2,maxX3); - //test only edges - case EDGES: - return arePointsInsideGeoObject(minX1, minX2, minX3, maxX1, minX2, minX3, delta) && - arePointsInsideGeoObject(minX1, maxX2, minX3, maxX1, maxX2, minX3, delta) && - arePointsInsideGeoObject(minX1, minX2, maxX3, maxX1, minX2, maxX3, delta) && - arePointsInsideGeoObject(minX1, maxX2, maxX3, maxX1, maxX2, maxX3, delta) && - - arePointsInsideGeoObject(minX1, minX2, minX3, minX1, maxX2, minX3, delta) && - arePointsInsideGeoObject(maxX1, minX2, minX3, maxX1, maxX2, minX3, delta) && - arePointsInsideGeoObject(minX1, minX2, maxX3, maxX1, minX2, maxX3, delta) && - arePointsInsideGeoObject(maxX1, minX2, maxX3, maxX1, maxX2, maxX3, delta) && - - arePointsInsideGeoObject(minX1, minX2, minX3, minX1, maxX2, maxX3, delta) && - arePointsInsideGeoObject(maxX1, minX2, minX3, maxX1, maxX2, maxX3, delta) && - arePointsInsideGeoObject(minX1, maxX2, minX3, maxX1, minX2, maxX3, delta) && - arePointsInsideGeoObject(maxX1, maxX2, minX3, maxX1, maxX2, maxX3, delta); - //test only faces - case FACES: - return arePointsInsideGeoObject(minX1, minX2, minX3, minX1, maxX2, maxX3, delta) && - arePointsInsideGeoObject(maxX1, minX2, minX3, maxX1, maxX2, maxX3, delta) && - arePointsInsideGeoObject(minX1, minX2, minX3, maxX1, minX2, maxX3, delta) && - arePointsInsideGeoObject(minX1, maxX2, minX3, maxX1, maxX2, maxX3, delta) && - arePointsInsideGeoObject(minX1, minX2, minX3, maxX1, maxX2, minX3, delta) && - arePointsInsideGeoObject(minX1, minX2, maxX3, maxX1, maxX2, maxX3, delta); - //test all points - case POINTS: - return arePointsInsideGeoObject(minX1, minX2, minX3, maxX1, maxX2, maxX3, delta); - default: - UB_THROW( UbException(UB_EXARGS, "Accuracy isn't correct") ); - break; - } -} -////////////////////////////////////////////////////////////////////////// -bool Interactor3D::isBlockCuttingGeoObject(double minX1, double minX2, double minX3, double maxX1, double maxX2, double maxX3, double delta) -{ - switch (accuracy) - { - //simple duff - case SIMPLE: - return this->geoObject3D->isCellCuttingGbObject3D(minX1,minX2,minX3,maxX1,maxX2,maxX3); - //test only edges - case EDGES: - return arePointsCuttingGeoObject(minX1, minX2, minX3, maxX1, minX2, minX3, delta) || - arePointsCuttingGeoObject(minX1, maxX2, minX3, maxX1, maxX2, minX3, delta) || - arePointsCuttingGeoObject(minX1, minX2, maxX3, maxX1, minX2, maxX3, delta) || - arePointsCuttingGeoObject(minX1, maxX2, maxX3, maxX1, maxX2, maxX3, delta) || - - arePointsCuttingGeoObject(minX1, minX2, minX3, minX1, maxX2, minX3, delta) || - arePointsCuttingGeoObject(maxX1, minX2, minX3, maxX1, maxX2, minX3, delta) || - arePointsCuttingGeoObject(minX1, minX2, maxX3, maxX1, minX2, maxX3, delta) || - arePointsCuttingGeoObject(maxX1, minX2, maxX3, maxX1, maxX2, maxX3, delta) || - - arePointsCuttingGeoObject(minX1, minX2, minX3, minX1, maxX2, maxX3, delta) || - arePointsCuttingGeoObject(maxX1, minX2, minX3, maxX1, maxX2, maxX3, delta) || - arePointsCuttingGeoObject(minX1, maxX2, minX3, maxX1, minX2, maxX3, delta) || - arePointsCuttingGeoObject(maxX1, maxX2, minX3, maxX1, maxX2, maxX3, delta); - //test only faceCutting - case FACES: - return arePointsCuttingGeoObject(minX1, minX2, minX3, minX1, maxX2, maxX3, delta) || - arePointsCuttingGeoObject(maxX1, minX2, minX3, maxX1, maxX2, maxX3, delta) || - arePointsCuttingGeoObject(minX1, minX2, minX3, maxX1, minX2, maxX3, delta) || - arePointsCuttingGeoObject(minX1, maxX2, minX3, maxX1, maxX2, maxX3, delta) || - arePointsCuttingGeoObject(minX1, minX2, minX3, maxX1, maxX2, minX3, delta) || - arePointsCuttingGeoObject(minX1, minX2, maxX3, maxX1, maxX2, maxX3, delta); - //test all pointCutting - case POINTS: - return arePointsCuttingGeoObject(minX1, minX2, minX3, maxX1, maxX2, maxX3, delta); - default: - UB_THROW( UbException(UB_EXARGS, "Accuracy isn't correct") ); - break; - } -} -////////////////////////////////////////////////////////////////////////// -void Interactor3D::setSolidBlock(Block3DPtr block) -{ - double minX1,minX2,minX3,maxX1,maxX2,maxX3; - - double deltaX = grid.lock()->getDeltaX(block); - UbTupleDouble3 blockLengths = grid.lock()->getBlockLengths(block); - UbTupleDouble3 org = grid.lock()->getBlockWorldCoordinates(block); - UbTupleDouble3 nodeOffset = grid.lock()->getNodeOffset(block); - - //coordinates of block without ghost layer - minX1 = val<1>(org) + val<1>(nodeOffset); - minX2 = val<2>(org) + val<2>(nodeOffset); - minX3 = val<3>(org) + val<3>(nodeOffset); - maxX1 = val<1>(org) + val<1>(blockLengths) - val<1>(nodeOffset); - maxX2 = val<2>(org) + val<2>(blockLengths) - val<2>(nodeOffset); - maxX3 = val<3>(org) + val<3>(blockLengths) - val<3>(nodeOffset); - - if(this->isInverseSolid()) - { - if(isBlockOutsideGeoObject(minX1, minX2, minX3, maxX1, maxX2, maxX3, deltaX)) - { - block->setActive(false); - this->solidBlocks.push_back(block); - } - } - else //solid - { - if(isBlockInsideGeoObject(minX1, minX2, minX3, maxX1, maxX2, maxX3, deltaX)) - { - block->setActive(false); - this->solidBlocks.push_back(block); - } - } -} -////////////////////////////////////////////////////////////////////////// -void Interactor3D::setBCBlock(Block3DPtr block) -{ - double minX1,minX2,minX3,maxX1,maxX2,maxX3; - - double deltaX = grid.lock()->getDeltaX(block); - UbTupleDouble3 blockLengths = grid.lock()->getBlockLengths(block); - UbTupleDouble3 org = grid.lock()->getBlockWorldCoordinates(block); - UbTupleDouble3 nodeOffset = grid.lock()->getNodeOffset(block); - - //coordinates of block with ghost layer - minX1 = val<1>(org) - val<1>(nodeOffset); - minX2 = val<2>(org) - val<2>(nodeOffset); - minX3 = val<3>(org) - val<3>(nodeOffset); - maxX1 = val<1>(org) + val<1>(blockLengths) + val<1>(nodeOffset); - maxX2 = val<2>(org) + val<2>(blockLengths) + val<2>(nodeOffset); - maxX3 = val<3>(org) + val<3>(blockLengths) + val<3>(nodeOffset); - - if(isBlockCuttingGeoObject(minX1, minX2, minX3, maxX1, maxX2, maxX3, deltaX)) - this->bcBlocks.push_back(block); -} - -UbTupleDouble3 Interactor3D::getForces() -{ - UB_THROW( UbException("UbTupleDouble3 getForces() - gehoert in die abgeleitete klasse") ); -} - -////////////////////////////////////////////////////////////////////////// -void Interactor3D::initInteractor(const double& timeStep) -{ - //UBLOG(logINFO, "transBlocks.size = "<<transBlocks.size()); - - for(Block3DPtr block : bcBlocks) - { - this->setDifferencesToGbObject3D(block); - } -} -////////////////////////////////////////////////////////////////////////// -void Interactor3D::updateInteractor(const double& timeStep) -{ - UB_THROW( UbException("Interactor3D::updateInteractor - toDo") ); -} -////////////////////////////////////////////////////////////////////////// - diff --git a/src/VirtualFluids/Interactors/Interactor3D.h b/src/VirtualFluids/Interactors/Interactor3D.h deleted file mode 100644 index 2efd48d66..000000000 --- a/src/VirtualFluids/Interactors/Interactor3D.h +++ /dev/null @@ -1,119 +0,0 @@ -#ifndef INTERACTOR3D_H -#define INTERACTOR3D_H - -#include <vector> -#include <memory> - -#include "UbSystem.h" -#include "UbTuple.h" - -#include <boost/serialization/serialization.hpp> -#include <boost/serialization/shared_ptr.hpp> - -#include <VirtualFluidsDefinitions.h> - -class Block3D; -class Grid3D; -class UbFileInput; -class UbFileOutput; -class GbObject3D; -class Block3D; - -class Interactor3D; -typedef std::shared_ptr<Interactor3D> Interactor3DPtr; - -class VF_PUBLIC Interactor3D : public std::enable_shared_from_this<Interactor3D> -{ -public: - enum Accuracy{SIMPLE, EDGES, FACES, POINTS}; - Interactor3D(); - Interactor3D(std::shared_ptr<Grid3D> grid, int type=Interactor3D::SOLID); - Interactor3D(std::shared_ptr<GbObject3D> geoObject3D, std::shared_ptr<Grid3D> grid, int type); - //! constructor - //! \param a set accuracy for arePointsInObject() and arePointsNotInObject() - Interactor3D(std::shared_ptr<GbObject3D> geoObject3D, std::shared_ptr<Grid3D> grid, int type, Interactor3D::Accuracy a); - - virtual ~Interactor3D(); - virtual void initInteractor(const double& timestep=0); - virtual void updateInteractor(const double& timestep=0)=0; - - void setSolidBlock(std::shared_ptr<Block3D> block); - void setBCBlock(std::shared_ptr<Block3D> block); - - virtual UbTupleDouble3 getForces(); - - void setSolid() { UbSystem::setBit(this->type, SOLID ); } - void setMoveable() { UbSystem::setBit(this->type, MOVEABLE); } - - bool isSolid() { return UbSystem::bitCheck(this->type, SOLID ); } - bool isInverseSolid() { return UbSystem::bitCheck(this->type, INVERSESOLID ); } - bool isTimeDependent() { return UbSystem::bitCheck(this->type, TIMEDEPENDENT); } - bool isMoveable() { return UbSystem::bitCheck(this->type, MOVEABLE ); } - - std::shared_ptr<Grid3D> getGrid3D() const { return grid.lock(); } - void setGrid3D(std::shared_ptr<Grid3D> grid) { this->grid = grid; } - virtual std::shared_ptr<GbObject3D> getGbObject3D() const { return geoObject3D; } - virtual bool setDifferencesToGbObject3D(const std::shared_ptr<Block3D> block/*, const double& x1, const double& x2, const double& x3, const double& blockLengthX1, const double& blockLengthX2, const double& blockLengthX3, const double& timestep=0*/) - { - return false; - } - - virtual std::vector<std::shared_ptr<Block3D> >& getBcBlocks() { return this->bcBlocks; } - virtual void removeBcBlocks() { this->bcBlocks.clear(); } - virtual std::vector<std::shared_ptr<Block3D> >& getSolidBlockSet() { return this->solidBlocks; } - virtual void removeSolidBlocks() { this->solidBlocks.clear(); } - -protected: - void setTimeDependent() { UbSystem::setBit(this->type , TIMEDEPENDENT); } - void unsetTimeDependent() { UbSystem::unsetBit(this->type, TIMEDEPENDENT); } - - //! detect that points are inside object - //! \param min/max coordinates of bounding box - //! \param delta is delta x - bool arePointsInsideGeoObject(double minX1, double minX2, double minX3, double maxX1, double maxX2, double maxX3, double delta); - - //! detect that points aren't inside object - //! \param min/max coordinates of bounding box - //! \param delta is delta x - bool arePointsOutsideGeoObject(double minX1, double minX2, double minX3, double maxX1, double maxX2, double maxX3, double delta); - - //! detect that points are cutting object - //! \param min/max coordinates of bounding box - //! \param delta is delta x - bool arePointsCuttingGeoObject(double minX1, double minX2, double minX3, double maxX1, double maxX2, double maxX3, double delta); - - bool isBlockOutsideGeoObject(double minX1, double minX2, double minX3, double maxX1, double maxX2, double maxX3, double delta); - bool isBlockInsideGeoObject(double minX1, double minX2, double minX3, double maxX1, double maxX2, double maxX3, double delta); - bool isBlockCuttingGeoObject(double minX1, double minX2, double minX3, double maxX1, double maxX2, double maxX3, double delta); - - int type; - - std::weak_ptr<Grid3D> grid; - std::shared_ptr<GbObject3D> geoObject3D; - - std::vector<std::shared_ptr<Block3D> > bcBlocks; - std::vector<std::shared_ptr<Block3D> > solidBlocks; - int accuracy; - -public: - static const int SOLID ;//= (1<<0); //1 - static const int INVERSESOLID ;//= (1<<1); //2 - static const int TIMEDEPENDENT ;//= (1<<2); //4 //zeitlich - static const int FLUID ;//= (1<<3); //8 - static const int MOVEABLE ;//= (1<<4); //16 // geometrisch - static const int CHANGENOTNECESSARY ;//= (1<<5); //32 - -private: - friend class boost::serialization::access; - template<class Archive> - void serialize(Archive & ar, const unsigned int version) - { - ar & bcBlocks; - ar & solidBlocks; - } - -}; - - - -#endif diff --git a/src/VirtualFluids/Interactors/InteractorsHelper.cpp b/src/VirtualFluids/Interactors/InteractorsHelper.cpp deleted file mode 100644 index 344a16f5d..000000000 --- a/src/VirtualFluids/Interactors/InteractorsHelper.cpp +++ /dev/null @@ -1,85 +0,0 @@ -#include "InteractorsHelper.h" - -#include <SetSolidBlockVisitor.h> -#include <Grid3DVisitor.h> -#include <Grid3D.h> -#include <Interactor3D.h> -#include "Block3D.h" -#include "Communicator.h" - - -InteractorsHelper::InteractorsHelper(Grid3DPtr grid, Grid3DVisitorPtr visitor) : - grid(grid), visitor(visitor) -{ - -} -////////////////////////////////////////////////////////////////////////// -InteractorsHelper::~InteractorsHelper() -{ - -} -////////////////////////////////////////////////////////////////////////// -void InteractorsHelper::addInteractor( Interactor3DPtr interactor ) -{ - interactors.push_back(interactor); -} -////////////////////////////////////////////////////////////////////////// -void InteractorsHelper::setBC() -{ - for(Interactor3DPtr i : interactors) - i->initInteractor(); -} - -void InteractorsHelper::sendDomainDecompositionVisitor() const -{ - grid->accept( visitor ); -} - -////////////////////////////////////////////////////////////////////////// -void InteractorsHelper::selectBlocks() -{ - sendDomainDecompositionVisitor(); - deleteSolidBlocks(); - - sendDomainDecompositionVisitor(); - setBcBlocks(); -} -////////////////////////////////////////////////////////////////////////// -void InteractorsHelper::deleteSolidBlocks() -{ - for(Interactor3DPtr interactor : interactors) - { - setBlocks(interactor, BlockType::SOLID); - - std::vector<Block3DPtr>& sb = interactor->getSolidBlockSet(); - solidBlocks.insert(solidBlocks.end(), sb.begin(), sb.end()); - interactor->removeSolidBlocks(); - } - - updateGrid(); -} -////////////////////////////////////////////////////////////////////////// -void InteractorsHelper::setBlocks(const Interactor3DPtr interactor, BlockType type) const -{ - SetSolidBlockVisitor v(interactor, type); - grid->accept(v); -} -////////////////////////////////////////////////////////////////////////// -void InteractorsHelper::setBcBlocks() -{ - for(const Interactor3DPtr interactor : interactors) - setBlocks(interactor, BlockType::BC); -} -////////////////////////////////////////////////////////////////////////// -void InteractorsHelper::updateGrid() -{ - std::vector<int> ids; - - for(const Block3DPtr block : solidBlocks) - ids.push_back(block->getGlobalID()); - - std::vector<int> rids; - Communicator::getInstance()->allGather(ids, rids); - grid->deleteBlocks(rids); -} - diff --git a/src/VirtualFluids/Interactors/InteractorsHelper.h b/src/VirtualFluids/Interactors/InteractorsHelper.h deleted file mode 100644 index 94c5eaf92..000000000 --- a/src/VirtualFluids/Interactors/InteractorsHelper.h +++ /dev/null @@ -1,38 +0,0 @@ -#ifndef SolidBlocksHelper_h -#define SolidBlocksHelper_h - -#include <vector> -#include <memory> - -class Interactor3D; -class Block3D; -class Grid3D; -class Grid3DVisitor; -enum class BlockType; - -class InteractorsHelper -{ -public: - InteractorsHelper(std::shared_ptr<Grid3D> grid, std::shared_ptr<Grid3DVisitor> visitor); - ~InteractorsHelper(); - - void addInteractor(std::shared_ptr<Interactor3D> interactor); - void selectBlocks(); - void setBC(); - void sendDomainDecompositionVisitor() const; - -protected: - void deleteSolidBlocks(); - void setBlocks(const std::shared_ptr<Interactor3D> interactor, BlockType type) const; - void setBcBlocks(); - -private: - void updateGrid(); - - std::vector<std::shared_ptr<Interactor3D> > interactors; - std::shared_ptr<Grid3D> grid; - std::vector<std::shared_ptr<Block3D> > solidBlocks; - std::shared_ptr<Grid3DVisitor> visitor; -}; - -#endif diff --git a/src/VirtualFluids/Interactors/package.include b/src/VirtualFluids/Interactors/package.include deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/VirtualFluids/LBM/CompressibleCumulant2LBMKernel.cpp b/src/VirtualFluids/LBM/CompressibleCumulant2LBMKernel.cpp deleted file mode 100644 index d8c8ecfa8..000000000 --- a/src/VirtualFluids/LBM/CompressibleCumulant2LBMKernel.cpp +++ /dev/null @@ -1,1083 +0,0 @@ -#include "CompressibleCumulant2LBMKernel.h" -#include "D3Q27System.h" -#include "InterpolationProcessor.h" -#include "D3Q27EsoTwist3DSplittedVector.h" -#include <math.h> -#include <omp.h> -#include "DataSet3D.h" -#include "LBMKernel.h" - -#define PROOF_CORRECTNESS - -////////////////////////////////////////////////////////////////////////// -CompressibleCumulant2LBMKernel::CompressibleCumulant2LBMKernel() -{ - this->nx1 = 0; - this->nx2 = 0; - this->nx3 = 0; - this->parameter = NORMAL; - this->OxyyMxzz = 1.0; - this->compressible = true; - this->bulkOmegaToOmega = false; - this->OxxPyyPzz = 1.0; -} -////////////////////////////////////////////////////////////////////////// -CompressibleCumulant2LBMKernel::CompressibleCumulant2LBMKernel(int nx1, int nx2, int nx3, Parameter p) -{ - this->nx1 = nx1; - this->nx2 = nx2; - this->nx3 = nx3; - this->parameter = p; - this->OxyyMxzz = 1.0; - this->compressible = true; - this->bulkOmegaToOmega = false; - this->OxxPyyPzz = 1.0; -} -////////////////////////////////////////////////////////////////////////// -CompressibleCumulant2LBMKernel::~CompressibleCumulant2LBMKernel(void) -{ - -} -////////////////////////////////////////////////////////////////////////// -void CompressibleCumulant2LBMKernel::init() -{ - DistributionArray3DPtr d(new D3Q27EsoTwist3DSplittedVector(nx1+2, nx2+2, nx3+2, -999.0)); - dataSet->setFdistributions(d); -} -////////////////////////////////////////////////////////////////////////// -LBMKernelPtr CompressibleCumulant2LBMKernel::clone() -{ - LBMKernelPtr kernel(new CompressibleCumulant2LBMKernel(nx1, nx2, nx3, parameter)); - std::dynamic_pointer_cast<CompressibleCumulant2LBMKernel>(kernel)->init(); - kernel->setCollisionFactor(this->collFactor); - kernel->setBCProcessor(bcProcessor->clone(kernel)); - kernel->setWithForcing(withForcing); - kernel->setForcingX1(muForcingX1); - kernel->setForcingX2(muForcingX2); - kernel->setForcingX3(muForcingX3); - kernel->setIndex(ix1, ix2, ix3); - kernel->setDeltaT(deltaT); - switch (parameter) - { - case NORMAL: - std::dynamic_pointer_cast<CompressibleCumulant2LBMKernel>(kernel)->OxyyMxzz = 1.0; - break; - case MAGIC: - std::dynamic_pointer_cast<CompressibleCumulant2LBMKernel>(kernel)->OxyyMxzz = 2.0 +(-collFactor); - break; - } - - if (bulkOmegaToOmega) - { - std::dynamic_pointer_cast<CompressibleCumulant2LBMKernel>(kernel)->OxxPyyPzz = collFactor; - } - else - { - std::dynamic_pointer_cast<CompressibleCumulant2LBMKernel>(kernel)->OxxPyyPzz = one; - } - return kernel; -} -////////////////////////////////////////////////////////////////////////// -void CompressibleCumulant2LBMKernel::calculate() -{ - timer.resetAndStart(); - collideAll(); - timer.stop(); -} -////////////////////////////////////////////////////////////////////////// -void CompressibleCumulant2LBMKernel::collideAll() -{ - using namespace D3Q27System; - - //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; - } - ///////////////////////////////////// - - localDistributions = std::dynamic_pointer_cast<D3Q27EsoTwist3DSplittedVector>(dataSet->getFdistributions())->getLocalDistributions(); - nonLocalDistributions = std::dynamic_pointer_cast<D3Q27EsoTwist3DSplittedVector>(dataSet->getFdistributions())->getNonLocalDistributions(); - zeroDistributions = std::dynamic_pointer_cast<D3Q27EsoTwist3DSplittedVector>(dataSet->getFdistributions())->getZeroDistributions(); - - BCArray3DPtr bcArray = this->getBCProcessor()->getBCArray(); - - const int bcArrayMaxX1 = (int)bcArray->getNX1(); - const int bcArrayMaxX2 = (int)bcArray->getNX2(); - const int bcArrayMaxX3 = (int)bcArray->getNX3(); - - int minX1 = ghostLayerWidth; - int minX2 = ghostLayerWidth; - int minX3 = ghostLayerWidth; - int maxX1 = bcArrayMaxX1-ghostLayerWidth; - int maxX2 = bcArrayMaxX2-ghostLayerWidth; - int maxX3 = bcArrayMaxX3-ghostLayerWidth; - - LBMReal omega = collFactor; - - - //#pragma omp parallel num_threads(8) - { - // int i = omp_get_thread_num(); - // printf_s("Hello from thread %d\n", i); - //} - //#pragma omp for - for (int x3 = minX3; x3 < maxX3; x3++) - { - for (int x2 = minX2; x2 < maxX2; x2++) - { - for (int x1 = minX1; x1 < maxX1; x1++) - { - if (!bcArray->isSolid(x1, x2, x3) && !bcArray->isUndefined(x1, x2, x3)) - { - int x1p = x1 + 1; - int x2p = x2 + 1; - int x3p = x3 + 1; - ////////////////////////////////////////////////////////////////////////// - //read distribution - //////////////////////////////////////////////////////////////////////////// - ////////////////////////////////////////////////////////////////////////// - - //E N T - //c c c - ////////// - //W S B - //a a a - - //Rest ist b - - //mfxyz - //a - negative - //b - null - //c - positive - - // a b c - //-1 0 1 - - LBMReal mfcbb = (*this->localDistributions)(D3Q27System::ET_E, x1, x2, x3); - LBMReal mfbcb = (*this->localDistributions)(D3Q27System::ET_N, x1, x2, x3); - LBMReal mfbbc = (*this->localDistributions)(D3Q27System::ET_T, x1, x2, x3); - LBMReal mfccb = (*this->localDistributions)(D3Q27System::ET_NE, x1, x2, x3); - LBMReal mfacb = (*this->localDistributions)(D3Q27System::ET_NW, x1p, x2, x3); - LBMReal mfcbc = (*this->localDistributions)(D3Q27System::ET_TE, x1, x2, x3); - LBMReal mfabc = (*this->localDistributions)(D3Q27System::ET_TW, x1p, x2, x3); - LBMReal mfbcc = (*this->localDistributions)(D3Q27System::ET_TN, x1, x2, x3); - LBMReal mfbac = (*this->localDistributions)(D3Q27System::ET_TS, x1, x2p, x3); - LBMReal mfccc = (*this->localDistributions)(D3Q27System::ET_TNE, x1, x2, x3); - LBMReal mfacc = (*this->localDistributions)(D3Q27System::ET_TNW, x1p, x2, x3); - LBMReal mfcac = (*this->localDistributions)(D3Q27System::ET_TSE, x1, x2p, x3); - LBMReal mfaac = (*this->localDistributions)(D3Q27System::ET_TSW, x1p, x2p, x3); - - LBMReal mfabb = (*this->nonLocalDistributions)(D3Q27System::ET_W, x1p, x2, x3); - LBMReal mfbab = (*this->nonLocalDistributions)(D3Q27System::ET_S, x1, x2p, x3); - LBMReal mfbba = (*this->nonLocalDistributions)(D3Q27System::ET_B, x1, x2, x3p); - LBMReal mfaab = (*this->nonLocalDistributions)(D3Q27System::ET_SW, x1p, x2p, x3); - LBMReal mfcab = (*this->nonLocalDistributions)(D3Q27System::ET_SE, x1, x2p, x3); - LBMReal mfaba = (*this->nonLocalDistributions)(D3Q27System::ET_BW, x1p, x2, x3p); - LBMReal mfcba = (*this->nonLocalDistributions)(D3Q27System::ET_BE, x1, x2, x3p); - LBMReal mfbaa = (*this->nonLocalDistributions)(D3Q27System::ET_BS, x1, x2p, x3p); - LBMReal mfbca = (*this->nonLocalDistributions)(D3Q27System::ET_BN, x1, x2, x3p); - LBMReal mfaaa = (*this->nonLocalDistributions)(D3Q27System::ET_BSW, x1p, x2p, x3p); - LBMReal mfcaa = (*this->nonLocalDistributions)(D3Q27System::ET_BSE, x1, x2p, x3p); - LBMReal mfaca = (*this->nonLocalDistributions)(D3Q27System::ET_BNW, x1p, x2, x3p); - LBMReal mfcca = (*this->nonLocalDistributions)(D3Q27System::ET_BNE, x1, x2, x3p); - - LBMReal mfbbb = (*this->zeroDistributions)(x1, x2, x3); - - //////////////////////////////////////////////////////////////////////////////////// - LBMReal drho = ((((mfccc+mfaaa)+(mfaca+mfcac))+((mfacc+mfcaa)+(mfaac+mfcca)))+ - (((mfbac+mfbca)+(mfbaa+mfbcc))+((mfabc+mfcba)+(mfaba+mfcbc))+((mfacb+mfcab)+(mfaab+mfccb)))+ - ((mfabb+mfcbb)+(mfbab+mfbcb))+(mfbba+mfbbc))+mfbbb; - - LBMReal rho = one+drho; - //////////////////////////////////////////////////////////////////////////////////// - LBMReal vvx = ((((mfccc-mfaaa)+(mfcac-mfaca))+((mfcaa-mfacc)+(mfcca-mfaac)))+ - (((mfcba-mfabc)+(mfcbc-mfaba))+((mfcab-mfacb)+(mfccb-mfaab)))+ - (mfcbb-mfabb))/rho; - LBMReal vvy = ((((mfccc-mfaaa)+(mfaca-mfcac))+((mfacc-mfcaa)+(mfcca-mfaac)))+ - (((mfbca-mfbac)+(mfbcc-mfbaa))+((mfacb-mfcab)+(mfccb-mfaab)))+ - (mfbcb-mfbab))/rho; - LBMReal vvz = ((((mfccc-mfaaa)+(mfcac-mfaca))+((mfacc-mfcaa)+(mfaac-mfcca)))+ - (((mfbac-mfbca)+(mfbcc-mfbaa))+((mfabc-mfcba)+(mfcbc-mfaba)))+ - (mfbbc-mfbba))/rho; - //////////////////////////////////////////////////////////////////////////////////// - - //forcing - /////////////////////////////////////////////////////////////////////////////////////////// - if (withForcing) - { - muX1 = static_cast<double>(x1-1+ix1*maxX1); - muX2 = static_cast<double>(x2-1+ix2*maxX2); - muX3 = static_cast<double>(x3-1+ix3*maxX3); - - forcingX1 = muForcingX1.Eval(); - forcingX2 = muForcingX2.Eval(); - forcingX3 = muForcingX3.Eval(); - - vvx += forcingX1*deltaT*0.5; // X - vvy += forcingX2*deltaT*0.5; // Y - vvz += forcingX3*deltaT*0.5; // Z - } - /////////////////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////////// - LBMReal oMdrho = one; // comp special - //////////////////////////////////////////////////////////////////////////////////// - LBMReal m0, m1, m2; - LBMReal vx2; - LBMReal vy2; - LBMReal vz2; - vx2 = vvx*vvx; - vy2 = vvy*vvy; - vz2 = vvz*vvz; - //////////////////////////////////////////////////////////////////////////////////// - LBMReal wadjust; - LBMReal qudricLimitP = 0.001;// * 0.0001f; - LBMReal qudricLimitM = 0.001;// * 0.0001f; - LBMReal qudricLimitD = 0.001;// * 0.001f; - //LBMReal s9 = minusomega; - //test - //s9 = 0.; - //////////////////////////////////////////////////////////////////////////////////// - //Hin - //////////////////////////////////////////////////////////////////////////////////// - // mit 1/36, 1/9, 1/36, 1/9, 4/9, 1/9, 1/36, 1/9, 1/36 Konditionieren - //////////////////////////////////////////////////////////////////////////////////// - // Z - Dir - m2 = mfaaa+mfaac; - m1 = mfaac-mfaaa; - m0 = m2+mfaab; - mfaaa = m0; - m0 += c1o36 * oMdrho; - mfaab = m1-m0 * vvz; - mfaac = m2-two* m1 * vvz+vz2 * m0; - //////////////////////////////////////////////////////////////////////////////////// - m2 = mfaba+mfabc; - m1 = mfabc-mfaba; - m0 = m2+mfabb; - mfaba = m0; - m0 += c1o9 * oMdrho; - mfabb = m1-m0 * vvz; - mfabc = m2-two* m1 * vvz+vz2 * m0; - //////////////////////////////////////////////////////////////////////////////////// - m2 = mfaca+mfacc; - m1 = mfacc-mfaca; - m0 = m2+mfacb; - mfaca = m0; - m0 += c1o36 * oMdrho; - mfacb = m1-m0 * vvz; - mfacc = m2-two* m1 * vvz+vz2 * m0; - //////////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////////// - m2 = mfbaa+mfbac; - m1 = mfbac-mfbaa; - m0 = m2+mfbab; - mfbaa = m0; - m0 += c1o9 * oMdrho; - mfbab = m1-m0 * vvz; - mfbac = m2-two* m1 * vvz+vz2 * m0; - //////////////////////////////////////////////////////////////////////////////////// - m2 = mfbba+mfbbc; - m1 = mfbbc-mfbba; - m0 = m2+mfbbb; - mfbba = m0; - m0 += c4o9 * oMdrho; - mfbbb = m1-m0 * vvz; - mfbbc = m2-two* m1 * vvz+vz2 * m0; - //////////////////////////////////////////////////////////////////////////////////// - m2 = mfbca+mfbcc; - m1 = mfbcc-mfbca; - m0 = m2+mfbcb; - mfbca = m0; - m0 += c1o9 * oMdrho; - mfbcb = m1-m0 * vvz; - mfbcc = m2-two* m1 * vvz+vz2 * m0; - //////////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////////// - m2 = mfcaa+mfcac; - m1 = mfcac-mfcaa; - m0 = m2+mfcab; - mfcaa = m0; - m0 += c1o36 * oMdrho; - mfcab = m1-m0 * vvz; - mfcac = m2-two* m1 * vvz+vz2 * m0; - //////////////////////////////////////////////////////////////////////////////////// - m2 = mfcba+mfcbc; - m1 = mfcbc-mfcba; - m0 = m2+mfcbb; - mfcba = m0; - m0 += c1o9 * oMdrho; - mfcbb = m1-m0 * vvz; - mfcbc = m2-two* m1 * vvz+vz2 * m0; - //////////////////////////////////////////////////////////////////////////////////// - m2 = mfcca+mfccc; - m1 = mfccc-mfcca; - m0 = m2+mfccb; - mfcca = m0; - m0 += c1o36 * oMdrho; - mfccb = m1-m0 * vvz; - mfccc = m2-two* m1 * vvz+vz2 * m0; - //////////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////////// - // mit 1/6, 0, 1/18, 2/3, 0, 2/9, 1/6, 0, 1/18 Konditionieren - //////////////////////////////////////////////////////////////////////////////////// - // Y - Dir - m2 = mfaaa+mfaca; - m1 = mfaca-mfaaa; - m0 = m2+mfaba; - mfaaa = m0; - m0 += c1o6 * oMdrho; - mfaba = m1-m0 * vvy; - mfaca = m2-two* m1 * vvy+vy2 * m0; - //////////////////////////////////////////////////////////////////////////////////// - m2 = mfaab+mfacb; - m1 = mfacb-mfaab; - m0 = m2+mfabb; - mfaab = m0; - mfabb = m1-m0 * vvy; - mfacb = m2-two* m1 * vvy+vy2 * m0; - //////////////////////////////////////////////////////////////////////////////////// - m2 = mfaac+mfacc; - m1 = mfacc-mfaac; - m0 = m2+mfabc; - mfaac = m0; - m0 += c1o18 * oMdrho; - mfabc = m1-m0 * vvy; - mfacc = m2-two* m1 * vvy+vy2 * m0; - //////////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////////// - m2 = mfbaa+mfbca; - m1 = mfbca-mfbaa; - m0 = m2+mfbba; - mfbaa = m0; - m0 += c2o3 * oMdrho; - mfbba = m1-m0 * vvy; - mfbca = m2-two* m1 * vvy+vy2 * m0; - //////////////////////////////////////////////////////////////////////////////////// - m2 = mfbab+mfbcb; - m1 = mfbcb-mfbab; - m0 = m2+mfbbb; - mfbab = m0; - mfbbb = m1-m0 * vvy; - mfbcb = m2-two* m1 * vvy+vy2 * m0; - //////////////////////////////////////////////////////////////////////////////////// - m2 = mfbac+mfbcc; - m1 = mfbcc-mfbac; - m0 = m2+mfbbc; - mfbac = m0; - m0 += c2o9 * oMdrho; - mfbbc = m1-m0 * vvy; - mfbcc = m2-two* m1 * vvy+vy2 * m0; - //////////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////////// - m2 = mfcaa+mfcca; - m1 = mfcca-mfcaa; - m0 = m2+mfcba; - mfcaa = m0; - m0 += c1o6 * oMdrho; - mfcba = m1-m0 * vvy; - mfcca = m2-two* m1 * vvy+vy2 * m0; - //////////////////////////////////////////////////////////////////////////////////// - m2 = mfcab+mfccb; - m1 = mfccb-mfcab; - m0 = m2+mfcbb; - mfcab = m0; - mfcbb = m1-m0 * vvy; - mfccb = m2-two* m1 * vvy+vy2 * m0; - //////////////////////////////////////////////////////////////////////////////////// - m2 = mfcac+mfccc; - m1 = mfccc-mfcac; - m0 = m2+mfcbc; - mfcac = m0; - m0 += c1o18 * oMdrho; - mfcbc = m1-m0 * vvy; - mfccc = m2-two* m1 * vvy+vy2 * m0; - //////////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////////// - // mit 1, 0, 1/3, 0, 0, 0, 1/3, 0, 1/9 Konditionieren - //////////////////////////////////////////////////////////////////////////////////// - // X - Dir - m2 = mfaaa+mfcaa; - m1 = mfcaa-mfaaa; - m0 = m2+mfbaa; - mfaaa = m0; - m0 += one* oMdrho; - mfbaa = m1-m0 * vvx; - mfcaa = m2-two* m1 * vvx+vx2 * m0; - //////////////////////////////////////////////////////////////////////////////////// - m2 = mfaba+mfcba; - m1 = mfcba-mfaba; - m0 = m2+mfbba; - mfaba = m0; - mfbba = m1-m0 * vvx; - mfcba = m2-two* m1 * vvx+vx2 * m0; - //////////////////////////////////////////////////////////////////////////////////// - m2 = mfaca+mfcca; - m1 = mfcca-mfaca; - m0 = m2+mfbca; - mfaca = m0; - m0 += c1o3 * oMdrho; - mfbca = m1-m0 * vvx; - mfcca = m2-two* m1 * vvx+vx2 * m0; - //////////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////////// - m2 = mfaab+mfcab; - m1 = mfcab-mfaab; - m0 = m2+mfbab; - mfaab = m0; - mfbab = m1-m0 * vvx; - mfcab = m2-two* m1 * vvx+vx2 * m0; - //////////////////////////////////////////////////////////////////////////////////// - m2 = mfabb+mfcbb; - m1 = mfcbb-mfabb; - m0 = m2+mfbbb; - mfabb = m0; - mfbbb = m1-m0 * vvx; - mfcbb = m2-two* m1 * vvx+vx2 * m0; - //////////////////////////////////////////////////////////////////////////////////// - m2 = mfacb+mfccb; - m1 = mfccb-mfacb; - m0 = m2+mfbcb; - mfacb = m0; - mfbcb = m1-m0 * vvx; - mfccb = m2-two* m1 * vvx+vx2 * m0; - //////////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////////// - m2 = mfaac+mfcac; - m1 = mfcac-mfaac; - m0 = m2+mfbac; - mfaac = m0; - m0 += c1o3 * oMdrho; - mfbac = m1-m0 * vvx; - mfcac = m2-two* m1 * vvx+vx2 * m0; - //////////////////////////////////////////////////////////////////////////////////// - m2 = mfabc+mfcbc; - m1 = mfcbc-mfabc; - m0 = m2+mfbbc; - mfabc = m0; - mfbbc = m1-m0 * vvx; - mfcbc = m2-two* m1 * vvx+vx2 * m0; - //////////////////////////////////////////////////////////////////////////////////// - m2 = mfacc+mfccc; - m1 = mfccc-mfacc; - m0 = m2+mfbcc; - mfacc = m0; - m0 += c1o9 * oMdrho; - mfbcc = m1-m0 * vvx; - mfccc = m2-two* m1 * vvx+vx2 * m0; - //////////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////////// - - - //////////////////////////////////////////////////////////////////////////////////// - // Cumulants - //////////////////////////////////////////////////////////////////////////////////// - - //LBMReal OxxPyyPzz = one; // bulk viscosity - - //////////////////////////////////////////////////////////// - //3. - ////////////////////////////// - //LBMReal OxyyPxzz = one;//three * (two - omega) / (three - omega);// - //LBMReal OxyyMxzz = one;//six * (two - omega) / (six - omega);// - //LBMReal Oxyz = one;//twelve * (two - omega) / (twelve + omega);// - - LBMReal OxyyPxzz = eight*(-two+omega)*(one+two*omega)/(-eight-fourteen*omega+seven*omega*omega);//one; - - LBMReal OxyyMxzz = eight*(-two+omega)*(-seven+four*omega)/(fiftysix-fifty*omega+nine*omega*omega);//one; - - LBMReal Oxyz = twentyfour*(-two+omega)*(-two-seven*omega+three*omega*omega)/(fourtyeight+c152*omega-c130*omega*omega+twentynine*omega*omega*omega); - ////////////////////////////// - //LBMReal OxyyPxzz = two-omega;// - //LBMReal OxyyMxzz = two-omega;// - ////////////////////////////// - //LBMReal OxyyPxzz = (eight * (omega - two)) / (omega - eight);//Ginzburg - //LBMReal OxyyMxzz = (eight * (omega - two)) / (omega - eight);//Ginzburg - ////////////////////////////// - //LBMReal OxyyPxzz = omega;//BGK - //LBMReal OxyyMxzz = omega;//BGK - ////////////////////////////// - //LBMReal OxyyPxzz = (one + omega) / two;//1P5 - //LBMReal OxyyMxzz = (one + omega) / two;//1P5 - ////////////////////////////// - //LBMReal OxyyPxzz = (three - omega) / two;//0P5 - //LBMReal OxyyMxzz = (three - omega) / two;//0P5 - ////////////////////////////// - //LBMReal OxyyPxzz = (one + (eight * (omega - two)) / (omega - eight)) / two;//one + Ginzburg / two ... Car - //LBMReal OxyyMxzz = (one + (eight * (omega - two)) / (omega - eight)) / two;//one + Ginzburg / two ... Car - //////////////////////////////////////////////////////////// - //4. - ////////////////////////////// - LBMReal O4 = one; - ////////////////////////////// - //LBMReal O4 = omega;//TRT - //////////////////////////////////////////////////////////// - //5. - ////////////////////////////// - LBMReal O5 = one; - //////////////////////////////////////////////////////////// - //6. - ////////////////////////////// - LBMReal O6 = one; - //////////////////////////////////////////////////////////// - - - //central moments to cumulants - //4. - LBMReal CUMcbb = mfcbb-((mfcaa+c1o3) * mfabb+two * mfbba * mfbab)/rho; //ab 15.05.2015 verwendet - LBMReal CUMbcb = mfbcb-((mfaca+c1o3) * mfbab+two * mfbba * mfabb)/rho; //ab 15.05.2015 verwendet - LBMReal CUMbbc = mfbbc-((mfaac+c1o3) * mfbba+two * mfbab * mfabb)/rho; //ab 15.05.2015 verwendet - - LBMReal CUMcca = mfcca-(((mfcaa * mfaca+two * mfbba * mfbba)+c1o3 * (mfcaa+mfaca))/rho-c1o9*(drho/rho)); - LBMReal CUMcac = mfcac-(((mfcaa * mfaac+two * mfbab * mfbab)+c1o3 * (mfcaa+mfaac))/rho-c1o9*(drho/rho)); - LBMReal CUMacc = mfacc-(((mfaac * mfaca+two * mfabb * mfabb)+c1o3 * (mfaac+mfaca))/rho-c1o9*(drho/rho)); - - //5. - LBMReal CUMbcc = mfbcc-((mfaac * mfbca+mfaca * mfbac+four * mfabb * mfbbb+two * (mfbab * mfacb+mfbba * mfabc))+c1o3 * (mfbca+mfbac))/rho; - LBMReal CUMcbc = mfcbc-((mfaac * mfcba+mfcaa * mfabc+four * mfbab * mfbbb+two * (mfabb * mfcab+mfbba * mfbac))+c1o3 * (mfcba+mfabc))/rho; - LBMReal CUMccb = mfccb-((mfcaa * mfacb+mfaca * mfcab+four * mfbba * mfbbb+two * (mfbab * mfbca+mfabb * mfcba))+c1o3 * (mfacb+mfcab))/rho; - - //6. - - LBMReal CUMccc = mfccc+((-four * mfbbb * mfbbb - -(mfcaa * mfacc+mfaca * mfcac+mfaac * mfcca) - -four * (mfabb * mfcbb+mfbab * mfbcb+mfbba * mfbbc) - -two * (mfbca * mfbac+mfcba * mfabc+mfcab * mfacb))/rho - +(four * (mfbab * mfbab * mfaca+mfabb * mfabb * mfcaa+mfbba * mfbba * mfaac) - +two * (mfcaa * mfaca * mfaac) - +sixteen * mfbba * mfbab * mfabb)/(rho * rho) - -c1o3 * (mfacc+mfcac+mfcca)/rho - -c1o9 * (mfcaa+mfaca+mfaac)/rho - +(two * (mfbab * mfbab+mfabb * mfabb+mfbba * mfbba) - +(mfaac * mfaca+mfaac * mfcaa+mfaca * mfcaa)+c1o3 *(mfaac+mfaca+mfcaa))/(rho * rho) * c2o3 - +c1o27*((drho * drho-drho)/(rho*rho))); - //+ c1o27*(one -three/rho +two/(rho*rho))); - - - - - //2. - // linear combinations - LBMReal mxxPyyPzz = mfcaa+mfaca+mfaac; - LBMReal mxxMyy = mfcaa-mfaca; - LBMReal mxxMzz = mfcaa-mfaac; - - ////////////////////////////////////////////////////////////////////////// - // LBMReal magicBulk=(CUMacc+CUMcac+CUMcca)*(one/OxxPyyPzz-c1o2)*c3o2*8.; - - ////////////////////////////////////////////////////////////////////////// - //limiter-Scheise Teil 1 - //LBMReal oxxyy,oxxzz,oxy,oxz,oyz; - //LBMReal smag=0.001; - //oxxyy = omega+(one-omega)*abs(mxxMyy)/(abs(mxxMyy)+smag); - //oxxzz = omega+(one-omega)*abs(mxxMzz)/(abs(mxxMzz)+smag); - //oxy = omega+(one-omega)*abs(mfbba)/(abs(mfbba)+smag); - //oxz = omega+(one-omega)*abs(mfbab)/(abs(mfbab)+smag); - //oyz = omega+(one-omega)*abs(mfabb)/(abs(mfabb)+smag); - - //////////////////////////////////////////////////////////////////////////// - ////Teil 1b - //LBMReal constante = 1000.0; - //LBMReal nuEddi = constante * abs(mxxPyyPzz); - //LBMReal omegaLimit = one / (one / omega + three * nuEddi); - - //{ - // LBMReal dxux = c1o2 * (-omegaLimit) *(mxxMyy + mxxMzz) + OxxPyyPzz * (mfaaa - mxxPyyPzz); - // LBMReal dyuy = dxux + omegaLimit * c3o2 * mxxMyy; - // LBMReal dzuz = dxux + omegaLimit * c3o2 * mxxMzz; - - ////relax - //mxxPyyPzz += OxxPyyPzz*(mfaaa - mxxPyyPzz)- three * (one - c1o2 * OxxPyyPzz) * (vx2 * dxux + vy2 * dyuy + vz2 * dzuz); - //mxxMyy += omegaLimit * (-mxxMyy) - three * (one + c1o2 * (-omegaLimit)) * (vx2 * dxux + vy2 * dyuy); - //mxxMzz += omegaLimit * (-mxxMzz) - three * (one + c1o2 * (-omegaLimit)) * (vx2 * dxux + vz2 * dzuz); - - //} - //mfabb += omegaLimit * (-mfabb); - //mfbab += omegaLimit * (-mfbab); - //mfbba += omegaLimit * (-mfbba); - //////////////////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //incl. correction (hat noch nicht so gut funktioniert...Optimierungsbedarf??) - - LBMReal dxux = c1o2 * (-omega) *(mxxMyy+mxxMzz)+c1o2 * OxxPyyPzz * (mfaaa-mxxPyyPzz); - LBMReal dyuy = dxux+omega * c3o2 * mxxMyy; - LBMReal dzuz = dxux+omega * c3o2 * mxxMzz; - - LBMReal Dxy =-three*omega*mfbba; - LBMReal Dxz =-three*omega*mfbab; - LBMReal Dyz =-three*omega*mfabb; - - - - //relax - mxxPyyPzz += OxxPyyPzz*(mfaaa-mxxPyyPzz)-three * (one-c1o2 * OxxPyyPzz) * (vx2 * dxux+vy2 * dyuy+vz2 * dzuz);//-magicBulk*OxxPyyPzz; - mxxMyy += omega * (-mxxMyy)-three * (one+c1o2 * (-omega)) * (vx2 * dxux-vy2 * dyuy); - mxxMzz += omega * (-mxxMzz)-three * (one+c1o2 * (-omega)) * (vx2 * dxux-vz2 * dzuz); - - ////////////////////////////////////////////////////////////////////////// - //limiter-Scheise Teil 2 - //mxxMyy += oxxyy * (-mxxMyy) - three * (one + c1o2 * (-omega)) * (vx2 * dxux + vy2 * dyuy); - //mxxMzz += oxxzz * (-mxxMzz) - three * (one + c1o2 * (-omega)) * (vx2 * dxux + vz2 * dzuz); - ////////////////////////////////////////////////////////////////////////// - - - /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - ////no correction - //mxxPyyPzz += OxxPyyPzz*(mfaaa-mxxPyyPzz);//-magicBulk*OxxPyyPzz; - //mxxMyy += -(-omega) * (-mxxMyy); - //mxxMzz += -(-omega) * (-mxxMzz); - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - mfabb += omega * (-mfabb); - mfbab += omega * (-mfbab); - mfbba += omega * (-mfbba); - - ////////////////////////////////////////////////////////////////////////// - //limiter-Scheise Teil 3 - //mfabb += oyz * (-mfabb); - //mfbab += oxz * (-mfbab); - //mfbba += oxy * (-mfbba); - ////////////////////////////////////////////////////////////////////////// - - // linear combinations back - mfcaa = c1o3 * (mxxMyy+mxxMzz+mxxPyyPzz); - mfaca = c1o3 * (-two* mxxMyy+mxxMzz+mxxPyyPzz); - mfaac = c1o3 * (mxxMyy-two* mxxMzz+mxxPyyPzz); - - //3. - // linear combinations - - LBMReal mxxyPyzz = mfcba+mfabc; - LBMReal mxxyMyzz = mfcba-mfabc; - - LBMReal mxxzPyyz = mfcab+mfacb; - LBMReal mxxzMyyz = mfcab-mfacb; - - LBMReal mxyyPxzz = mfbca+mfbac; - LBMReal mxyyMxzz = mfbca-mfbac; - - //relax - ////////////////////////////////////////////////////////////////////////// - //das ist der limiter - wadjust = Oxyz+(one-Oxyz)*abs(mfbbb)/(abs(mfbbb)+qudricLimitD); - mfbbb += wadjust * (-mfbbb); - wadjust = OxyyPxzz+(one-OxyyPxzz)*abs(mxxyPyzz)/(abs(mxxyPyzz)+qudricLimitP); - mxxyPyzz += wadjust * (-mxxyPyzz); - wadjust = OxyyMxzz+(one-OxyyMxzz)*abs(mxxyMyzz)/(abs(mxxyMyzz)+qudricLimitM); - mxxyMyzz += wadjust * (-mxxyMyzz); - wadjust = OxyyPxzz+(one-OxyyPxzz)*abs(mxxzPyyz)/(abs(mxxzPyyz)+qudricLimitP); - mxxzPyyz += wadjust * (-mxxzPyyz); - wadjust = OxyyMxzz+(one-OxyyMxzz)*abs(mxxzMyyz)/(abs(mxxzMyyz)+qudricLimitM); - mxxzMyyz += wadjust * (-mxxzMyyz); - wadjust = OxyyPxzz+(one-OxyyPxzz)*abs(mxyyPxzz)/(abs(mxyyPxzz)+qudricLimitP); - mxyyPxzz += wadjust * (-mxyyPxzz); - wadjust = OxyyMxzz+(one-OxyyMxzz)*abs(mxyyMxzz)/(abs(mxyyMxzz)+qudricLimitM); - mxyyMxzz += wadjust * (-mxyyMxzz); - ////////////////////////////////////////////////////////////////////////// - //ohne limiter - //mfbbb += OxyyMxzz * (-mfbbb); - //mxxyPyzz += OxyyPxzz * (-mxxyPyzz); - //mxxyMyzz += OxyyMxzz * (-mxxyMyzz); - //mxxzPyyz += OxyyPxzz * (-mxxzPyyz); - //mxxzMyyz += OxyyMxzz * (-mxxzMyyz); - //mxyyPxzz += OxyyPxzz * (-mxyyPxzz); - //mxyyMxzz += OxyyMxzz * (-mxyyMxzz); - ////////////////////////////////////////////////////////////////////////// - - //// linear combinations back - mfcba = (mxxyMyzz+mxxyPyzz) * c1o2; - mfabc = (-mxxyMyzz+mxxyPyzz) * c1o2; - mfcab = (mxxzMyyz+mxxzPyyz) * c1o2; - mfacb = (-mxxzMyyz+mxxzPyyz) * c1o2; - mfbca = (mxyyMxzz+mxyyPxzz) * c1o2; - mfbac = (-mxyyMxzz+mxyyPxzz) * c1o2; - - //4. - ////////////////////////////////////////////////////////////////////////// - //mit limiter - // wadjust = O4+(one-O4)*abs(CUMacc)/(abs(CUMacc)+qudricLimit); - //CUMacc += wadjust * (-CUMacc); - // wadjust = O4+(one-O4)*abs(CUMcac)/(abs(CUMcac)+qudricLimit); - //CUMcac += wadjust * (-CUMcac); - // wadjust = O4+(one-O4)*abs(CUMcca)/(abs(CUMcca)+qudricLimit); - //CUMcca += wadjust * (-CUMcca); - - // wadjust = O4+(one-O4)*abs(CUMbbc)/(abs(CUMbbc)+qudricLimit); - //CUMbbc += wadjust * (-CUMbbc); - // wadjust = O4+(one-O4)*abs(CUMbcb)/(abs(CUMbcb)+qudricLimit); - //CUMbcb += wadjust * (-CUMbcb); - // wadjust = O4+(one-O4)*abs(CUMcbb)/(abs(CUMcbb)+qudricLimit); - //CUMcbb += wadjust * (-CUMcbb); - ////////////////////////////////////////////////////////////////////////// - ////////////////////////////////////////////////////////////////////////// - LBMReal A = (four + two*omega - three*omega*omega) / (two - seven*omega + five*omega*omega); - LBMReal B = (four + twentyeight*omega - fourteen*omega*omega) / (six - twentyone*omega + fiveteen*omega*omega); - ////////////////////////////////////////////////////////////////////////// - - - //ohne limiter - //CUMacc += O4 * (-CUMacc); - //CUMcac += O4 * (-CUMcac); - //CUMcca += O4 * (-CUMcca); - - //CUMbbc += O4 * (-CUMbbc); - //CUMbcb += O4 * (-CUMbcb); - //CUMcbb += O4 * (-CUMcbb); - CUMacc = -O4*(one / omega - c1o2) * (dyuy + dzuz) * c2o3 * A + (one - O4) * (CUMacc); - CUMcac = -O4*(one / omega - c1o2) * (dxux + dzuz) * c2o3 * A + (one - O4) * (CUMcac); - CUMcca = -O4*(one / omega - c1o2) * (dyuy + dxux) * c2o3 * A + (one - O4) * (CUMcca); - CUMbbc = -O4*(one / omega - c1o2) * Dxy * c1o3 * B + (one - O4) * (CUMbbc); - CUMbcb = -O4*(one / omega - c1o2) * Dxz * c1o3 * B + (one - O4) * (CUMbcb); - CUMcbb = -O4*(one / omega - c1o2) * Dyz * c1o3 * B + (one - O4) * (CUMcbb); - ////////////////////////////////////////////////////////////////////////// - - - //5. - CUMbcc += O5 * (-CUMbcc); - CUMcbc += O5 * (-CUMcbc); - CUMccb += O5 * (-CUMccb); - - //6. - CUMccc += O6 * (-CUMccc); - - - - //back cumulants to central moments - //4. - mfcbb = CUMcbb+((mfcaa+c1o3) * mfabb+two * mfbba * mfbab)/rho; - mfbcb = CUMbcb+((mfaca+c1o3) * mfbab+two * mfbba * mfabb)/rho; - mfbbc = CUMbbc+((mfaac+c1o3) * mfbba+two * mfbab * mfabb)/rho; - - mfcca = CUMcca+(((mfcaa * mfaca+two * mfbba * mfbba)+c1o3 * (mfcaa+mfaca))/rho-c1o9*(drho/rho));//(one/rho-one)); - mfcac = CUMcac+(((mfcaa * mfaac+two * mfbab * mfbab)+c1o3 * (mfcaa+mfaac))/rho-c1o9*(drho/rho));//(one/rho-one)); - mfacc = CUMacc+(((mfaac * mfaca+two * mfabb * mfabb)+c1o3 * (mfaac+mfaca))/rho-c1o9*(drho/rho));//(one/rho-one)); - - //5. - mfbcc = CUMbcc+((mfaac * mfbca+mfaca * mfbac+four * mfabb * mfbbb+two * (mfbab * mfacb+mfbba * mfabc))+c1o3 * (mfbca+mfbac))/rho; - mfcbc = CUMcbc+((mfaac * mfcba+mfcaa * mfabc+four * mfbab * mfbbb+two * (mfabb * mfcab+mfbba * mfbac))+c1o3 * (mfcba+mfabc))/rho; - mfccb = CUMccb+((mfcaa * mfacb+mfaca * mfcab+four * mfbba * mfbbb+two * (mfbab * mfbca+mfabb * mfcba))+c1o3 * (mfacb+mfcab))/rho; - - //6. - - mfccc = CUMccc-((-four * mfbbb * mfbbb - -(mfcaa * mfacc+mfaca * mfcac+mfaac * mfcca) - -four * (mfabb * mfcbb+mfbab * mfbcb+mfbba * mfbbc) - -two * (mfbca * mfbac+mfcba * mfabc+mfcab * mfacb))/rho - +(four * (mfbab * mfbab * mfaca+mfabb * mfabb * mfcaa+mfbba * mfbba * mfaac) - +two * (mfcaa * mfaca * mfaac) - +sixteen * mfbba * mfbab * mfabb)/(rho * rho) - -c1o3 * (mfacc+mfcac+mfcca)/rho - -c1o9 * (mfcaa+mfaca+mfaac)/rho - +(two * (mfbab * mfbab+mfabb * mfabb+mfbba * mfbba) - +(mfaac * mfaca+mfaac * mfcaa+mfaca * mfcaa)+c1o3 *(mfaac+mfaca+mfcaa))/(rho * rho) * c2o3 - +c1o27*((drho * drho-drho)/(rho*rho))); - //////////////////////////////////////////////////////////////////////////////////// - //forcing - mfbaa=-mfbaa; - mfaba=-mfaba; - mfaab=-mfaab; - ////////////////////////////////////////////////////////////////////////////////////// - - //////////////////////////////////////////////////////////////////////////////////// - //back - //////////////////////////////////////////////////////////////////////////////////// - //mit 1, 0, 1/3, 0, 0, 0, 1/3, 0, 1/9 Konditionieren - //////////////////////////////////////////////////////////////////////////////////// - // Z - Dir - m0 = mfaac * c1o2+mfaab * (vvz-c1o2)+(mfaaa+one* oMdrho) * (vz2-vvz) * c1o2; - m1 = -mfaac-two* mfaab * vvz+mfaaa * (one-vz2)-one* oMdrho * vz2; - m2 = mfaac * c1o2+mfaab * (vvz+c1o2)+(mfaaa+one* oMdrho) * (vz2+vvz) * c1o2; - mfaaa = m0; - mfaab = m1; - mfaac = m2; - //////////////////////////////////////////////////////////////////////////////////// - m0 = mfabc * c1o2+mfabb * (vvz-c1o2)+mfaba * (vz2-vvz) * c1o2; - m1 = -mfabc-two* mfabb * vvz+mfaba * (one-vz2); - m2 = mfabc * c1o2+mfabb * (vvz+c1o2)+mfaba * (vz2+vvz) * c1o2; - mfaba = m0; - mfabb = m1; - mfabc = m2; - //////////////////////////////////////////////////////////////////////////////////// - m0 = mfacc * c1o2+mfacb * (vvz-c1o2)+(mfaca+c1o3 * oMdrho) * (vz2-vvz) * c1o2; - m1 = -mfacc-two* mfacb * vvz+mfaca * (one-vz2)-c1o3 * oMdrho * vz2; - m2 = mfacc * c1o2+mfacb * (vvz+c1o2)+(mfaca+c1o3 * oMdrho) * (vz2+vvz) * c1o2; - mfaca = m0; - mfacb = m1; - mfacc = m2; - //////////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////////// - m0 = mfbac * c1o2+mfbab * (vvz-c1o2)+mfbaa * (vz2-vvz) * c1o2; - m1 = -mfbac-two* mfbab * vvz+mfbaa * (one-vz2); - m2 = mfbac * c1o2+mfbab * (vvz+c1o2)+mfbaa * (vz2+vvz) * c1o2; - mfbaa = m0; - mfbab = m1; - mfbac = m2; - /////////b////////////////////////////////////////////////////////////////////////// - m0 = mfbbc * c1o2+mfbbb * (vvz-c1o2)+mfbba * (vz2-vvz) * c1o2; - m1 = -mfbbc-two* mfbbb * vvz+mfbba * (one-vz2); - m2 = mfbbc * c1o2+mfbbb * (vvz+c1o2)+mfbba * (vz2+vvz) * c1o2; - mfbba = m0; - mfbbb = m1; - mfbbc = m2; - /////////b////////////////////////////////////////////////////////////////////////// - m0 = mfbcc * c1o2+mfbcb * (vvz-c1o2)+mfbca * (vz2-vvz) * c1o2; - m1 = -mfbcc-two* mfbcb * vvz+mfbca * (one-vz2); - m2 = mfbcc * c1o2+mfbcb * (vvz+c1o2)+mfbca * (vz2+vvz) * c1o2; - mfbca = m0; - mfbcb = m1; - mfbcc = m2; - //////////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////////// - m0 = mfcac * c1o2+mfcab * (vvz-c1o2)+(mfcaa+c1o3 * oMdrho) * (vz2-vvz) * c1o2; - m1 = -mfcac-two* mfcab * vvz+mfcaa * (one-vz2)-c1o3 * oMdrho * vz2; - m2 = mfcac * c1o2+mfcab * (vvz+c1o2)+(mfcaa+c1o3 * oMdrho) * (vz2+vvz) * c1o2; - mfcaa = m0; - mfcab = m1; - mfcac = m2; - /////////c////////////////////////////////////////////////////////////////////////// - m0 = mfcbc * c1o2+mfcbb * (vvz-c1o2)+mfcba * (vz2-vvz) * c1o2; - m1 = -mfcbc-two* mfcbb * vvz+mfcba * (one-vz2); - m2 = mfcbc * c1o2+mfcbb * (vvz+c1o2)+mfcba * (vz2+vvz) * c1o2; - mfcba = m0; - mfcbb = m1; - mfcbc = m2; - /////////c////////////////////////////////////////////////////////////////////////// - m0 = mfccc * c1o2+mfccb * (vvz-c1o2)+(mfcca+c1o9 * oMdrho) * (vz2-vvz) * c1o2; - m1 = -mfccc-two* mfccb * vvz+mfcca * (one-vz2)-c1o9 * oMdrho * vz2; - m2 = mfccc * c1o2+mfccb * (vvz+c1o2)+(mfcca+c1o9 * oMdrho) * (vz2+vvz) * c1o2; - mfcca = m0; - mfccb = m1; - mfccc = m2; - //////////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////////// - //mit 1/6, 2/3, 1/6, 0, 0, 0, 1/18, 2/9, 1/18 Konditionieren - //////////////////////////////////////////////////////////////////////////////////// - // Y - Dir - m0 = mfaca * c1o2+mfaba * (vvy-c1o2)+(mfaaa+c1o6 * oMdrho) * (vy2-vvy) * c1o2; - m1 = -mfaca-two* mfaba * vvy+mfaaa * (one-vy2)-c1o6 * oMdrho * vy2; - m2 = mfaca * c1o2+mfaba * (vvy+c1o2)+(mfaaa+c1o6 * oMdrho) * (vy2+vvy) * c1o2; - mfaaa = m0; - mfaba = m1; - mfaca = m2; - //////////////////////////////////////////////////////////////////////////////////// - m0 = mfacb * c1o2+mfabb * (vvy-c1o2)+(mfaab+c2o3 * oMdrho) * (vy2-vvy) * c1o2; - m1 = -mfacb-two* mfabb * vvy+mfaab * (one-vy2)-c2o3 * oMdrho * vy2; - m2 = mfacb * c1o2+mfabb * (vvy+c1o2)+(mfaab+c2o3 * oMdrho) * (vy2+vvy) * c1o2; - mfaab = m0; - mfabb = m1; - mfacb = m2; - //////////////////////////////////////////////////////////////////////////////////// - m0 = mfacc * c1o2+mfabc * (vvy-c1o2)+(mfaac+c1o6 * oMdrho) * (vy2-vvy) * c1o2; - m1 = -mfacc-two* mfabc * vvy+mfaac * (one-vy2)-c1o6 * oMdrho * vy2; - m2 = mfacc * c1o2+mfabc * (vvy+c1o2)+(mfaac+c1o6 * oMdrho) * (vy2+vvy) * c1o2; - mfaac = m0; - mfabc = m1; - mfacc = m2; - //////////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////////// - m0 = mfbca * c1o2+mfbba * (vvy-c1o2)+mfbaa * (vy2-vvy) * c1o2; - m1 = -mfbca-two* mfbba * vvy+mfbaa * (one-vy2); - m2 = mfbca * c1o2+mfbba * (vvy+c1o2)+mfbaa * (vy2+vvy) * c1o2; - mfbaa = m0; - mfbba = m1; - mfbca = m2; - /////////b////////////////////////////////////////////////////////////////////////// - m0 = mfbcb * c1o2+mfbbb * (vvy-c1o2)+mfbab * (vy2-vvy) * c1o2; - m1 = -mfbcb-two* mfbbb * vvy+mfbab * (one-vy2); - m2 = mfbcb * c1o2+mfbbb * (vvy+c1o2)+mfbab * (vy2+vvy) * c1o2; - mfbab = m0; - mfbbb = m1; - mfbcb = m2; - /////////b////////////////////////////////////////////////////////////////////////// - m0 = mfbcc * c1o2+mfbbc * (vvy-c1o2)+mfbac * (vy2-vvy) * c1o2; - m1 = -mfbcc-two* mfbbc * vvy+mfbac * (one-vy2); - m2 = mfbcc * c1o2+mfbbc * (vvy+c1o2)+mfbac * (vy2+vvy) * c1o2; - mfbac = m0; - mfbbc = m1; - mfbcc = m2; - //////////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////////// - m0 = mfcca * c1o2+mfcba * (vvy-c1o2)+(mfcaa+c1o18 * oMdrho) * (vy2-vvy) * c1o2; - m1 = -mfcca-two* mfcba * vvy+mfcaa * (one-vy2)-c1o18 * oMdrho * vy2; - m2 = mfcca * c1o2+mfcba * (vvy+c1o2)+(mfcaa+c1o18 * oMdrho) * (vy2+vvy) * c1o2; - mfcaa = m0; - mfcba = m1; - mfcca = m2; - /////////c////////////////////////////////////////////////////////////////////////// - m0 = mfccb * c1o2+mfcbb * (vvy-c1o2)+(mfcab+c2o9 * oMdrho) * (vy2-vvy) * c1o2; - m1 = -mfccb-two* mfcbb * vvy+mfcab * (one-vy2)-c2o9 * oMdrho * vy2; - m2 = mfccb * c1o2+mfcbb * (vvy+c1o2)+(mfcab+c2o9 * oMdrho) * (vy2+vvy) * c1o2; - mfcab = m0; - mfcbb = m1; - mfccb = m2; - /////////c////////////////////////////////////////////////////////////////////////// - m0 = mfccc * c1o2+mfcbc * (vvy-c1o2)+(mfcac+c1o18 * oMdrho) * (vy2-vvy) * c1o2; - m1 = -mfccc-two* mfcbc * vvy+mfcac * (one-vy2)-c1o18 * oMdrho * vy2; - m2 = mfccc * c1o2+mfcbc * (vvy+c1o2)+(mfcac+c1o18 * oMdrho) * (vy2+vvy) * c1o2; - mfcac = m0; - mfcbc = m1; - mfccc = m2; - //////////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////////// - //mit 1/36, 1/9, 1/36, 1/9, 4/9, 1/9, 1/36, 1/9, 1/36 Konditionieren - //////////////////////////////////////////////////////////////////////////////////// - // X - Dir - m0 = mfcaa * c1o2+mfbaa * (vvx-c1o2)+(mfaaa+c1o36 * oMdrho) * (vx2-vvx) * c1o2; - m1 = -mfcaa-two* mfbaa * vvx+mfaaa * (one-vx2)-c1o36 * oMdrho * vx2; - m2 = mfcaa * c1o2+mfbaa * (vvx+c1o2)+(mfaaa+c1o36 * oMdrho) * (vx2+vvx) * c1o2; - mfaaa = m0; - mfbaa = m1; - mfcaa = m2; - //////////////////////////////////////////////////////////////////////////////////// - m0 = mfcba * c1o2+mfbba * (vvx-c1o2)+(mfaba+c1o9 * oMdrho) * (vx2-vvx) * c1o2; - m1 = -mfcba-two* mfbba * vvx+mfaba * (one-vx2)-c1o9 * oMdrho * vx2; - m2 = mfcba * c1o2+mfbba * (vvx+c1o2)+(mfaba+c1o9 * oMdrho) * (vx2+vvx) * c1o2; - mfaba = m0; - mfbba = m1; - mfcba = m2; - //////////////////////////////////////////////////////////////////////////////////// - m0 = mfcca * c1o2+mfbca * (vvx-c1o2)+(mfaca+c1o36 * oMdrho) * (vx2-vvx) * c1o2; - m1 = -mfcca-two* mfbca * vvx+mfaca * (one-vx2)-c1o36 * oMdrho * vx2; - m2 = mfcca * c1o2+mfbca * (vvx+c1o2)+(mfaca+c1o36 * oMdrho) * (vx2+vvx) * c1o2; - mfaca = m0; - mfbca = m1; - mfcca = m2; - //////////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////////// - m0 = mfcab * c1o2+mfbab * (vvx-c1o2)+(mfaab+c1o9 * oMdrho) * (vx2-vvx) * c1o2; - m1 = -mfcab-two* mfbab * vvx+mfaab * (one-vx2)-c1o9 * oMdrho * vx2; - m2 = mfcab * c1o2+mfbab * (vvx+c1o2)+(mfaab+c1o9 * oMdrho) * (vx2+vvx) * c1o2; - mfaab = m0; - mfbab = m1; - mfcab = m2; - ///////////b//////////////////////////////////////////////////////////////////////// - m0 = mfcbb * c1o2+mfbbb * (vvx-c1o2)+(mfabb+c4o9 * oMdrho) * (vx2-vvx) * c1o2; - m1 = -mfcbb-two* mfbbb * vvx+mfabb * (one-vx2)-c4o9 * oMdrho * vx2; - m2 = mfcbb * c1o2+mfbbb * (vvx+c1o2)+(mfabb+c4o9 * oMdrho) * (vx2+vvx) * c1o2; - mfabb = m0; - mfbbb = m1; - mfcbb = m2; - ///////////b//////////////////////////////////////////////////////////////////////// - m0 = mfccb * c1o2+mfbcb * (vvx-c1o2)+(mfacb+c1o9 * oMdrho) * (vx2-vvx) * c1o2; - m1 = -mfccb-two* mfbcb * vvx+mfacb * (one-vx2)-c1o9 * oMdrho * vx2; - m2 = mfccb * c1o2+mfbcb * (vvx+c1o2)+(mfacb+c1o9 * oMdrho) * (vx2+vvx) * c1o2; - mfacb = m0; - mfbcb = m1; - mfccb = m2; - //////////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////////// - m0 = mfcac * c1o2+mfbac * (vvx-c1o2)+(mfaac+c1o36 * oMdrho) * (vx2-vvx) * c1o2; - m1 = -mfcac-two* mfbac * vvx+mfaac * (one-vx2)-c1o36 * oMdrho * vx2; - m2 = mfcac * c1o2+mfbac * (vvx+c1o2)+(mfaac+c1o36 * oMdrho) * (vx2+vvx) * c1o2; - mfaac = m0; - mfbac = m1; - mfcac = m2; - ///////////c//////////////////////////////////////////////////////////////////////// - m0 = mfcbc * c1o2+mfbbc * (vvx-c1o2)+(mfabc+c1o9 * oMdrho) * (vx2-vvx) * c1o2; - m1 = -mfcbc-two* mfbbc * vvx+mfabc * (one-vx2)-c1o9 * oMdrho * vx2; - m2 = mfcbc * c1o2+mfbbc * (vvx+c1o2)+(mfabc+c1o9 * oMdrho) * (vx2+vvx) * c1o2; - mfabc = m0; - mfbbc = m1; - mfcbc = m2; - ///////////c//////////////////////////////////////////////////////////////////////// - m0 = mfccc * c1o2+mfbcc * (vvx-c1o2)+(mfacc+c1o36 * oMdrho) * (vx2-vvx) * c1o2; - m1 = -mfccc-two* mfbcc * vvx+mfacc * (one-vx2)-c1o36 * oMdrho * vx2; - m2 = mfccc * c1o2+mfbcc * (vvx+c1o2)+(mfacc+c1o36 * oMdrho) * (vx2+vvx) * c1o2; - mfacc = m0; - mfbcc = m1; - mfccc = m2; - //////////////////////////////////////////////////////////////////////////////////// - - ////////////////////////////////////////////////////////////////////////// - //proof correctness - ////////////////////////////////////////////////////////////////////////// -#ifdef PROOF_CORRECTNESS - LBMReal drho_post = (mfaaa+mfaac+mfaca+mfcaa+mfacc+mfcac+mfccc+mfcca) - +(mfaab+mfacb+mfcab+mfccb)+(mfaba+mfabc+mfcba+mfcbc)+(mfbaa+mfbac+mfbca+mfbcc) - +(mfabb+mfcbb)+(mfbab+mfbcb)+(mfbba+mfbbc)+mfbbb; - //LBMReal dif = fabs(rho - rho_post); - LBMReal dif = drho - drho_post; -#ifdef SINGLEPRECISION - if (dif > 10.0E-7 || dif < -10.0E-7) -#else - if (dif > 10.0E-15 || dif < -10.0E-15) -#endif - { - UB_THROW(UbException(UB_EXARGS, "rho="+UbSystem::toString(drho)+", rho_post="+UbSystem::toString(drho_post) - +" dif="+UbSystem::toString(dif) - +" rho is not correct for node "+UbSystem::toString(x1)+","+UbSystem::toString(x2)+","+UbSystem::toString(x3))); - //UBLOG(logERROR,"LBMKernelETD3Q27CCLB::collideAll(): rho is not correct for node "+UbSystem::toString(x1)+","+UbSystem::toString(x2)+","+UbSystem::toString(x3)); - //exit(EXIT_FAILURE); - } -#endif - ////////////////////////////////////////////////////////////////////////// - //write distribution - ////////////////////////////////////////////////////////////////////////// - (*this->localDistributions)(D3Q27System::ET_E, x1, x2, x3) = mfabb; - (*this->localDistributions)(D3Q27System::ET_N, x1, x2, x3) = mfbab; - (*this->localDistributions)(D3Q27System::ET_T, x1, x2, x3) = mfbba; - (*this->localDistributions)(D3Q27System::ET_NE, x1, x2, x3) = mfaab; - (*this->localDistributions)(D3Q27System::ET_NW, x1p, x2, x3) = mfcab; - (*this->localDistributions)(D3Q27System::ET_TE, x1, x2, x3) = mfaba; - (*this->localDistributions)(D3Q27System::ET_TW, x1p, x2, x3) = mfcba; - (*this->localDistributions)(D3Q27System::ET_TN, x1, x2, x3) = mfbaa; - (*this->localDistributions)(D3Q27System::ET_TS, x1, x2p, x3) = mfbca; - (*this->localDistributions)(D3Q27System::ET_TNE, x1, x2, x3) = mfaaa; - (*this->localDistributions)(D3Q27System::ET_TNW, x1p, x2, x3) = mfcaa; - (*this->localDistributions)(D3Q27System::ET_TSE, x1, x2p, x3) = mfaca; - (*this->localDistributions)(D3Q27System::ET_TSW, x1p, x2p, x3) = mfcca; - - (*this->nonLocalDistributions)(D3Q27System::ET_W, x1p, x2, x3) = mfcbb; - (*this->nonLocalDistributions)(D3Q27System::ET_S, x1, x2p, x3) = mfbcb; - (*this->nonLocalDistributions)(D3Q27System::ET_B, x1, x2, x3p) = mfbbc; - (*this->nonLocalDistributions)(D3Q27System::ET_SW, x1p, x2p, x3) = mfccb; - (*this->nonLocalDistributions)(D3Q27System::ET_SE, x1, x2p, x3) = mfacb; - (*this->nonLocalDistributions)(D3Q27System::ET_BW, x1p, x2, x3p) = mfcbc; - (*this->nonLocalDistributions)(D3Q27System::ET_BE, x1, x2, x3p) = mfabc; - (*this->nonLocalDistributions)(D3Q27System::ET_BS, x1, x2p, x3p) = mfbcc; - (*this->nonLocalDistributions)(D3Q27System::ET_BN, x1, x2, x3p) = mfbac; - (*this->nonLocalDistributions)(D3Q27System::ET_BSW, x1p, x2p, x3p) = mfccc; - (*this->nonLocalDistributions)(D3Q27System::ET_BSE, x1, x2p, x3p) = mfacc; - (*this->nonLocalDistributions)(D3Q27System::ET_BNW, x1p, x2, x3p) = mfcac; - (*this->nonLocalDistributions)(D3Q27System::ET_BNE, x1, x2, x3p) = mfaac; - - (*this->zeroDistributions)(x1, x2, x3) = mfbbb; - ////////////////////////////////////////////////////////////////////////// - - } - } - } - } - - } -} -////////////////////////////////////////////////////////////////////////// -double CompressibleCumulant2LBMKernel::getCalculationTime() -{ - //return timer.getDuration(); - return timer.getTotalTime(); -} -////////////////////////////////////////////////////////////////////////// -void CompressibleCumulant2LBMKernel::setBulkOmegaToOmega(bool value) -{ - bulkOmegaToOmega = value; -} diff --git a/src/VirtualFluids/LBM/CompressibleCumulant2LBMKernel.h b/src/VirtualFluids/LBM/CompressibleCumulant2LBMKernel.h deleted file mode 100644 index 44c051097..000000000 --- a/src/VirtualFluids/LBM/CompressibleCumulant2LBMKernel.h +++ /dev/null @@ -1,72 +0,0 @@ -#ifndef CompressibleCumulant2LBMKernel_h__ -#define CompressibleCumulant2LBMKernel_h__ - -#include "LBMKernel.h" -#include "BCProcessor.h" -#include "D3Q27System.h" -#include <boost/serialization/export.hpp> -#include "basics/utilities/UbTiming.h" -#include "basics/container/CbArray4D.h" -#include "basics/container/CbArray3D.h" - -class CompressibleCumulant2LBMKernel; -typedef std::shared_ptr<CompressibleCumulant2LBMKernel> CompressibleCumulant2LBMKernelPtr; - -//! \brief compressible cumulant LBM kernel. -//! \details CFD solver that use Cascaded Cumulant Lattice Boltzmann method for D3Q27 model -//! \author K. Kutscher, M. Geier -class CompressibleCumulant2LBMKernel : public LBMKernel -{ -public: - //! This option set relaxation parameter: NORMAL - enum Parameter{NORMAL, MAGIC}; -public: - CompressibleCumulant2LBMKernel(); - //! Constructor - //! \param nx1 number of nodes in x dimension - //! \param nx2 number of nodes in y dimension - //! \param nx3 number of nodes in z dimension - //! \param p set relaxation parameter: NORMAL is OxyyMxzz = 1.0 and MAGIC is OxyyMxzz = 2.0 +(-collFactor) - CompressibleCumulant2LBMKernel(int nx1, int nx2, int nx3, Parameter p); - virtual ~CompressibleCumulant2LBMKernel(void); - virtual void calculate(); - virtual LBMKernelPtr clone(); - double getCalculationTime() override; - void setBulkOmegaToOmega(bool value); -protected: - friend class boost::serialization::access; - template<class Archive> - void serialize(Archive & ar, const unsigned int version) - { - ar & boost::serialization::base_object<LBMKernel>(*this); - ar & OxyyMxzz; - ar & parameter; - } - - virtual void collideAll(); - virtual void init(); - LBMReal f[D3Q27System::ENDF+1]; - - UbTimer timer; - - LBMReal OxyyMxzz; - Parameter parameter; - - CbArray4D<LBMReal,IndexerX4X3X2X1>::CbArray4DPtr localDistributions; - CbArray4D<LBMReal,IndexerX4X3X2X1>::CbArray4DPtr nonLocalDistributions; - CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr zeroDistributions; - - mu::value_type muX1,muX2,muX3; - mu::value_type muDeltaT; - mu::value_type muNu; - LBMReal forcingX1; - LBMReal forcingX2; - LBMReal forcingX3; - - // bulk viscosity - bool bulkOmegaToOmega; - LBMReal OxxPyyPzz; -}; -#endif // CompressibleCumulantLBMKernel_h__ - - diff --git a/src/VirtualFluids/LBM/CompressibleCumulantLBMKernel.cpp b/src/VirtualFluids/LBM/CompressibleCumulantLBMKernel.cpp deleted file mode 100644 index 1e123360e..000000000 --- a/src/VirtualFluids/LBM/CompressibleCumulantLBMKernel.cpp +++ /dev/null @@ -1,1057 +0,0 @@ -#include "CompressibleCumulantLBMKernel.h" -#include "D3Q27System.h" -#include "InterpolationProcessor.h" -#include "D3Q27EsoTwist3DSplittedVector.h" -#include <math.h> -//#include <omp.h> -#include "DataSet3D.h" -#define PROOF_CORRECTNESS - -////////////////////////////////////////////////////////////////////////// -CompressibleCumulantLBMKernel::CompressibleCumulantLBMKernel() -{ - this->nx1 = 0; - this->nx2 = 0; - this->nx3 = 0; - this->parameter = NORMAL; - this->OxyyMxzz = 1.0; - this->compressible = true; - this->bulkOmegaToOmega = false; - this->OxxPyyPzz = 1.0; -} -////////////////////////////////////////////////////////////////////////// -CompressibleCumulantLBMKernel::CompressibleCumulantLBMKernel(int nx1, int nx2, int nx3, Parameter p) -{ - this->nx1 = nx1; - this->nx2 = nx2; - this->nx3 = nx3; - this->parameter = p; - this->OxyyMxzz = 1.0; - this->compressible = true; - this->bulkOmegaToOmega = false; - this->OxxPyyPzz = 1.0; -} -////////////////////////////////////////////////////////////////////////// -CompressibleCumulantLBMKernel::~CompressibleCumulantLBMKernel(void) -{ - -} -////////////////////////////////////////////////////////////////////////// -void CompressibleCumulantLBMKernel::init() -{ - DistributionArray3DPtr d(new D3Q27EsoTwist3DSplittedVector(nx1+2, nx2+2, nx3+2, -999.0)); - dataSet->setFdistributions(d); -} -////////////////////////////////////////////////////////////////////////// -LBMKernelPtr CompressibleCumulantLBMKernel::clone() -{ - LBMKernelPtr kernel(new CompressibleCumulantLBMKernel(nx1, nx2, nx3, parameter)); - std::dynamic_pointer_cast<CompressibleCumulantLBMKernel>(kernel)->init(); - kernel->setCollisionFactor(this->collFactor); - kernel->setBCProcessor(bcProcessor->clone(kernel)); - kernel->setWithForcing(withForcing); - kernel->setForcingX1(muForcingX1); - kernel->setForcingX2(muForcingX2); - kernel->setForcingX3(muForcingX3); - kernel->setIndex(ix1, ix2, ix3); - kernel->setDeltaT(deltaT); - switch (parameter) - { - case NORMAL: - std::dynamic_pointer_cast<CompressibleCumulantLBMKernel>(kernel)->OxyyMxzz = 1.0; - break; - case MAGIC: - std::dynamic_pointer_cast<CompressibleCumulantLBMKernel>(kernel)->OxyyMxzz = 2.0 +(-collFactor); - break; - } - - if (bulkOmegaToOmega) - { - std::dynamic_pointer_cast<CompressibleCumulantLBMKernel>(kernel)->OxxPyyPzz = collFactor; - } - else - { - std::dynamic_pointer_cast<CompressibleCumulantLBMKernel>(kernel)->OxxPyyPzz = one; - } - return kernel; -} -////////////////////////////////////////////////////////////////////////// -void CompressibleCumulantLBMKernel::calculate() -{ - timer.resetAndStart(); - collideAll(); - timer.stop(); -} -////////////////////////////////////////////////////////////////////////// -void CompressibleCumulantLBMKernel::collideAll() -{ - using namespace D3Q27System; - - //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; - } - ///////////////////////////////////// - - localDistributions = std::dynamic_pointer_cast<D3Q27EsoTwist3DSplittedVector>(dataSet->getFdistributions())->getLocalDistributions(); - nonLocalDistributions = std::dynamic_pointer_cast<D3Q27EsoTwist3DSplittedVector>(dataSet->getFdistributions())->getNonLocalDistributions(); - zeroDistributions = std::dynamic_pointer_cast<D3Q27EsoTwist3DSplittedVector>(dataSet->getFdistributions())->getZeroDistributions(); - - BCArray3DPtr bcArray = this->getBCProcessor()->getBCArray(); - - const int bcArrayMaxX1 = (int)bcArray->getNX1(); - const int bcArrayMaxX2 = (int)bcArray->getNX2(); - const int bcArrayMaxX3 = (int)bcArray->getNX3(); - - int minX1 = ghostLayerWidth; - int minX2 = ghostLayerWidth; - int minX3 = ghostLayerWidth; - int maxX1 = bcArrayMaxX1-ghostLayerWidth; - int maxX2 = bcArrayMaxX2-ghostLayerWidth; - int maxX3 = bcArrayMaxX3-ghostLayerWidth; - - LBMReal omega = collFactor; - - - //#pragma omp parallel num_threads(8) - { - // int i = omp_get_thread_num(); - // printf_s("Hello from thread %d\n", i); - //} - //#pragma omp for - for (int x3 = minX3; x3 < maxX3; x3++) - { - for (int x2 = minX2; x2 < maxX2; x2++) - { - for (int x1 = minX1; x1 < maxX1; x1++) - { - if (!bcArray->isSolid(x1, x2, x3) && !bcArray->isUndefined(x1, x2, x3)) - { - int x1p = x1 + 1; - int x2p = x2 + 1; - int x3p = x3 + 1; - ////////////////////////////////////////////////////////////////////////// - //read distribution - //////////////////////////////////////////////////////////////////////////// - ////////////////////////////////////////////////////////////////////////// - - //E N T - //c c c - ////////// - //W S B - //a a a - - //Rest ist b - - //mfxyz - //a - negative - //b - null - //c - positive - - // a b c - //-1 0 1 - - LBMReal mfcbb = (*this->localDistributions)(D3Q27System::ET_E, x1, x2, x3); - LBMReal mfbcb = (*this->localDistributions)(D3Q27System::ET_N, x1, x2, x3); - LBMReal mfbbc = (*this->localDistributions)(D3Q27System::ET_T, x1, x2, x3); - LBMReal mfccb = (*this->localDistributions)(D3Q27System::ET_NE, x1, x2, x3); - LBMReal mfacb = (*this->localDistributions)(D3Q27System::ET_NW, x1p, x2, x3); - LBMReal mfcbc = (*this->localDistributions)(D3Q27System::ET_TE, x1, x2, x3); - LBMReal mfabc = (*this->localDistributions)(D3Q27System::ET_TW, x1p, x2, x3); - LBMReal mfbcc = (*this->localDistributions)(D3Q27System::ET_TN, x1, x2, x3); - LBMReal mfbac = (*this->localDistributions)(D3Q27System::ET_TS, x1, x2p, x3); - LBMReal mfccc = (*this->localDistributions)(D3Q27System::ET_TNE, x1, x2, x3); - LBMReal mfacc = (*this->localDistributions)(D3Q27System::ET_TNW, x1p, x2, x3); - LBMReal mfcac = (*this->localDistributions)(D3Q27System::ET_TSE, x1, x2p, x3); - LBMReal mfaac = (*this->localDistributions)(D3Q27System::ET_TSW, x1p, x2p, x3); - - LBMReal mfabb = (*this->nonLocalDistributions)(D3Q27System::ET_W, x1p, x2, x3); - LBMReal mfbab = (*this->nonLocalDistributions)(D3Q27System::ET_S, x1, x2p, x3); - LBMReal mfbba = (*this->nonLocalDistributions)(D3Q27System::ET_B, x1, x2, x3p); - LBMReal mfaab = (*this->nonLocalDistributions)(D3Q27System::ET_SW, x1p, x2p, x3); - LBMReal mfcab = (*this->nonLocalDistributions)(D3Q27System::ET_SE, x1, x2p, x3); - LBMReal mfaba = (*this->nonLocalDistributions)(D3Q27System::ET_BW, x1p, x2, x3p); - LBMReal mfcba = (*this->nonLocalDistributions)(D3Q27System::ET_BE, x1, x2, x3p); - LBMReal mfbaa = (*this->nonLocalDistributions)(D3Q27System::ET_BS, x1, x2p, x3p); - LBMReal mfbca = (*this->nonLocalDistributions)(D3Q27System::ET_BN, x1, x2, x3p); - LBMReal mfaaa = (*this->nonLocalDistributions)(D3Q27System::ET_BSW, x1p, x2p, x3p); - LBMReal mfcaa = (*this->nonLocalDistributions)(D3Q27System::ET_BSE, x1, x2p, x3p); - LBMReal mfaca = (*this->nonLocalDistributions)(D3Q27System::ET_BNW, x1p, x2, x3p); - LBMReal mfcca = (*this->nonLocalDistributions)(D3Q27System::ET_BNE, x1, x2, x3p); - - LBMReal mfbbb = (*this->zeroDistributions)(x1, x2, x3); - - //////////////////////////////////////////////////////////////////////////////////// - LBMReal drho = ((((mfccc+mfaaa)+(mfaca+mfcac))+((mfacc+mfcaa)+(mfaac+mfcca)))+ - (((mfbac+mfbca)+(mfbaa+mfbcc))+((mfabc+mfcba)+(mfaba+mfcbc))+((mfacb+mfcab)+(mfaab+mfccb)))+ - ((mfabb+mfcbb)+(mfbab+mfbcb))+(mfbba+mfbbc))+mfbbb; - - LBMReal rho = one+drho; - //////////////////////////////////////////////////////////////////////////////////// - LBMReal vvx = ((((mfccc-mfaaa)+(mfcac-mfaca))+((mfcaa-mfacc)+(mfcca-mfaac)))+ - (((mfcba-mfabc)+(mfcbc-mfaba))+((mfcab-mfacb)+(mfccb-mfaab)))+ - (mfcbb-mfabb))/rho; - LBMReal vvy = ((((mfccc-mfaaa)+(mfaca-mfcac))+((mfacc-mfcaa)+(mfcca-mfaac)))+ - (((mfbca-mfbac)+(mfbcc-mfbaa))+((mfacb-mfcab)+(mfccb-mfaab)))+ - (mfbcb-mfbab))/rho; - LBMReal vvz = ((((mfccc-mfaaa)+(mfcac-mfaca))+((mfacc-mfcaa)+(mfaac-mfcca)))+ - (((mfbac-mfbca)+(mfbcc-mfbaa))+((mfabc-mfcba)+(mfcbc-mfaba)))+ - (mfbbc-mfbba))/rho; - //////////////////////////////////////////////////////////////////////////////////// - - //forcing - /////////////////////////////////////////////////////////////////////////////////////////// - if (withForcing) - { - muX1 = static_cast<double>(x1-1+ix1*maxX1); - muX2 = static_cast<double>(x2-1+ix2*maxX2); - muX3 = static_cast<double>(x3-1+ix3*maxX3); - - forcingX1 = muForcingX1.Eval(); - forcingX2 = muForcingX2.Eval(); - forcingX3 = muForcingX3.Eval(); - - vvx += forcingX1*deltaT*0.5; // X - vvy += forcingX2*deltaT*0.5; // Y - vvz += forcingX3*deltaT*0.5; // Z - } - /////////////////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////////// - LBMReal oMdrho = one; // comp special - //////////////////////////////////////////////////////////////////////////////////// - LBMReal m0, m1, m2; - LBMReal vx2; - LBMReal vy2; - LBMReal vz2; - vx2 = vvx*vvx; - vy2 = vvy*vvy; - vz2 = vvz*vvz; - //////////////////////////////////////////////////////////////////////////////////// - LBMReal wadjust; - LBMReal qudricLimitP = 0.01f;// * 0.0001f; - LBMReal qudricLimitM = 0.01f;// * 0.0001f; - LBMReal qudricLimitD = 0.01f;// * 0.001f; - //LBMReal s9 = minusomega; - //test - //s9 = 0.; - //////////////////////////////////////////////////////////////////////////////////// - //Hin - //////////////////////////////////////////////////////////////////////////////////// - // mit 1/36, 1/9, 1/36, 1/9, 4/9, 1/9, 1/36, 1/9, 1/36 Konditionieren - //////////////////////////////////////////////////////////////////////////////////// - // Z - Dir - m2 = mfaaa+mfaac; - m1 = mfaac-mfaaa; - m0 = m2+mfaab; - mfaaa = m0; - m0 += c1o36 * oMdrho; - mfaab = m1-m0 * vvz; - mfaac = m2-two* m1 * vvz+vz2 * m0; - //////////////////////////////////////////////////////////////////////////////////// - m2 = mfaba+mfabc; - m1 = mfabc-mfaba; - m0 = m2+mfabb; - mfaba = m0; - m0 += c1o9 * oMdrho; - mfabb = m1-m0 * vvz; - mfabc = m2-two* m1 * vvz+vz2 * m0; - //////////////////////////////////////////////////////////////////////////////////// - m2 = mfaca+mfacc; - m1 = mfacc-mfaca; - m0 = m2+mfacb; - mfaca = m0; - m0 += c1o36 * oMdrho; - mfacb = m1-m0 * vvz; - mfacc = m2-two* m1 * vvz+vz2 * m0; - //////////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////////// - m2 = mfbaa+mfbac; - m1 = mfbac-mfbaa; - m0 = m2+mfbab; - mfbaa = m0; - m0 += c1o9 * oMdrho; - mfbab = m1-m0 * vvz; - mfbac = m2-two* m1 * vvz+vz2 * m0; - //////////////////////////////////////////////////////////////////////////////////// - m2 = mfbba+mfbbc; - m1 = mfbbc-mfbba; - m0 = m2+mfbbb; - mfbba = m0; - m0 += c4o9 * oMdrho; - mfbbb = m1-m0 * vvz; - mfbbc = m2-two* m1 * vvz+vz2 * m0; - //////////////////////////////////////////////////////////////////////////////////// - m2 = mfbca+mfbcc; - m1 = mfbcc-mfbca; - m0 = m2+mfbcb; - mfbca = m0; - m0 += c1o9 * oMdrho; - mfbcb = m1-m0 * vvz; - mfbcc = m2-two* m1 * vvz+vz2 * m0; - //////////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////////// - m2 = mfcaa+mfcac; - m1 = mfcac-mfcaa; - m0 = m2+mfcab; - mfcaa = m0; - m0 += c1o36 * oMdrho; - mfcab = m1-m0 * vvz; - mfcac = m2-two* m1 * vvz+vz2 * m0; - //////////////////////////////////////////////////////////////////////////////////// - m2 = mfcba+mfcbc; - m1 = mfcbc-mfcba; - m0 = m2+mfcbb; - mfcba = m0; - m0 += c1o9 * oMdrho; - mfcbb = m1-m0 * vvz; - mfcbc = m2-two* m1 * vvz+vz2 * m0; - //////////////////////////////////////////////////////////////////////////////////// - m2 = mfcca+mfccc; - m1 = mfccc-mfcca; - m0 = m2+mfccb; - mfcca = m0; - m0 += c1o36 * oMdrho; - mfccb = m1-m0 * vvz; - mfccc = m2-two* m1 * vvz+vz2 * m0; - //////////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////////// - // mit 1/6, 0, 1/18, 2/3, 0, 2/9, 1/6, 0, 1/18 Konditionieren - //////////////////////////////////////////////////////////////////////////////////// - // Y - Dir - m2 = mfaaa+mfaca; - m1 = mfaca-mfaaa; - m0 = m2+mfaba; - mfaaa = m0; - m0 += c1o6 * oMdrho; - mfaba = m1-m0 * vvy; - mfaca = m2-two* m1 * vvy+vy2 * m0; - //////////////////////////////////////////////////////////////////////////////////// - m2 = mfaab+mfacb; - m1 = mfacb-mfaab; - m0 = m2+mfabb; - mfaab = m0; - mfabb = m1-m0 * vvy; - mfacb = m2-two* m1 * vvy+vy2 * m0; - //////////////////////////////////////////////////////////////////////////////////// - m2 = mfaac+mfacc; - m1 = mfacc-mfaac; - m0 = m2+mfabc; - mfaac = m0; - m0 += c1o18 * oMdrho; - mfabc = m1-m0 * vvy; - mfacc = m2-two* m1 * vvy+vy2 * m0; - //////////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////////// - m2 = mfbaa+mfbca; - m1 = mfbca-mfbaa; - m0 = m2+mfbba; - mfbaa = m0; - m0 += c2o3 * oMdrho; - mfbba = m1-m0 * vvy; - mfbca = m2-two* m1 * vvy+vy2 * m0; - //////////////////////////////////////////////////////////////////////////////////// - m2 = mfbab+mfbcb; - m1 = mfbcb-mfbab; - m0 = m2+mfbbb; - mfbab = m0; - mfbbb = m1-m0 * vvy; - mfbcb = m2-two* m1 * vvy+vy2 * m0; - //////////////////////////////////////////////////////////////////////////////////// - m2 = mfbac+mfbcc; - m1 = mfbcc-mfbac; - m0 = m2+mfbbc; - mfbac = m0; - m0 += c2o9 * oMdrho; - mfbbc = m1-m0 * vvy; - mfbcc = m2-two* m1 * vvy+vy2 * m0; - //////////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////////// - m2 = mfcaa+mfcca; - m1 = mfcca-mfcaa; - m0 = m2+mfcba; - mfcaa = m0; - m0 += c1o6 * oMdrho; - mfcba = m1-m0 * vvy; - mfcca = m2-two* m1 * vvy+vy2 * m0; - //////////////////////////////////////////////////////////////////////////////////// - m2 = mfcab+mfccb; - m1 = mfccb-mfcab; - m0 = m2+mfcbb; - mfcab = m0; - mfcbb = m1-m0 * vvy; - mfccb = m2-two* m1 * vvy+vy2 * m0; - //////////////////////////////////////////////////////////////////////////////////// - m2 = mfcac+mfccc; - m1 = mfccc-mfcac; - m0 = m2+mfcbc; - mfcac = m0; - m0 += c1o18 * oMdrho; - mfcbc = m1-m0 * vvy; - mfccc = m2-two* m1 * vvy+vy2 * m0; - //////////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////////// - // mit 1, 0, 1/3, 0, 0, 0, 1/3, 0, 1/9 Konditionieren - //////////////////////////////////////////////////////////////////////////////////// - // X - Dir - m2 = mfaaa+mfcaa; - m1 = mfcaa-mfaaa; - m0 = m2+mfbaa; - mfaaa = m0; - m0 += one* oMdrho; - mfbaa = m1-m0 * vvx; - mfcaa = m2-two* m1 * vvx+vx2 * m0; - //////////////////////////////////////////////////////////////////////////////////// - m2 = mfaba+mfcba; - m1 = mfcba-mfaba; - m0 = m2+mfbba; - mfaba = m0; - mfbba = m1-m0 * vvx; - mfcba = m2-two* m1 * vvx+vx2 * m0; - //////////////////////////////////////////////////////////////////////////////////// - m2 = mfaca+mfcca; - m1 = mfcca-mfaca; - m0 = m2+mfbca; - mfaca = m0; - m0 += c1o3 * oMdrho; - mfbca = m1-m0 * vvx; - mfcca = m2-two* m1 * vvx+vx2 * m0; - //////////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////////// - m2 = mfaab+mfcab; - m1 = mfcab-mfaab; - m0 = m2+mfbab; - mfaab = m0; - mfbab = m1-m0 * vvx; - mfcab = m2-two* m1 * vvx+vx2 * m0; - //////////////////////////////////////////////////////////////////////////////////// - m2 = mfabb+mfcbb; - m1 = mfcbb-mfabb; - m0 = m2+mfbbb; - mfabb = m0; - mfbbb = m1-m0 * vvx; - mfcbb = m2-two* m1 * vvx+vx2 * m0; - //////////////////////////////////////////////////////////////////////////////////// - m2 = mfacb+mfccb; - m1 = mfccb-mfacb; - m0 = m2+mfbcb; - mfacb = m0; - mfbcb = m1-m0 * vvx; - mfccb = m2-two* m1 * vvx+vx2 * m0; - //////////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////////// - m2 = mfaac+mfcac; - m1 = mfcac-mfaac; - m0 = m2+mfbac; - mfaac = m0; - m0 += c1o3 * oMdrho; - mfbac = m1-m0 * vvx; - mfcac = m2-two* m1 * vvx+vx2 * m0; - //////////////////////////////////////////////////////////////////////////////////// - m2 = mfabc+mfcbc; - m1 = mfcbc-mfabc; - m0 = m2+mfbbc; - mfabc = m0; - mfbbc = m1-m0 * vvx; - mfcbc = m2-two* m1 * vvx+vx2 * m0; - //////////////////////////////////////////////////////////////////////////////////// - m2 = mfacc+mfccc; - m1 = mfccc-mfacc; - m0 = m2+mfbcc; - mfacc = m0; - m0 += c1o9 * oMdrho; - mfbcc = m1-m0 * vvx; - mfccc = m2-two* m1 * vvx+vx2 * m0; - //////////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////////// - - - //////////////////////////////////////////////////////////////////////////////////// - // Cumulants - //////////////////////////////////////////////////////////////////////////////////// - - //LBMReal OxxPyyPzz = one; // bulk viscosity - - //////////////////////////////////////////////////////////// - //3. - ////////////////////////////// - LBMReal OxyyPxzz = one;//three * (two - omega) / (three - omega);// - //LBMReal OxyyMxzz = one;//six * (two - omega) / (six - omega);// - LBMReal Oxyz = one;//twelve * (two - omega) / (twelve + omega);// - ////////////////////////////// - //LBMReal OxyyPxzz = two-omega;// - //LBMReal OxyyMxzz = two-omega;// - ////////////////////////////// - //LBMReal OxyyPxzz = (eight * (omega - two)) / (omega - eight);//Ginzburg - //LBMReal OxyyMxzz = (eight * (omega - two)) / (omega - eight);//Ginzburg - ////////////////////////////// - //LBMReal OxyyPxzz = omega;//BGK - //LBMReal OxyyMxzz = omega;//BGK - ////////////////////////////// - //LBMReal OxyyPxzz = (one + omega) / two;//1P5 - //LBMReal OxyyMxzz = (one + omega) / two;//1P5 - ////////////////////////////// - //LBMReal OxyyPxzz = (three - omega) / two;//0P5 - //LBMReal OxyyMxzz = (three - omega) / two;//0P5 - ////////////////////////////// - //LBMReal OxyyPxzz = (one + (eight * (omega - two)) / (omega - eight)) / two;//one + Ginzburg / two ... Car - //LBMReal OxyyMxzz = (one + (eight * (omega - two)) / (omega - eight)) / two;//one + Ginzburg / two ... Car - //////////////////////////////////////////////////////////// - //4. - ////////////////////////////// - LBMReal O4 = one; - ////////////////////////////// - //LBMReal O4 = omega;//TRT - //////////////////////////////////////////////////////////// - //5. - ////////////////////////////// - LBMReal O5 = one; - //////////////////////////////////////////////////////////// - //6. - ////////////////////////////// - LBMReal O6 = one; - //////////////////////////////////////////////////////////// - - - //central moments to cumulants - //4. - LBMReal CUMcbb = mfcbb-((mfcaa+c1o3) * mfabb+two * mfbba * mfbab)/rho; //ab 15.05.2015 verwendet - LBMReal CUMbcb = mfbcb-((mfaca+c1o3) * mfbab+two * mfbba * mfabb)/rho; //ab 15.05.2015 verwendet - LBMReal CUMbbc = mfbbc-((mfaac+c1o3) * mfbba+two * mfbab * mfabb)/rho; //ab 15.05.2015 verwendet - - LBMReal CUMcca = mfcca-(((mfcaa * mfaca+two * mfbba * mfbba)+c1o3 * (mfcaa+mfaca))/rho-c1o9*(drho/rho)); - LBMReal CUMcac = mfcac-(((mfcaa * mfaac+two * mfbab * mfbab)+c1o3 * (mfcaa+mfaac))/rho-c1o9*(drho/rho)); - LBMReal CUMacc = mfacc-(((mfaac * mfaca+two * mfabb * mfabb)+c1o3 * (mfaac+mfaca))/rho-c1o9*(drho/rho)); - - //5. - LBMReal CUMbcc = mfbcc-((mfaac * mfbca+mfaca * mfbac+four * mfabb * mfbbb+two * (mfbab * mfacb+mfbba * mfabc))+c1o3 * (mfbca+mfbac))/rho; - LBMReal CUMcbc = mfcbc-((mfaac * mfcba+mfcaa * mfabc+four * mfbab * mfbbb+two * (mfabb * mfcab+mfbba * mfbac))+c1o3 * (mfcba+mfabc))/rho; - LBMReal CUMccb = mfccb-((mfcaa * mfacb+mfaca * mfcab+four * mfbba * mfbbb+two * (mfbab * mfbca+mfabb * mfcba))+c1o3 * (mfacb+mfcab))/rho; - - //6. - - LBMReal CUMccc = mfccc+((-four * mfbbb * mfbbb - -(mfcaa * mfacc+mfaca * mfcac+mfaac * mfcca) - -four * (mfabb * mfcbb+mfbab * mfbcb+mfbba * mfbbc) - -two * (mfbca * mfbac+mfcba * mfabc+mfcab * mfacb))/rho - +(four * (mfbab * mfbab * mfaca+mfabb * mfabb * mfcaa+mfbba * mfbba * mfaac) - +two * (mfcaa * mfaca * mfaac) - +sixteen * mfbba * mfbab * mfabb)/(rho * rho) - -c1o3 * (mfacc+mfcac+mfcca)/rho - -c1o9 * (mfcaa+mfaca+mfaac)/rho - +(two * (mfbab * mfbab+mfabb * mfabb+mfbba * mfbba) - +(mfaac * mfaca+mfaac * mfcaa+mfaca * mfcaa)+c1o3 *(mfaac+mfaca+mfcaa))/(rho * rho) * c2o3 - +c1o27*((drho * drho-drho)/(rho*rho))); - //+ c1o27*(one -three/rho +two/(rho*rho))); - - - - - //2. - // linear combinations - LBMReal mxxPyyPzz = mfcaa+mfaca+mfaac; - LBMReal mxxMyy = mfcaa-mfaca; - LBMReal mxxMzz = mfcaa-mfaac; - - ////////////////////////////////////////////////////////////////////////// - // LBMReal magicBulk=(CUMacc+CUMcac+CUMcca)*(one/OxxPyyPzz-c1o2)*c3o2*8.; - - ////////////////////////////////////////////////////////////////////////// - //limiter-Scheise Teil 1 - //LBMReal oxxyy,oxxzz,oxy,oxz,oyz; - //LBMReal smag=0.001; - //oxxyy = omega+(one-omega)*abs(mxxMyy)/(abs(mxxMyy)+smag); - //oxxzz = omega+(one-omega)*abs(mxxMzz)/(abs(mxxMzz)+smag); - //oxy = omega+(one-omega)*abs(mfbba)/(abs(mfbba)+smag); - //oxz = omega+(one-omega)*abs(mfbab)/(abs(mfbab)+smag); - //oyz = omega+(one-omega)*abs(mfabb)/(abs(mfabb)+smag); - - //////////////////////////////////////////////////////////////////////////// - ////Teil 1b - //LBMReal constante = 1000.0; - //LBMReal nuEddi = constante * abs(mxxPyyPzz); - //LBMReal omegaLimit = one / (one / omega + three * nuEddi); - - //{ - // LBMReal dxux = c1o2 * (-omegaLimit) *(mxxMyy + mxxMzz) + OxxPyyPzz * (mfaaa - mxxPyyPzz); - // LBMReal dyuy = dxux + omegaLimit * c3o2 * mxxMyy; - // LBMReal dzuz = dxux + omegaLimit * c3o2 * mxxMzz; - - ////relax - //mxxPyyPzz += OxxPyyPzz*(mfaaa - mxxPyyPzz)- three * (one - c1o2 * OxxPyyPzz) * (vx2 * dxux + vy2 * dyuy + vz2 * dzuz); - //mxxMyy += omegaLimit * (-mxxMyy) - three * (one + c1o2 * (-omegaLimit)) * (vx2 * dxux + vy2 * dyuy); - //mxxMzz += omegaLimit * (-mxxMzz) - three * (one + c1o2 * (-omegaLimit)) * (vx2 * dxux + vz2 * dzuz); - - //} - //mfabb += omegaLimit * (-mfabb); - //mfbab += omegaLimit * (-mfbab); - //mfbba += omegaLimit * (-mfbba); - //////////////////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //incl. correction (hat noch nicht so gut funktioniert...Optimierungsbedarf??) - { - LBMReal dxux = c1o2 * (-omega) *(mxxMyy+mxxMzz)+c1o2 * OxxPyyPzz * (mfaaa-mxxPyyPzz); - LBMReal dyuy = dxux+omega * c3o2 * mxxMyy; - LBMReal dzuz = dxux+omega * c3o2 * mxxMzz; - - //relax - mxxPyyPzz += OxxPyyPzz*(mfaaa-mxxPyyPzz)-three * (one-c1o2 * OxxPyyPzz) * (vx2 * dxux+vy2 * dyuy+vz2 * dzuz);//-magicBulk*OxxPyyPzz; - mxxMyy += omega * (-mxxMyy)-three * (one+c1o2 * (-omega)) * (vx2 * dxux-vy2 * dyuy); - mxxMzz += omega * (-mxxMzz)-three * (one+c1o2 * (-omega)) * (vx2 * dxux-vz2 * dzuz); - - ////////////////////////////////////////////////////////////////////////// - //limiter-Scheise Teil 2 - //mxxMyy += oxxyy * (-mxxMyy) - three * (one + c1o2 * (-omega)) * (vx2 * dxux + vy2 * dyuy); - //mxxMzz += oxxzz * (-mxxMzz) - three * (one + c1o2 * (-omega)) * (vx2 * dxux + vz2 * dzuz); - ////////////////////////////////////////////////////////////////////////// - - } - /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - ////no correction - //mxxPyyPzz += OxxPyyPzz*(mfaaa-mxxPyyPzz);//-magicBulk*OxxPyyPzz; - //mxxMyy += -(-omega) * (-mxxMyy); - //mxxMzz += -(-omega) * (-mxxMzz); - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - mfabb += omega * (-mfabb); - mfbab += omega * (-mfbab); - mfbba += omega * (-mfbba); - - ////////////////////////////////////////////////////////////////////////// - //limiter-Scheise Teil 3 - //mfabb += oyz * (-mfabb); - //mfbab += oxz * (-mfbab); - //mfbba += oxy * (-mfbba); - ////////////////////////////////////////////////////////////////////////// - - // linear combinations back - mfcaa = c1o3 * (mxxMyy+mxxMzz+mxxPyyPzz); - mfaca = c1o3 * (-two* mxxMyy+mxxMzz+mxxPyyPzz); - mfaac = c1o3 * (mxxMyy-two* mxxMzz+mxxPyyPzz); - - //3. - // linear combinations - - LBMReal mxxyPyzz = mfcba+mfabc; - LBMReal mxxyMyzz = mfcba-mfabc; - - LBMReal mxxzPyyz = mfcab+mfacb; - LBMReal mxxzMyyz = mfcab-mfacb; - - LBMReal mxyyPxzz = mfbca+mfbac; - LBMReal mxyyMxzz = mfbca-mfbac; - - //relax - ////////////////////////////////////////////////////////////////////////// - //das ist der limiter - wadjust = Oxyz+(one-Oxyz)*abs(mfbbb)/(abs(mfbbb)+qudricLimitD); - mfbbb += wadjust * (-mfbbb); - wadjust = OxyyPxzz+(one-OxyyPxzz)*abs(mxxyPyzz)/(abs(mxxyPyzz)+qudricLimitP); - mxxyPyzz += wadjust * (-mxxyPyzz); - wadjust = OxyyMxzz+(one-OxyyMxzz)*abs(mxxyMyzz)/(abs(mxxyMyzz)+qudricLimitM); - mxxyMyzz += wadjust * (-mxxyMyzz); - wadjust = OxyyPxzz+(one-OxyyPxzz)*abs(mxxzPyyz)/(abs(mxxzPyyz)+qudricLimitP); - mxxzPyyz += wadjust * (-mxxzPyyz); - wadjust = OxyyMxzz+(one-OxyyMxzz)*abs(mxxzMyyz)/(abs(mxxzMyyz)+qudricLimitM); - mxxzMyyz += wadjust * (-mxxzMyyz); - wadjust = OxyyPxzz+(one-OxyyPxzz)*abs(mxyyPxzz)/(abs(mxyyPxzz)+qudricLimitP); - mxyyPxzz += wadjust * (-mxyyPxzz); - wadjust = OxyyMxzz+(one-OxyyMxzz)*abs(mxyyMxzz)/(abs(mxyyMxzz)+qudricLimitM); - mxyyMxzz += wadjust * (-mxyyMxzz); - ////////////////////////////////////////////////////////////////////////// - //ohne limiter - //mfbbb += OxyyMxzz * (-mfbbb); - //mxxyPyzz += OxyyPxzz * (-mxxyPyzz); - //mxxyMyzz += OxyyMxzz * (-mxxyMyzz); - //mxxzPyyz += OxyyPxzz * (-mxxzPyyz); - //mxxzMyyz += OxyyMxzz * (-mxxzMyyz); - //mxyyPxzz += OxyyPxzz * (-mxyyPxzz); - //mxyyMxzz += OxyyMxzz * (-mxyyMxzz); - ////////////////////////////////////////////////////////////////////////// - - //// linear combinations back - mfcba = (mxxyMyzz+mxxyPyzz) * c1o2; - mfabc = (-mxxyMyzz+mxxyPyzz) * c1o2; - mfcab = (mxxzMyyz+mxxzPyyz) * c1o2; - mfacb = (-mxxzMyyz+mxxzPyyz) * c1o2; - mfbca = (mxyyMxzz+mxyyPxzz) * c1o2; - mfbac = (-mxyyMxzz+mxyyPxzz) * c1o2; - - //4. - ////////////////////////////////////////////////////////////////////////// - //mit limiter - // wadjust = O4+(one-O4)*abs(CUMacc)/(abs(CUMacc)+qudricLimit); - //CUMacc += wadjust * (-CUMacc); - // wadjust = O4+(one-O4)*abs(CUMcac)/(abs(CUMcac)+qudricLimit); - //CUMcac += wadjust * (-CUMcac); - // wadjust = O4+(one-O4)*abs(CUMcca)/(abs(CUMcca)+qudricLimit); - //CUMcca += wadjust * (-CUMcca); - - // wadjust = O4+(one-O4)*abs(CUMbbc)/(abs(CUMbbc)+qudricLimit); - //CUMbbc += wadjust * (-CUMbbc); - // wadjust = O4+(one-O4)*abs(CUMbcb)/(abs(CUMbcb)+qudricLimit); - //CUMbcb += wadjust * (-CUMbcb); - // wadjust = O4+(one-O4)*abs(CUMcbb)/(abs(CUMcbb)+qudricLimit); - //CUMcbb += wadjust * (-CUMcbb); - ////////////////////////////////////////////////////////////////////////// - //ohne limiter - CUMacc += O4 * (-CUMacc); - CUMcac += O4 * (-CUMcac); - CUMcca += O4 * (-CUMcca); - - CUMbbc += O4 * (-CUMbbc); - CUMbcb += O4 * (-CUMbcb); - CUMcbb += O4 * (-CUMcbb); - ////////////////////////////////////////////////////////////////////////// - - - //5. - CUMbcc += O5 * (-CUMbcc); - CUMcbc += O5 * (-CUMcbc); - CUMccb += O5 * (-CUMccb); - - //6. - CUMccc += O6 * (-CUMccc); - - - - //back cumulants to central moments - //4. - mfcbb = CUMcbb+((mfcaa+c1o3) * mfabb+two * mfbba * mfbab)/rho; - mfbcb = CUMbcb+((mfaca+c1o3) * mfbab+two * mfbba * mfabb)/rho; - mfbbc = CUMbbc+((mfaac+c1o3) * mfbba+two * mfbab * mfabb)/rho; - - mfcca = CUMcca+(((mfcaa * mfaca+two * mfbba * mfbba)+c1o3 * (mfcaa+mfaca))/rho-c1o9*(drho/rho));//(one/rho-one)); - mfcac = CUMcac+(((mfcaa * mfaac+two * mfbab * mfbab)+c1o3 * (mfcaa+mfaac))/rho-c1o9*(drho/rho));//(one/rho-one)); - mfacc = CUMacc+(((mfaac * mfaca+two * mfabb * mfabb)+c1o3 * (mfaac+mfaca))/rho-c1o9*(drho/rho));//(one/rho-one)); - - //5. - mfbcc = CUMbcc+((mfaac * mfbca+mfaca * mfbac+four * mfabb * mfbbb+two * (mfbab * mfacb+mfbba * mfabc))+c1o3 * (mfbca+mfbac))/rho; - mfcbc = CUMcbc+((mfaac * mfcba+mfcaa * mfabc+four * mfbab * mfbbb+two * (mfabb * mfcab+mfbba * mfbac))+c1o3 * (mfcba+mfabc))/rho; - mfccb = CUMccb+((mfcaa * mfacb+mfaca * mfcab+four * mfbba * mfbbb+two * (mfbab * mfbca+mfabb * mfcba))+c1o3 * (mfacb+mfcab))/rho; - - //6. - - mfccc = CUMccc-((-four * mfbbb * mfbbb - -(mfcaa * mfacc+mfaca * mfcac+mfaac * mfcca) - -four * (mfabb * mfcbb+mfbab * mfbcb+mfbba * mfbbc) - -two * (mfbca * mfbac+mfcba * mfabc+mfcab * mfacb))/rho - +(four * (mfbab * mfbab * mfaca+mfabb * mfabb * mfcaa+mfbba * mfbba * mfaac) - +two * (mfcaa * mfaca * mfaac) - +sixteen * mfbba * mfbab * mfabb)/(rho * rho) - -c1o3 * (mfacc+mfcac+mfcca)/rho - -c1o9 * (mfcaa+mfaca+mfaac)/rho - +(two * (mfbab * mfbab+mfabb * mfabb+mfbba * mfbba) - +(mfaac * mfaca+mfaac * mfcaa+mfaca * mfcaa)+c1o3 *(mfaac+mfaca+mfcaa))/(rho * rho) * c2o3 - +c1o27*((drho * drho-drho)/(rho*rho))); - //////////////////////////////////////////////////////////////////////////////////// - //forcing - mfbaa=-mfbaa; - mfaba=-mfaba; - mfaab=-mfaab; - ////////////////////////////////////////////////////////////////////////////////////// - - //////////////////////////////////////////////////////////////////////////////////// - //back - //////////////////////////////////////////////////////////////////////////////////// - //mit 1, 0, 1/3, 0, 0, 0, 1/3, 0, 1/9 Konditionieren - //////////////////////////////////////////////////////////////////////////////////// - // Z - Dir - m0 = mfaac * c1o2+mfaab * (vvz-c1o2)+(mfaaa+one* oMdrho) * (vz2-vvz) * c1o2; - m1 = -mfaac-two* mfaab * vvz+mfaaa * (one-vz2)-one* oMdrho * vz2; - m2 = mfaac * c1o2+mfaab * (vvz+c1o2)+(mfaaa+one* oMdrho) * (vz2+vvz) * c1o2; - mfaaa = m0; - mfaab = m1; - mfaac = m2; - //////////////////////////////////////////////////////////////////////////////////// - m0 = mfabc * c1o2+mfabb * (vvz-c1o2)+mfaba * (vz2-vvz) * c1o2; - m1 = -mfabc-two* mfabb * vvz+mfaba * (one-vz2); - m2 = mfabc * c1o2+mfabb * (vvz+c1o2)+mfaba * (vz2+vvz) * c1o2; - mfaba = m0; - mfabb = m1; - mfabc = m2; - //////////////////////////////////////////////////////////////////////////////////// - m0 = mfacc * c1o2+mfacb * (vvz-c1o2)+(mfaca+c1o3 * oMdrho) * (vz2-vvz) * c1o2; - m1 = -mfacc-two* mfacb * vvz+mfaca * (one-vz2)-c1o3 * oMdrho * vz2; - m2 = mfacc * c1o2+mfacb * (vvz+c1o2)+(mfaca+c1o3 * oMdrho) * (vz2+vvz) * c1o2; - mfaca = m0; - mfacb = m1; - mfacc = m2; - //////////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////////// - m0 = mfbac * c1o2+mfbab * (vvz-c1o2)+mfbaa * (vz2-vvz) * c1o2; - m1 = -mfbac-two* mfbab * vvz+mfbaa * (one-vz2); - m2 = mfbac * c1o2+mfbab * (vvz+c1o2)+mfbaa * (vz2+vvz) * c1o2; - mfbaa = m0; - mfbab = m1; - mfbac = m2; - /////////b////////////////////////////////////////////////////////////////////////// - m0 = mfbbc * c1o2+mfbbb * (vvz-c1o2)+mfbba * (vz2-vvz) * c1o2; - m1 = -mfbbc-two* mfbbb * vvz+mfbba * (one-vz2); - m2 = mfbbc * c1o2+mfbbb * (vvz+c1o2)+mfbba * (vz2+vvz) * c1o2; - mfbba = m0; - mfbbb = m1; - mfbbc = m2; - /////////b////////////////////////////////////////////////////////////////////////// - m0 = mfbcc * c1o2+mfbcb * (vvz-c1o2)+mfbca * (vz2-vvz) * c1o2; - m1 = -mfbcc-two* mfbcb * vvz+mfbca * (one-vz2); - m2 = mfbcc * c1o2+mfbcb * (vvz+c1o2)+mfbca * (vz2+vvz) * c1o2; - mfbca = m0; - mfbcb = m1; - mfbcc = m2; - //////////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////////// - m0 = mfcac * c1o2+mfcab * (vvz-c1o2)+(mfcaa+c1o3 * oMdrho) * (vz2-vvz) * c1o2; - m1 = -mfcac-two* mfcab * vvz+mfcaa * (one-vz2)-c1o3 * oMdrho * vz2; - m2 = mfcac * c1o2+mfcab * (vvz+c1o2)+(mfcaa+c1o3 * oMdrho) * (vz2+vvz) * c1o2; - mfcaa = m0; - mfcab = m1; - mfcac = m2; - /////////c////////////////////////////////////////////////////////////////////////// - m0 = mfcbc * c1o2+mfcbb * (vvz-c1o2)+mfcba * (vz2-vvz) * c1o2; - m1 = -mfcbc-two* mfcbb * vvz+mfcba * (one-vz2); - m2 = mfcbc * c1o2+mfcbb * (vvz+c1o2)+mfcba * (vz2+vvz) * c1o2; - mfcba = m0; - mfcbb = m1; - mfcbc = m2; - /////////c////////////////////////////////////////////////////////////////////////// - m0 = mfccc * c1o2+mfccb * (vvz-c1o2)+(mfcca+c1o9 * oMdrho) * (vz2-vvz) * c1o2; - m1 = -mfccc-two* mfccb * vvz+mfcca * (one-vz2)-c1o9 * oMdrho * vz2; - m2 = mfccc * c1o2+mfccb * (vvz+c1o2)+(mfcca+c1o9 * oMdrho) * (vz2+vvz) * c1o2; - mfcca = m0; - mfccb = m1; - mfccc = m2; - //////////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////////// - //mit 1/6, 2/3, 1/6, 0, 0, 0, 1/18, 2/9, 1/18 Konditionieren - //////////////////////////////////////////////////////////////////////////////////// - // Y - Dir - m0 = mfaca * c1o2+mfaba * (vvy-c1o2)+(mfaaa+c1o6 * oMdrho) * (vy2-vvy) * c1o2; - m1 = -mfaca-two* mfaba * vvy+mfaaa * (one-vy2)-c1o6 * oMdrho * vy2; - m2 = mfaca * c1o2+mfaba * (vvy+c1o2)+(mfaaa+c1o6 * oMdrho) * (vy2+vvy) * c1o2; - mfaaa = m0; - mfaba = m1; - mfaca = m2; - //////////////////////////////////////////////////////////////////////////////////// - m0 = mfacb * c1o2+mfabb * (vvy-c1o2)+(mfaab+c2o3 * oMdrho) * (vy2-vvy) * c1o2; - m1 = -mfacb-two* mfabb * vvy+mfaab * (one-vy2)-c2o3 * oMdrho * vy2; - m2 = mfacb * c1o2+mfabb * (vvy+c1o2)+(mfaab+c2o3 * oMdrho) * (vy2+vvy) * c1o2; - mfaab = m0; - mfabb = m1; - mfacb = m2; - //////////////////////////////////////////////////////////////////////////////////// - m0 = mfacc * c1o2+mfabc * (vvy-c1o2)+(mfaac+c1o6 * oMdrho) * (vy2-vvy) * c1o2; - m1 = -mfacc-two* mfabc * vvy+mfaac * (one-vy2)-c1o6 * oMdrho * vy2; - m2 = mfacc * c1o2+mfabc * (vvy+c1o2)+(mfaac+c1o6 * oMdrho) * (vy2+vvy) * c1o2; - mfaac = m0; - mfabc = m1; - mfacc = m2; - //////////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////////// - m0 = mfbca * c1o2+mfbba * (vvy-c1o2)+mfbaa * (vy2-vvy) * c1o2; - m1 = -mfbca-two* mfbba * vvy+mfbaa * (one-vy2); - m2 = mfbca * c1o2+mfbba * (vvy+c1o2)+mfbaa * (vy2+vvy) * c1o2; - mfbaa = m0; - mfbba = m1; - mfbca = m2; - /////////b////////////////////////////////////////////////////////////////////////// - m0 = mfbcb * c1o2+mfbbb * (vvy-c1o2)+mfbab * (vy2-vvy) * c1o2; - m1 = -mfbcb-two* mfbbb * vvy+mfbab * (one-vy2); - m2 = mfbcb * c1o2+mfbbb * (vvy+c1o2)+mfbab * (vy2+vvy) * c1o2; - mfbab = m0; - mfbbb = m1; - mfbcb = m2; - /////////b////////////////////////////////////////////////////////////////////////// - m0 = mfbcc * c1o2+mfbbc * (vvy-c1o2)+mfbac * (vy2-vvy) * c1o2; - m1 = -mfbcc-two* mfbbc * vvy+mfbac * (one-vy2); - m2 = mfbcc * c1o2+mfbbc * (vvy+c1o2)+mfbac * (vy2+vvy) * c1o2; - mfbac = m0; - mfbbc = m1; - mfbcc = m2; - //////////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////////// - m0 = mfcca * c1o2+mfcba * (vvy-c1o2)+(mfcaa+c1o18 * oMdrho) * (vy2-vvy) * c1o2; - m1 = -mfcca-two* mfcba * vvy+mfcaa * (one-vy2)-c1o18 * oMdrho * vy2; - m2 = mfcca * c1o2+mfcba * (vvy+c1o2)+(mfcaa+c1o18 * oMdrho) * (vy2+vvy) * c1o2; - mfcaa = m0; - mfcba = m1; - mfcca = m2; - /////////c////////////////////////////////////////////////////////////////////////// - m0 = mfccb * c1o2+mfcbb * (vvy-c1o2)+(mfcab+c2o9 * oMdrho) * (vy2-vvy) * c1o2; - m1 = -mfccb-two* mfcbb * vvy+mfcab * (one-vy2)-c2o9 * oMdrho * vy2; - m2 = mfccb * c1o2+mfcbb * (vvy+c1o2)+(mfcab+c2o9 * oMdrho) * (vy2+vvy) * c1o2; - mfcab = m0; - mfcbb = m1; - mfccb = m2; - /////////c////////////////////////////////////////////////////////////////////////// - m0 = mfccc * c1o2+mfcbc * (vvy-c1o2)+(mfcac+c1o18 * oMdrho) * (vy2-vvy) * c1o2; - m1 = -mfccc-two* mfcbc * vvy+mfcac * (one-vy2)-c1o18 * oMdrho * vy2; - m2 = mfccc * c1o2+mfcbc * (vvy+c1o2)+(mfcac+c1o18 * oMdrho) * (vy2+vvy) * c1o2; - mfcac = m0; - mfcbc = m1; - mfccc = m2; - //////////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////////// - //mit 1/36, 1/9, 1/36, 1/9, 4/9, 1/9, 1/36, 1/9, 1/36 Konditionieren - //////////////////////////////////////////////////////////////////////////////////// - // X - Dir - m0 = mfcaa * c1o2+mfbaa * (vvx-c1o2)+(mfaaa+c1o36 * oMdrho) * (vx2-vvx) * c1o2; - m1 = -mfcaa-two* mfbaa * vvx+mfaaa * (one-vx2)-c1o36 * oMdrho * vx2; - m2 = mfcaa * c1o2+mfbaa * (vvx+c1o2)+(mfaaa+c1o36 * oMdrho) * (vx2+vvx) * c1o2; - mfaaa = m0; - mfbaa = m1; - mfcaa = m2; - //////////////////////////////////////////////////////////////////////////////////// - m0 = mfcba * c1o2+mfbba * (vvx-c1o2)+(mfaba+c1o9 * oMdrho) * (vx2-vvx) * c1o2; - m1 = -mfcba-two* mfbba * vvx+mfaba * (one-vx2)-c1o9 * oMdrho * vx2; - m2 = mfcba * c1o2+mfbba * (vvx+c1o2)+(mfaba+c1o9 * oMdrho) * (vx2+vvx) * c1o2; - mfaba = m0; - mfbba = m1; - mfcba = m2; - //////////////////////////////////////////////////////////////////////////////////// - m0 = mfcca * c1o2+mfbca * (vvx-c1o2)+(mfaca+c1o36 * oMdrho) * (vx2-vvx) * c1o2; - m1 = -mfcca-two* mfbca * vvx+mfaca * (one-vx2)-c1o36 * oMdrho * vx2; - m2 = mfcca * c1o2+mfbca * (vvx+c1o2)+(mfaca+c1o36 * oMdrho) * (vx2+vvx) * c1o2; - mfaca = m0; - mfbca = m1; - mfcca = m2; - //////////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////////// - m0 = mfcab * c1o2+mfbab * (vvx-c1o2)+(mfaab+c1o9 * oMdrho) * (vx2-vvx) * c1o2; - m1 = -mfcab-two* mfbab * vvx+mfaab * (one-vx2)-c1o9 * oMdrho * vx2; - m2 = mfcab * c1o2+mfbab * (vvx+c1o2)+(mfaab+c1o9 * oMdrho) * (vx2+vvx) * c1o2; - mfaab = m0; - mfbab = m1; - mfcab = m2; - ///////////b//////////////////////////////////////////////////////////////////////// - m0 = mfcbb * c1o2+mfbbb * (vvx-c1o2)+(mfabb+c4o9 * oMdrho) * (vx2-vvx) * c1o2; - m1 = -mfcbb-two* mfbbb * vvx+mfabb * (one-vx2)-c4o9 * oMdrho * vx2; - m2 = mfcbb * c1o2+mfbbb * (vvx+c1o2)+(mfabb+c4o9 * oMdrho) * (vx2+vvx) * c1o2; - mfabb = m0; - mfbbb = m1; - mfcbb = m2; - ///////////b//////////////////////////////////////////////////////////////////////// - m0 = mfccb * c1o2+mfbcb * (vvx-c1o2)+(mfacb+c1o9 * oMdrho) * (vx2-vvx) * c1o2; - m1 = -mfccb-two* mfbcb * vvx+mfacb * (one-vx2)-c1o9 * oMdrho * vx2; - m2 = mfccb * c1o2+mfbcb * (vvx+c1o2)+(mfacb+c1o9 * oMdrho) * (vx2+vvx) * c1o2; - mfacb = m0; - mfbcb = m1; - mfccb = m2; - //////////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////////// - m0 = mfcac * c1o2+mfbac * (vvx-c1o2)+(mfaac+c1o36 * oMdrho) * (vx2-vvx) * c1o2; - m1 = -mfcac-two* mfbac * vvx+mfaac * (one-vx2)-c1o36 * oMdrho * vx2; - m2 = mfcac * c1o2+mfbac * (vvx+c1o2)+(mfaac+c1o36 * oMdrho) * (vx2+vvx) * c1o2; - mfaac = m0; - mfbac = m1; - mfcac = m2; - ///////////c//////////////////////////////////////////////////////////////////////// - m0 = mfcbc * c1o2+mfbbc * (vvx-c1o2)+(mfabc+c1o9 * oMdrho) * (vx2-vvx) * c1o2; - m1 = -mfcbc-two* mfbbc * vvx+mfabc * (one-vx2)-c1o9 * oMdrho * vx2; - m2 = mfcbc * c1o2+mfbbc * (vvx+c1o2)+(mfabc+c1o9 * oMdrho) * (vx2+vvx) * c1o2; - mfabc = m0; - mfbbc = m1; - mfcbc = m2; - ///////////c//////////////////////////////////////////////////////////////////////// - m0 = mfccc * c1o2+mfbcc * (vvx-c1o2)+(mfacc+c1o36 * oMdrho) * (vx2-vvx) * c1o2; - m1 = -mfccc-two* mfbcc * vvx+mfacc * (one-vx2)-c1o36 * oMdrho * vx2; - m2 = mfccc * c1o2+mfbcc * (vvx+c1o2)+(mfacc+c1o36 * oMdrho) * (vx2+vvx) * c1o2; - mfacc = m0; - mfbcc = m1; - mfccc = m2; - //////////////////////////////////////////////////////////////////////////////////// - - ////////////////////////////////////////////////////////////////////////// - //proof correctness - ////////////////////////////////////////////////////////////////////////// -#ifdef PROOF_CORRECTNESS - LBMReal drho_post = (mfaaa+mfaac+mfaca+mfcaa+mfacc+mfcac+mfccc+mfcca) - +(mfaab+mfacb+mfcab+mfccb)+(mfaba+mfabc+mfcba+mfcbc)+(mfbaa+mfbac+mfbca+mfbcc) - +(mfabb+mfcbb)+(mfbab+mfbcb)+(mfbba+mfbbc)+mfbbb; - //LBMReal dif = fabs(rho - rho_post); - LBMReal dif = drho - drho_post; -#ifdef SINGLEPRECISION - if (dif > 10.0E-7 || dif < -10.0E-7) -#else - if (dif > 10.0E-15 || dif < -10.0E-15) -#endif - { - UB_THROW(UbException(UB_EXARGS, "rho="+UbSystem::toString(drho)+", rho_post="+UbSystem::toString(drho_post) - +" dif="+UbSystem::toString(dif) - +" rho is not correct for node "+UbSystem::toString(x1)+","+UbSystem::toString(x2)+","+UbSystem::toString(x3))); - //UBLOG(logERROR,"LBMKernelETD3Q27CCLB::collideAll(): rho is not correct for node "+UbSystem::toString(x1)+","+UbSystem::toString(x2)+","+UbSystem::toString(x3)); - //exit(EXIT_FAILURE); - } -#endif - ////////////////////////////////////////////////////////////////////////// - //write distribution - ////////////////////////////////////////////////////////////////////////// - (*this->localDistributions)(D3Q27System::ET_E, x1, x2, x3) = mfabb; - (*this->localDistributions)(D3Q27System::ET_N, x1, x2, x3) = mfbab; - (*this->localDistributions)(D3Q27System::ET_T, x1, x2, x3) = mfbba; - (*this->localDistributions)(D3Q27System::ET_NE, x1, x2, x3) = mfaab; - (*this->localDistributions)(D3Q27System::ET_NW, x1p, x2, x3) = mfcab; - (*this->localDistributions)(D3Q27System::ET_TE, x1, x2, x3) = mfaba; - (*this->localDistributions)(D3Q27System::ET_TW, x1p, x2, x3) = mfcba; - (*this->localDistributions)(D3Q27System::ET_TN, x1, x2, x3) = mfbaa; - (*this->localDistributions)(D3Q27System::ET_TS, x1, x2p, x3) = mfbca; - (*this->localDistributions)(D3Q27System::ET_TNE, x1, x2, x3) = mfaaa; - (*this->localDistributions)(D3Q27System::ET_TNW, x1p, x2, x3) = mfcaa; - (*this->localDistributions)(D3Q27System::ET_TSE, x1, x2p, x3) = mfaca; - (*this->localDistributions)(D3Q27System::ET_TSW, x1p, x2p, x3) = mfcca; - - (*this->nonLocalDistributions)(D3Q27System::ET_W, x1p, x2, x3) = mfcbb; - (*this->nonLocalDistributions)(D3Q27System::ET_S, x1, x2p, x3) = mfbcb; - (*this->nonLocalDistributions)(D3Q27System::ET_B, x1, x2, x3p) = mfbbc; - (*this->nonLocalDistributions)(D3Q27System::ET_SW, x1p, x2p, x3) = mfccb; - (*this->nonLocalDistributions)(D3Q27System::ET_SE, x1, x2p, x3) = mfacb; - (*this->nonLocalDistributions)(D3Q27System::ET_BW, x1p, x2, x3p) = mfcbc; - (*this->nonLocalDistributions)(D3Q27System::ET_BE, x1, x2, x3p) = mfabc; - (*this->nonLocalDistributions)(D3Q27System::ET_BS, x1, x2p, x3p) = mfbcc; - (*this->nonLocalDistributions)(D3Q27System::ET_BN, x1, x2, x3p) = mfbac; - (*this->nonLocalDistributions)(D3Q27System::ET_BSW, x1p, x2p, x3p) = mfccc; - (*this->nonLocalDistributions)(D3Q27System::ET_BSE, x1, x2p, x3p) = mfacc; - (*this->nonLocalDistributions)(D3Q27System::ET_BNW, x1p, x2, x3p) = mfcac; - (*this->nonLocalDistributions)(D3Q27System::ET_BNE, x1, x2, x3p) = mfaac; - - (*this->zeroDistributions)(x1, x2, x3) = mfbbb; - ////////////////////////////////////////////////////////////////////////// - - } - } - } - } - - } -} -////////////////////////////////////////////////////////////////////////// -double CompressibleCumulantLBMKernel::getCalculationTime() -{ - //return timer.getDuration(); - return timer.getTotalTime(); -} -////////////////////////////////////////////////////////////////////////// -void CompressibleCumulantLBMKernel::setBulkOmegaToOmega(bool value) -{ - bulkOmegaToOmega = value; -} diff --git a/src/VirtualFluids/LBM/CompressibleCumulantLBMKernel.h b/src/VirtualFluids/LBM/CompressibleCumulantLBMKernel.h deleted file mode 100644 index 1012c3707..000000000 --- a/src/VirtualFluids/LBM/CompressibleCumulantLBMKernel.h +++ /dev/null @@ -1,72 +0,0 @@ -#ifndef CompressibleCumulantLBMKernel_h__ -#define CompressibleCumulantLBMKernel_h__ - -#include "LBMKernel.h" -#include "BCProcessor.h" -#include "D3Q27System.h" -#include <boost/serialization/export.hpp> -#include "basics/utilities/UbTiming.h" -#include "basics/container/CbArray4D.h" -#include "basics/container/CbArray3D.h" - -class CompressibleCumulantLBMKernel; -typedef std::shared_ptr<CompressibleCumulantLBMKernel> CompressibleCumulantLBMKernelPtr; - -//! \brief compressible cumulant LBM kernel. -//! \details CFD solver that use Cascaded Cumulant Lattice Boltzmann method for D3Q27 model -//! \author K. Kutscher, M. Geier -class CompressibleCumulantLBMKernel : public LBMKernel -{ -public: - //! This option set relaxation parameter: NORMAL - enum Parameter{NORMAL, MAGIC}; -public: - CompressibleCumulantLBMKernel(); - //! Constructor - //! \param nx1 number of nodes in x dimension - //! \param nx2 number of nodes in y dimension - //! \param nx3 number of nodes in z dimension - //! \param p set relaxation parameter: NORMAL is OxyyMxzz = 1.0 and MAGIC is OxyyMxzz = 2.0 +(-collFactor) - CompressibleCumulantLBMKernel(int nx1, int nx2, int nx3, Parameter p); - virtual ~CompressibleCumulantLBMKernel(void); - virtual void calculate(); - virtual LBMKernelPtr clone(); - double getCalculationTime(); - void setBulkOmegaToOmega(bool value); -protected: - friend class boost::serialization::access; - template<class Archive> - void serialize(Archive & ar, const unsigned int version) - { - ar & boost::serialization::base_object<LBMKernel>(*this); - ar & OxyyMxzz; - ar & parameter; - } - - virtual void collideAll(); - virtual void init(); - LBMReal f[D3Q27System::ENDF+1]; - - UbTimer timer; - - LBMReal OxyyMxzz; - Parameter parameter; - - CbArray4D<LBMReal,IndexerX4X3X2X1>::CbArray4DPtr localDistributions; - CbArray4D<LBMReal,IndexerX4X3X2X1>::CbArray4DPtr nonLocalDistributions; - CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr zeroDistributions; - - mu::value_type muX1,muX2,muX3; - mu::value_type muDeltaT; - mu::value_type muNu; - LBMReal forcingX1; - LBMReal forcingX2; - LBMReal forcingX3; - - // bulk viscosity - bool bulkOmegaToOmega; - LBMReal OxxPyyPzz; -}; -#endif // CompressibleCumulantLBMKernel_h__ - - diff --git a/src/VirtualFluids/LBM/CompressibleOffsetInterpolationProcessor.cpp b/src/VirtualFluids/LBM/CompressibleOffsetInterpolationProcessor.cpp deleted file mode 100644 index 7c6601831..000000000 --- a/src/VirtualFluids/LBM/CompressibleOffsetInterpolationProcessor.cpp +++ /dev/null @@ -1,722 +0,0 @@ -#include "CompressibleOffsetInterpolationProcessor.h" -#include "D3Q27System.h" - - - -CompressibleOffsetInterpolationProcessor::CompressibleOffsetInterpolationProcessor() - : omegaC(0.0), omegaF(0.0) -{ - //forcingC = 0; //9.99685e-7; - //forcingF = 0; //forcingC*0.5; -} -////////////////////////////////////////////////////////////////////////// -CompressibleOffsetInterpolationProcessor::CompressibleOffsetInterpolationProcessor(LBMReal omegaC, LBMReal omegaF) - : omegaC(omegaC), omegaF(omegaF) -{ - -} -////////////////////////////////////////////////////////////////////////// -CompressibleOffsetInterpolationProcessor::~CompressibleOffsetInterpolationProcessor() -{ - -} -////////////////////////////////////////////////////////////////////////// -InterpolationProcessorPtr CompressibleOffsetInterpolationProcessor::clone() -{ - InterpolationProcessorPtr iproc = InterpolationProcessorPtr (new CompressibleOffsetInterpolationProcessor(this->omegaC, this->omegaF)); - //std::dynamic_pointer_cast<D3Q27IncompressibleOffsetInterpolationProcessor>(iproc)->forcingC = forcingC; - //std::dynamic_pointer_cast<D3Q27IncompressibleOffsetInterpolationProcessor>(iproc)->forcingF = forcingF; - return iproc; -} -////////////////////////////////////////////////////////////////////////// -void CompressibleOffsetInterpolationProcessor::setOmegas( LBMReal omegaC, LBMReal omegaF ) -{ - this->omegaC = omegaC; - this->omegaF = omegaF; -} -////////////////////////////////////////////////////////////////////////// -void CompressibleOffsetInterpolationProcessor::setOffsets(LBMReal xoff, LBMReal yoff, LBMReal zoff) -{ - this->xoff = xoff; - this->yoff = yoff; - this->zoff = zoff; - this->xoff_sq = xoff * xoff; - this->yoff_sq = yoff * yoff; - this->zoff_sq = zoff * zoff; -} -////////////////////////////////////////////////////////////////////////// -void CompressibleOffsetInterpolationProcessor::interpolateCoarseToFine(D3Q27ICell& icellC, D3Q27ICell& icellF, LBMReal xoff, LBMReal yoff, LBMReal zoff) -{ - setOffsets(xoff, yoff, zoff); - calcInterpolatedCoefficiets(icellC, omegaC, 0.5); - calcInterpolatedNodeCF(icellF.BSW, omegaF, -0.25, -0.25, -0.25, calcPressBSW(), -1, -1, -1); - calcInterpolatedNodeCF(icellF.BNE, omegaF, 0.25, 0.25, -0.25, calcPressBNE(), 1, 1, -1); - calcInterpolatedNodeCF(icellF.TNW, omegaF, -0.25, 0.25, 0.25, calcPressTNW(), -1, 1, 1); - calcInterpolatedNodeCF(icellF.TSE, omegaF, 0.25, -0.25, 0.25, calcPressTSE(), 1, -1, 1); - calcInterpolatedNodeCF(icellF.BNW, omegaF, -0.25, 0.25, -0.25, calcPressBNW(), -1, 1, -1); - calcInterpolatedNodeCF(icellF.BSE, omegaF, 0.25, -0.25, -0.25, calcPressBSE(), 1, -1, -1); - calcInterpolatedNodeCF(icellF.TSW, omegaF, -0.25, -0.25, 0.25, calcPressTSW(), -1, -1, 1); - calcInterpolatedNodeCF(icellF.TNE, omegaF, 0.25, 0.25, 0.25, calcPressTNE(), 1, 1, 1); -} -////////////////////////////////////////////////////////////////////////// -void CompressibleOffsetInterpolationProcessor::interpolateFineToCoarse(D3Q27ICell& icellF, LBMReal* icellC, LBMReal xoff, LBMReal yoff, LBMReal zoff) -{ - setOffsets(xoff, yoff, zoff); - calcInterpolatedCoefficiets(icellF, omegaF, 2.0); - calcInterpolatedNodeFC(icellC, omegaC); -} -////////////////////////////////////////////////////////////////////////// -void CompressibleOffsetInterpolationProcessor::calcMoments(const LBMReal* const f, LBMReal omega, LBMReal& press, LBMReal& vx1, LBMReal& vx2, LBMReal& vx3, - LBMReal& kxy, LBMReal& kyz, LBMReal& kxz, LBMReal& kxxMyy, LBMReal& kxxMzz) -{ - using namespace D3Q27System; - - LBMReal drho = 0.0; - D3Q27System::calcCompMacroscopicValues(f,drho,vx1,vx2,vx3); - - press = drho; //interpolate rho! - - kxy = -3.*omega*((((f[TSW]+f[BNE])-(f[TNW]+f[BSE]))+((f[BSW]+f[TNE])-(f[BNW]+f[TSE])))+((f[SW]+f[NE])-(f[NW]+f[SE]))/(one + drho)-(vx1*vx2));// might not be optimal MG 25.2.13 - kyz = -3.*omega*((((f[BSW]+f[TNE])-(f[TSE]+f[BNW]))+((f[BSE]+f[TNW])-(f[TSW]+f[BNE])))+((f[BS]+f[TN])-(f[TS]+f[BN]))/(one + drho)-(vx2*vx3)); - kxz = -3.*omega*((((f[BNW]+f[TSE])-(f[TSW]+f[BNE]))+((f[BSW]+f[TNE])-(f[BSE]+f[TNW])))+((f[BW]+f[TE])-(f[TW]+f[BE]))/(one + drho)-(vx1*vx3)); - kxxMyy = -3./2.*omega*((((f[BW]+f[TE])-(f[BS]+f[TN]))+((f[TW]+f[BE])-(f[TS]+f[BN])))+((f[W]+f[E])-(f[S]+f[N]))/(one + drho)-(vx1*vx1-vx2*vx2)); - kxxMzz = -3./2.*omega*((((f[NW]+f[SE])-(f[BS]+f[TN]))+((f[SW]+f[NE])-(f[TS]+f[BN])))+((f[W]+f[E])-(f[B]+f[T]))/(one + drho)-(vx1*vx1-vx3*vx3)); -} -////////////////////////////////////////////////////////////////////////// -void CompressibleOffsetInterpolationProcessor::calcInterpolatedCoefficiets(const D3Q27ICell& icell, LBMReal omega, LBMReal eps_new) -{ - LBMReal vx1_SWT,vx2_SWT,vx3_SWT; - LBMReal vx1_NWT,vx2_NWT,vx3_NWT; - LBMReal vx1_NET,vx2_NET,vx3_NET; - LBMReal vx1_SET,vx2_SET,vx3_SET; - LBMReal vx1_SWB,vx2_SWB,vx3_SWB; - LBMReal vx1_NWB,vx2_NWB,vx3_NWB; - LBMReal vx1_NEB,vx2_NEB,vx3_NEB; - LBMReal vx1_SEB,vx2_SEB,vx3_SEB; - - LBMReal kxyFromfcNEQ_SWT, kyzFromfcNEQ_SWT, kxzFromfcNEQ_SWT, kxxMyyFromfcNEQ_SWT, kxxMzzFromfcNEQ_SWT; - LBMReal kxyFromfcNEQ_NWT, kyzFromfcNEQ_NWT, kxzFromfcNEQ_NWT, kxxMyyFromfcNEQ_NWT, kxxMzzFromfcNEQ_NWT; - LBMReal kxyFromfcNEQ_NET, kyzFromfcNEQ_NET, kxzFromfcNEQ_NET, kxxMyyFromfcNEQ_NET, kxxMzzFromfcNEQ_NET; - LBMReal kxyFromfcNEQ_SET, kyzFromfcNEQ_SET, kxzFromfcNEQ_SET, kxxMyyFromfcNEQ_SET, kxxMzzFromfcNEQ_SET; - LBMReal kxyFromfcNEQ_SWB, kyzFromfcNEQ_SWB, kxzFromfcNEQ_SWB, kxxMyyFromfcNEQ_SWB, kxxMzzFromfcNEQ_SWB; - LBMReal kxyFromfcNEQ_NWB, kyzFromfcNEQ_NWB, kxzFromfcNEQ_NWB, kxxMyyFromfcNEQ_NWB, kxxMzzFromfcNEQ_NWB; - LBMReal kxyFromfcNEQ_NEB, kyzFromfcNEQ_NEB, kxzFromfcNEQ_NEB, kxxMyyFromfcNEQ_NEB, kxxMzzFromfcNEQ_NEB; - LBMReal kxyFromfcNEQ_SEB, kyzFromfcNEQ_SEB, kxzFromfcNEQ_SEB, kxxMyyFromfcNEQ_SEB, kxxMzzFromfcNEQ_SEB; - - calcMoments(icell.TSW,omega,press_SWT,vx1_SWT,vx2_SWT,vx3_SWT, kxyFromfcNEQ_SWT, kyzFromfcNEQ_SWT, kxzFromfcNEQ_SWT, kxxMyyFromfcNEQ_SWT, kxxMzzFromfcNEQ_SWT); - calcMoments(icell.TNW,omega,press_NWT,vx1_NWT,vx2_NWT,vx3_NWT, kxyFromfcNEQ_NWT, kyzFromfcNEQ_NWT, kxzFromfcNEQ_NWT, kxxMyyFromfcNEQ_NWT, kxxMzzFromfcNEQ_NWT); - calcMoments(icell.TNE,omega,press_NET,vx1_NET,vx2_NET,vx3_NET, kxyFromfcNEQ_NET, kyzFromfcNEQ_NET, kxzFromfcNEQ_NET, kxxMyyFromfcNEQ_NET, kxxMzzFromfcNEQ_NET); - calcMoments(icell.TSE,omega,press_SET,vx1_SET,vx2_SET,vx3_SET, kxyFromfcNEQ_SET, kyzFromfcNEQ_SET, kxzFromfcNEQ_SET, kxxMyyFromfcNEQ_SET, kxxMzzFromfcNEQ_SET); - calcMoments(icell.BSW,omega,press_SWB,vx1_SWB,vx2_SWB,vx3_SWB, kxyFromfcNEQ_SWB, kyzFromfcNEQ_SWB, kxzFromfcNEQ_SWB, kxxMyyFromfcNEQ_SWB, kxxMzzFromfcNEQ_SWB); - calcMoments(icell.BNW,omega,press_NWB,vx1_NWB,vx2_NWB,vx3_NWB, kxyFromfcNEQ_NWB, kyzFromfcNEQ_NWB, kxzFromfcNEQ_NWB, kxxMyyFromfcNEQ_NWB, kxxMzzFromfcNEQ_NWB); - calcMoments(icell.BNE,omega,press_NEB,vx1_NEB,vx2_NEB,vx3_NEB, kxyFromfcNEQ_NEB, kyzFromfcNEQ_NEB, kxzFromfcNEQ_NEB, kxxMyyFromfcNEQ_NEB, kxxMzzFromfcNEQ_NEB); - calcMoments(icell.BSE,omega,press_SEB,vx1_SEB,vx2_SEB,vx3_SEB, kxyFromfcNEQ_SEB, kyzFromfcNEQ_SEB, kxzFromfcNEQ_SEB, kxxMyyFromfcNEQ_SEB, kxxMzzFromfcNEQ_SEB); - - //LBMReal dxRho=c1o4*((press_NET-press_SWB)+(press_SET-press_NWB)+(press_NEB-press_SWT)+(press_SEB-press_NWT)); - //LBMReal dyRho=c1o4*((press_NET-press_SWB)-(press_SET-press_NWB)+(press_NEB-press_SWT)-(press_SEB-press_NWT)); - //LBMReal dzRho=c1o4*((press_NET-press_SWB)+(press_SET-press_NWB)-(press_NEB-press_SWT)-(press_SEB-press_NWT)); - - // kxyFromfcNEQ_SWT+=vx1_SWT*dyRho+vx2_SWT*dxRho; - // kxyFromfcNEQ_NWT+=vx1_NWT*dyRho+vx2_NWT*dxRho; - // kxyFromfcNEQ_NET+=vx1_NET*dyRho+vx2_NET*dxRho; - // kxyFromfcNEQ_SET+=vx1_SET*dyRho+vx2_SET*dxRho; - // kxyFromfcNEQ_SWB+=vx1_SWB*dyRho+vx2_SWB*dxRho; - // kxyFromfcNEQ_NWB+=vx1_NWB*dyRho+vx2_NWB*dxRho; - // kxyFromfcNEQ_NEB+=vx1_NEB*dyRho+vx2_NEB*dxRho; - // kxyFromfcNEQ_SEB+=vx1_SEB*dyRho+vx2_SEB*dxRho; - - // kyzFromfcNEQ_SWT+=vx3_SWT*dyRho+vx2_SWT*dzRho; - // kyzFromfcNEQ_NWT+=vx3_NWT*dyRho+vx2_NWT*dzRho; - // kyzFromfcNEQ_NET+=vx3_NET*dyRho+vx2_NET*dzRho; - // kyzFromfcNEQ_SET+=vx3_SET*dyRho+vx2_SET*dzRho; - // kyzFromfcNEQ_SWB+=vx3_SWB*dyRho+vx2_SWB*dzRho; - // kyzFromfcNEQ_NWB+=vx3_NWB*dyRho+vx2_NWB*dzRho; - // kyzFromfcNEQ_NEB+=vx3_NEB*dyRho+vx2_NEB*dzRho; - // kyzFromfcNEQ_SEB+=vx3_SEB*dyRho+vx2_SEB*dzRho; - - // kxzFromfcNEQ_SWT+=vx1_SWT*dzRho+vx3_SWT*dxRho; - // kxzFromfcNEQ_NWT+=vx1_NWT*dzRho+vx3_NWT*dxRho; - // kxzFromfcNEQ_NET+=vx1_NET*dzRho+vx3_NET*dxRho; - // kxzFromfcNEQ_SET+=vx1_SET*dzRho+vx3_SET*dxRho; - // kxzFromfcNEQ_SWB+=vx1_SWB*dzRho+vx3_SWB*dxRho; - // kxzFromfcNEQ_NWB+=vx1_NWB*dzRho+vx3_NWB*dxRho; - // kxzFromfcNEQ_NEB+=vx1_NEB*dzRho+vx3_NEB*dxRho; - // kxzFromfcNEQ_SEB+=vx1_SEB*dzRho+vx3_SEB*dxRho; - - // kxxMyyFromfcNEQ_SWT+=vx1_SWT*dxRho-vx2_SWT*dyRho; - // kxxMyyFromfcNEQ_NWT+=vx1_NWT*dxRho-vx2_NWT*dyRho; - // kxxMyyFromfcNEQ_NET+=vx1_NET*dxRho-vx2_NET*dyRho; - // kxxMyyFromfcNEQ_SET+=vx1_SET*dxRho-vx2_SET*dyRho; - // kxxMyyFromfcNEQ_SWB+=vx1_SWB*dxRho-vx2_SWB*dyRho; - // kxxMyyFromfcNEQ_NWB+=vx1_NWB*dxRho-vx2_NWB*dyRho; - // kxxMyyFromfcNEQ_NEB+=vx1_NEB*dxRho-vx2_NEB*dyRho; - // kxxMyyFromfcNEQ_SEB+=vx1_SEB*dxRho-vx2_SEB*dyRho; - - // kxxMzzFromfcNEQ_SWT+=vx1_SWT*dxRho-vx3_SWT*dzRho; - // kxxMzzFromfcNEQ_NWT+=vx1_NWT*dxRho-vx3_NWT*dzRho; - // kxxMzzFromfcNEQ_NET+=vx1_NET*dxRho-vx3_NET*dzRho; - // kxxMzzFromfcNEQ_SET+=vx1_SET*dxRho-vx3_SET*dzRho; - // kxxMzzFromfcNEQ_SWB+=vx1_SWB*dxRho-vx3_SWB*dzRho; - // kxxMzzFromfcNEQ_NWB+=vx1_NWB*dxRho-vx3_NWB*dzRho; - // kxxMzzFromfcNEQ_NEB+=vx1_NEB*dxRho-vx3_NEB*dzRho; - // kxxMzzFromfcNEQ_SEB+=vx1_SEB*dxRho-vx3_SEB*dzRho; - - - //kxxMzzFromfcNEQ_SWT=0.0; - //kxxMzzFromfcNEQ_NWT=0.0; - //kxxMzzFromfcNEQ_NET=0.0; - //kxxMzzFromfcNEQ_SET=0.0; - //kxxMzzFromfcNEQ_SWB=0.0; - //kxxMzzFromfcNEQ_NWB=0.0; - //kxxMzzFromfcNEQ_NEB=0.0; - //kxxMzzFromfcNEQ_SEB=0.0; - - - - - - a0 = (-kxxMyyFromfcNEQ_NEB - kxxMyyFromfcNEQ_NET + kxxMyyFromfcNEQ_NWB + kxxMyyFromfcNEQ_NWT - - kxxMyyFromfcNEQ_SEB - kxxMyyFromfcNEQ_SET + kxxMyyFromfcNEQ_SWB + kxxMyyFromfcNEQ_SWT - - kxxMzzFromfcNEQ_NEB - kxxMzzFromfcNEQ_NET + kxxMzzFromfcNEQ_NWB + kxxMzzFromfcNEQ_NWT - - kxxMzzFromfcNEQ_SEB - kxxMzzFromfcNEQ_SET + kxxMzzFromfcNEQ_SWB + kxxMzzFromfcNEQ_SWT - - 2.*kxyFromfcNEQ_NEB - 2.*kxyFromfcNEQ_NET - 2.*kxyFromfcNEQ_NWB - 2.*kxyFromfcNEQ_NWT + - 2.*kxyFromfcNEQ_SEB + 2.*kxyFromfcNEQ_SET + 2.*kxyFromfcNEQ_SWB + 2.*kxyFromfcNEQ_SWT + - 2.*kxzFromfcNEQ_NEB - 2.*kxzFromfcNEQ_NET + 2.*kxzFromfcNEQ_NWB - 2.*kxzFromfcNEQ_NWT + - 2.*kxzFromfcNEQ_SEB - 2.*kxzFromfcNEQ_SET + 2.*kxzFromfcNEQ_SWB - 2.*kxzFromfcNEQ_SWT + - 8.*vx1_NEB + 8.*vx1_NET + 8.*vx1_NWB + 8.*vx1_NWT + 8.*vx1_SEB + - 8.*vx1_SET + 8.*vx1_SWB + 8.*vx1_SWT + 2.*vx2_NEB + 2.*vx2_NET - - 2.*vx2_NWB - 2.*vx2_NWT - 2.*vx2_SEB - 2.*vx2_SET + 2.*vx2_SWB + - 2.*vx2_SWT - 2.*vx3_NEB + 2.*vx3_NET + 2.*vx3_NWB - 2.*vx3_NWT - - 2.*vx3_SEB + 2.*vx3_SET + 2.*vx3_SWB - 2.*vx3_SWT)/64.; - b0 = (2.*kxxMyyFromfcNEQ_NEB + 2.*kxxMyyFromfcNEQ_NET + 2.*kxxMyyFromfcNEQ_NWB + 2.*kxxMyyFromfcNEQ_NWT - - 2.*kxxMyyFromfcNEQ_SEB - 2.*kxxMyyFromfcNEQ_SET - 2.*kxxMyyFromfcNEQ_SWB - 2.*kxxMyyFromfcNEQ_SWT - - kxxMzzFromfcNEQ_NEB - kxxMzzFromfcNEQ_NET - kxxMzzFromfcNEQ_NWB - kxxMzzFromfcNEQ_NWT + - kxxMzzFromfcNEQ_SEB + kxxMzzFromfcNEQ_SET + kxxMzzFromfcNEQ_SWB + kxxMzzFromfcNEQ_SWT - - 2.*kxyFromfcNEQ_NEB - 2.*kxyFromfcNEQ_NET + 2.*kxyFromfcNEQ_NWB + 2.*kxyFromfcNEQ_NWT - - 2.*kxyFromfcNEQ_SEB - 2.*kxyFromfcNEQ_SET + 2.*kxyFromfcNEQ_SWB + 2.*kxyFromfcNEQ_SWT + - 2.*kyzFromfcNEQ_NEB - 2.*kyzFromfcNEQ_NET + 2.*kyzFromfcNEQ_NWB - 2.*kyzFromfcNEQ_NWT + - 2.*kyzFromfcNEQ_SEB - 2.*kyzFromfcNEQ_SET + 2.*kyzFromfcNEQ_SWB - 2.*kyzFromfcNEQ_SWT + - 2.*vx1_NEB + 2.*vx1_NET - 2.*vx1_NWB - 2.*vx1_NWT - - 2.*vx1_SEB - 2.*vx1_SET + 2.*vx1_SWB + 2.*vx1_SWT + - 8.*vx2_NEB + 8.*vx2_NET + 8.*vx2_NWB + 8.*vx2_NWT + - 8.*vx2_SEB + 8.*vx2_SET + 8.*vx2_SWB + 8.*vx2_SWT - - 2.*vx3_NEB + 2.*vx3_NET - 2.*vx3_NWB + 2.*vx3_NWT + - 2.*vx3_SEB - 2.*vx3_SET + 2.*vx3_SWB - 2.*vx3_SWT)/64.; - c0 = (kxxMyyFromfcNEQ_NEB - kxxMyyFromfcNEQ_NET + kxxMyyFromfcNEQ_NWB - kxxMyyFromfcNEQ_NWT + - kxxMyyFromfcNEQ_SEB - kxxMyyFromfcNEQ_SET + kxxMyyFromfcNEQ_SWB - kxxMyyFromfcNEQ_SWT - - 2.*kxxMzzFromfcNEQ_NEB + 2.*kxxMzzFromfcNEQ_NET - 2.*kxxMzzFromfcNEQ_NWB + 2.*kxxMzzFromfcNEQ_NWT - - 2.*kxxMzzFromfcNEQ_SEB + 2.*kxxMzzFromfcNEQ_SET - 2.*kxxMzzFromfcNEQ_SWB + 2.*kxxMzzFromfcNEQ_SWT - - 2.*kxzFromfcNEQ_NEB - 2.*kxzFromfcNEQ_NET + 2.*kxzFromfcNEQ_NWB + 2.*kxzFromfcNEQ_NWT - - 2.*kxzFromfcNEQ_SEB - 2.*kxzFromfcNEQ_SET + 2.*kxzFromfcNEQ_SWB + 2.*kxzFromfcNEQ_SWT - - 2.*kyzFromfcNEQ_NEB - 2.*kyzFromfcNEQ_NET - 2.*kyzFromfcNEQ_NWB - 2.*kyzFromfcNEQ_NWT + - 2.*kyzFromfcNEQ_SEB + 2.*kyzFromfcNEQ_SET + 2.*kyzFromfcNEQ_SWB + 2.*kyzFromfcNEQ_SWT - - 2.*vx1_NEB + 2.*vx1_NET + 2.*vx1_NWB - 2.*vx1_NWT - - 2.*vx1_SEB + 2.*vx1_SET + 2.*vx1_SWB - 2.*vx1_SWT - - 2.*vx2_NEB + 2.*vx2_NET - 2.*vx2_NWB + 2.*vx2_NWT + - 2.*vx2_SEB - 2.*vx2_SET + 2.*vx2_SWB - 2.*vx2_SWT + - 8.*vx3_NEB + 8.*vx3_NET + 8.*vx3_NWB + 8.*vx3_NWT + - 8.*vx3_SEB + 8.*vx3_SET + 8.*vx3_SWB + 8.*vx3_SWT)/64.; - ax = (vx1_NEB + vx1_NET - vx1_NWB - vx1_NWT + vx1_SEB + vx1_SET - vx1_SWB - vx1_SWT)/4.; - bx = (vx2_NEB + vx2_NET - vx2_NWB - vx2_NWT + vx2_SEB + vx2_SET - vx2_SWB - vx2_SWT)/4.; - cx = (vx3_NEB + vx3_NET - vx3_NWB - vx3_NWT + vx3_SEB + vx3_SET - vx3_SWB - vx3_SWT)/4.; - axx= (kxxMyyFromfcNEQ_NEB + kxxMyyFromfcNEQ_NET - kxxMyyFromfcNEQ_NWB - kxxMyyFromfcNEQ_NWT + - kxxMyyFromfcNEQ_SEB + kxxMyyFromfcNEQ_SET - kxxMyyFromfcNEQ_SWB - kxxMyyFromfcNEQ_SWT + - kxxMzzFromfcNEQ_NEB + kxxMzzFromfcNEQ_NET - kxxMzzFromfcNEQ_NWB - kxxMzzFromfcNEQ_NWT + - kxxMzzFromfcNEQ_SEB + kxxMzzFromfcNEQ_SET - kxxMzzFromfcNEQ_SWB - kxxMzzFromfcNEQ_SWT + - 2.*vx2_NEB + 2.*vx2_NET - 2.*vx2_NWB - 2.*vx2_NWT - - 2.*vx2_SEB - 2.*vx2_SET + 2.*vx2_SWB + 2.*vx2_SWT - - 2.*vx3_NEB + 2.*vx3_NET + 2.*vx3_NWB - 2.*vx3_NWT - - 2.*vx3_SEB + 2.*vx3_SET + 2.*vx3_SWB - 2.*vx3_SWT)/16.; - bxx= (kxyFromfcNEQ_NEB + kxyFromfcNEQ_NET - kxyFromfcNEQ_NWB - kxyFromfcNEQ_NWT + - kxyFromfcNEQ_SEB + kxyFromfcNEQ_SET - kxyFromfcNEQ_SWB - kxyFromfcNEQ_SWT - - 2.*vx1_NEB - 2.*vx1_NET + 2.*vx1_NWB + 2.*vx1_NWT + - 2.*vx1_SEB + 2.*vx1_SET - 2.*vx1_SWB - 2.*vx1_SWT)/8.; - cxx= (kxzFromfcNEQ_NEB + kxzFromfcNEQ_NET - kxzFromfcNEQ_NWB - kxzFromfcNEQ_NWT + - kxzFromfcNEQ_SEB + kxzFromfcNEQ_SET - kxzFromfcNEQ_SWB - kxzFromfcNEQ_SWT + - 2.*vx1_NEB - 2.*vx1_NET - 2.*vx1_NWB + 2.*vx1_NWT + - 2.*vx1_SEB - 2.*vx1_SET - 2.*vx1_SWB + 2.*vx1_SWT)/8.; - ay = (vx1_NEB + vx1_NET + vx1_NWB + vx1_NWT - vx1_SEB - vx1_SET - vx1_SWB - vx1_SWT)/4.; - by = (vx2_NEB + vx2_NET + vx2_NWB + vx2_NWT - vx2_SEB - vx2_SET - vx2_SWB - vx2_SWT)/4.; - cy = (vx3_NEB + vx3_NET + vx3_NWB + vx3_NWT - vx3_SEB - vx3_SET - vx3_SWB - vx3_SWT)/4.; - ayy= (kxyFromfcNEQ_NEB + kxyFromfcNEQ_NET + kxyFromfcNEQ_NWB + kxyFromfcNEQ_NWT - - kxyFromfcNEQ_SEB - kxyFromfcNEQ_SET - kxyFromfcNEQ_SWB - kxyFromfcNEQ_SWT - - 2.*vx2_NEB - 2.*vx2_NET + 2.*vx2_NWB + 2.*vx2_NWT + - 2.*vx2_SEB + 2.*vx2_SET - 2.*vx2_SWB - 2.*vx2_SWT)/8.; - byy= (-2.*kxxMyyFromfcNEQ_NEB - 2.*kxxMyyFromfcNEQ_NET - 2.*kxxMyyFromfcNEQ_NWB - 2.*kxxMyyFromfcNEQ_NWT + - 2.*kxxMyyFromfcNEQ_SEB + 2.*kxxMyyFromfcNEQ_SET + 2.*kxxMyyFromfcNEQ_SWB + 2.*kxxMyyFromfcNEQ_SWT + - kxxMzzFromfcNEQ_NEB + kxxMzzFromfcNEQ_NET + kxxMzzFromfcNEQ_NWB + kxxMzzFromfcNEQ_NWT - - kxxMzzFromfcNEQ_SEB - kxxMzzFromfcNEQ_SET - kxxMzzFromfcNEQ_SWB - kxxMzzFromfcNEQ_SWT + - 2.*vx1_NEB + 2.*vx1_NET - 2.*vx1_NWB - 2.*vx1_NWT - - 2.*vx1_SEB - 2.*vx1_SET + 2.*vx1_SWB + 2.*vx1_SWT - - 2.*vx3_NEB + 2.*vx3_NET - 2.*vx3_NWB + 2.*vx3_NWT + - 2.*vx3_SEB - 2.*vx3_SET + 2.*vx3_SWB - 2.*vx3_SWT)/16.; - cyy= (kyzFromfcNEQ_NEB + kyzFromfcNEQ_NET + kyzFromfcNEQ_NWB + kyzFromfcNEQ_NWT - - kyzFromfcNEQ_SEB - kyzFromfcNEQ_SET - kyzFromfcNEQ_SWB - kyzFromfcNEQ_SWT + - 2.*vx2_NEB - 2.*vx2_NET + 2.*vx2_NWB - 2.*vx2_NWT - - 2.*vx2_SEB + 2.*vx2_SET - 2.*vx2_SWB + 2.*vx2_SWT)/8.; - az = (-vx1_NEB + vx1_NET - vx1_NWB + vx1_NWT - vx1_SEB + vx1_SET - vx1_SWB + vx1_SWT)/4.; - bz = (-vx2_NEB + vx2_NET - vx2_NWB + vx2_NWT - vx2_SEB + vx2_SET - vx2_SWB + vx2_SWT)/4.; - cz = (-vx3_NEB + vx3_NET - vx3_NWB + vx3_NWT - vx3_SEB + vx3_SET - vx3_SWB + vx3_SWT)/4.; - azz= (-kxzFromfcNEQ_NEB + kxzFromfcNEQ_NET - kxzFromfcNEQ_NWB + kxzFromfcNEQ_NWT - - kxzFromfcNEQ_SEB + kxzFromfcNEQ_SET - kxzFromfcNEQ_SWB + kxzFromfcNEQ_SWT + - 2.*vx3_NEB - 2.*vx3_NET - 2.*vx3_NWB + 2.*vx3_NWT + - 2.*vx3_SEB - 2.*vx3_SET - 2.*vx3_SWB + 2.*vx3_SWT)/8.; - bzz= (-kyzFromfcNEQ_NEB + kyzFromfcNEQ_NET - kyzFromfcNEQ_NWB + kyzFromfcNEQ_NWT - - kyzFromfcNEQ_SEB + kyzFromfcNEQ_SET - kyzFromfcNEQ_SWB + kyzFromfcNEQ_SWT + - 2.*vx3_NEB - 2.*vx3_NET + 2.*vx3_NWB - 2.*vx3_NWT - - 2.*vx3_SEB + 2.*vx3_SET - 2.*vx3_SWB + 2.*vx3_SWT)/8.; - czz= (-kxxMyyFromfcNEQ_NEB + kxxMyyFromfcNEQ_NET - kxxMyyFromfcNEQ_NWB + kxxMyyFromfcNEQ_NWT - - kxxMyyFromfcNEQ_SEB + kxxMyyFromfcNEQ_SET - kxxMyyFromfcNEQ_SWB + kxxMyyFromfcNEQ_SWT + - 2.*kxxMzzFromfcNEQ_NEB - 2.*kxxMzzFromfcNEQ_NET + 2.*kxxMzzFromfcNEQ_NWB - 2.*kxxMzzFromfcNEQ_NWT + - 2.*kxxMzzFromfcNEQ_SEB - 2.*kxxMzzFromfcNEQ_SET + 2.*kxxMzzFromfcNEQ_SWB - 2.*kxxMzzFromfcNEQ_SWT - - 2.*vx1_NEB + 2.*vx1_NET + 2.*vx1_NWB - 2.*vx1_NWT - - 2.*vx1_SEB + 2.*vx1_SET + 2.*vx1_SWB - 2.*vx1_SWT - - 2.*vx2_NEB + 2.*vx2_NET - 2.*vx2_NWB + 2.*vx2_NWT + - 2.*vx2_SEB - 2.*vx2_SET + 2.*vx2_SWB - 2.*vx2_SWT)/16.; - axy= (vx1_NEB + vx1_NET - vx1_NWB - vx1_NWT - vx1_SEB - vx1_SET + vx1_SWB + vx1_SWT)/2.; - bxy= (vx2_NEB + vx2_NET - vx2_NWB - vx2_NWT - vx2_SEB - vx2_SET + vx2_SWB + vx2_SWT)/2.; - cxy= (vx3_NEB + vx3_NET - vx3_NWB - vx3_NWT - vx3_SEB - vx3_SET + vx3_SWB + vx3_SWT)/2.; - axz= (-vx1_NEB + vx1_NET + vx1_NWB - vx1_NWT - vx1_SEB + vx1_SET + vx1_SWB - vx1_SWT)/2.; - bxz= (-vx2_NEB + vx2_NET + vx2_NWB - vx2_NWT - vx2_SEB + vx2_SET + vx2_SWB - vx2_SWT)/2.; - cxz= (-vx3_NEB + vx3_NET + vx3_NWB - vx3_NWT - vx3_SEB + vx3_SET + vx3_SWB - vx3_SWT)/2.; - ayz= (-vx1_NEB + vx1_NET - vx1_NWB + vx1_NWT + vx1_SEB - vx1_SET + vx1_SWB - vx1_SWT)/2.; - byz= (-vx2_NEB + vx2_NET - vx2_NWB + vx2_NWT + vx2_SEB - vx2_SET + vx2_SWB - vx2_SWT)/2.; - cyz= (-vx3_NEB + vx3_NET - vx3_NWB + vx3_NWT + vx3_SEB - vx3_SET + vx3_SWB - vx3_SWT)/2.; - axyz=-vx1_NEB + vx1_NET + vx1_NWB - vx1_NWT + vx1_SEB - vx1_SET - vx1_SWB + vx1_SWT; - bxyz=-vx2_NEB + vx2_NET + vx2_NWB - vx2_NWT + vx2_SEB - vx2_SET - vx2_SWB + vx2_SWT; - cxyz=-vx3_NEB + vx3_NET + vx3_NWB - vx3_NWT + vx3_SEB - vx3_SET - vx3_SWB + vx3_SWT; - - - ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - kxyAverage =0;//(kxyFromfcNEQ_SWB+ - //kxyFromfcNEQ_SWT+ - //kxyFromfcNEQ_SET+ - //kxyFromfcNEQ_SEB+ - //kxyFromfcNEQ_NWB+ - //kxyFromfcNEQ_NWT+ - //kxyFromfcNEQ_NET+ - //kxyFromfcNEQ_NEB)*c1o8-(ay+bx); - kyzAverage =0;//(kyzFromfcNEQ_SWB+ - //kyzFromfcNEQ_SWT+ - //kyzFromfcNEQ_SET+ - //kyzFromfcNEQ_SEB+ - //kyzFromfcNEQ_NWB+ - //kyzFromfcNEQ_NWT+ - //kyzFromfcNEQ_NET+ - //kyzFromfcNEQ_NEB)*c1o8-(bz+cy); - kxzAverage =0;//(kxzFromfcNEQ_SWB+ - //kxzFromfcNEQ_SWT+ - //kxzFromfcNEQ_SET+ - //kxzFromfcNEQ_SEB+ - //kxzFromfcNEQ_NWB+ - //kxzFromfcNEQ_NWT+ - //kxzFromfcNEQ_NET+ - //kxzFromfcNEQ_NEB)*c1o8-(az+cx); - kxxMyyAverage =0;//(kxxMyyFromfcNEQ_SWB+ - //kxxMyyFromfcNEQ_SWT+ - //kxxMyyFromfcNEQ_SET+ - //kxxMyyFromfcNEQ_SEB+ - //kxxMyyFromfcNEQ_NWB+ - //kxxMyyFromfcNEQ_NWT+ - //kxxMyyFromfcNEQ_NET+ - //kxxMyyFromfcNEQ_NEB)*c1o8-(ax-by); - kxxMzzAverage =0;//(kxxMzzFromfcNEQ_SWB+ - //kxxMzzFromfcNEQ_SWT+ - //kxxMzzFromfcNEQ_SET+ - //kxxMzzFromfcNEQ_SEB+ - //kxxMzzFromfcNEQ_NWB+ - //kxxMzzFromfcNEQ_NWT+ - //kxxMzzFromfcNEQ_NET+ - //kxxMzzFromfcNEQ_NEB)*c1o8-(ax-cz); - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - // - // Bernd das Brot - // - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - a0 = a0 + xoff * ax + yoff * ay + zoff * az + xoff_sq * axx + yoff_sq * ayy + zoff_sq * azz + xoff*yoff*axy + xoff*zoff*axz + yoff*zoff*ayz + xoff*yoff*zoff*axyz ; - ax = ax + 2. * xoff * axx + yoff * axy + zoff * axz + yoff*zoff*axyz; - ay = ay + 2. * yoff * ayy + xoff * axy + zoff * ayz + xoff*zoff*axyz; - az = az + 2. * zoff * azz + xoff * axz + yoff * ayz + xoff*yoff*axyz; - b0 = b0 + xoff * bx + yoff * by + zoff * bz + xoff_sq * bxx + yoff_sq * byy + zoff_sq * bzz + xoff*yoff*bxy + xoff*zoff*bxz + yoff*zoff*byz + xoff*yoff*zoff*bxyz; - bx = bx + 2. * xoff * bxx + yoff * bxy + zoff * bxz + yoff*zoff*bxyz; - by = by + 2. * yoff * byy + xoff * bxy + zoff * byz + xoff*zoff*bxyz; - bz = bz + 2. * zoff * bzz + xoff * bxz + yoff * byz + xoff*yoff*bxyz; - c0 = c0 + xoff * cx + yoff * cy + zoff * cz + xoff_sq * cxx + yoff_sq * cyy + zoff_sq * czz + xoff*yoff*cxy + xoff*zoff*cxz + yoff*zoff*cyz + xoff*yoff*zoff*cxyz; - cx = cx + 2. * xoff * cxx + yoff * cxy + zoff * cxz + yoff*zoff*cxyz; - cy = cy + 2. * yoff * cyy + xoff * cxy + zoff * cyz + xoff*zoff*cxyz; - cz = cz + 2. * zoff * czz + xoff * cxz + yoff * cyz + xoff*yoff*cxyz; - axy= axy + zoff*axyz; - axz= axz + yoff*axyz; - ayz= ayz + xoff*axyz; - bxy= bxy + zoff*bxyz; - bxz= bxz + yoff*bxyz; - byz= byz + xoff*bxyz; - cxy= cxy + zoff*cxyz; - cxz= cxz + yoff*cxyz; - cyz= cyz + xoff*cxyz; - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - const LBMReal o = omega; - - f_E = eps_new*((2*(-2*ax + by + cz-kxxMzzAverage-kxxMyyAverage))/(27.*o)); - f_N = eps_new*((2*(ax - 2*by + cz+2*kxxMyyAverage-kxxMzzAverage))/(27.*o)); - f_T = eps_new*((2*(ax + by - 2*cz-kxxMyyAverage+2*kxxMzzAverage))/(27.*o)); - f_NE = eps_new*(-(ax + 3*ay + 3*bx + by - 2*cz+2*kxxMyyAverage-kxxMyyAverage+3*kxyAverage)/(54.*o)); - f_SE = eps_new*(-(ax - 3*ay - 3*bx + by - 2*cz+2*kxxMyyAverage-kxxMyyAverage-3*kxyAverage)/(54.*o)); - f_TE = eps_new*(-(ax + 3*az - 2*by + 3*cx + cz+2*kxxMyyAverage-kxxMzzAverage+3*kxzAverage)/(54.*o)); - f_BE = eps_new*(-(ax - 3*az - 2*by - 3*cx + cz+2*kxxMyyAverage-kxxMzzAverage-3*kxzAverage)/(54.*o)); - f_TN = eps_new*(-(-2*ax + by + 3*bz + 3*cy + cz-kxxMyyAverage-kxxMzzAverage+3*kyzAverage)/(54.*o)); - f_BN = eps_new*(-(-2*ax + by - 3*bz - 3*cy + cz-kxxMyyAverage-kxxMzzAverage-3*kyzAverage)/(54.*o)); - f_ZERO = 0.; - f_TNE = eps_new*(-(ay + az + bx + bz + cx + cy+kxyAverage+kxzAverage+kyzAverage)/(72.*o)); - f_TSW = eps_new*((-ay + az - bx + bz + cx + cy-kxyAverage+kxzAverage+kyzAverage)/(72.*o)); - f_TSE = eps_new*((ay - az + bx + bz - cx + cy+kxyAverage-kxzAverage+kyzAverage)/(72.*o)); - f_TNW = eps_new*((ay + az + bx - bz + cx - cy+kxyAverage+kxzAverage-kyzAverage)/(72.*o)); - - x_E = 0.25*eps_new*((2*(-4*axx + bxy + cxz))/(27.*o)); - x_N = 0.25*eps_new*((2*(2*axx - 2*bxy + cxz))/(27.*o)); - x_T = 0.25*eps_new*((2*(2*axx + bxy - 2*cxz))/(27.*o)); - x_NE = 0.25*eps_new*(-((2*axx + 3*axy + 6*bxx + bxy - 2*cxz))/(54.*o)); - x_SE = 0.25*eps_new*(-((2*axx - 3*axy - 6*bxx + bxy - 2*cxz))/(54.*o)); - x_TE = 0.25*eps_new*(-((2*axx + 3*axz - 2*bxy + 6*cxx + cxz))/(54.*o)); - x_BE = 0.25*eps_new*(-((2*axx - 3*axz - 2*bxy - 6*cxx + cxz))/(54.*o)); - x_TN = 0.25*eps_new*(-((-4*axx + bxy + 3*bxz + 3*cxy + cxz))/(54.*o)); - x_BN = 0.25*eps_new*(-((-4*axx + bxy - 3*bxz - 3*cxy + cxz))/(54.*o)); - x_ZERO = 0.; - x_TNE = 0.25*eps_new*(-((axy + axz + 2*bxx + bxz + 2*cxx + cxy))/(72.*o)); - x_TSW = 0.25*eps_new*(((-axy + axz - 2*bxx + bxz + 2*cxx + cxy))/(72.*o)); - x_TSE = 0.25*eps_new*(((axy - axz + 2*bxx + bxz - 2*cxx + cxy))/(72.*o)); - x_TNW = 0.25*eps_new*(((axy + axz + 2*bxx - bxz + 2*cxx - cxy))/(72.*o)); - - y_E = 0.25*eps_new*(2*(-2*axy + 2*byy + cyz))/(27.*o); - y_N = 0.25*eps_new*(2*(axy - 4*byy + cyz))/(27.*o); - y_T = 0.25*eps_new*(2*(axy + 2*byy - 2*cyz))/(27.*o); - y_NE = 0.25*eps_new*(-((axy + 6*ayy + 3*bxy + 2*byy - 2*cyz))/(54.*o)); - y_SE = 0.25*eps_new*(-((axy - 6*ayy - 3*bxy + 2*byy - 2*cyz))/(54.*o)); - y_TE = 0.25*eps_new*(-((axy + 3*ayz - 4*byy + 3*cxy + cyz))/(54.*o)); - y_BE = 0.25*eps_new*(-((axy - 3*ayz - 4*byy - 3*cxy + cyz))/(54.*o)); - y_TN = 0.25*eps_new*(-((-2*axy + 2*byy + 3*byz + 6*cyy + cyz))/(54.*o)); - y_BN = 0.25*eps_new*(-((-2*axy + 2*byy - 3*byz - 6*cyy + cyz))/(54.*o)); - y_ZERO = 0.; - y_TNE = 0.25*eps_new*(-((2*ayy + ayz + bxy + byz + cxy + 2*cyy))/(72.*o)); - y_TSW = 0.25*eps_new*(((-2*ayy + ayz - bxy + byz + cxy + 2*cyy))/(72.*o)); - y_TSE = 0.25*eps_new*(((2*ayy - ayz + bxy + byz - cxy + 2*cyy))/(72.*o)); - y_TNW = 0.25*eps_new*(((2*ayy + ayz + bxy - byz + cxy - 2*cyy))/(72.*o)); - - z_E = 0.25*eps_new*((2*(-2*axz + byz + 2*czz))/(27.*o)); - z_N = 0.25*eps_new*((2*(axz - 2*byz + 2*czz))/(27.*o)); - z_T = 0.25*eps_new*((2*(axz + byz - 4*czz))/(27.*o)); - z_NE = 0.25*eps_new*(-((axz + 3*ayz + 3*bxz + byz - 4*czz))/(54.*o)); - z_SE = 0.25*eps_new*(-((axz - 3*ayz - 3*bxz + byz - 4*czz))/(54.*o)); - z_TE = 0.25*eps_new*(-((axz + 6*azz - 2*byz + 3*cxz + 2*czz))/(54.*o)); - z_BE = 0.25*eps_new*(-((axz - 6*azz - 2*byz - 3*cxz + 2*czz))/(54.*o)); - z_TN = 0.25*eps_new*(-((-2*axz + byz + 6*bzz + 3*cyz + 2*czz))/(54.*o)); - z_BN = 0.25*eps_new*(-((-2*axz + byz - 6*bzz - 3*cyz + 2*czz))/(54.*o)); - z_ZERO = 0.; - z_TNE = 0.25*eps_new*(-((ayz + 2*azz + bxz + 2*bzz + cxz + cyz))/(72.*o)); - z_TSW = 0.25*eps_new*(((-ayz + 2*azz - bxz + 2*bzz + cxz + cyz))/(72.*o)); - z_TSE = 0.25*eps_new*(((ayz - 2*azz + bxz + 2*bzz - cxz + cyz))/(72.*o)); - z_TNW = 0.25*eps_new*(((ayz + 2*azz + bxz - 2*bzz + cxz - cyz))/(72.*o)); - - xy_E = 0.0625*eps_new *(( 2.*cxyz)/(27.*o)); - xy_N = 0.0625*eps_new *(( 2.*cxyz)/(27.*o)); - xy_T = -(0.0625*eps_new *(( 4.*cxyz)/(27.*o))); - xy_NE = 0.0625*eps_new *( cxyz /(27.*o)); - xy_SE = 0.0625*eps_new *( cxyz /(27.*o)); - xy_TE = -(0.0625*eps_new *(( 3.*axyz + cxyz)/(54.*o))); - xy_BE = -(0.0625*eps_new *((-3.*axyz + cxyz)/(54.*o))); - xy_TN = -(0.0625*eps_new *(( 3.*bxyz + cxyz)/(54.*o))); - xy_BN = -(0.0625*eps_new *(( - 3.*bxyz + cxyz)/(54.*o))); - //xy_ZERO= 0.0625*eps_new; - xy_TNE = -(0.0625*eps_new *(( axyz + bxyz )/(72.*o))); - xy_TSW = 0.0625*eps_new *(( axyz + bxyz )/(72.*o)); - xy_TSE = 0.0625*eps_new *((- axyz + bxyz )/(72.*o)); - xy_TNW = 0.0625*eps_new *(( axyz - bxyz )/(72.*o)); - - xz_E = 0.0625*eps_new *(( 2.*bxyz )/(27.*o)); - xz_N = -(0.0625*eps_new *(( 4.*bxyz )/(27.*o))); - xz_T = 0.0625*eps_new *(( 2.*bxyz )/(27.*o)); - xz_NE = -(0.0625*eps_new *(( 3.*axyz + bxyz )/(54.*o))); - xz_SE = -(0.0625*eps_new *((-3.*axyz + bxyz )/(54.*o))); - xz_TE = 0.0625*eps_new *(( bxyz )/(27.*o)); - xz_BE = 0.0625*eps_new *(( bxyz )/(27.*o)); - xz_TN = -(0.0625*eps_new *(( bxyz + 3.*cxyz)/(54.*o))); - xz_BN = -(0.0625*eps_new *(( bxyz - 3.*cxyz)/(54.*o))); - //xz_ZERO= 0.0625*eps_new; - xz_TNE = -(0.0625*eps_new *(( axyz + cxyz)/(72.*o))); - xz_TSW = 0.0625*eps_new *((- axyz + cxyz)/(72.*o)); - xz_TSE = 0.0625*eps_new *(( axyz + cxyz)/(72.*o)); - xz_TNW = 0.0625*eps_new *(( axyz - cxyz)/(72.*o)); - - yz_E = -(0.0625*eps_new *(( 4.*axyz )/(27.*o))); - yz_N = 0.0625*eps_new *(( 2.*axyz )/(27.*o)); - yz_T = 0.0625*eps_new *(( 2.*axyz )/(27.*o)); - yz_NE = -(0.0625*eps_new *(( axyz + 3.*bxyz )/(54.*o))); - yz_SE = -(0.0625*eps_new *(( axyz - 3.*bxyz )/(54.*o))); - yz_TE = -(0.0625*eps_new *(( axyz + 3.*cxyz)/(54.*o))); - yz_BE = -(0.0625*eps_new *(( axyz - 3.*cxyz)/(54.*o))); - yz_TN = 0.0625*eps_new *(( axyz )/(27.*o)); - yz_BN = 0.0625*eps_new *(( axyz )/(27.*o)); - //yz_ZERO= 0.0625*eps_new; - yz_TNE = -(0.0625*eps_new *(( bxyz + cxyz)/(72.*o))); - yz_TSW = 0.0625*eps_new *(( - bxyz + cxyz)/(72.*o)); - yz_TSE = 0.0625*eps_new *(( bxyz - cxyz)/(72.*o)); - yz_TNW = 0.0625*eps_new *(( bxyz + cxyz)/(72.*o)); -} -////////////////////////////////////////////////////////////////////////// -void CompressibleOffsetInterpolationProcessor::calcInterpolatedNodeCF(LBMReal* f, LBMReal omega, LBMReal x, LBMReal y, LBMReal z, LBMReal press, LBMReal xs, LBMReal ys, LBMReal zs) -{ - using namespace D3Q27System; - - LBMReal rho = press ;//+ (2.*axx*x+axy*y+axz*z+axyz*y*z+ax + 2.*byy*y+bxy*x+byz*z+bxyz*x*z+by + 2.*czz*z+cxz*x+cyz*y+cxyz*x*y+cz)/3.; - LBMReal vx1 = a0 + 0.25*( xs*ax + ys*ay + zs*az) + 0.0625*(axx + xs*ys*axy + xs*zs*axz + ayy + ys*zs*ayz + azz) + 0.015625*(xs*ys*zs*axyz); - LBMReal vx2 = b0 + 0.25*( xs*bx + ys*by + zs*bz) + 0.0625*(bxx + xs*ys*bxy + xs*zs*bxz + byy + ys*zs*byz + bzz) + 0.015625*(xs*ys*zs*bxyz); - LBMReal vx3 = c0 + 0.25*( xs*cx + ys*cy + zs*cz) + 0.0625*(cxx + xs*ys*cxy + xs*zs*cxz + cyy + ys*zs*cyz + czz) + 0.015625*(xs*ys*zs*cxyz); - - ////////////////////////////////////////////////////////////////////////// - //DRAFT - //vx1 -= forcingF*0.5; - ////////////////////////////////////////////////////////////////////////// - - LBMReal feq[ENDF+1]; - D3Q27System::calcCompFeq(feq,rho,vx1,vx2,vx3); - - f[E] = f_E + xs*x_E + ys*y_E + zs*z_E + xs*ys*xy_E + xs*zs*xz_E + ys*zs*yz_E + feq[E]; - f[W] = f_E + xs*x_E + ys*y_E + zs*z_E + xs*ys*xy_E + xs*zs*xz_E + ys*zs*yz_E + feq[W]; - f[N] = f_N + xs*x_N + ys*y_N + zs*z_N + xs*ys*xy_N + xs*zs*xz_N + ys*zs*yz_N + feq[N]; - f[S] = f_N + xs*x_N + ys*y_N + zs*z_N + xs*ys*xy_N + xs*zs*xz_N + ys*zs*yz_N + feq[S]; - f[T] = f_T + xs*x_T + ys*y_T + zs*z_T + xs*ys*xy_T + xs*zs*xz_T + ys*zs*yz_T + feq[T]; - f[B] = f_T + xs*x_T + ys*y_T + zs*z_T + xs*ys*xy_T + xs*zs*xz_T + ys*zs*yz_T + feq[B]; - f[NE] = f_NE + xs*x_NE + ys*y_NE + zs*z_NE + xs*ys*xy_NE + xs*zs*xz_NE + ys*zs*yz_NE + feq[NE]; - f[SW] = f_NE + xs*x_NE + ys*y_NE + zs*z_NE + xs*ys*xy_NE + xs*zs*xz_NE + ys*zs*yz_NE + feq[SW]; - f[SE] = f_SE + xs*x_SE + ys*y_SE + zs*z_SE + xs*ys*xy_SE + xs*zs*xz_SE + ys*zs*yz_SE + feq[SE]; - f[NW] = f_SE + xs*x_SE + ys*y_SE + zs*z_SE + xs*ys*xy_SE + xs*zs*xz_SE + ys*zs*yz_SE + feq[NW]; - f[TE] = f_TE + xs*x_TE + ys*y_TE + zs*z_TE + xs*ys*xy_TE + xs*zs*xz_TE + ys*zs*yz_TE + feq[TE]; - f[BW] = f_TE + xs*x_TE + ys*y_TE + zs*z_TE + xs*ys*xy_TE + xs*zs*xz_TE + ys*zs*yz_TE + feq[BW]; - f[BE] = f_BE + xs*x_BE + ys*y_BE + zs*z_BE + xs*ys*xy_BE + xs*zs*xz_BE + ys*zs*yz_BE + feq[BE]; - f[TW] = f_BE + xs*x_BE + ys*y_BE + zs*z_BE + xs*ys*xy_BE + xs*zs*xz_BE + ys*zs*yz_BE + feq[TW]; - f[TN] = f_TN + xs*x_TN + ys*y_TN + zs*z_TN + xs*ys*xy_TN + xs*zs*xz_TN + ys*zs*yz_TN + feq[TN]; - f[BS] = f_TN + xs*x_TN + ys*y_TN + zs*z_TN + xs*ys*xy_TN + xs*zs*xz_TN + ys*zs*yz_TN + feq[BS]; - f[BN] = f_BN + xs*x_BN + ys*y_BN + zs*z_BN + xs*ys*xy_BN + xs*zs*xz_BN + ys*zs*yz_BN + feq[BN]; - f[TS] = f_BN + xs*x_BN + ys*y_BN + zs*z_BN + xs*ys*xy_BN + xs*zs*xz_BN + ys*zs*yz_BN + feq[TS]; - f[TNE] = f_TNE + xs*x_TNE + ys*y_TNE + zs*z_TNE + xs*ys*xy_TNE + xs*zs*xz_TNE + ys*zs*yz_TNE + feq[TNE]; - f[TSW] = f_TSW + xs*x_TSW + ys*y_TSW + zs*z_TSW + xs*ys*xy_TSW + xs*zs*xz_TSW + ys*zs*yz_TSW + feq[TSW]; - f[TSE] = f_TSE + xs*x_TSE + ys*y_TSE + zs*z_TSE + xs*ys*xy_TSE + xs*zs*xz_TSE + ys*zs*yz_TSE + feq[TSE]; - f[TNW] = f_TNW + xs*x_TNW + ys*y_TNW + zs*z_TNW + xs*ys*xy_TNW + xs*zs*xz_TNW + ys*zs*yz_TNW + feq[TNW]; - f[BNE] = f_TSW + xs*x_TSW + ys*y_TSW + zs*z_TSW + xs*ys*xy_TSW + xs*zs*xz_TSW + ys*zs*yz_TSW + feq[BNE]; - f[BSW] = f_TNE + xs*x_TNE + ys*y_TNE + zs*z_TNE + xs*ys*xy_TNE + xs*zs*xz_TNE + ys*zs*yz_TNE + feq[BSW]; - f[BSE] = f_TNW + xs*x_TNW + ys*y_TNW + zs*z_TNW + xs*ys*xy_TNW + xs*zs*xz_TNW + ys*zs*yz_TNW + feq[BSE]; - f[BNW] = f_TSE + xs*x_TSE + ys*y_TSE + zs*z_TSE + xs*ys*xy_TSE + xs*zs*xz_TSE + ys*zs*yz_TSE + feq[BNW]; - f[ZERO] = f_ZERO + xs*x_ZERO + ys*y_ZERO + zs*z_ZERO + feq[ZERO]; -} -////////////////////////////////////////////////////////////////////////// -//Position SWB -0.25, -0.25, -0.25 -LBMReal CompressibleOffsetInterpolationProcessor::calcPressBSW() -{ - return press_SWT * (0.140625 + 0.1875 * xoff + 0.1875 * yoff - 0.5625 * zoff) + - press_NWT * (0.046875 + 0.0625 * xoff - 0.1875 * yoff - 0.1875 * zoff) + - press_SET * (0.046875 - 0.1875 * xoff + 0.0625 * yoff - 0.1875 * zoff) + - press_NET * (0.015625 - 0.0625 * xoff - 0.0625 * yoff - 0.0625 * zoff) + - press_NEB * (0.046875 - 0.1875 * xoff - 0.1875 * yoff + 0.0625 * zoff) + - press_NWB * (0.140625 + 0.1875 * xoff - 0.5625 * yoff + 0.1875 * zoff) + - press_SEB * (0.140625 - 0.5625 * xoff + 0.1875 * yoff + 0.1875 * zoff) + - press_SWB * (0.421875 + 0.5625 * xoff + 0.5625 * yoff + 0.5625 * zoff); -} -////////////////////////////////////////////////////////////////////////// -//Position SWT -0.25, -0.25, 0.25 -LBMReal CompressibleOffsetInterpolationProcessor::calcPressTSW() -{ - return press_SWT * (0.421875 + 0.5625 * xoff + 0.5625 * yoff - 0.5625 * zoff) + - press_NWT * (0.140625 + 0.1875 * xoff - 0.5625 * yoff - 0.1875 * zoff) + - press_SET * (0.140625 - 0.5625 * xoff + 0.1875 * yoff - 0.1875 * zoff) + - press_NET * (0.046875 - 0.1875 * xoff - 0.1875 * yoff - 0.0625 * zoff) + - press_NEB * (0.015625 - 0.0625 * xoff - 0.0625 * yoff + 0.0625 * zoff) + - press_NWB * (0.046875 + 0.0625 * xoff - 0.1875 * yoff + 0.1875 * zoff) + - press_SEB * (0.046875 - 0.1875 * xoff + 0.0625 * yoff + 0.1875 * zoff) + - press_SWB * (0.140625 + 0.1875 * xoff + 0.1875 * yoff + 0.5625 * zoff); -} -////////////////////////////////////////////////////////////////////////// -//Position SET 0.25, -0.25, 0.25 -LBMReal CompressibleOffsetInterpolationProcessor::calcPressTSE() -{ - return press_SET * (0.421875 - 0.5625 * xoff + 0.5625 * yoff - 0.5625 * zoff) + - press_NET * (0.140625 - 0.1875 * xoff - 0.5625 * yoff - 0.1875 * zoff) + - press_SWT * (0.140625 + 0.5625 * xoff + 0.1875 * yoff - 0.1875 * zoff) + - press_NWT * (0.046875 + 0.1875 * xoff - 0.1875 * yoff - 0.0625 * zoff) + - press_NWB * (0.015625 + 0.0625 * xoff - 0.0625 * yoff + 0.0625 * zoff) + - press_NEB * (0.046875 - 0.0625 * xoff - 0.1875 * yoff + 0.1875 * zoff) + - press_SWB * (0.046875 + 0.1875 * xoff + 0.0625 * yoff + 0.1875 * zoff) + - press_SEB * (0.140625 - 0.1875 * xoff + 0.1875 * yoff + 0.5625 * zoff); -} -////////////////////////////////////////////////////////////////////////// -//Position SEB 0.25, -0.25, -0.25 -LBMReal CompressibleOffsetInterpolationProcessor::calcPressBSE() -{ - return press_SET * (0.140625 - 0.1875 * xoff + 0.1875 * yoff - 0.5625 * zoff) + - press_NET * (0.046875 - 0.0625 * xoff - 0.1875 * yoff - 0.1875 * zoff) + - press_SWT * (0.046875 + 0.1875 * xoff + 0.0625 * yoff - 0.1875 * zoff) + - press_NWT * (0.015625 + 0.0625 * xoff - 0.0625 * yoff - 0.0625 * zoff) + - press_NWB * (0.046875 + 0.1875 * xoff - 0.1875 * yoff + 0.0625 * zoff) + - press_NEB * (0.140625 - 0.1875 * xoff - 0.5625 * yoff + 0.1875 * zoff) + - press_SWB * (0.140625 + 0.5625 * xoff + 0.1875 * yoff + 0.1875 * zoff) + - press_SEB * (0.421875 - 0.5625 * xoff + 0.5625 * yoff + 0.5625 * zoff); -} -////////////////////////////////////////////////////////////////////////// -//Position NWB -0.25, 0.25, -0.25 -LBMReal CompressibleOffsetInterpolationProcessor::calcPressBNW() -{ - return press_NWT * (0.140625 + 0.1875 * xoff - 0.1875 * yoff - 0.5625 * zoff) + - press_NET * (0.046875 - 0.1875 * xoff - 0.0625 * yoff - 0.1875 * zoff) + - press_SWT * (0.046875 + 0.0625 * xoff + 0.1875 * yoff - 0.1875 * zoff) + - press_SET * (0.015625 - 0.0625 * xoff + 0.0625 * yoff - 0.0625 * zoff) + - press_SEB * (0.046875 - 0.1875 * xoff + 0.1875 * yoff + 0.0625 * zoff) + - press_NEB * (0.140625 - 0.5625 * xoff - 0.1875 * yoff + 0.1875 * zoff) + - press_SWB * (0.140625 + 0.1875 * xoff + 0.5625 * yoff + 0.1875 * zoff) + - press_NWB * (0.421875 + 0.5625 * xoff - 0.5625 * yoff + 0.5625 * zoff); -} -////////////////////////////////////////////////////////////////////////// -//Position NWT -0.25, 0.25, 0.25 -LBMReal CompressibleOffsetInterpolationProcessor::calcPressTNW() -{ - return press_NWT * (0.421875 + 0.5625 * xoff - 0.5625 * yoff - 0.5625 * zoff) + - press_NET * (0.140625 - 0.5625 * xoff - 0.1875 * yoff - 0.1875 * zoff) + - press_SWT * (0.140625 + 0.1875 * xoff + 0.5625 * yoff - 0.1875 * zoff) + - press_SET * (0.046875 - 0.1875 * xoff + 0.1875 * yoff - 0.0625 * zoff) + - press_SEB * (0.015625 - 0.0625 * xoff + 0.0625 * yoff + 0.0625 * zoff) + - press_NEB * (0.046875 - 0.1875 * xoff - 0.0625 * yoff + 0.1875 * zoff) + - press_SWB * (0.046875 + 0.0625 * xoff + 0.1875 * yoff + 0.1875 * zoff) + - press_NWB * (0.140625 + 0.1875 * xoff - 0.1875 * yoff + 0.5625 * zoff); -} -////////////////////////////////////////////////////////////////////////// -//Position NET 0.25, 0.25, 0.25 -LBMReal CompressibleOffsetInterpolationProcessor::calcPressTNE() -{ - return press_NET * (0.421875 - 0.5625 * xoff - 0.5625 * yoff - 0.5625 * zoff) + - press_NWT * (0.140625 + 0.5625 * xoff - 0.1875 * yoff - 0.1875 * zoff) + - press_SET * (0.140625 - 0.1875 * xoff + 0.5625 * yoff - 0.1875 * zoff) + - press_SWT * (0.046875 + 0.1875 * xoff + 0.1875 * yoff - 0.0625 * zoff) + - press_SWB * (0.015625 + 0.0625 * xoff + 0.0625 * yoff + 0.0625 * zoff) + - press_NWB * (0.046875 + 0.1875 * xoff - 0.0625 * yoff + 0.1875 * zoff) + - press_SEB * (0.046875 - 0.0625 * xoff + 0.1875 * yoff + 0.1875 * zoff) + - press_NEB * (0.140625 - 0.1875 * xoff - 0.1875 * yoff + 0.5625 * zoff); -} -////////////////////////////////////////////////////////////////////////// -//Position NEB 0.25, 0.25, -0.25 -LBMReal CompressibleOffsetInterpolationProcessor::calcPressBNE() -{ - return press_NET * (0.140625 - 0.1875 * xoff - 0.1875 * yoff - 0.5625 * zoff) + - press_NWT * (0.046875 + 0.1875 * xoff - 0.0625 * yoff - 0.1875 * zoff) + - press_SET * (0.046875 - 0.0625 * xoff + 0.1875 * yoff - 0.1875 * zoff) + - press_SWT * (0.015625 + 0.0625 * xoff + 0.0625 * yoff - 0.0625 * zoff) + - press_SWB * (0.046875 + 0.1875 * xoff + 0.1875 * yoff + 0.0625 * zoff) + - press_NWB * (0.140625 + 0.5625 * xoff - 0.1875 * yoff + 0.1875 * zoff) + - press_SEB * (0.140625 - 0.1875 * xoff + 0.5625 * yoff + 0.1875 * zoff) + - press_NEB * (0.421875 - 0.5625 * xoff - 0.5625 * yoff + 0.5625 * zoff); -} -////////////////////////////////////////////////////////////////////////// -//Position C 0.0, 0.0, 0.0 -void CompressibleOffsetInterpolationProcessor::calcInterpolatedNodeFC(LBMReal* f, LBMReal omega) -{ - using namespace D3Q27System; - - LBMReal press = press_NET * (0.125 - 0.25 * xoff - 0.25 * yoff - 0.25 * zoff) + - press_NWT * (0.125 + 0.25 * xoff - 0.25 * yoff - 0.25 * zoff) + - press_SET * (0.125 - 0.25 * xoff + 0.25 * yoff - 0.25 * zoff) + - press_SWT * (0.125 + 0.25 * xoff + 0.25 * yoff - 0.25 * zoff) + - press_NEB * (0.125 - 0.25 * xoff - 0.25 * yoff + 0.25 * zoff) + - press_NWB * (0.125 + 0.25 * xoff - 0.25 * yoff + 0.25 * zoff) + - press_SEB * (0.125 - 0.25 * xoff + 0.25 * yoff + 0.25 * zoff) + - press_SWB * (0.125 + 0.25 * xoff + 0.25 * yoff + 0.25 * zoff); - LBMReal vx1 = a0; - LBMReal vx2 = b0; - LBMReal vx3 = c0; - - LBMReal rho = press ;//+ (ax+by+cz)/3.; - - ////////////////////////////////////////////////////////////////////////// - //DRAFT - //vx1 -= forcingC*0.5; - ////////////////////////////////////////////////////////////////////////// - - LBMReal feq[ENDF+1]; - D3Q27System::calcCompFeq(feq,rho,vx1,vx2,vx3); - - LBMReal eps_new = 2.; - LBMReal o = omega; - LBMReal op = 1.; - - //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)); - //f_N = f_E + eps_new *((2.*(ax - by))/(9.*o)); - //f_T = f_E + eps_new *((2.*(ax - cz))/(9.*o)); - //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)); - //f_SE = f_NE + eps_new *(( ay + bx )/(9.*o)); - //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)); - //f_BE = f_TE + eps_new *(( az + cx )/(9.*o)); - //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)); - //f_BN = f_TN + eps_new *(( bz + cy )/(9.*o)); - //f_ZERO = eps_new *((5.*(ax + by + cz))/(9.*op)); - //f_TNE = eps_new *(-(ay + az + bx + bz + cx + cy)/(72.*o)); - //f_TSW = - eps_new *((ay + bx)/(36.*o)) - f_TNE; - //f_TSE = - eps_new *((az + cx)/(36.*o)) - f_TNE; - //f_TNW = - eps_new *((bz + cy)/(36.*o)) - f_TNE; - - f_E = eps_new*((2*(-2*ax + by + cz-kxxMzzAverage-kxxMyyAverage))/(27.*o)); - f_N = eps_new*((2*(ax - 2*by + cz+2*kxxMyyAverage-kxxMzzAverage))/(27.*o)); - f_T = eps_new*((2*(ax + by - 2*cz-kxxMyyAverage+2*kxxMzzAverage))/(27.*o)); - f_NE = eps_new*(-(ax + 3*ay + 3*bx + by - 2*cz+2*kxxMyyAverage-kxxMyyAverage+3*kxyAverage)/(54.*o)); - f_SE = eps_new*(-(ax - 3*ay - 3*bx + by - 2*cz+2*kxxMyyAverage-kxxMyyAverage-3*kxyAverage)/(54.*o)); - f_TE = eps_new*(-(ax + 3*az - 2*by + 3*cx + cz+2*kxxMyyAverage-kxxMzzAverage+3*kxzAverage)/(54.*o)); - f_BE = eps_new*(-(ax - 3*az - 2*by - 3*cx + cz+2*kxxMyyAverage-kxxMzzAverage-3*kxzAverage)/(54.*o)); - f_TN = eps_new*(-(-2*ax + by + 3*bz + 3*cy + cz-kxxMyyAverage-kxxMzzAverage+3*kyzAverage)/(54.*o)); - f_BN = eps_new*(-(-2*ax + by - 3*bz - 3*cy + cz-kxxMyyAverage-kxxMzzAverage-3*kyzAverage)/(54.*o)); - f_ZERO = 0.; - f_TNE = eps_new*(-(ay + az + bx + bz + cx + cy+kxyAverage+kxzAverage+kyzAverage)/(72.*o)); - f_TSW = eps_new*((-ay + az - bx + bz + cx + cy-kxyAverage+kxzAverage+kyzAverage)/(72.*o)); - f_TSE = eps_new*((ay - az + bx + bz - cx + cy+kxyAverage-kxzAverage+kyzAverage)/(72.*o)); - f_TNW = eps_new*((ay + az + bx - bz + cx - cy+kxyAverage+kxzAverage-kyzAverage)/(72.*o)); - - f[E] = 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[ZERO] = f_ZERO + feq[ZERO]; -} -////////////////////////////////////////////////////////////////////////// -void CompressibleOffsetInterpolationProcessor::calcInterpolatedVelocity(LBMReal x, LBMReal y, LBMReal z, LBMReal& vx1, LBMReal& vx2, LBMReal& vx3) -{ - vx1 = a0 + ax*x + ay*y + az*z + axx*x*x + ayy*y*y + azz*z*z + axy*x*y + axz*x*z + ayz*y*z+axyz*x*y*z; - vx2 = b0 + bx*x + by*y + bz*z + bxx*x*x + byy*y*y + bzz*z*z + bxy*x*y + bxz*x*z + byz*y*z+bxyz*x*y*z; - vx3 = c0 + cx*x + cy*y + cz*z + cxx*x*x + cyy*y*y + czz*z*z + cxy*x*y + cxz*x*z + cyz*y*z+cxyz*x*y*z; -} -////////////////////////////////////////////////////////////////////////// -void CompressibleOffsetInterpolationProcessor::calcInterpolatedShearStress(LBMReal x, LBMReal y, LBMReal z,LBMReal& tauxx, LBMReal& tauyy, LBMReal& tauzz,LBMReal& tauxy, LBMReal& tauxz, LBMReal& tauyz) -{ - tauxx=ax+2*axx*x+axy*y+axz*z+axyz*y*z; - tauyy=by+2*byy*y+bxy*x+byz*z+bxyz*x*z; - tauzz=cz+2*czz*z+cxz*x+cyz*y+cxyz*x*y; - tauxy=0.5*((ay+2.0*ayy*y+axy*x+ayz*z+axyz*x*z)+(bx+2.0*bxx*x+bxy*y+bxz*z+bxyz*y*z)); - tauxz=0.5*((az+2.0*azz*z+axz*x+ayz*y+axyz*x*y)+(cx+2.0*cxx*x+cxy*y+cxz*z+cxyz*y*z)); - tauyz=0.5*((bz+2.0*bzz*z+bxz*x+byz*y+bxyz*x*y)+(cy+2.0*cyy*y+cxy*x+cyz*z+cxyz*x*z)); -} diff --git a/src/VirtualFluids/LBM/CompressibleOffsetInterpolationProcessor.h b/src/VirtualFluids/LBM/CompressibleOffsetInterpolationProcessor.h deleted file mode 100644 index bc94c4512..000000000 --- a/src/VirtualFluids/LBM/CompressibleOffsetInterpolationProcessor.h +++ /dev/null @@ -1,77 +0,0 @@ -#ifndef CompressibleOffsetInterpolationProcessor_H_ -#define CompressibleOffsetInterpolationProcessor_H_ - -#include "InterpolationProcessor.h" -#include "D3Q27System.h" - -////////////////////////////////////////////////////////////////////////// -//it works only for cascaded LBM -//super compact interpolation method by Martin Geier -////////////////////////////////////////////////////////////////////////// - -class CompressibleOffsetInterpolationProcessor; -typedef std::shared_ptr<CompressibleOffsetInterpolationProcessor> CompressibleOffsetInterpolationProcessorPtr; - -class CompressibleOffsetInterpolationProcessor : public InterpolationProcessor -{ -public: - CompressibleOffsetInterpolationProcessor(); - CompressibleOffsetInterpolationProcessor(LBMReal omegaC, LBMReal omegaF); - virtual ~CompressibleOffsetInterpolationProcessor(); - InterpolationProcessorPtr clone(); - void setOmegas(LBMReal omegaC, LBMReal omegaF); - void interpolateCoarseToFine(D3Q27ICell& icellC, D3Q27ICell& icellF); - void interpolateCoarseToFine(D3Q27ICell& icellC, D3Q27ICell& icellF, LBMReal xoff, LBMReal yoff, LBMReal zoff); - void interpolateFineToCoarse(D3Q27ICell& icellF, LBMReal* icellC); - void interpolateFineToCoarse(D3Q27ICell& icellF, LBMReal* icellC, LBMReal xoff, LBMReal yoff, LBMReal zoff); - //LBMReal forcingC, forcingF; -protected: -private: - LBMReal omegaC, omegaF; - LBMReal a0, ax, ay, az, axx, ayy, azz, axy, axz, ayz, b0, bx, by, bz, bxx, byy, bzz, bxy, bxz, byz, c0, cx, cy, cz, cxx, cyy, czz, cxy, cxz, cyz, axyz, bxyz, cxyz; - LBMReal xoff, yoff, zoff; - LBMReal xoff_sq, yoff_sq, zoff_sq; - LBMReal press_SWT, press_NWT, press_NET, press_SET, press_SWB, press_NWB, press_NEB, press_SEB; - - LBMReal f_E, f_N, f_T, f_NE, f_SE, f_BE, f_TE, f_TN, f_BN, f_TNE, f_TNW, f_TSE, f_TSW, f_ZERO; - LBMReal x_E, x_N, x_T, x_NE, x_SE, x_BE, x_TE, x_TN, x_BN, x_TNE, x_TNW, x_TSE, x_TSW, x_ZERO; - LBMReal y_E, y_N, y_T, y_NE, y_SE, y_BE, y_TE, y_TN, y_BN, y_TNE, y_TNW, y_TSE, y_TSW, y_ZERO; - LBMReal z_E, z_N, z_T, z_NE, z_SE, z_BE, z_TE, z_TN, z_BN, z_TNE, z_TNW, z_TSE, z_TSW, z_ZERO; - LBMReal xy_E, xy_N, xy_T, xy_NE, xy_SE, xy_BE, xy_TE, xy_TN, xy_BN, xy_TNE, xy_TNW, xy_TSE, xy_TSW/*, xy_ZERO*/; - LBMReal xz_E, xz_N, xz_T, xz_NE, xz_SE, xz_BE, xz_TE, xz_TN, xz_BN, xz_TNE, xz_TNW, xz_TSE, xz_TSW/*, xz_ZERO*/; - LBMReal yz_E, yz_N, yz_T, yz_NE, yz_SE, yz_BE, yz_TE, yz_TN, yz_BN, yz_TNE, yz_TNW, yz_TSE, yz_TSW/*, yz_ZERO*/; - - LBMReal kxyAverage, kyzAverage, kxzAverage, kxxMyyAverage, kxxMzzAverage; - - LBMReal a,b,c; - - void setOffsets(LBMReal xoff, LBMReal yoff, LBMReal zoff); - void calcMoments(const LBMReal* const f, LBMReal omega, LBMReal& rho, LBMReal& vx1, LBMReal& vx2, LBMReal& vx3, - LBMReal& kxy, LBMReal& kyz, LBMReal& kxz, LBMReal& kxxMyy, LBMReal& kxxMzz); - void calcInterpolatedCoefficiets(const D3Q27ICell& icell, LBMReal omega, LBMReal eps_new); - void calcInterpolatedNodeCF(LBMReal* f, LBMReal omega, LBMReal x, LBMReal y, LBMReal z, LBMReal press, LBMReal xs, LBMReal ys, LBMReal zs); - LBMReal calcPressBSW(); - LBMReal calcPressTSW(); - LBMReal calcPressTSE(); - LBMReal calcPressBSE(); - LBMReal calcPressBNW(); - LBMReal calcPressTNW(); - LBMReal calcPressTNE(); - LBMReal calcPressBNE(); - void calcInterpolatedNodeFC(LBMReal* f, LBMReal omega); - void calcInterpolatedVelocity(LBMReal x, LBMReal y, LBMReal z,LBMReal& vx1, LBMReal& vx2, LBMReal& vx3); - void calcInterpolatedShearStress(LBMReal x, LBMReal y, LBMReal z,LBMReal& tauxx, LBMReal& tauyy, LBMReal& tauzz,LBMReal& tauxy, LBMReal& tauxz, LBMReal& tauyz); -}; - -////////////////////////////////////////////////////////////////////////// -inline void CompressibleOffsetInterpolationProcessor::interpolateCoarseToFine(D3Q27ICell& icellC, D3Q27ICell& icellF) -{ - this->interpolateCoarseToFine(icellC, icellF, 0.0, 0.0, 0.0); -} -////////////////////////////////////////////////////////////////////////// -inline void CompressibleOffsetInterpolationProcessor::interpolateFineToCoarse(D3Q27ICell& icellF, LBMReal* icellC) -{ - this->interpolateFineToCoarse(icellF, icellC, 0.0, 0.0, 0.0); -} - -#endif diff --git a/src/VirtualFluids/LBM/CompressibleOffsetMomentsInterpolationProcessor.cpp b/src/VirtualFluids/LBM/CompressibleOffsetMomentsInterpolationProcessor.cpp deleted file mode 100644 index 1f5245afc..000000000 --- a/src/VirtualFluids/LBM/CompressibleOffsetMomentsInterpolationProcessor.cpp +++ /dev/null @@ -1,1278 +0,0 @@ -#include "CompressibleOffsetMomentsInterpolationProcessor.h" -#include "D3Q27System.h" - - - -CompressibleOffsetMomentsInterpolationProcessor::CompressibleOffsetMomentsInterpolationProcessor() - : omegaC(0.0), omegaF(0.0) -{ - this->bulkOmegaToOmega = false; - this->OxxPyyPzzC = one; - this->OxxPyyPzzF = one; -} -////////////////////////////////////////////////////////////////////////// -CompressibleOffsetMomentsInterpolationProcessor::CompressibleOffsetMomentsInterpolationProcessor(LBMReal omegaC, LBMReal omegaF) - : omegaC(omegaC), omegaF(omegaF) -{ - this->bulkOmegaToOmega = false; - this->OxxPyyPzzC = one; - this->OxxPyyPzzF = one; -} -////////////////////////////////////////////////////////////////////////// -CompressibleOffsetMomentsInterpolationProcessor::~CompressibleOffsetMomentsInterpolationProcessor() -{ - -} -////////////////////////////////////////////////////////////////////////// -InterpolationProcessorPtr CompressibleOffsetMomentsInterpolationProcessor::clone() -{ - InterpolationProcessorPtr iproc = InterpolationProcessorPtr (new CompressibleOffsetMomentsInterpolationProcessor(this->omegaC, this->omegaF)); - if (bulkOmegaToOmega) - { - std::dynamic_pointer_cast<CompressibleOffsetMomentsInterpolationProcessor>(iproc)->OxxPyyPzzC = omegaC; - std::dynamic_pointer_cast<CompressibleOffsetMomentsInterpolationProcessor>(iproc)->OxxPyyPzzF = omegaF; - } - else - { - std::dynamic_pointer_cast<CompressibleOffsetMomentsInterpolationProcessor>(iproc)->OxxPyyPzzC = one; - std::dynamic_pointer_cast<CompressibleOffsetMomentsInterpolationProcessor>(iproc)->OxxPyyPzzF = one; - } - return iproc; -} -////////////////////////////////////////////////////////////////////////// -void CompressibleOffsetMomentsInterpolationProcessor::setOmegas( LBMReal omegaC, LBMReal omegaF ) -{ - this->omegaC = omegaC; - this->omegaF = omegaF; -} -////////////////////////////////////////////////////////////////////////// -void CompressibleOffsetMomentsInterpolationProcessor::setOffsets(LBMReal xoff, LBMReal yoff, LBMReal zoff) -{ - this->xoff = xoff; - this->yoff = yoff; - this->zoff = zoff; - this->xoff_sq = xoff * xoff; - this->yoff_sq = yoff * yoff; - this->zoff_sq = zoff * zoff; -} -////////////////////////////////////////////////////////////////////////// -void CompressibleOffsetMomentsInterpolationProcessor::interpolateCoarseToFine(D3Q27ICell& icellC, D3Q27ICell& icellF, LBMReal xoff, LBMReal yoff, LBMReal zoff) -{ - setOffsets(xoff, yoff, zoff); - calcInterpolatedCoefficiets(icellC, omegaC, 0.5); - calcInterpolatedNodeCF(icellF.BSW, omegaF, -0.25, -0.25, -0.25, calcPressBSW(), -1, -1, -1); - calcInterpolatedNodeCF(icellF.BNE, omegaF, 0.25, 0.25, -0.25, calcPressBNE(), 1, 1, -1); - calcInterpolatedNodeCF(icellF.TNW, omegaF, -0.25, 0.25, 0.25, calcPressTNW(), -1, 1, 1); - calcInterpolatedNodeCF(icellF.TSE, omegaF, 0.25, -0.25, 0.25, calcPressTSE(), 1, -1, 1); - calcInterpolatedNodeCF(icellF.BNW, omegaF, -0.25, 0.25, -0.25, calcPressBNW(), -1, 1, -1); - calcInterpolatedNodeCF(icellF.BSE, omegaF, 0.25, -0.25, -0.25, calcPressBSE(), 1, -1, -1); - calcInterpolatedNodeCF(icellF.TSW, omegaF, -0.25, -0.25, 0.25, calcPressTSW(), -1, -1, 1); - calcInterpolatedNodeCF(icellF.TNE, omegaF, 0.25, 0.25, 0.25, calcPressTNE(), 1, 1, 1); -} -////////////////////////////////////////////////////////////////////////// -void CompressibleOffsetMomentsInterpolationProcessor::interpolateFineToCoarse(D3Q27ICell& icellF, LBMReal* icellC, LBMReal xoff, LBMReal yoff, LBMReal zoff) -{ - setOffsets(xoff, yoff, zoff); - calcInterpolatedCoefficiets(icellF, omegaF, 2.0); - calcInterpolatedNodeFC(icellC, omegaC); -} -////////////////////////////////////////////////////////////////////////// -void CompressibleOffsetMomentsInterpolationProcessor::calcMoments(const LBMReal* const f, LBMReal omega, LBMReal& press, LBMReal& vx1, LBMReal& vx2, LBMReal& vx3, - LBMReal& kxy, LBMReal& kyz, LBMReal& kxz, LBMReal& kxxMyy, LBMReal& kxxMzz) -{ - using namespace D3Q27System; - - LBMReal drho = 0.0; - D3Q27System::calcCompMacroscopicValues(f,drho,vx1,vx2,vx3); - - press = drho; //interpolate rho! - - kxy = -3.*omega*((((f[TSW]+f[BNE])-(f[TNW]+f[BSE]))+((f[BSW]+f[TNE])-(f[BNW]+f[TSE])))+((f[SW]+f[NE])-(f[NW]+f[SE]))/(one + drho)-(vx1*vx2));// might not be optimal MG 25.2.13 - kyz = -3.*omega*((((f[BSW]+f[TNE])-(f[TSE]+f[BNW]))+((f[BSE]+f[TNW])-(f[TSW]+f[BNE])))+((f[BS]+f[TN])-(f[TS]+f[BN]))/(one + drho)-(vx2*vx3)); - kxz = -3.*omega*((((f[BNW]+f[TSE])-(f[TSW]+f[BNE]))+((f[BSW]+f[TNE])-(f[BSE]+f[TNW])))+((f[BW]+f[TE])-(f[TW]+f[BE]))/(one + drho)-(vx1*vx3)); - kxxMyy = -3./2.*omega*((((f[BW]+f[TE])-(f[BS]+f[TN]))+((f[TW]+f[BE])-(f[TS]+f[BN])))+((f[W]+f[E])-(f[S]+f[N]))/(one + drho)-(vx1*vx1-vx2*vx2)); - kxxMzz = -3./2.*omega*((((f[NW]+f[SE])-(f[BS]+f[TN]))+((f[SW]+f[NE])-(f[TS]+f[BN])))+((f[W]+f[E])-(f[B]+f[T]))/(one + drho)-(vx1*vx1-vx3*vx3)); -} -////////////////////////////////////////////////////////////////////////// -void CompressibleOffsetMomentsInterpolationProcessor::calcInterpolatedCoefficiets(const D3Q27ICell& icell, LBMReal omega, LBMReal eps_new) -{ - LBMReal vx1_SWT,vx2_SWT,vx3_SWT; - LBMReal vx1_NWT,vx2_NWT,vx3_NWT; - LBMReal vx1_NET,vx2_NET,vx3_NET; - LBMReal vx1_SET,vx2_SET,vx3_SET; - LBMReal vx1_SWB,vx2_SWB,vx3_SWB; - LBMReal vx1_NWB,vx2_NWB,vx3_NWB; - LBMReal vx1_NEB,vx2_NEB,vx3_NEB; - LBMReal vx1_SEB,vx2_SEB,vx3_SEB; - - LBMReal kxyFromfcNEQ_SWT, kyzFromfcNEQ_SWT, kxzFromfcNEQ_SWT, kxxMyyFromfcNEQ_SWT, kxxMzzFromfcNEQ_SWT; - LBMReal kxyFromfcNEQ_NWT, kyzFromfcNEQ_NWT, kxzFromfcNEQ_NWT, kxxMyyFromfcNEQ_NWT, kxxMzzFromfcNEQ_NWT; - LBMReal kxyFromfcNEQ_NET, kyzFromfcNEQ_NET, kxzFromfcNEQ_NET, kxxMyyFromfcNEQ_NET, kxxMzzFromfcNEQ_NET; - LBMReal kxyFromfcNEQ_SET, kyzFromfcNEQ_SET, kxzFromfcNEQ_SET, kxxMyyFromfcNEQ_SET, kxxMzzFromfcNEQ_SET; - LBMReal kxyFromfcNEQ_SWB, kyzFromfcNEQ_SWB, kxzFromfcNEQ_SWB, kxxMyyFromfcNEQ_SWB, kxxMzzFromfcNEQ_SWB; - LBMReal kxyFromfcNEQ_NWB, kyzFromfcNEQ_NWB, kxzFromfcNEQ_NWB, kxxMyyFromfcNEQ_NWB, kxxMzzFromfcNEQ_NWB; - LBMReal kxyFromfcNEQ_NEB, kyzFromfcNEQ_NEB, kxzFromfcNEQ_NEB, kxxMyyFromfcNEQ_NEB, kxxMzzFromfcNEQ_NEB; - LBMReal kxyFromfcNEQ_SEB, kyzFromfcNEQ_SEB, kxzFromfcNEQ_SEB, kxxMyyFromfcNEQ_SEB, kxxMzzFromfcNEQ_SEB; - - calcMoments(icell.TSW,omega,press_SWT,vx1_SWT,vx2_SWT,vx3_SWT, kxyFromfcNEQ_SWT, kyzFromfcNEQ_SWT, kxzFromfcNEQ_SWT, kxxMyyFromfcNEQ_SWT, kxxMzzFromfcNEQ_SWT); - calcMoments(icell.TNW,omega,press_NWT,vx1_NWT,vx2_NWT,vx3_NWT, kxyFromfcNEQ_NWT, kyzFromfcNEQ_NWT, kxzFromfcNEQ_NWT, kxxMyyFromfcNEQ_NWT, kxxMzzFromfcNEQ_NWT); - calcMoments(icell.TNE,omega,press_NET,vx1_NET,vx2_NET,vx3_NET, kxyFromfcNEQ_NET, kyzFromfcNEQ_NET, kxzFromfcNEQ_NET, kxxMyyFromfcNEQ_NET, kxxMzzFromfcNEQ_NET); - calcMoments(icell.TSE,omega,press_SET,vx1_SET,vx2_SET,vx3_SET, kxyFromfcNEQ_SET, kyzFromfcNEQ_SET, kxzFromfcNEQ_SET, kxxMyyFromfcNEQ_SET, kxxMzzFromfcNEQ_SET); - calcMoments(icell.BSW,omega,press_SWB,vx1_SWB,vx2_SWB,vx3_SWB, kxyFromfcNEQ_SWB, kyzFromfcNEQ_SWB, kxzFromfcNEQ_SWB, kxxMyyFromfcNEQ_SWB, kxxMzzFromfcNEQ_SWB); - calcMoments(icell.BNW,omega,press_NWB,vx1_NWB,vx2_NWB,vx3_NWB, kxyFromfcNEQ_NWB, kyzFromfcNEQ_NWB, kxzFromfcNEQ_NWB, kxxMyyFromfcNEQ_NWB, kxxMzzFromfcNEQ_NWB); - calcMoments(icell.BNE,omega,press_NEB,vx1_NEB,vx2_NEB,vx3_NEB, kxyFromfcNEQ_NEB, kyzFromfcNEQ_NEB, kxzFromfcNEQ_NEB, kxxMyyFromfcNEQ_NEB, kxxMzzFromfcNEQ_NEB); - calcMoments(icell.BSE,omega,press_SEB,vx1_SEB,vx2_SEB,vx3_SEB, kxyFromfcNEQ_SEB, kyzFromfcNEQ_SEB, kxzFromfcNEQ_SEB, kxxMyyFromfcNEQ_SEB, kxxMzzFromfcNEQ_SEB); - - //LBMReal dxRho=c1o4*((press_NET-press_SWB)+(press_SET-press_NWB)+(press_NEB-press_SWT)+(press_SEB-press_NWT)); - //LBMReal dyRho=c1o4*((press_NET-press_SWB)-(press_SET-press_NWB)+(press_NEB-press_SWT)-(press_SEB-press_NWT)); - //LBMReal dzRho=c1o4*((press_NET-press_SWB)+(press_SET-press_NWB)-(press_NEB-press_SWT)-(press_SEB-press_NWT)); - - // kxyFromfcNEQ_SWT+=vx1_SWT*dyRho+vx2_SWT*dxRho; - // kxyFromfcNEQ_NWT+=vx1_NWT*dyRho+vx2_NWT*dxRho; - // kxyFromfcNEQ_NET+=vx1_NET*dyRho+vx2_NET*dxRho; - // kxyFromfcNEQ_SET+=vx1_SET*dyRho+vx2_SET*dxRho; - // kxyFromfcNEQ_SWB+=vx1_SWB*dyRho+vx2_SWB*dxRho; - // kxyFromfcNEQ_NWB+=vx1_NWB*dyRho+vx2_NWB*dxRho; - // kxyFromfcNEQ_NEB+=vx1_NEB*dyRho+vx2_NEB*dxRho; - // kxyFromfcNEQ_SEB+=vx1_SEB*dyRho+vx2_SEB*dxRho; - - // kyzFromfcNEQ_SWT+=vx3_SWT*dyRho+vx2_SWT*dzRho; - // kyzFromfcNEQ_NWT+=vx3_NWT*dyRho+vx2_NWT*dzRho; - // kyzFromfcNEQ_NET+=vx3_NET*dyRho+vx2_NET*dzRho; - // kyzFromfcNEQ_SET+=vx3_SET*dyRho+vx2_SET*dzRho; - // kyzFromfcNEQ_SWB+=vx3_SWB*dyRho+vx2_SWB*dzRho; - // kyzFromfcNEQ_NWB+=vx3_NWB*dyRho+vx2_NWB*dzRho; - // kyzFromfcNEQ_NEB+=vx3_NEB*dyRho+vx2_NEB*dzRho; - // kyzFromfcNEQ_SEB+=vx3_SEB*dyRho+vx2_SEB*dzRho; - - // kxzFromfcNEQ_SWT+=vx1_SWT*dzRho+vx3_SWT*dxRho; - // kxzFromfcNEQ_NWT+=vx1_NWT*dzRho+vx3_NWT*dxRho; - // kxzFromfcNEQ_NET+=vx1_NET*dzRho+vx3_NET*dxRho; - // kxzFromfcNEQ_SET+=vx1_SET*dzRho+vx3_SET*dxRho; - // kxzFromfcNEQ_SWB+=vx1_SWB*dzRho+vx3_SWB*dxRho; - // kxzFromfcNEQ_NWB+=vx1_NWB*dzRho+vx3_NWB*dxRho; - // kxzFromfcNEQ_NEB+=vx1_NEB*dzRho+vx3_NEB*dxRho; - // kxzFromfcNEQ_SEB+=vx1_SEB*dzRho+vx3_SEB*dxRho; - - // kxxMyyFromfcNEQ_SWT+=vx1_SWT*dxRho-vx2_SWT*dyRho; - // kxxMyyFromfcNEQ_NWT+=vx1_NWT*dxRho-vx2_NWT*dyRho; - // kxxMyyFromfcNEQ_NET+=vx1_NET*dxRho-vx2_NET*dyRho; - // kxxMyyFromfcNEQ_SET+=vx1_SET*dxRho-vx2_SET*dyRho; - // kxxMyyFromfcNEQ_SWB+=vx1_SWB*dxRho-vx2_SWB*dyRho; - // kxxMyyFromfcNEQ_NWB+=vx1_NWB*dxRho-vx2_NWB*dyRho; - // kxxMyyFromfcNEQ_NEB+=vx1_NEB*dxRho-vx2_NEB*dyRho; - // kxxMyyFromfcNEQ_SEB+=vx1_SEB*dxRho-vx2_SEB*dyRho; - - // kxxMzzFromfcNEQ_SWT+=vx1_SWT*dxRho-vx3_SWT*dzRho; - // kxxMzzFromfcNEQ_NWT+=vx1_NWT*dxRho-vx3_NWT*dzRho; - // kxxMzzFromfcNEQ_NET+=vx1_NET*dxRho-vx3_NET*dzRho; - // kxxMzzFromfcNEQ_SET+=vx1_SET*dxRho-vx3_SET*dzRho; - // kxxMzzFromfcNEQ_SWB+=vx1_SWB*dxRho-vx3_SWB*dzRho; - // kxxMzzFromfcNEQ_NWB+=vx1_NWB*dxRho-vx3_NWB*dzRho; - // kxxMzzFromfcNEQ_NEB+=vx1_NEB*dxRho-vx3_NEB*dzRho; - // kxxMzzFromfcNEQ_SEB+=vx1_SEB*dxRho-vx3_SEB*dzRho; - - - //kxxMzzFromfcNEQ_SWT=0.0; - //kxxMzzFromfcNEQ_NWT=0.0; - //kxxMzzFromfcNEQ_NET=0.0; - //kxxMzzFromfcNEQ_SET=0.0; - //kxxMzzFromfcNEQ_SWB=0.0; - //kxxMzzFromfcNEQ_NWB=0.0; - //kxxMzzFromfcNEQ_NEB=0.0; - //kxxMzzFromfcNEQ_SEB=0.0; - - - - - - a0 = (-kxxMyyFromfcNEQ_NEB - kxxMyyFromfcNEQ_NET + kxxMyyFromfcNEQ_NWB + kxxMyyFromfcNEQ_NWT - - kxxMyyFromfcNEQ_SEB - kxxMyyFromfcNEQ_SET + kxxMyyFromfcNEQ_SWB + kxxMyyFromfcNEQ_SWT - - kxxMzzFromfcNEQ_NEB - kxxMzzFromfcNEQ_NET + kxxMzzFromfcNEQ_NWB + kxxMzzFromfcNEQ_NWT - - kxxMzzFromfcNEQ_SEB - kxxMzzFromfcNEQ_SET + kxxMzzFromfcNEQ_SWB + kxxMzzFromfcNEQ_SWT - - 2.*kxyFromfcNEQ_NEB - 2.*kxyFromfcNEQ_NET - 2.*kxyFromfcNEQ_NWB - 2.*kxyFromfcNEQ_NWT + - 2.*kxyFromfcNEQ_SEB + 2.*kxyFromfcNEQ_SET + 2.*kxyFromfcNEQ_SWB + 2.*kxyFromfcNEQ_SWT + - 2.*kxzFromfcNEQ_NEB - 2.*kxzFromfcNEQ_NET + 2.*kxzFromfcNEQ_NWB - 2.*kxzFromfcNEQ_NWT + - 2.*kxzFromfcNEQ_SEB - 2.*kxzFromfcNEQ_SET + 2.*kxzFromfcNEQ_SWB - 2.*kxzFromfcNEQ_SWT + - 8.*vx1_NEB + 8.*vx1_NET + 8.*vx1_NWB + 8.*vx1_NWT + 8.*vx1_SEB + - 8.*vx1_SET + 8.*vx1_SWB + 8.*vx1_SWT + 2.*vx2_NEB + 2.*vx2_NET - - 2.*vx2_NWB - 2.*vx2_NWT - 2.*vx2_SEB - 2.*vx2_SET + 2.*vx2_SWB + - 2.*vx2_SWT - 2.*vx3_NEB + 2.*vx3_NET + 2.*vx3_NWB - 2.*vx3_NWT - - 2.*vx3_SEB + 2.*vx3_SET + 2.*vx3_SWB - 2.*vx3_SWT)/64.; - b0 = (2.*kxxMyyFromfcNEQ_NEB + 2.*kxxMyyFromfcNEQ_NET + 2.*kxxMyyFromfcNEQ_NWB + 2.*kxxMyyFromfcNEQ_NWT - - 2.*kxxMyyFromfcNEQ_SEB - 2.*kxxMyyFromfcNEQ_SET - 2.*kxxMyyFromfcNEQ_SWB - 2.*kxxMyyFromfcNEQ_SWT - - kxxMzzFromfcNEQ_NEB - kxxMzzFromfcNEQ_NET - kxxMzzFromfcNEQ_NWB - kxxMzzFromfcNEQ_NWT + - kxxMzzFromfcNEQ_SEB + kxxMzzFromfcNEQ_SET + kxxMzzFromfcNEQ_SWB + kxxMzzFromfcNEQ_SWT - - 2.*kxyFromfcNEQ_NEB - 2.*kxyFromfcNEQ_NET + 2.*kxyFromfcNEQ_NWB + 2.*kxyFromfcNEQ_NWT - - 2.*kxyFromfcNEQ_SEB - 2.*kxyFromfcNEQ_SET + 2.*kxyFromfcNEQ_SWB + 2.*kxyFromfcNEQ_SWT + - 2.*kyzFromfcNEQ_NEB - 2.*kyzFromfcNEQ_NET + 2.*kyzFromfcNEQ_NWB - 2.*kyzFromfcNEQ_NWT + - 2.*kyzFromfcNEQ_SEB - 2.*kyzFromfcNEQ_SET + 2.*kyzFromfcNEQ_SWB - 2.*kyzFromfcNEQ_SWT + - 2.*vx1_NEB + 2.*vx1_NET - 2.*vx1_NWB - 2.*vx1_NWT - - 2.*vx1_SEB - 2.*vx1_SET + 2.*vx1_SWB + 2.*vx1_SWT + - 8.*vx2_NEB + 8.*vx2_NET + 8.*vx2_NWB + 8.*vx2_NWT + - 8.*vx2_SEB + 8.*vx2_SET + 8.*vx2_SWB + 8.*vx2_SWT - - 2.*vx3_NEB + 2.*vx3_NET - 2.*vx3_NWB + 2.*vx3_NWT + - 2.*vx3_SEB - 2.*vx3_SET + 2.*vx3_SWB - 2.*vx3_SWT)/64.; - c0 = (kxxMyyFromfcNEQ_NEB - kxxMyyFromfcNEQ_NET + kxxMyyFromfcNEQ_NWB - kxxMyyFromfcNEQ_NWT + - kxxMyyFromfcNEQ_SEB - kxxMyyFromfcNEQ_SET + kxxMyyFromfcNEQ_SWB - kxxMyyFromfcNEQ_SWT - - 2.*kxxMzzFromfcNEQ_NEB + 2.*kxxMzzFromfcNEQ_NET - 2.*kxxMzzFromfcNEQ_NWB + 2.*kxxMzzFromfcNEQ_NWT - - 2.*kxxMzzFromfcNEQ_SEB + 2.*kxxMzzFromfcNEQ_SET - 2.*kxxMzzFromfcNEQ_SWB + 2.*kxxMzzFromfcNEQ_SWT - - 2.*kxzFromfcNEQ_NEB - 2.*kxzFromfcNEQ_NET + 2.*kxzFromfcNEQ_NWB + 2.*kxzFromfcNEQ_NWT - - 2.*kxzFromfcNEQ_SEB - 2.*kxzFromfcNEQ_SET + 2.*kxzFromfcNEQ_SWB + 2.*kxzFromfcNEQ_SWT - - 2.*kyzFromfcNEQ_NEB - 2.*kyzFromfcNEQ_NET - 2.*kyzFromfcNEQ_NWB - 2.*kyzFromfcNEQ_NWT + - 2.*kyzFromfcNEQ_SEB + 2.*kyzFromfcNEQ_SET + 2.*kyzFromfcNEQ_SWB + 2.*kyzFromfcNEQ_SWT - - 2.*vx1_NEB + 2.*vx1_NET + 2.*vx1_NWB - 2.*vx1_NWT - - 2.*vx1_SEB + 2.*vx1_SET + 2.*vx1_SWB - 2.*vx1_SWT - - 2.*vx2_NEB + 2.*vx2_NET - 2.*vx2_NWB + 2.*vx2_NWT + - 2.*vx2_SEB - 2.*vx2_SET + 2.*vx2_SWB - 2.*vx2_SWT + - 8.*vx3_NEB + 8.*vx3_NET + 8.*vx3_NWB + 8.*vx3_NWT + - 8.*vx3_SEB + 8.*vx3_SET + 8.*vx3_SWB + 8.*vx3_SWT)/64.; - ax = (vx1_NEB + vx1_NET - vx1_NWB - vx1_NWT + vx1_SEB + vx1_SET - vx1_SWB - vx1_SWT)/4.; - bx = (vx2_NEB + vx2_NET - vx2_NWB - vx2_NWT + vx2_SEB + vx2_SET - vx2_SWB - vx2_SWT)/4.; - cx = (vx3_NEB + vx3_NET - vx3_NWB - vx3_NWT + vx3_SEB + vx3_SET - vx3_SWB - vx3_SWT)/4.; - axx= (kxxMyyFromfcNEQ_NEB + kxxMyyFromfcNEQ_NET - kxxMyyFromfcNEQ_NWB - kxxMyyFromfcNEQ_NWT + - kxxMyyFromfcNEQ_SEB + kxxMyyFromfcNEQ_SET - kxxMyyFromfcNEQ_SWB - kxxMyyFromfcNEQ_SWT + - kxxMzzFromfcNEQ_NEB + kxxMzzFromfcNEQ_NET - kxxMzzFromfcNEQ_NWB - kxxMzzFromfcNEQ_NWT + - kxxMzzFromfcNEQ_SEB + kxxMzzFromfcNEQ_SET - kxxMzzFromfcNEQ_SWB - kxxMzzFromfcNEQ_SWT + - 2.*vx2_NEB + 2.*vx2_NET - 2.*vx2_NWB - 2.*vx2_NWT - - 2.*vx2_SEB - 2.*vx2_SET + 2.*vx2_SWB + 2.*vx2_SWT - - 2.*vx3_NEB + 2.*vx3_NET + 2.*vx3_NWB - 2.*vx3_NWT - - 2.*vx3_SEB + 2.*vx3_SET + 2.*vx3_SWB - 2.*vx3_SWT)/16.; - bxx= (kxyFromfcNEQ_NEB + kxyFromfcNEQ_NET - kxyFromfcNEQ_NWB - kxyFromfcNEQ_NWT + - kxyFromfcNEQ_SEB + kxyFromfcNEQ_SET - kxyFromfcNEQ_SWB - kxyFromfcNEQ_SWT - - 2.*vx1_NEB - 2.*vx1_NET + 2.*vx1_NWB + 2.*vx1_NWT + - 2.*vx1_SEB + 2.*vx1_SET - 2.*vx1_SWB - 2.*vx1_SWT)/8.; - cxx= (kxzFromfcNEQ_NEB + kxzFromfcNEQ_NET - kxzFromfcNEQ_NWB - kxzFromfcNEQ_NWT + - kxzFromfcNEQ_SEB + kxzFromfcNEQ_SET - kxzFromfcNEQ_SWB - kxzFromfcNEQ_SWT + - 2.*vx1_NEB - 2.*vx1_NET - 2.*vx1_NWB + 2.*vx1_NWT + - 2.*vx1_SEB - 2.*vx1_SET - 2.*vx1_SWB + 2.*vx1_SWT)/8.; - ay = (vx1_NEB + vx1_NET + vx1_NWB + vx1_NWT - vx1_SEB - vx1_SET - vx1_SWB - vx1_SWT)/4.; - by = (vx2_NEB + vx2_NET + vx2_NWB + vx2_NWT - vx2_SEB - vx2_SET - vx2_SWB - vx2_SWT)/4.; - cy = (vx3_NEB + vx3_NET + vx3_NWB + vx3_NWT - vx3_SEB - vx3_SET - vx3_SWB - vx3_SWT)/4.; - ayy= (kxyFromfcNEQ_NEB + kxyFromfcNEQ_NET + kxyFromfcNEQ_NWB + kxyFromfcNEQ_NWT - - kxyFromfcNEQ_SEB - kxyFromfcNEQ_SET - kxyFromfcNEQ_SWB - kxyFromfcNEQ_SWT - - 2.*vx2_NEB - 2.*vx2_NET + 2.*vx2_NWB + 2.*vx2_NWT + - 2.*vx2_SEB + 2.*vx2_SET - 2.*vx2_SWB - 2.*vx2_SWT)/8.; - byy= (-2.*kxxMyyFromfcNEQ_NEB - 2.*kxxMyyFromfcNEQ_NET - 2.*kxxMyyFromfcNEQ_NWB - 2.*kxxMyyFromfcNEQ_NWT + - 2.*kxxMyyFromfcNEQ_SEB + 2.*kxxMyyFromfcNEQ_SET + 2.*kxxMyyFromfcNEQ_SWB + 2.*kxxMyyFromfcNEQ_SWT + - kxxMzzFromfcNEQ_NEB + kxxMzzFromfcNEQ_NET + kxxMzzFromfcNEQ_NWB + kxxMzzFromfcNEQ_NWT - - kxxMzzFromfcNEQ_SEB - kxxMzzFromfcNEQ_SET - kxxMzzFromfcNEQ_SWB - kxxMzzFromfcNEQ_SWT + - 2.*vx1_NEB + 2.*vx1_NET - 2.*vx1_NWB - 2.*vx1_NWT - - 2.*vx1_SEB - 2.*vx1_SET + 2.*vx1_SWB + 2.*vx1_SWT - - 2.*vx3_NEB + 2.*vx3_NET - 2.*vx3_NWB + 2.*vx3_NWT + - 2.*vx3_SEB - 2.*vx3_SET + 2.*vx3_SWB - 2.*vx3_SWT)/16.; - cyy= (kyzFromfcNEQ_NEB + kyzFromfcNEQ_NET + kyzFromfcNEQ_NWB + kyzFromfcNEQ_NWT - - kyzFromfcNEQ_SEB - kyzFromfcNEQ_SET - kyzFromfcNEQ_SWB - kyzFromfcNEQ_SWT + - 2.*vx2_NEB - 2.*vx2_NET + 2.*vx2_NWB - 2.*vx2_NWT - - 2.*vx2_SEB + 2.*vx2_SET - 2.*vx2_SWB + 2.*vx2_SWT)/8.; - az = (-vx1_NEB + vx1_NET - vx1_NWB + vx1_NWT - vx1_SEB + vx1_SET - vx1_SWB + vx1_SWT)/4.; - bz = (-vx2_NEB + vx2_NET - vx2_NWB + vx2_NWT - vx2_SEB + vx2_SET - vx2_SWB + vx2_SWT)/4.; - cz = (-vx3_NEB + vx3_NET - vx3_NWB + vx3_NWT - vx3_SEB + vx3_SET - vx3_SWB + vx3_SWT)/4.; - azz= (-kxzFromfcNEQ_NEB + kxzFromfcNEQ_NET - kxzFromfcNEQ_NWB + kxzFromfcNEQ_NWT - - kxzFromfcNEQ_SEB + kxzFromfcNEQ_SET - kxzFromfcNEQ_SWB + kxzFromfcNEQ_SWT + - 2.*vx3_NEB - 2.*vx3_NET - 2.*vx3_NWB + 2.*vx3_NWT + - 2.*vx3_SEB - 2.*vx3_SET - 2.*vx3_SWB + 2.*vx3_SWT)/8.; - bzz= (-kyzFromfcNEQ_NEB + kyzFromfcNEQ_NET - kyzFromfcNEQ_NWB + kyzFromfcNEQ_NWT - - kyzFromfcNEQ_SEB + kyzFromfcNEQ_SET - kyzFromfcNEQ_SWB + kyzFromfcNEQ_SWT + - 2.*vx3_NEB - 2.*vx3_NET + 2.*vx3_NWB - 2.*vx3_NWT - - 2.*vx3_SEB + 2.*vx3_SET - 2.*vx3_SWB + 2.*vx3_SWT)/8.; - czz= (-kxxMyyFromfcNEQ_NEB + kxxMyyFromfcNEQ_NET - kxxMyyFromfcNEQ_NWB + kxxMyyFromfcNEQ_NWT - - kxxMyyFromfcNEQ_SEB + kxxMyyFromfcNEQ_SET - kxxMyyFromfcNEQ_SWB + kxxMyyFromfcNEQ_SWT + - 2.*kxxMzzFromfcNEQ_NEB - 2.*kxxMzzFromfcNEQ_NET + 2.*kxxMzzFromfcNEQ_NWB - 2.*kxxMzzFromfcNEQ_NWT + - 2.*kxxMzzFromfcNEQ_SEB - 2.*kxxMzzFromfcNEQ_SET + 2.*kxxMzzFromfcNEQ_SWB - 2.*kxxMzzFromfcNEQ_SWT - - 2.*vx1_NEB + 2.*vx1_NET + 2.*vx1_NWB - 2.*vx1_NWT - - 2.*vx1_SEB + 2.*vx1_SET + 2.*vx1_SWB - 2.*vx1_SWT - - 2.*vx2_NEB + 2.*vx2_NET - 2.*vx2_NWB + 2.*vx2_NWT + - 2.*vx2_SEB - 2.*vx2_SET + 2.*vx2_SWB - 2.*vx2_SWT)/16.; - axy= (vx1_NEB + vx1_NET - vx1_NWB - vx1_NWT - vx1_SEB - vx1_SET + vx1_SWB + vx1_SWT)/2.; - bxy= (vx2_NEB + vx2_NET - vx2_NWB - vx2_NWT - vx2_SEB - vx2_SET + vx2_SWB + vx2_SWT)/2.; - cxy= (vx3_NEB + vx3_NET - vx3_NWB - vx3_NWT - vx3_SEB - vx3_SET + vx3_SWB + vx3_SWT)/2.; - axz= (-vx1_NEB + vx1_NET + vx1_NWB - vx1_NWT - vx1_SEB + vx1_SET + vx1_SWB - vx1_SWT)/2.; - bxz= (-vx2_NEB + vx2_NET + vx2_NWB - vx2_NWT - vx2_SEB + vx2_SET + vx2_SWB - vx2_SWT)/2.; - cxz= (-vx3_NEB + vx3_NET + vx3_NWB - vx3_NWT - vx3_SEB + vx3_SET + vx3_SWB - vx3_SWT)/2.; - ayz= (-vx1_NEB + vx1_NET - vx1_NWB + vx1_NWT + vx1_SEB - vx1_SET + vx1_SWB - vx1_SWT)/2.; - byz= (-vx2_NEB + vx2_NET - vx2_NWB + vx2_NWT + vx2_SEB - vx2_SET + vx2_SWB - vx2_SWT)/2.; - cyz= (-vx3_NEB + vx3_NET - vx3_NWB + vx3_NWT + vx3_SEB - vx3_SET + vx3_SWB - vx3_SWT)/2.; - axyz=-vx1_NEB + vx1_NET + vx1_NWB - vx1_NWT + vx1_SEB - vx1_SET - vx1_SWB + vx1_SWT; - bxyz=-vx2_NEB + vx2_NET + vx2_NWB - vx2_NWT + vx2_SEB - vx2_SET - vx2_SWB + vx2_SWT; - cxyz=-vx3_NEB + vx3_NET + vx3_NWB - vx3_NWT + vx3_SEB - vx3_SET - vx3_SWB + vx3_SWT; - - - ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - kxyAverage =0;//(kxyFromfcNEQ_SWB+ - //kxyFromfcNEQ_SWT+ - //kxyFromfcNEQ_SET+ - //kxyFromfcNEQ_SEB+ - //kxyFromfcNEQ_NWB+ - //kxyFromfcNEQ_NWT+ - //kxyFromfcNEQ_NET+ - //kxyFromfcNEQ_NEB)*c1o8-(ay+bx); - kyzAverage =0;//(kyzFromfcNEQ_SWB+ - //kyzFromfcNEQ_SWT+ - //kyzFromfcNEQ_SET+ - //kyzFromfcNEQ_SEB+ - //kyzFromfcNEQ_NWB+ - //kyzFromfcNEQ_NWT+ - //kyzFromfcNEQ_NET+ - //kyzFromfcNEQ_NEB)*c1o8-(bz+cy); - kxzAverage =0;//(kxzFromfcNEQ_SWB+ - //kxzFromfcNEQ_SWT+ - //kxzFromfcNEQ_SET+ - //kxzFromfcNEQ_SEB+ - //kxzFromfcNEQ_NWB+ - //kxzFromfcNEQ_NWT+ - //kxzFromfcNEQ_NET+ - //kxzFromfcNEQ_NEB)*c1o8-(az+cx); - kxxMyyAverage =0;//(kxxMyyFromfcNEQ_SWB+ - //kxxMyyFromfcNEQ_SWT+ - //kxxMyyFromfcNEQ_SET+ - //kxxMyyFromfcNEQ_SEB+ - //kxxMyyFromfcNEQ_NWB+ - //kxxMyyFromfcNEQ_NWT+ - //kxxMyyFromfcNEQ_NET+ - //kxxMyyFromfcNEQ_NEB)*c1o8-(ax-by); - kxxMzzAverage =0;//(kxxMzzFromfcNEQ_SWB+ - //kxxMzzFromfcNEQ_SWT+ - //kxxMzzFromfcNEQ_SET+ - //kxxMzzFromfcNEQ_SEB+ - //kxxMzzFromfcNEQ_NWB+ - //kxxMzzFromfcNEQ_NWT+ - //kxxMzzFromfcNEQ_NET+ - //kxxMzzFromfcNEQ_NEB)*c1o8-(ax-cz); - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - // - // Bernd das Brot - // - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - a0 = a0 + xoff * ax + yoff * ay + zoff * az + xoff_sq * axx + yoff_sq * ayy + zoff_sq * azz + xoff*yoff*axy + xoff*zoff*axz + yoff*zoff*ayz + xoff*yoff*zoff*axyz ; - ax = ax + 2. * xoff * axx + yoff * axy + zoff * axz + yoff*zoff*axyz; - ay = ay + 2. * yoff * ayy + xoff * axy + zoff * ayz + xoff*zoff*axyz; - az = az + 2. * zoff * azz + xoff * axz + yoff * ayz + xoff*yoff*axyz; - b0 = b0 + xoff * bx + yoff * by + zoff * bz + xoff_sq * bxx + yoff_sq * byy + zoff_sq * bzz + xoff*yoff*bxy + xoff*zoff*bxz + yoff*zoff*byz + xoff*yoff*zoff*bxyz; - bx = bx + 2. * xoff * bxx + yoff * bxy + zoff * bxz + yoff*zoff*bxyz; - by = by + 2. * yoff * byy + xoff * bxy + zoff * byz + xoff*zoff*bxyz; - bz = bz + 2. * zoff * bzz + xoff * bxz + yoff * byz + xoff*yoff*bxyz; - c0 = c0 + xoff * cx + yoff * cy + zoff * cz + xoff_sq * cxx + yoff_sq * cyy + zoff_sq * czz + xoff*yoff*cxy + xoff*zoff*cxz + yoff*zoff*cyz + xoff*yoff*zoff*cxyz; - cx = cx + 2. * xoff * cxx + yoff * cxy + zoff * cxz + yoff*zoff*cxyz; - cy = cy + 2. * yoff * cyy + xoff * cxy + zoff * cyz + xoff*zoff*cxyz; - cz = cz + 2. * zoff * czz + xoff * cxz + yoff * cyz + xoff*yoff*cxyz; - axy= axy + zoff*axyz; - axz= axz + yoff*axyz; - ayz= ayz + xoff*axyz; - bxy= bxy + zoff*bxyz; - bxz= bxz + yoff*bxyz; - byz= byz + xoff*bxyz; - cxy= cxy + zoff*cxyz; - cxz= cxz + yoff*cxyz; - cyz= cyz + xoff*cxyz; - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - const LBMReal o = omega; - - f_E = eps_new*((2*(-2*ax + by + cz-kxxMzzAverage-kxxMyyAverage))/(27.*o)); - f_N = eps_new*((2*(ax - 2*by + cz+2*kxxMyyAverage-kxxMzzAverage))/(27.*o)); - f_T = eps_new*((2*(ax + by - 2*cz-kxxMyyAverage+2*kxxMzzAverage))/(27.*o)); - f_NE = eps_new*(-(ax + 3*ay + 3*bx + by - 2*cz+2*kxxMyyAverage-kxxMyyAverage+3*kxyAverage)/(54.*o)); - f_SE = eps_new*(-(ax - 3*ay - 3*bx + by - 2*cz+2*kxxMyyAverage-kxxMyyAverage-3*kxyAverage)/(54.*o)); - f_TE = eps_new*(-(ax + 3*az - 2*by + 3*cx + cz+2*kxxMyyAverage-kxxMzzAverage+3*kxzAverage)/(54.*o)); - f_BE = eps_new*(-(ax - 3*az - 2*by - 3*cx + cz+2*kxxMyyAverage-kxxMzzAverage-3*kxzAverage)/(54.*o)); - f_TN = eps_new*(-(-2*ax + by + 3*bz + 3*cy + cz-kxxMyyAverage-kxxMzzAverage+3*kyzAverage)/(54.*o)); - f_BN = eps_new*(-(-2*ax + by - 3*bz - 3*cy + cz-kxxMyyAverage-kxxMzzAverage-3*kyzAverage)/(54.*o)); - f_ZERO = 0.; - f_TNE = eps_new*(-(ay + az + bx + bz + cx + cy+kxyAverage+kxzAverage+kyzAverage)/(72.*o)); - f_TSW = eps_new*((-ay + az - bx + bz + cx + cy-kxyAverage+kxzAverage+kyzAverage)/(72.*o)); - f_TSE = eps_new*((ay - az + bx + bz - cx + cy+kxyAverage-kxzAverage+kyzAverage)/(72.*o)); - f_TNW = eps_new*((ay + az + bx - bz + cx - cy+kxyAverage+kxzAverage-kyzAverage)/(72.*o)); - - x_E = 0.25*eps_new*((2*(-4*axx + bxy + cxz))/(27.*o)); - x_N = 0.25*eps_new*((2*(2*axx - 2*bxy + cxz))/(27.*o)); - x_T = 0.25*eps_new*((2*(2*axx + bxy - 2*cxz))/(27.*o)); - x_NE = 0.25*eps_new*(-((2*axx + 3*axy + 6*bxx + bxy - 2*cxz))/(54.*o)); - x_SE = 0.25*eps_new*(-((2*axx - 3*axy - 6*bxx + bxy - 2*cxz))/(54.*o)); - x_TE = 0.25*eps_new*(-((2*axx + 3*axz - 2*bxy + 6*cxx + cxz))/(54.*o)); - x_BE = 0.25*eps_new*(-((2*axx - 3*axz - 2*bxy - 6*cxx + cxz))/(54.*o)); - x_TN = 0.25*eps_new*(-((-4*axx + bxy + 3*bxz + 3*cxy + cxz))/(54.*o)); - x_BN = 0.25*eps_new*(-((-4*axx + bxy - 3*bxz - 3*cxy + cxz))/(54.*o)); - x_ZERO = 0.; - x_TNE = 0.25*eps_new*(-((axy + axz + 2*bxx + bxz + 2*cxx + cxy))/(72.*o)); - x_TSW = 0.25*eps_new*(((-axy + axz - 2*bxx + bxz + 2*cxx + cxy))/(72.*o)); - x_TSE = 0.25*eps_new*(((axy - axz + 2*bxx + bxz - 2*cxx + cxy))/(72.*o)); - x_TNW = 0.25*eps_new*(((axy + axz + 2*bxx - bxz + 2*cxx - cxy))/(72.*o)); - - y_E = 0.25*eps_new*(2*(-2*axy + 2*byy + cyz))/(27.*o); - y_N = 0.25*eps_new*(2*(axy - 4*byy + cyz))/(27.*o); - y_T = 0.25*eps_new*(2*(axy + 2*byy - 2*cyz))/(27.*o); - y_NE = 0.25*eps_new*(-((axy + 6*ayy + 3*bxy + 2*byy - 2*cyz))/(54.*o)); - y_SE = 0.25*eps_new*(-((axy - 6*ayy - 3*bxy + 2*byy - 2*cyz))/(54.*o)); - y_TE = 0.25*eps_new*(-((axy + 3*ayz - 4*byy + 3*cxy + cyz))/(54.*o)); - y_BE = 0.25*eps_new*(-((axy - 3*ayz - 4*byy - 3*cxy + cyz))/(54.*o)); - y_TN = 0.25*eps_new*(-((-2*axy + 2*byy + 3*byz + 6*cyy + cyz))/(54.*o)); - y_BN = 0.25*eps_new*(-((-2*axy + 2*byy - 3*byz - 6*cyy + cyz))/(54.*o)); - y_ZERO = 0.; - y_TNE = 0.25*eps_new*(-((2*ayy + ayz + bxy + byz + cxy + 2*cyy))/(72.*o)); - y_TSW = 0.25*eps_new*(((-2*ayy + ayz - bxy + byz + cxy + 2*cyy))/(72.*o)); - y_TSE = 0.25*eps_new*(((2*ayy - ayz + bxy + byz - cxy + 2*cyy))/(72.*o)); - y_TNW = 0.25*eps_new*(((2*ayy + ayz + bxy - byz + cxy - 2*cyy))/(72.*o)); - - z_E = 0.25*eps_new*((2*(-2*axz + byz + 2*czz))/(27.*o)); - z_N = 0.25*eps_new*((2*(axz - 2*byz + 2*czz))/(27.*o)); - z_T = 0.25*eps_new*((2*(axz + byz - 4*czz))/(27.*o)); - z_NE = 0.25*eps_new*(-((axz + 3*ayz + 3*bxz + byz - 4*czz))/(54.*o)); - z_SE = 0.25*eps_new*(-((axz - 3*ayz - 3*bxz + byz - 4*czz))/(54.*o)); - z_TE = 0.25*eps_new*(-((axz + 6*azz - 2*byz + 3*cxz + 2*czz))/(54.*o)); - z_BE = 0.25*eps_new*(-((axz - 6*azz - 2*byz - 3*cxz + 2*czz))/(54.*o)); - z_TN = 0.25*eps_new*(-((-2*axz + byz + 6*bzz + 3*cyz + 2*czz))/(54.*o)); - z_BN = 0.25*eps_new*(-((-2*axz + byz - 6*bzz - 3*cyz + 2*czz))/(54.*o)); - z_ZERO = 0.; - z_TNE = 0.25*eps_new*(-((ayz + 2*azz + bxz + 2*bzz + cxz + cyz))/(72.*o)); - z_TSW = 0.25*eps_new*(((-ayz + 2*azz - bxz + 2*bzz + cxz + cyz))/(72.*o)); - z_TSE = 0.25*eps_new*(((ayz - 2*azz + bxz + 2*bzz - cxz + cyz))/(72.*o)); - z_TNW = 0.25*eps_new*(((ayz + 2*azz + bxz - 2*bzz + cxz - cyz))/(72.*o)); - - xy_E = 0.0625*eps_new *(( 2.*cxyz)/(27.*o)); - xy_N = 0.0625*eps_new *(( 2.*cxyz)/(27.*o)); - xy_T = -(0.0625*eps_new *(( 4.*cxyz)/(27.*o))); - xy_NE = 0.0625*eps_new *( cxyz /(27.*o)); - xy_SE = 0.0625*eps_new *( cxyz /(27.*o)); - xy_TE = -(0.0625*eps_new *(( 3.*axyz + cxyz)/(54.*o))); - xy_BE = -(0.0625*eps_new *((-3.*axyz + cxyz)/(54.*o))); - xy_TN = -(0.0625*eps_new *(( 3.*bxyz + cxyz)/(54.*o))); - xy_BN = -(0.0625*eps_new *(( - 3.*bxyz + cxyz)/(54.*o))); - //xy_ZERO= 0.0625*eps_new; - xy_TNE = -(0.0625*eps_new *(( axyz + bxyz )/(72.*o))); - xy_TSW = 0.0625*eps_new *(( axyz + bxyz )/(72.*o)); - xy_TSE = 0.0625*eps_new *((- axyz + bxyz )/(72.*o)); - xy_TNW = 0.0625*eps_new *(( axyz - bxyz )/(72.*o)); - - xz_E = 0.0625*eps_new *(( 2.*bxyz )/(27.*o)); - xz_N = -(0.0625*eps_new *(( 4.*bxyz )/(27.*o))); - xz_T = 0.0625*eps_new *(( 2.*bxyz )/(27.*o)); - xz_NE = -(0.0625*eps_new *(( 3.*axyz + bxyz )/(54.*o))); - xz_SE = -(0.0625*eps_new *((-3.*axyz + bxyz )/(54.*o))); - xz_TE = 0.0625*eps_new *(( bxyz )/(27.*o)); - xz_BE = 0.0625*eps_new *(( bxyz )/(27.*o)); - xz_TN = -(0.0625*eps_new *(( bxyz + 3.*cxyz)/(54.*o))); - xz_BN = -(0.0625*eps_new *(( bxyz - 3.*cxyz)/(54.*o))); - //xz_ZERO= 0.0625*eps_new; - xz_TNE = -(0.0625*eps_new *(( axyz + cxyz)/(72.*o))); - xz_TSW = 0.0625*eps_new *((- axyz + cxyz)/(72.*o)); - xz_TSE = 0.0625*eps_new *(( axyz + cxyz)/(72.*o)); - xz_TNW = 0.0625*eps_new *(( axyz - cxyz)/(72.*o)); - - yz_E = -(0.0625*eps_new *(( 4.*axyz )/(27.*o))); - yz_N = 0.0625*eps_new *(( 2.*axyz )/(27.*o)); - yz_T = 0.0625*eps_new *(( 2.*axyz )/(27.*o)); - yz_NE = -(0.0625*eps_new *(( axyz + 3.*bxyz )/(54.*o))); - yz_SE = -(0.0625*eps_new *(( axyz - 3.*bxyz )/(54.*o))); - yz_TE = -(0.0625*eps_new *(( axyz + 3.*cxyz)/(54.*o))); - yz_BE = -(0.0625*eps_new *(( axyz - 3.*cxyz)/(54.*o))); - yz_TN = 0.0625*eps_new *(( axyz )/(27.*o)); - yz_BN = 0.0625*eps_new *(( axyz )/(27.*o)); - //yz_ZERO= 0.0625*eps_new; - yz_TNE = -(0.0625*eps_new *(( bxyz + cxyz)/(72.*o))); - yz_TSW = 0.0625*eps_new *(( - bxyz + cxyz)/(72.*o)); - yz_TSE = 0.0625*eps_new *(( bxyz - cxyz)/(72.*o)); - yz_TNW = 0.0625*eps_new *(( bxyz + cxyz)/(72.*o)); -} -////////////////////////////////////////////////////////////////////////// -void CompressibleOffsetMomentsInterpolationProcessor::calcInterpolatedNodeCF(LBMReal* f, LBMReal omega, LBMReal x, LBMReal y, LBMReal z, LBMReal press, LBMReal xs, LBMReal ys, LBMReal zs) -{ - using namespace D3Q27System; - - LBMReal eps_new = 0.5; - LBMReal o = omega; - //bulk viscosity - LBMReal oP = OxxPyyPzzF; - - LBMReal rho = press ;//+ (2.*axx*x+axy*y+axz*z+axyz*y*z+ax + 2.*byy*y+bxy*x+byz*z+bxyz*x*z+by + 2.*czz*z+cxz*x+cyz*y+cxyz*x*y+cz)/3.; - LBMReal vx1 = a0 + 0.25*( xs*ax + ys*ay + zs*az) + 0.0625*(axx + xs*ys*axy + xs*zs*axz + ayy + ys*zs*ayz + azz) + 0.015625*(xs*ys*zs*axyz); - LBMReal vx2 = b0 + 0.25*( xs*bx + ys*by + zs*bz) + 0.0625*(bxx + xs*ys*bxy + xs*zs*bxz + byy + ys*zs*byz + bzz) + 0.015625*(xs*ys*zs*bxyz); - LBMReal vx3 = c0 + 0.25*( xs*cx + ys*cy + zs*cz) + 0.0625*(cxx + xs*ys*cxy + xs*zs*cxz + cyy + ys*zs*cyz + czz) + 0.015625*(xs*ys*zs*cxyz); - - LBMReal mfcbb = zeroReal; - LBMReal mfabb = zeroReal; - LBMReal mfbcb = zeroReal; - LBMReal mfbab = zeroReal; - LBMReal mfbbc = zeroReal; - LBMReal mfbba = zeroReal; - LBMReal mfccb = zeroReal; - LBMReal mfaab = zeroReal; - LBMReal mfcab = zeroReal; - LBMReal mfacb = zeroReal; - LBMReal mfcbc = zeroReal; - LBMReal mfaba = zeroReal; - LBMReal mfcba = zeroReal; - LBMReal mfabc = zeroReal; - LBMReal mfbcc = zeroReal; - LBMReal mfbaa = zeroReal; - LBMReal mfbca = zeroReal; - LBMReal mfbac = zeroReal; - LBMReal mfbbb = zeroReal; - LBMReal mfccc = zeroReal; - LBMReal mfaac = zeroReal; - LBMReal mfcac = zeroReal; - LBMReal mfacc = zeroReal; - LBMReal mfcca = zeroReal; - LBMReal mfaaa = zeroReal; - LBMReal mfcaa = zeroReal; - LBMReal mfaca = zeroReal; - - mfaaa = press; // if drho is interpolated directly - - LBMReal vx1Sq = vx1*vx1; - LBMReal vx2Sq = vx2*vx2; - LBMReal vx3Sq = vx3*vx3; - LBMReal oMdrho = one; - - //2.f - - // linear combinations - LBMReal mxxPyyPzz = mfaaa - c2o3*(ax + by + two*axx*x + bxy*x + axy*y + two*byy*y + axz*z + byz*z + bxyz*x*z + axyz*y*z + cz - cxz*x + cyz*y + cxyz*x*y + two*czz*z)*eps_new / oP* (one + press); - LBMReal mxxMyy = -c2o3*(ax - by + kxxMyyAverage + two*axx*x - bxy*x + axy*y - two*byy*y + axz*z - byz*z - bxyz*x*z + axyz*y*z)*eps_new/o * (one + press); - LBMReal mxxMzz = -c2o3*(ax - cz + kxxMzzAverage + two*axx*x - cxz*x + axy*y - cyz*y - cxyz*x*y + axz*z - two*czz*z + axyz*y*z)*eps_new/o * (one + press); - - mfabb = -c1o3 * (bz + cy + kyzAverage + bxz*x + cxy*x + byz*y + two*cyy*y + bxyz*x*y + two*bzz*z + cyz*z + cxyz*x*z)*eps_new/o * (one + press); - mfbab = -c1o3 * (az + cx + kxzAverage + axz*x + two*cxx*x + ayz*y + cxy*y + axyz*x*y + two*azz*z + cxz*z + cxyz*y*z)*eps_new/o * (one + press); - mfbba = -c1o3 * (ay + bx + kxyAverage + axy*x + two*bxx*x + two*ayy*y + bxy*y + ayz*z + bxz*z + axyz*x*z + bxyz*y*z)*eps_new/o * (one + press); - - // linear combinations back - mfcaa = c1o3 * (mxxMyy + mxxMzz + mxxPyyPzz) ; - mfaca = c1o3 * (-two * mxxMyy + mxxMzz + mxxPyyPzz) ; - mfaac = c1o3 * (mxxMyy - two * mxxMzz + mxxPyyPzz) ; - - //three - mfbbb = zeroReal; - LBMReal mxxyPyzz = zeroReal; - LBMReal mxxyMyzz = zeroReal; - LBMReal mxxzPyyz = zeroReal; - LBMReal mxxzMyyz = zeroReal; - LBMReal mxyyPxzz = zeroReal; - LBMReal mxyyMxzz = zeroReal; - - // linear combinations back - mfcba = (mxxyMyzz + mxxyPyzz) * c1o2; - mfabc = (-mxxyMyzz + mxxyPyzz) * c1o2; - mfcab = (mxxzMyyz + mxxzPyyz) * c1o2; - mfacb = (-mxxzMyyz + mxxzPyyz) * c1o2; - mfbca = (mxyyMxzz + mxyyPxzz) * c1o2; - mfbac = (-mxyyMxzz + mxyyPxzz) * c1o2; - - //4.f - mfacc = mfaaa*c1o9; - mfcac = mfacc; - mfcca = mfacc; - - //5. - - //6. - - mfccc = mfaaa*c1o27; - //////////////////////////////////////////////////////////////////////////////////// - //back - //////////////////////////////////////////////////////////////////////////////////// - //mit 1, 0, 1/3, 0, 0, 0, 1/3, 0, 1/9 Konditionieren - //////////////////////////////////////////////////////////////////////////////////// - // Z - Dir - LBMReal m0 = mfaac * c1o2 + mfaab * (vx3 - c1o2) + (mfaaa + one * oMdrho) * (vx3Sq - vx3) * c1o2; - LBMReal m1 = -mfaac - two * mfaab * vx3 + mfaaa * (one - vx3Sq) - one * oMdrho * vx3Sq; - LBMReal m2 = mfaac * c1o2 + mfaab * (vx3 + c1o2) + (mfaaa + one * oMdrho) * (vx3Sq + vx3) * c1o2; - mfaaa = m0; - mfaab = m1; - mfaac = m2; - //////////////////////////////////////////////////////////////////////////////////// - m0 = mfabc * c1o2 + mfabb * (vx3 - c1o2) + mfaba * (vx3Sq - vx3) * c1o2; - m1 = -mfabc - two * mfabb * vx3 + mfaba * (one - vx3Sq); - m2 = mfabc * c1o2 + mfabb * (vx3 + c1o2) + mfaba * (vx3Sq + vx3) * c1o2; - mfaba = m0; - mfabb = m1; - mfabc = m2; - //////////////////////////////////////////////////////////////////////////////////// - m0 = mfacc * c1o2 + mfacb * (vx3 - c1o2) + (mfaca + c1o3 * oMdrho) * (vx3Sq - vx3) * c1o2; - m1 = -mfacc - two * mfacb * vx3 + mfaca * (one - vx3Sq) - c1o3 * oMdrho * vx3Sq; - m2 = mfacc * c1o2 + mfacb * (vx3 + c1o2) + (mfaca + c1o3 * oMdrho) * (vx3Sq + vx3) * c1o2; - mfaca = m0; - mfacb = m1; - mfacc = m2; - //////////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////////// - m0 = mfbac * c1o2 + mfbab * (vx3 - c1o2) + mfbaa * (vx3Sq - vx3) * c1o2; - m1 = -mfbac - two * mfbab * vx3 + mfbaa * (one - vx3Sq); - m2 = mfbac * c1o2 + mfbab * (vx3 + c1o2) + mfbaa * (vx3Sq + vx3) * c1o2; - mfbaa = m0; - mfbab = m1; - mfbac = m2; - /////////b////////////////////////////////////////////////////////////////////////// - m0 = mfbbc * c1o2 + mfbbb * (vx3 - c1o2) + mfbba * (vx3Sq - vx3) * c1o2; - m1 = -mfbbc - two * mfbbb * vx3 + mfbba * (one - vx3Sq); - m2 = mfbbc * c1o2 + mfbbb * (vx3 + c1o2) + mfbba * (vx3Sq + vx3) * c1o2; - mfbba = m0; - mfbbb = m1; - mfbbc = m2; - /////////b////////////////////////////////////////////////////////////////////////// - m0 = mfbcc * c1o2 + mfbcb * (vx3 - c1o2) + mfbca * (vx3Sq - vx3) * c1o2; - m1 = -mfbcc - two * mfbcb * vx3 + mfbca * (one - vx3Sq); - m2 = mfbcc * c1o2 + mfbcb * (vx3 + c1o2) + mfbca * (vx3Sq + vx3) * c1o2; - mfbca = m0; - mfbcb = m1; - mfbcc = m2; - //////////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////////// - m0 = mfcac * c1o2 + mfcab * (vx3 - c1o2) + (mfcaa + c1o3 * oMdrho) * (vx3Sq - vx3) * c1o2; - m1 = -mfcac - two * mfcab * vx3 + mfcaa * (one - vx3Sq) - c1o3 * oMdrho * vx3Sq; - m2 = mfcac * c1o2 + mfcab * (vx3 + c1o2) + (mfcaa + c1o3 * oMdrho) * (vx3Sq + vx3) * c1o2; - mfcaa = m0; - mfcab = m1; - mfcac = m2; - /////////c////////////////////////////////////////////////////////////////////////// - m0 = mfcbc * c1o2 + mfcbb * (vx3 - c1o2) + mfcba * (vx3Sq - vx3) * c1o2; - m1 = -mfcbc - two * mfcbb * vx3 + mfcba * (one - vx3Sq); - m2 = mfcbc * c1o2 + mfcbb * (vx3 + c1o2) + mfcba * (vx3Sq + vx3) * c1o2; - mfcba = m0; - mfcbb = m1; - mfcbc = m2; - /////////c////////////////////////////////////////////////////////////////////////// - m0 = mfccc * c1o2 + mfccb * (vx3 - c1o2) + (mfcca + c1o9 * oMdrho) * (vx3Sq - vx3) * c1o2; - m1 = -mfccc - two * mfccb * vx3 + mfcca * (one - vx3Sq) - c1o9 * oMdrho * vx3Sq; - m2 = mfccc * c1o2 + mfccb * (vx3 + c1o2) + (mfcca + c1o9 * oMdrho) * (vx3Sq + vx3) * c1o2; - mfcca = m0; - mfccb = m1; - mfccc = m2; - //////////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////////// - //mit 1/6, 2/3, 1/6, 0, 0, 0, 1/18, 2/9, 1/18 Konditionieren - //////////////////////////////////////////////////////////////////////////////////// - // Y - Dir - m0 = mfaca * c1o2 + mfaba * (vx2 - c1o2) + (mfaaa + c1o6 * oMdrho) * (vx2Sq - vx2) * c1o2; - m1 = -mfaca - two * mfaba * vx2 + mfaaa * (one - vx2Sq) - c1o6 * oMdrho * vx2Sq; - m2 = mfaca * c1o2 + mfaba * (vx2 + c1o2) + (mfaaa + c1o6 * oMdrho) * (vx2Sq + vx2) * c1o2; - mfaaa = m0; - mfaba = m1; - mfaca = m2; - //////////////////////////////////////////////////////////////////////////////////// - m0 = mfacb * c1o2 + mfabb * (vx2 - c1o2) + (mfaab + c2o3 * oMdrho) * (vx2Sq - vx2) * c1o2; - m1 = -mfacb - two * mfabb * vx2 + mfaab * (one - vx2Sq) - c2o3 * oMdrho * vx2Sq; - m2 = mfacb * c1o2 + mfabb * (vx2 + c1o2) + (mfaab + c2o3 * oMdrho) * (vx2Sq + vx2) * c1o2; - mfaab = m0; - mfabb = m1; - mfacb = m2; - //////////////////////////////////////////////////////////////////////////////////// - m0 = mfacc * c1o2 + mfabc * (vx2 - c1o2) + (mfaac + c1o6 * oMdrho) * (vx2Sq - vx2) * c1o2; - m1 = -mfacc - two * mfabc * vx2 + mfaac * (one - vx2Sq) - c1o6 * oMdrho * vx2Sq; - m2 = mfacc * c1o2 + mfabc * (vx2 + c1o2) + (mfaac + c1o6 * oMdrho) * (vx2Sq + vx2) * c1o2; - mfaac = m0; - mfabc = m1; - mfacc = m2; - //////////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////////// - m0 = mfbca * c1o2 + mfbba * (vx2 - c1o2) + mfbaa * (vx2Sq - vx2) * c1o2; - m1 = -mfbca - two * mfbba * vx2 + mfbaa * (one - vx2Sq); - m2 = mfbca * c1o2 + mfbba * (vx2 + c1o2) + mfbaa * (vx2Sq + vx2) * c1o2; - mfbaa = m0; - mfbba = m1; - mfbca = m2; - /////////b////////////////////////////////////////////////////////////////////////// - m0 = mfbcb * c1o2 + mfbbb * (vx2 - c1o2) + mfbab * (vx2Sq - vx2) * c1o2; - m1 = -mfbcb - two * mfbbb * vx2 + mfbab * (one - vx2Sq); - m2 = mfbcb * c1o2 + mfbbb * (vx2 + c1o2) + mfbab * (vx2Sq + vx2) * c1o2; - mfbab = m0; - mfbbb = m1; - mfbcb = m2; - /////////b////////////////////////////////////////////////////////////////////////// - m0 = mfbcc * c1o2 + mfbbc * (vx2 - c1o2) + mfbac * (vx2Sq - vx2) * c1o2; - m1 = -mfbcc - two * mfbbc * vx2 + mfbac * (one - vx2Sq); - m2 = mfbcc * c1o2 + mfbbc * (vx2 + c1o2) + mfbac * (vx2Sq + vx2) * c1o2; - mfbac = m0; - mfbbc = m1; - mfbcc = m2; - //////////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////////// - m0 = mfcca * c1o2 + mfcba * (vx2 - c1o2) + (mfcaa + c1o18 * oMdrho) * (vx2Sq - vx2) * c1o2; - m1 = -mfcca - two * mfcba * vx2 + mfcaa * (one - vx2Sq) - c1o18 * oMdrho * vx2Sq; - m2 = mfcca * c1o2 + mfcba * (vx2 + c1o2) + (mfcaa + c1o18 * oMdrho) * (vx2Sq + vx2) * c1o2; - mfcaa = m0; - mfcba = m1; - mfcca = m2; - /////////c////////////////////////////////////////////////////////////////////////// - m0 = mfccb * c1o2 + mfcbb * (vx2 - c1o2) + (mfcab + c2o9 * oMdrho) * (vx2Sq - vx2) * c1o2; - m1 = -mfccb - two * mfcbb * vx2 + mfcab * (one - vx2Sq) - c2o9 * oMdrho * vx2Sq; - m2 = mfccb * c1o2 + mfcbb * (vx2 + c1o2) + (mfcab + c2o9 * oMdrho) * (vx2Sq + vx2) * c1o2; - mfcab = m0; - mfcbb = m1; - mfccb = m2; - /////////c////////////////////////////////////////////////////////////////////////// - m0 = mfccc * c1o2 + mfcbc * (vx2 - c1o2) + (mfcac + c1o18 * oMdrho) * (vx2Sq - vx2) * c1o2; - m1 = -mfccc - two * mfcbc * vx2 + mfcac * (one - vx2Sq) - c1o18 * oMdrho * vx2Sq; - m2 = mfccc * c1o2 + mfcbc * (vx2 + c1o2) + (mfcac + c1o18 * oMdrho) * (vx2Sq + vx2) * c1o2; - mfcac = m0; - mfcbc = m1; - mfccc = m2; - //////////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////////// - //mit 1/36, 1/9, 1/36, 1/9, 4/9, 1/9, 1/36, 1/9, 1/36 Konditionieren - //////////////////////////////////////////////////////////////////////////////////// - // X - Dir - m0 = mfcaa * c1o2 + mfbaa * (vx1 - c1o2) + (mfaaa + c1o36 * oMdrho) * (vx1Sq - vx1) * c1o2; - m1 = -mfcaa - two * mfbaa * vx1 + mfaaa * (one - vx1Sq) - c1o36 * oMdrho * vx1Sq; - m2 = mfcaa * c1o2 + mfbaa * (vx1 + c1o2) + (mfaaa + c1o36 * oMdrho) * (vx1Sq + vx1) * c1o2; - mfaaa = m0; - mfbaa = m1; - mfcaa = m2; - //////////////////////////////////////////////////////////////////////////////////// - m0 = mfcba * c1o2 + mfbba * (vx1 - c1o2) + (mfaba + c1o9 * oMdrho) * (vx1Sq - vx1) * c1o2; - m1 = -mfcba - two * mfbba * vx1 + mfaba * (one - vx1Sq) - c1o9 * oMdrho * vx1Sq; - m2 = mfcba * c1o2 + mfbba * (vx1 + c1o2) + (mfaba + c1o9 * oMdrho) * (vx1Sq + vx1) * c1o2; - mfaba = m0; - mfbba = m1; - mfcba = m2; - //////////////////////////////////////////////////////////////////////////////////// - m0 = mfcca * c1o2 + mfbca * (vx1 - c1o2) + (mfaca + c1o36 * oMdrho) * (vx1Sq - vx1) * c1o2; - m1 = -mfcca - two * mfbca * vx1 + mfaca * (one - vx1Sq) - c1o36 * oMdrho * vx1Sq; - m2 = mfcca * c1o2 + mfbca * (vx1 + c1o2) + (mfaca + c1o36 * oMdrho) * (vx1Sq + vx1) * c1o2; - mfaca = m0; - mfbca = m1; - mfcca = m2; - //////////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////////// - m0 = mfcab * c1o2 + mfbab * (vx1 - c1o2) + (mfaab + c1o9 * oMdrho) * (vx1Sq - vx1) * c1o2; - m1 = -mfcab - two * mfbab * vx1 + mfaab * (one - vx1Sq) - c1o9 * oMdrho * vx1Sq; - m2 = mfcab * c1o2 + mfbab * (vx1 + c1o2) + (mfaab + c1o9 * oMdrho) * (vx1Sq + vx1) * c1o2; - mfaab = m0; - mfbab = m1; - mfcab = m2; - ///////////b//////////////////////////////////////////////////////////////////////// - m0 = mfcbb * c1o2 + mfbbb * (vx1 - c1o2) + (mfabb + c4o9 * oMdrho) * (vx1Sq - vx1) * c1o2; - m1 = -mfcbb - two * mfbbb * vx1 + mfabb * (one - vx1Sq) - c4o9 * oMdrho * vx1Sq; - m2 = mfcbb * c1o2 + mfbbb * (vx1 + c1o2) + (mfabb + c4o9 * oMdrho) * (vx1Sq + vx1) * c1o2; - mfabb = m0; - mfbbb = m1; - mfcbb = m2; - ///////////b//////////////////////////////////////////////////////////////////////// - m0 = mfccb * c1o2 + mfbcb * (vx1 - c1o2) + (mfacb + c1o9 * oMdrho) * (vx1Sq - vx1) * c1o2; - m1 = -mfccb - two * mfbcb * vx1 + mfacb * (one - vx1Sq) - c1o9 * oMdrho * vx1Sq; - m2 = mfccb * c1o2 + mfbcb * (vx1 + c1o2) + (mfacb + c1o9 * oMdrho) * (vx1Sq + vx1) * c1o2; - mfacb = m0; - mfbcb = m1; - mfccb = m2; - //////////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////////// - m0 = mfcac * c1o2 + mfbac * (vx1 - c1o2) + (mfaac + c1o36 * oMdrho) * (vx1Sq - vx1) * c1o2; - m1 = -mfcac - two * mfbac * vx1 + mfaac * (one - vx1Sq) - c1o36 * oMdrho * vx1Sq; - m2 = mfcac * c1o2 + mfbac * (vx1 + c1o2) + (mfaac + c1o36 * oMdrho) * (vx1Sq + vx1) * c1o2; - mfaac = m0; - mfbac = m1; - mfcac = m2; - ///////////c//////////////////////////////////////////////////////////////////////// - m0 = mfcbc * c1o2 + mfbbc * (vx1 - c1o2) + (mfabc + c1o9 * oMdrho) * (vx1Sq - vx1) * c1o2; - m1 = -mfcbc - two * mfbbc * vx1 + mfabc * (one - vx1Sq) - c1o9 * oMdrho * vx1Sq; - m2 = mfcbc * c1o2 + mfbbc * (vx1 + c1o2) + (mfabc + c1o9 * oMdrho) * (vx1Sq + vx1) * c1o2; - mfabc = m0; - mfbbc = m1; - mfcbc = m2; - ///////////c//////////////////////////////////////////////////////////////////////// - m0 = mfccc * c1o2 + mfbcc * (vx1 - c1o2) + (mfacc + c1o36 * oMdrho) * (vx1Sq - vx1) * c1o2; - m1 = -mfccc - two * mfbcc * vx1 + mfacc * (one - vx1Sq) - c1o36 * oMdrho * vx1Sq; - m2 = mfccc * c1o2 + mfbcc * (vx1 + c1o2) + (mfacc + c1o36 * oMdrho) * (vx1Sq + vx1) * c1o2; - mfacc = m0; - mfbcc = m1; - mfccc = m2; - //////////////////////////////////////////////////////////////////////////////////// - - f[E] = mfcbb; - f[W] = mfabb; - f[N] = mfbcb; - f[S] = mfbab; - f[T] = mfbbc; - f[B] = mfbba; - f[NE] = mfccb; - f[SW] = mfaab; - f[SE] = mfcab; - f[NW] = mfacb; - f[TE] = mfcbc; - f[BW] = mfaba; - f[BE] = mfcba; - f[TW] = mfabc; - f[TN] = mfbcc; - f[BS] = mfbaa; - f[BN] = mfbca; - f[TS] = mfbac; - f[ZERO] = mfbbb; - f[TNE] = mfccc; - f[TSE] = mfcac; - f[BNE] = mfcca; - f[BSE] = mfcaa; - f[TNW] = mfacc; - f[TSW] = mfaac; - f[BNW] = mfaca; - f[BSW] = mfaaa; -} -////////////////////////////////////////////////////////////////////////// -//Position SWB -0.25, -0.25, -0.25 -LBMReal CompressibleOffsetMomentsInterpolationProcessor::calcPressBSW() -{ - return press_SWT * (0.140625 + 0.1875 * xoff + 0.1875 * yoff - 0.5625 * zoff) + - press_NWT * (0.046875 + 0.0625 * xoff - 0.1875 * yoff - 0.1875 * zoff) + - press_SET * (0.046875 - 0.1875 * xoff + 0.0625 * yoff - 0.1875 * zoff) + - press_NET * (0.015625 - 0.0625 * xoff - 0.0625 * yoff - 0.0625 * zoff) + - press_NEB * (0.046875 - 0.1875 * xoff - 0.1875 * yoff + 0.0625 * zoff) + - press_NWB * (0.140625 + 0.1875 * xoff - 0.5625 * yoff + 0.1875 * zoff) + - press_SEB * (0.140625 - 0.5625 * xoff + 0.1875 * yoff + 0.1875 * zoff) + - press_SWB * (0.421875 + 0.5625 * xoff + 0.5625 * yoff + 0.5625 * zoff); -} -////////////////////////////////////////////////////////////////////////// -//Position SWT -0.25, -0.25, 0.25 -LBMReal CompressibleOffsetMomentsInterpolationProcessor::calcPressTSW() -{ - return press_SWT * (0.421875 + 0.5625 * xoff + 0.5625 * yoff - 0.5625 * zoff) + - press_NWT * (0.140625 + 0.1875 * xoff - 0.5625 * yoff - 0.1875 * zoff) + - press_SET * (0.140625 - 0.5625 * xoff + 0.1875 * yoff - 0.1875 * zoff) + - press_NET * (0.046875 - 0.1875 * xoff - 0.1875 * yoff - 0.0625 * zoff) + - press_NEB * (0.015625 - 0.0625 * xoff - 0.0625 * yoff + 0.0625 * zoff) + - press_NWB * (0.046875 + 0.0625 * xoff - 0.1875 * yoff + 0.1875 * zoff) + - press_SEB * (0.046875 - 0.1875 * xoff + 0.0625 * yoff + 0.1875 * zoff) + - press_SWB * (0.140625 + 0.1875 * xoff + 0.1875 * yoff + 0.5625 * zoff); -} -////////////////////////////////////////////////////////////////////////// -//Position SET 0.25, -0.25, 0.25 -LBMReal CompressibleOffsetMomentsInterpolationProcessor::calcPressTSE() -{ - return press_SET * (0.421875 - 0.5625 * xoff + 0.5625 * yoff - 0.5625 * zoff) + - press_NET * (0.140625 - 0.1875 * xoff - 0.5625 * yoff - 0.1875 * zoff) + - press_SWT * (0.140625 + 0.5625 * xoff + 0.1875 * yoff - 0.1875 * zoff) + - press_NWT * (0.046875 + 0.1875 * xoff - 0.1875 * yoff - 0.0625 * zoff) + - press_NWB * (0.015625 + 0.0625 * xoff - 0.0625 * yoff + 0.0625 * zoff) + - press_NEB * (0.046875 - 0.0625 * xoff - 0.1875 * yoff + 0.1875 * zoff) + - press_SWB * (0.046875 + 0.1875 * xoff + 0.0625 * yoff + 0.1875 * zoff) + - press_SEB * (0.140625 - 0.1875 * xoff + 0.1875 * yoff + 0.5625 * zoff); -} -////////////////////////////////////////////////////////////////////////// -//Position SEB 0.25, -0.25, -0.25 -LBMReal CompressibleOffsetMomentsInterpolationProcessor::calcPressBSE() -{ - return press_SET * (0.140625 - 0.1875 * xoff + 0.1875 * yoff - 0.5625 * zoff) + - press_NET * (0.046875 - 0.0625 * xoff - 0.1875 * yoff - 0.1875 * zoff) + - press_SWT * (0.046875 + 0.1875 * xoff + 0.0625 * yoff - 0.1875 * zoff) + - press_NWT * (0.015625 + 0.0625 * xoff - 0.0625 * yoff - 0.0625 * zoff) + - press_NWB * (0.046875 + 0.1875 * xoff - 0.1875 * yoff + 0.0625 * zoff) + - press_NEB * (0.140625 - 0.1875 * xoff - 0.5625 * yoff + 0.1875 * zoff) + - press_SWB * (0.140625 + 0.5625 * xoff + 0.1875 * yoff + 0.1875 * zoff) + - press_SEB * (0.421875 - 0.5625 * xoff + 0.5625 * yoff + 0.5625 * zoff); -} -////////////////////////////////////////////////////////////////////////// -//Position NWB -0.25, 0.25, -0.25 -LBMReal CompressibleOffsetMomentsInterpolationProcessor::calcPressBNW() -{ - return press_NWT * (0.140625 + 0.1875 * xoff - 0.1875 * yoff - 0.5625 * zoff) + - press_NET * (0.046875 - 0.1875 * xoff - 0.0625 * yoff - 0.1875 * zoff) + - press_SWT * (0.046875 + 0.0625 * xoff + 0.1875 * yoff - 0.1875 * zoff) + - press_SET * (0.015625 - 0.0625 * xoff + 0.0625 * yoff - 0.0625 * zoff) + - press_SEB * (0.046875 - 0.1875 * xoff + 0.1875 * yoff + 0.0625 * zoff) + - press_NEB * (0.140625 - 0.5625 * xoff - 0.1875 * yoff + 0.1875 * zoff) + - press_SWB * (0.140625 + 0.1875 * xoff + 0.5625 * yoff + 0.1875 * zoff) + - press_NWB * (0.421875 + 0.5625 * xoff - 0.5625 * yoff + 0.5625 * zoff); -} -////////////////////////////////////////////////////////////////////////// -//Position NWT -0.25, 0.25, 0.25 -LBMReal CompressibleOffsetMomentsInterpolationProcessor::calcPressTNW() -{ - return press_NWT * (0.421875 + 0.5625 * xoff - 0.5625 * yoff - 0.5625 * zoff) + - press_NET * (0.140625 - 0.5625 * xoff - 0.1875 * yoff - 0.1875 * zoff) + - press_SWT * (0.140625 + 0.1875 * xoff + 0.5625 * yoff - 0.1875 * zoff) + - press_SET * (0.046875 - 0.1875 * xoff + 0.1875 * yoff - 0.0625 * zoff) + - press_SEB * (0.015625 - 0.0625 * xoff + 0.0625 * yoff + 0.0625 * zoff) + - press_NEB * (0.046875 - 0.1875 * xoff - 0.0625 * yoff + 0.1875 * zoff) + - press_SWB * (0.046875 + 0.0625 * xoff + 0.1875 * yoff + 0.1875 * zoff) + - press_NWB * (0.140625 + 0.1875 * xoff - 0.1875 * yoff + 0.5625 * zoff); -} -////////////////////////////////////////////////////////////////////////// -//Position NET 0.25, 0.25, 0.25 -LBMReal CompressibleOffsetMomentsInterpolationProcessor::calcPressTNE() -{ - return press_NET * (0.421875 - 0.5625 * xoff - 0.5625 * yoff - 0.5625 * zoff) + - press_NWT * (0.140625 + 0.5625 * xoff - 0.1875 * yoff - 0.1875 * zoff) + - press_SET * (0.140625 - 0.1875 * xoff + 0.5625 * yoff - 0.1875 * zoff) + - press_SWT * (0.046875 + 0.1875 * xoff + 0.1875 * yoff - 0.0625 * zoff) + - press_SWB * (0.015625 + 0.0625 * xoff + 0.0625 * yoff + 0.0625 * zoff) + - press_NWB * (0.046875 + 0.1875 * xoff - 0.0625 * yoff + 0.1875 * zoff) + - press_SEB * (0.046875 - 0.0625 * xoff + 0.1875 * yoff + 0.1875 * zoff) + - press_NEB * (0.140625 - 0.1875 * xoff - 0.1875 * yoff + 0.5625 * zoff); -} -////////////////////////////////////////////////////////////////////////// -//Position NEB 0.25, 0.25, -0.25 -LBMReal CompressibleOffsetMomentsInterpolationProcessor::calcPressBNE() -{ - return press_NET * (0.140625 - 0.1875 * xoff - 0.1875 * yoff - 0.5625 * zoff) + - press_NWT * (0.046875 + 0.1875 * xoff - 0.0625 * yoff - 0.1875 * zoff) + - press_SET * (0.046875 - 0.0625 * xoff + 0.1875 * yoff - 0.1875 * zoff) + - press_SWT * (0.015625 + 0.0625 * xoff + 0.0625 * yoff - 0.0625 * zoff) + - press_SWB * (0.046875 + 0.1875 * xoff + 0.1875 * yoff + 0.0625 * zoff) + - press_NWB * (0.140625 + 0.5625 * xoff - 0.1875 * yoff + 0.1875 * zoff) + - press_SEB * (0.140625 - 0.1875 * xoff + 0.5625 * yoff + 0.1875 * zoff) + - press_NEB * (0.421875 - 0.5625 * xoff - 0.5625 * yoff + 0.5625 * zoff); -} -////////////////////////////////////////////////////////////////////////// -//Position C 0.0, 0.0, 0.0 -void CompressibleOffsetMomentsInterpolationProcessor::calcInterpolatedNodeFC(LBMReal* f, LBMReal omega) -{ - using namespace D3Q27System; - - LBMReal press = press_NET * (0.125 - 0.25 * xoff - 0.25 * yoff - 0.25 * zoff) + - press_NWT * (0.125 + 0.25 * xoff - 0.25 * yoff - 0.25 * zoff) + - press_SET * (0.125 - 0.25 * xoff + 0.25 * yoff - 0.25 * zoff) + - press_SWT * (0.125 + 0.25 * xoff + 0.25 * yoff - 0.25 * zoff) + - press_NEB * (0.125 - 0.25 * xoff - 0.25 * yoff + 0.25 * zoff) + - press_NWB * (0.125 + 0.25 * xoff - 0.25 * yoff + 0.25 * zoff) + - press_SEB * (0.125 - 0.25 * xoff + 0.25 * yoff + 0.25 * zoff) + - press_SWB * (0.125 + 0.25 * xoff + 0.25 * yoff + 0.25 * zoff); - LBMReal vx1 = a0; - LBMReal vx2 = b0; - LBMReal vx3 = c0; - - LBMReal rho = press ;//+ (ax+by+cz)/3.; - - LBMReal eps_new = 2.; - LBMReal o = omega; - //bulk viscosity - LBMReal oP = OxxPyyPzzC; - - LBMReal mfcbb = zeroReal; - LBMReal mfabb = zeroReal; - LBMReal mfbcb = zeroReal; - LBMReal mfbab = zeroReal; - LBMReal mfbbc = zeroReal; - LBMReal mfbba = zeroReal; - LBMReal mfccb = zeroReal; - LBMReal mfaab = zeroReal; - LBMReal mfcab = zeroReal; - LBMReal mfacb = zeroReal; - LBMReal mfcbc = zeroReal; - LBMReal mfaba = zeroReal; - LBMReal mfcba = zeroReal; - LBMReal mfabc = zeroReal; - LBMReal mfbcc = zeroReal; - LBMReal mfbaa = zeroReal; - LBMReal mfbca = zeroReal; - LBMReal mfbac = zeroReal; - LBMReal mfbbb = zeroReal; - LBMReal mfccc = zeroReal; - LBMReal mfaac = zeroReal; - LBMReal mfcac = zeroReal; - LBMReal mfacc = zeroReal; - LBMReal mfcca = zeroReal; - LBMReal mfaaa = zeroReal; - LBMReal mfcaa = zeroReal; - LBMReal mfaca = zeroReal; - - mfaaa = press; // if drho is interpolated directly - - LBMReal vx1Sq = vx1*vx1; - LBMReal vx2Sq = vx2*vx2; - LBMReal vx3Sq = vx3*vx3; - LBMReal oMdrho = one; - //oMdrho = one - mfaaa; - - //2.f - // linear combinations - -///////////////////////// - LBMReal mxxPyyPzz = mfaaa -c2o3*(ax+by+cz)*eps_new/oP*(one+press); - - LBMReal mxxMyy = -c2o3*((ax - by)+kxxMyyAverage)*eps_new/o * (one + press); - LBMReal mxxMzz = -c2o3*((ax - cz)+kxxMzzAverage)*eps_new/o * (one + press); - - mfabb = -c1o3 * ((bz + cy)+kyzAverage)*eps_new/o * (one + press); - mfbab = -c1o3 * ((az + cx)+kxzAverage)*eps_new/o * (one + press); - mfbba = -c1o3 * ((ay + bx)+kxyAverage)*eps_new/o * (one + press); - - //////////////////////// - // linear combinations back - mfcaa = c1o3 * (mxxMyy + mxxMzz + mxxPyyPzz); - mfaca = c1o3 * (-two * mxxMyy + mxxMzz + mxxPyyPzz); - mfaac = c1o3 * (mxxMyy - two * mxxMzz + mxxPyyPzz); - - //three - mfbbb = zeroReal; - - LBMReal mxxyPyzz = zeroReal; - LBMReal mxxyMyzz = zeroReal; - LBMReal mxxzPyyz = zeroReal; - LBMReal mxxzMyyz = zeroReal; - LBMReal mxyyPxzz = zeroReal; - LBMReal mxyyMxzz = zeroReal; - - // linear combinations back - mfcba = (mxxyMyzz + mxxyPyzz) * c1o2; - mfabc = (-mxxyMyzz + mxxyPyzz) * c1o2; - mfcab = (mxxzMyyz + mxxzPyyz) * c1o2; - mfacb = (-mxxzMyyz + mxxzPyyz) * c1o2; - mfbca = (mxyyMxzz + mxyyPxzz) * c1o2; - mfbac = (-mxyyMxzz + mxyyPxzz) * c1o2; - - //4.f - mfacc = mfaaa*c1o9; - mfcac = mfacc; - mfcca = mfacc; - //5. - - //6. - mfccc = mfaaa*c1o27; - //////////////////////////////////////////////////////////////////////////////////// - //back - //////////////////////////////////////////////////////////////////////////////////// - //mit 1, 0, 1/3, 0, 0, 0, 1/3, 0, 1/9 Konditionieren - //////////////////////////////////////////////////////////////////////////////////// - // Z - Dir - LBMReal m0 = mfaac * c1o2 + mfaab * (vx3 - c1o2) + (mfaaa + one * oMdrho) * (vx3Sq - vx3) * c1o2; - LBMReal m1 = -mfaac - two * mfaab * vx3 + mfaaa * (one - vx3Sq) - one * oMdrho * vx3Sq; - LBMReal m2 = mfaac * c1o2 + mfaab * (vx3 + c1o2) + (mfaaa + one * oMdrho) * (vx3Sq + vx3) * c1o2; - mfaaa = m0; - mfaab = m1; - mfaac = m2; - //////////////////////////////////////////////////////////////////////////////////// - m0 = mfabc * c1o2 + mfabb * (vx3 - c1o2) + mfaba * (vx3Sq - vx3) * c1o2; - m1 = -mfabc - two * mfabb * vx3 + mfaba * (one - vx3Sq); - m2 = mfabc * c1o2 + mfabb * (vx3 + c1o2) + mfaba * (vx3Sq + vx3) * c1o2; - mfaba = m0; - mfabb = m1; - mfabc = m2; - //////////////////////////////////////////////////////////////////////////////////// - m0 = mfacc * c1o2 + mfacb * (vx3 - c1o2) + (mfaca + c1o3 * oMdrho) * (vx3Sq - vx3) * c1o2; - m1 = -mfacc - two * mfacb * vx3 + mfaca * (one - vx3Sq) - c1o3 * oMdrho * vx3Sq; - m2 = mfacc * c1o2 + mfacb * (vx3 + c1o2) + (mfaca + c1o3 * oMdrho) * (vx3Sq + vx3) * c1o2; - mfaca = m0; - mfacb = m1; - mfacc = m2; - //////////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////////// - m0 = mfbac * c1o2 + mfbab * (vx3 - c1o2) + mfbaa * (vx3Sq - vx3) * c1o2; - m1 = -mfbac - two * mfbab * vx3 + mfbaa * (one - vx3Sq); - m2 = mfbac * c1o2 + mfbab * (vx3 + c1o2) + mfbaa * (vx3Sq + vx3) * c1o2; - mfbaa = m0; - mfbab = m1; - mfbac = m2; - /////////b////////////////////////////////////////////////////////////////////////// - m0 = mfbbc * c1o2 + mfbbb * (vx3 - c1o2) + mfbba * (vx3Sq - vx3) * c1o2; - m1 = -mfbbc - two * mfbbb * vx3 + mfbba * (one - vx3Sq); - m2 = mfbbc * c1o2 + mfbbb * (vx3 + c1o2) + mfbba * (vx3Sq + vx3) * c1o2; - mfbba = m0; - mfbbb = m1; - mfbbc = m2; - /////////b////////////////////////////////////////////////////////////////////////// - m0 = mfbcc * c1o2 + mfbcb * (vx3 - c1o2) + mfbca * (vx3Sq - vx3) * c1o2; - m1 = -mfbcc - two * mfbcb * vx3 + mfbca * (one - vx3Sq); - m2 = mfbcc * c1o2 + mfbcb * (vx3 + c1o2) + mfbca * (vx3Sq + vx3) * c1o2; - mfbca = m0; - mfbcb = m1; - mfbcc = m2; - //////////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////////// - m0 = mfcac * c1o2 + mfcab * (vx3 - c1o2) + (mfcaa + c1o3 * oMdrho) * (vx3Sq - vx3) * c1o2; - m1 = -mfcac - two * mfcab * vx3 + mfcaa * (one - vx3Sq) - c1o3 * oMdrho * vx3Sq; - m2 = mfcac * c1o2 + mfcab * (vx3 + c1o2) + (mfcaa + c1o3 * oMdrho) * (vx3Sq + vx3) * c1o2; - mfcaa = m0; - mfcab = m1; - mfcac = m2; - /////////c////////////////////////////////////////////////////////////////////////// - m0 = mfcbc * c1o2 + mfcbb * (vx3 - c1o2) + mfcba * (vx3Sq - vx3) * c1o2; - m1 = -mfcbc - two * mfcbb * vx3 + mfcba * (one - vx3Sq); - m2 = mfcbc * c1o2 + mfcbb * (vx3 + c1o2) + mfcba * (vx3Sq + vx3) * c1o2; - mfcba = m0; - mfcbb = m1; - mfcbc = m2; - /////////c////////////////////////////////////////////////////////////////////////// - m0 = mfccc * c1o2 + mfccb * (vx3 - c1o2) + (mfcca + c1o9 * oMdrho) * (vx3Sq - vx3) * c1o2; - m1 = -mfccc - two * mfccb * vx3 + mfcca * (one - vx3Sq) - c1o9 * oMdrho * vx3Sq; - m2 = mfccc * c1o2 + mfccb * (vx3 + c1o2) + (mfcca + c1o9 * oMdrho) * (vx3Sq + vx3) * c1o2; - mfcca = m0; - mfccb = m1; - mfccc = m2; - //////////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////////// - //mit 1/6, 2/3, 1/6, 0, 0, 0, 1/18, 2/9, 1/18 Konditionieren - //////////////////////////////////////////////////////////////////////////////////// - // Y - Dir - m0 = mfaca * c1o2 + mfaba * (vx2 - c1o2) + (mfaaa + c1o6 * oMdrho) * (vx2Sq - vx2) * c1o2; - m1 = -mfaca - two * mfaba * vx2 + mfaaa * (one - vx2Sq) - c1o6 * oMdrho * vx2Sq; - m2 = mfaca * c1o2 + mfaba * (vx2 + c1o2) + (mfaaa + c1o6 * oMdrho) * (vx2Sq + vx2) * c1o2; - mfaaa = m0; - mfaba = m1; - mfaca = m2; - //////////////////////////////////////////////////////////////////////////////////// - m0 = mfacb * c1o2 + mfabb * (vx2 - c1o2) + (mfaab + c2o3 * oMdrho) * (vx2Sq - vx2) * c1o2; - m1 = -mfacb - two * mfabb * vx2 + mfaab * (one - vx2Sq) - c2o3 * oMdrho * vx2Sq; - m2 = mfacb * c1o2 + mfabb * (vx2 + c1o2) + (mfaab + c2o3 * oMdrho) * (vx2Sq + vx2) * c1o2; - mfaab = m0; - mfabb = m1; - mfacb = m2; - //////////////////////////////////////////////////////////////////////////////////// - m0 = mfacc * c1o2 + mfabc * (vx2 - c1o2) + (mfaac + c1o6 * oMdrho) * (vx2Sq - vx2) * c1o2; - m1 = -mfacc - two * mfabc * vx2 + mfaac * (one - vx2Sq) - c1o6 * oMdrho * vx2Sq; - m2 = mfacc * c1o2 + mfabc * (vx2 + c1o2) + (mfaac + c1o6 * oMdrho) * (vx2Sq + vx2) * c1o2; - mfaac = m0; - mfabc = m1; - mfacc = m2; - //////////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////////// - m0 = mfbca * c1o2 + mfbba * (vx2 - c1o2) + mfbaa * (vx2Sq - vx2) * c1o2; - m1 = -mfbca - two * mfbba * vx2 + mfbaa * (one - vx2Sq); - m2 = mfbca * c1o2 + mfbba * (vx2 + c1o2) + mfbaa * (vx2Sq + vx2) * c1o2; - mfbaa = m0; - mfbba = m1; - mfbca = m2; - /////////b////////////////////////////////////////////////////////////////////////// - m0 = mfbcb * c1o2 + mfbbb * (vx2 - c1o2) + mfbab * (vx2Sq - vx2) * c1o2; - m1 = -mfbcb - two * mfbbb * vx2 + mfbab * (one - vx2Sq); - m2 = mfbcb * c1o2 + mfbbb * (vx2 + c1o2) + mfbab * (vx2Sq + vx2) * c1o2; - mfbab = m0; - mfbbb = m1; - mfbcb = m2; - /////////b////////////////////////////////////////////////////////////////////////// - m0 = mfbcc * c1o2 + mfbbc * (vx2 - c1o2) + mfbac * (vx2Sq - vx2) * c1o2; - m1 = -mfbcc - two * mfbbc * vx2 + mfbac * (one - vx2Sq); - m2 = mfbcc * c1o2 + mfbbc * (vx2 + c1o2) + mfbac * (vx2Sq + vx2) * c1o2; - mfbac = m0; - mfbbc = m1; - mfbcc = m2; - //////////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////////// - m0 = mfcca * c1o2 + mfcba * (vx2 - c1o2) + (mfcaa + c1o18 * oMdrho) * (vx2Sq - vx2) * c1o2; - m1 = -mfcca - two * mfcba * vx2 + mfcaa * (one - vx2Sq) - c1o18 * oMdrho * vx2Sq; - m2 = mfcca * c1o2 + mfcba * (vx2 + c1o2) + (mfcaa + c1o18 * oMdrho) * (vx2Sq + vx2) * c1o2; - mfcaa = m0; - mfcba = m1; - mfcca = m2; - /////////c////////////////////////////////////////////////////////////////////////// - m0 = mfccb * c1o2 + mfcbb * (vx2 - c1o2) + (mfcab + c2o9 * oMdrho) * (vx2Sq - vx2) * c1o2; - m1 = -mfccb - two * mfcbb * vx2 + mfcab * (one - vx2Sq) - c2o9 * oMdrho * vx2Sq; - m2 = mfccb * c1o2 + mfcbb * (vx2 + c1o2) + (mfcab + c2o9 * oMdrho) * (vx2Sq + vx2) * c1o2; - mfcab = m0; - mfcbb = m1; - mfccb = m2; - /////////c////////////////////////////////////////////////////////////////////////// - m0 = mfccc * c1o2 + mfcbc * (vx2 - c1o2) + (mfcac + c1o18 * oMdrho) * (vx2Sq - vx2) * c1o2; - m1 = -mfccc - two * mfcbc * vx2 + mfcac * (one - vx2Sq) - c1o18 * oMdrho * vx2Sq; - m2 = mfccc * c1o2 + mfcbc * (vx2 + c1o2) + (mfcac + c1o18 * oMdrho) * (vx2Sq + vx2) * c1o2; - mfcac = m0; - mfcbc = m1; - mfccc = m2; - //////////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////////// - //mit 1/36, 1/9, 1/36, 1/9, 4/9, 1/9, 1/36, 1/9, 1/36 Konditionieren - //////////////////////////////////////////////////////////////////////////////////// - // X - Dir - m0 = mfcaa * c1o2 + mfbaa * (vx1 - c1o2) + (mfaaa + c1o36 * oMdrho) * (vx1Sq - vx1) * c1o2; - m1 = -mfcaa - two * mfbaa * vx1 + mfaaa * (one - vx1Sq) - c1o36 * oMdrho * vx1Sq; - m2 = mfcaa * c1o2 + mfbaa * (vx1 + c1o2) + (mfaaa + c1o36 * oMdrho) * (vx1Sq + vx1) * c1o2; - mfaaa = m0; - mfbaa = m1; - mfcaa = m2; - //////////////////////////////////////////////////////////////////////////////////// - m0 = mfcba * c1o2 + mfbba * (vx1 - c1o2) + (mfaba + c1o9 * oMdrho) * (vx1Sq - vx1) * c1o2; - m1 = -mfcba - two * mfbba * vx1 + mfaba * (one - vx1Sq) - c1o9 * oMdrho * vx1Sq; - m2 = mfcba * c1o2 + mfbba * (vx1 + c1o2) + (mfaba + c1o9 * oMdrho) * (vx1Sq + vx1) * c1o2; - mfaba = m0; - mfbba = m1; - mfcba = m2; - //////////////////////////////////////////////////////////////////////////////////// - m0 = mfcca * c1o2 + mfbca * (vx1 - c1o2) + (mfaca + c1o36 * oMdrho) * (vx1Sq - vx1) * c1o2; - m1 = -mfcca - two * mfbca * vx1 + mfaca * (one - vx1Sq) - c1o36 * oMdrho * vx1Sq; - m2 = mfcca * c1o2 + mfbca * (vx1 + c1o2) + (mfaca + c1o36 * oMdrho) * (vx1Sq + vx1) * c1o2; - mfaca = m0; - mfbca = m1; - mfcca = m2; - //////////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////////// - m0 = mfcab * c1o2 + mfbab * (vx1 - c1o2) + (mfaab + c1o9 * oMdrho) * (vx1Sq - vx1) * c1o2; - m1 = -mfcab - two * mfbab * vx1 + mfaab * (one - vx1Sq) - c1o9 * oMdrho * vx1Sq; - m2 = mfcab * c1o2 + mfbab * (vx1 + c1o2) + (mfaab + c1o9 * oMdrho) * (vx1Sq + vx1) * c1o2; - mfaab = m0; - mfbab = m1; - mfcab = m2; - ///////////b//////////////////////////////////////////////////////////////////////// - m0 = mfcbb * c1o2 + mfbbb * (vx1 - c1o2) + (mfabb + c4o9 * oMdrho) * (vx1Sq - vx1) * c1o2; - m1 = -mfcbb - two * mfbbb * vx1 + mfabb * (one - vx1Sq) - c4o9 * oMdrho * vx1Sq; - m2 = mfcbb * c1o2 + mfbbb * (vx1 + c1o2) + (mfabb + c4o9 * oMdrho) * (vx1Sq + vx1) * c1o2; - mfabb = m0; - mfbbb = m1; - mfcbb = m2; - ///////////b//////////////////////////////////////////////////////////////////////// - m0 = mfccb * c1o2 + mfbcb * (vx1 - c1o2) + (mfacb + c1o9 * oMdrho) * (vx1Sq - vx1) * c1o2; - m1 = -mfccb - two * mfbcb * vx1 + mfacb * (one - vx1Sq) - c1o9 * oMdrho * vx1Sq; - m2 = mfccb * c1o2 + mfbcb * (vx1 + c1o2) + (mfacb + c1o9 * oMdrho) * (vx1Sq + vx1) * c1o2; - mfacb = m0; - mfbcb = m1; - mfccb = m2; - //////////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////////// - m0 = mfcac * c1o2 + mfbac * (vx1 - c1o2) + (mfaac + c1o36 * oMdrho) * (vx1Sq - vx1) * c1o2; - m1 = -mfcac - two * mfbac * vx1 + mfaac * (one - vx1Sq) - c1o36 * oMdrho * vx1Sq; - m2 = mfcac * c1o2 + mfbac * (vx1 + c1o2) + (mfaac + c1o36 * oMdrho) * (vx1Sq + vx1) * c1o2; - mfaac = m0; - mfbac = m1; - mfcac = m2; - ///////////c//////////////////////////////////////////////////////////////////////// - m0 = mfcbc * c1o2 + mfbbc * (vx1 - c1o2) + (mfabc + c1o9 * oMdrho) * (vx1Sq - vx1) * c1o2; - m1 = -mfcbc - two * mfbbc * vx1 + mfabc * (one - vx1Sq) - c1o9 * oMdrho * vx1Sq; - m2 = mfcbc * c1o2 + mfbbc * (vx1 + c1o2) + (mfabc + c1o9 * oMdrho) * (vx1Sq + vx1) * c1o2; - mfabc = m0; - mfbbc = m1; - mfcbc = m2; - ///////////c//////////////////////////////////////////////////////////////////////// - m0 = mfccc * c1o2 + mfbcc * (vx1 - c1o2) + (mfacc + c1o36 * oMdrho) * (vx1Sq - vx1) * c1o2; - m1 = -mfccc - two * mfbcc * vx1 + mfacc * (one - vx1Sq) - c1o36 * oMdrho * vx1Sq; - m2 = mfccc * c1o2 + mfbcc * (vx1 + c1o2) + (mfacc + c1o36 * oMdrho) * (vx1Sq + vx1) * c1o2; - mfacc = m0; - mfbcc = m1; - mfccc = m2; - //////////////////////////////////////////////////////////////////////////////////// - - f[E] = mfcbb; - f[W] = mfabb; - f[N] = mfbcb; - f[S] = mfbab; - f[T] = mfbbc; - f[B] = mfbba; - f[NE] = mfccb; - f[SW] = mfaab; - f[SE] = mfcab; - f[NW] = mfacb; - f[TE] = mfcbc; - f[BW] = mfaba; - f[BE] = mfcba; - f[TW] = mfabc; - f[TN] = mfbcc; - f[BS] = mfbaa; - f[BN] = mfbca; - f[TS] = mfbac; - f[ZERO] = mfbbb; - f[TNE] = mfccc; - f[TSE] = mfcac; - f[BNE] = mfcca; - f[BSE] = mfcaa; - f[TNW] = mfacc; - f[TSW] = mfaac; - f[BNW] = mfaca; - f[BSW] = mfaaa; -} -////////////////////////////////////////////////////////////////////////// -void CompressibleOffsetMomentsInterpolationProcessor::calcInterpolatedVelocity(LBMReal x, LBMReal y, LBMReal z, LBMReal& vx1, LBMReal& vx2, LBMReal& vx3) -{ - vx1 = a0 + ax*x + ay*y + az*z + axx*x*x + ayy*y*y + azz*z*z + axy*x*y + axz*x*z + ayz*y*z+axyz*x*y*z; - vx2 = b0 + bx*x + by*y + bz*z + bxx*x*x + byy*y*y + bzz*z*z + bxy*x*y + bxz*x*z + byz*y*z+bxyz*x*y*z; - vx3 = c0 + cx*x + cy*y + cz*z + cxx*x*x + cyy*y*y + czz*z*z + cxy*x*y + cxz*x*z + cyz*y*z+cxyz*x*y*z; -} -////////////////////////////////////////////////////////////////////////// -void CompressibleOffsetMomentsInterpolationProcessor::calcInterpolatedShearStress(LBMReal x, LBMReal y, LBMReal z,LBMReal& tauxx, LBMReal& tauyy, LBMReal& tauzz,LBMReal& tauxy, LBMReal& tauxz, LBMReal& tauyz) -{ - tauxx=ax+2*axx*x+axy*y+axz*z+axyz*y*z; - tauyy=by+2*byy*y+bxy*x+byz*z+bxyz*x*z; - tauzz=cz+2*czz*z+cxz*x+cyz*y+cxyz*x*y; - tauxy=0.5*((ay+2.0*ayy*y+axy*x+ayz*z+axyz*x*z)+(bx+2.0*bxx*x+bxy*y+bxz*z+bxyz*y*z)); - tauxz=0.5*((az+2.0*azz*z+axz*x+ayz*y+axyz*x*y)+(cx+2.0*cxx*x+cxy*y+cxz*z+cxyz*y*z)); - tauyz=0.5*((bz+2.0*bzz*z+bxz*x+byz*y+bxyz*x*y)+(cy+2.0*cyy*y+cxy*x+cyz*z+cxyz*x*z)); -} -////////////////////////////////////////////////////////////////////////// -void CompressibleOffsetMomentsInterpolationProcessor::setBulkOmegaToOmega(bool value) -{ - bulkOmegaToOmega = value; -} - diff --git a/src/VirtualFluids/LBM/CompressibleOffsetMomentsInterpolationProcessor.h b/src/VirtualFluids/LBM/CompressibleOffsetMomentsInterpolationProcessor.h deleted file mode 100644 index 0f0e6ec27..000000000 --- a/src/VirtualFluids/LBM/CompressibleOffsetMomentsInterpolationProcessor.h +++ /dev/null @@ -1,82 +0,0 @@ -#ifndef CompressibleOffsetMomentsInterpolationProcessor_H_ -#define CompressibleOffsetMomentsInterpolationProcessor_H_ - -#include "InterpolationProcessor.h" -#include "D3Q27System.h" - -////////////////////////////////////////////////////////////////////////// -//it works only for cascaded LBM -//super compact interpolation method by Martin Geier -////////////////////////////////////////////////////////////////////////// - -class CompressibleOffsetMomentsInterpolationProcessor; -typedef std::shared_ptr<CompressibleOffsetMomentsInterpolationProcessor> CompressibleOffsetMomentsInterpolationProcessorPtr; - -class CompressibleOffsetMomentsInterpolationProcessor : public InterpolationProcessor -{ -public: - CompressibleOffsetMomentsInterpolationProcessor(); - CompressibleOffsetMomentsInterpolationProcessor(LBMReal omegaC, LBMReal omegaF); - virtual ~CompressibleOffsetMomentsInterpolationProcessor(); - InterpolationProcessorPtr clone(); - void setOmegas(LBMReal omegaC, LBMReal omegaF); - void interpolateCoarseToFine(D3Q27ICell& icellC, D3Q27ICell& icellF); - void interpolateCoarseToFine(D3Q27ICell& icellC, D3Q27ICell& icellF, LBMReal xoff, LBMReal yoff, LBMReal zoff); - void interpolateFineToCoarse(D3Q27ICell& icellF, LBMReal* icellC); - void interpolateFineToCoarse(D3Q27ICell& icellF, LBMReal* icellC, LBMReal xoff, LBMReal yoff, LBMReal zoff); - void setBulkOmegaToOmega(bool value); -protected: -private: - LBMReal omegaC, omegaF; - LBMReal a0, ax, ay, az, axx, ayy, azz, axy, axz, ayz, b0, bx, by, bz, bxx, byy, bzz, bxy, bxz, byz, c0, cx, cy, cz, cxx, cyy, czz, cxy, cxz, cyz, axyz, bxyz, cxyz; - LBMReal xoff, yoff, zoff; - LBMReal xoff_sq, yoff_sq, zoff_sq; - LBMReal press_SWT, press_NWT, press_NET, press_SET, press_SWB, press_NWB, press_NEB, press_SEB; - - LBMReal f_E, f_N, f_T, f_NE, f_SE, f_BE, f_TE, f_TN, f_BN, f_TNE, f_TNW, f_TSE, f_TSW, f_ZERO; - LBMReal x_E, x_N, x_T, x_NE, x_SE, x_BE, x_TE, x_TN, x_BN, x_TNE, x_TNW, x_TSE, x_TSW, x_ZERO; - LBMReal y_E, y_N, y_T, y_NE, y_SE, y_BE, y_TE, y_TN, y_BN, y_TNE, y_TNW, y_TSE, y_TSW, y_ZERO; - LBMReal z_E, z_N, z_T, z_NE, z_SE, z_BE, z_TE, z_TN, z_BN, z_TNE, z_TNW, z_TSE, z_TSW, z_ZERO; - LBMReal xy_E, xy_N, xy_T, xy_NE, xy_SE, xy_BE, xy_TE, xy_TN, xy_BN, xy_TNE, xy_TNW, xy_TSE, xy_TSW/*, xy_ZERO*/; - LBMReal xz_E, xz_N, xz_T, xz_NE, xz_SE, xz_BE, xz_TE, xz_TN, xz_BN, xz_TNE, xz_TNW, xz_TSE, xz_TSW/*, xz_ZERO*/; - LBMReal yz_E, yz_N, yz_T, yz_NE, yz_SE, yz_BE, yz_TE, yz_TN, yz_BN, yz_TNE, yz_TNW, yz_TSE, yz_TSW/*, yz_ZERO*/; - - LBMReal kxyAverage, kyzAverage, kxzAverage, kxxMyyAverage, kxxMzzAverage; - - LBMReal a,b,c; - - // bulk viscosity - bool bulkOmegaToOmega; - LBMReal OxxPyyPzzC; - LBMReal OxxPyyPzzF; - - void setOffsets(LBMReal xoff, LBMReal yoff, LBMReal zoff); - void calcMoments(const LBMReal* const f, LBMReal omega, LBMReal& rho, LBMReal& vx1, LBMReal& vx2, LBMReal& vx3, - LBMReal& kxy, LBMReal& kyz, LBMReal& kxz, LBMReal& kxxMyy, LBMReal& kxxMzz); - void calcInterpolatedCoefficiets(const D3Q27ICell& icell, LBMReal omega, LBMReal eps_new); - void calcInterpolatedNodeCF(LBMReal* f, LBMReal omega, LBMReal x, LBMReal y, LBMReal z, LBMReal press, LBMReal xs, LBMReal ys, LBMReal zs); - LBMReal calcPressBSW(); - LBMReal calcPressTSW(); - LBMReal calcPressTSE(); - LBMReal calcPressBSE(); - LBMReal calcPressBNW(); - LBMReal calcPressTNW(); - LBMReal calcPressTNE(); - LBMReal calcPressBNE(); - void calcInterpolatedNodeFC(LBMReal* f, LBMReal omega); - void calcInterpolatedVelocity(LBMReal x, LBMReal y, LBMReal z,LBMReal& vx1, LBMReal& vx2, LBMReal& vx3); - void calcInterpolatedShearStress(LBMReal x, LBMReal y, LBMReal z,LBMReal& tauxx, LBMReal& tauyy, LBMReal& tauzz,LBMReal& tauxy, LBMReal& tauxz, LBMReal& tauyz); -}; - -////////////////////////////////////////////////////////////////////////// -inline void CompressibleOffsetMomentsInterpolationProcessor::interpolateCoarseToFine(D3Q27ICell& icellC, D3Q27ICell& icellF) -{ - this->interpolateCoarseToFine(icellC, icellF, 0.0, 0.0, 0.0); -} -////////////////////////////////////////////////////////////////////////// -inline void CompressibleOffsetMomentsInterpolationProcessor::interpolateFineToCoarse(D3Q27ICell& icellF, LBMReal* icellC) -{ - this->interpolateFineToCoarse(icellF, icellC, 0.0, 0.0, 0.0); -} - -#endif diff --git a/src/VirtualFluids/LBM/D3Q27System.cpp b/src/VirtualFluids/LBM/D3Q27System.cpp deleted file mode 100644 index b4ed44e13..000000000 --- a/src/VirtualFluids/LBM/D3Q27System.cpp +++ /dev/null @@ -1,195 +0,0 @@ -#include "D3Q27System.h" -namespace D3Q27System -{ - //index 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18//falsch - //f: ZERO, E, W, N, S, T, B, NE, SW, SE, NW, TE, BW, BE, TW, TN, BS, BN, TS, TNE TNW TSE TSW BNE BNW BSE BSW - //const int EX1[] = { 0, 1, -1, 0, 0, 0, 0, 1, -1, 1, -1, 1, -1, 1, -1, 0, 0, 0, 0, 1, -1, 1, -1, 1, -1, 1, -1 }; - //const int EX2[] = { 0, 0, 0, 1, -1, 0, 0, 1, -1, -1, 1, 0, 0, 0, 0, 1, -1, 1, -1, 1, 1, -1, -1, 1, 1, -1, -1 }; - //const int EX3[] = { 0, 0, 0, 0, 0, 1, -1, 0, 0, 0, 0, 1, -1, -1, 1, 1, -1, -1, 1, 1, 1, 1, 1, -1, -1, -1, -1 }; - - //index 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 - //f: E, W, N, S, T, B, NE, SW, SE, NW, TE, BW, BE, TW, TN, BS, BN, TS, TNE TNW TSE TSW BNE BNW BSE BSW - const int DX1[] = { 1, -1, 0, 0, 0, 0, 1, -1, 1, -1, 1, -1, 1, -1, 0, 0, 0, 0, 1, -1, 1, -1, 1, -1, 1, -1 }; - const int DX2[] = { 0, 0, 1, -1, 0, 0, 1, -1, -1, 1, 0, 0, 0, 0, 1, -1, 1, -1, 1, 1, -1, -1, 1, 1, -1, -1 }; - const int DX3[] = { 0, 0, 0, 0, 1, -1, 0, 0, 0, 0, 1, -1, -1, 1, 1, -1, -1, 1, 1, 1, 1, 1, -1, -1, -1, -1 }; - - ////index 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 - ////f: E, W, N, S, T, B, NE, SW, SE, NW, TE, BW, BE, TW, TN, BS, BN, TS, TNE TNW TSE TSW BNE BNW BSE BSW - const double WEIGTH[] = { c2o27, c2o27, c2o27, c2o27, c2o27, c2o27, c1o54, c1o54, c1o54, c1o54, c1o54, c1o54, c1o54, c1o54, c1o54, c1o54, c1o54, c1o54, c1o216, c1o216, c1o216, c1o216, c1o216, c1o216, c1o216, c1o216 , c8o27 }; - - - const int INVDIR[] = { - INV_E, - INV_W, - INV_N, - INV_S, - INV_T, - INV_B, - INV_NE, - INV_SW, - INV_SE, - INV_NW, - INV_TE, - INV_BW, - INV_BE, - INV_TW, - INV_TN, - INV_BS, - INV_BN, - INV_TS, - INV_TNE, - INV_TNW, - INV_TSE, - INV_TSW, - INV_BNE, - INV_BNW, - INV_BSE, - INV_BSW }; - - - // The x,y,z component for each normalized direction - const double cNorm[3][ENDDIR] = { - { - double(DX1[0]), double(DX1[1]), - double(DX1[2]), double(DX1[3]), - double(DX1[4]), double(DX1[5]), - double(DX1[6]) / std::sqrt(double(2)), double(DX1[7]) / std::sqrt(double(2)), - double(DX1[8]) / std::sqrt(double(2)), double(DX1[9]) / std::sqrt(double(2)), - double(DX1[10]) / std::sqrt(double(2)), double(DX1[11]) / std::sqrt(double(2)), - double(DX1[12]) / std::sqrt(double(2)), double(DX1[13]) / std::sqrt(double(2)), - double(DX1[14]), double(DX1[15]), - double(DX1[16]), double(DX1[17]), - double(DX1[18]) / std::sqrt(double(3)), double(DX1[19]) / std::sqrt(double(3)), - double(DX1[20]) / std::sqrt(double(3)), double(DX1[21]) / std::sqrt(double(3)), - double(DX1[22]) / std::sqrt(double(3)), double(DX1[23]) / std::sqrt(double(3)), - double(DX1[24]) / std::sqrt(double(3)), double(DX1[25]) / std::sqrt(double(3)) - },{ - double(DX2[0]), double(DX2[1]), - double(DX2[2]), double(DX2[3]), - double(DX2[4]), double(DX2[5]), - double(DX2[6]) / std::sqrt(double(2)), double(DX2[7]) / std::sqrt(double(2)), - double(DX2[8]) / std::sqrt(double(2)), double(DX2[9]) / std::sqrt(double(2)), - double(DX2[10]), double(DX2[11]), - double(DX2[12]), double(DX2[13]), - double(DX2[14]) / std::sqrt(double(2)), double(DX2[15]) / std::sqrt(double(2)), - double(DX2[16]) / std::sqrt(double(2)), double(DX2[17]) / std::sqrt(double(2)), - double(DX2[18]) / std::sqrt(double(3)), double(DX2[19]) / std::sqrt(double(3)), - double(DX2[20]) / std::sqrt(double(3)), double(DX2[21]) / std::sqrt(double(3)), - double(DX2[22]) / std::sqrt(double(3)), double(DX2[23]) / std::sqrt(double(3)), - double(DX2[24]) / std::sqrt(double(3)), double(DX2[25]) / std::sqrt(double(3)) - },{ - double(DX3[0]), double(DX3[1]), - double(DX3[2]), double(DX3[3]), - double(DX3[4]), double(DX3[5]), - double(DX3[6]), double(DX3[7]), - double(DX3[8]), double(DX3[9]), - double(DX3[10]) / std::sqrt(double(2)), double(DX3[11]) / std::sqrt(double(2)), - double(DX3[12]) / std::sqrt(double(2)), double(DX3[13]) / std::sqrt(double(2)), - double(DX3[14]) / std::sqrt(double(2)), double(DX3[15]) / std::sqrt(double(2)), - double(DX3[16]) / std::sqrt(double(2)), double(DX3[17]) / std::sqrt(double(2)), - double(DX3[18]) / std::sqrt(double(3)), double(DX3[19]) / std::sqrt(double(3)), - double(DX3[20]) / std::sqrt(double(3)), double(DX3[21]) / std::sqrt(double(3)), - double(DX3[22]) / std::sqrt(double(3)), double(DX3[23]) / std::sqrt(double(3)), - double(DX3[24]) / std::sqrt(double(3)), double(DX3[25]) / std::sqrt(double(3)) - } - }; - -} - -//const int FSTARTDIR = 0; -//const int FENDDIR = 25; //D3Q27 - -//const int STARTF = 0; -//const int ENDF = 26; //D3Q27 - -//const int EX1[ENDF+1]; -//const int EX2[ENDF+1]; -//const int EX3[ENDF+1]; - -//const int STARTDIR = 0; -//const int ENDDIR = 26; //alle geometrischen richtungen - -//const int DX1[ENDDIR+1]; -//const int DX2[ENDDIR+1]; -//const int DX3[ENDDIR+1]; - - -//const int E /*f1 */ = 0; -//const int W /*f2 */ = 1; -//const int N /*f3 */ = 2; -//const int S /*f4 */ = 3; -//const int T /*f5 */ = 4; -//const int B /*f6 */ = 5; -//const int NE /*f7 */ = 6; -//const int SW /*f8 */ = 7; -//const int SE /*f9 */ = 8; -//const int NW /*f10*/ = 9; -//const int TE /*f11*/ = 10; -//const int BW /*f12*/ = 11; -//const int BE /*f13*/ = 12; -//const int TW /*f14*/ = 13; -//const int TN /*f15*/ = 14; -//const int BS /*f16*/ = 15; -//const int BN /*f17*/ = 16; -//const int TS /*f18*/ = 17; -//const int TNE = 18; -//const int TNW = 19; -//const int TSE = 20; -//const int TSW = 21; -//const int BNE = 22; -//const int BNW = 23; -//const int BSE = 24; -//const int BSW = 25; -//const int ZERO /*f0 */ = 26; - -//const int INV_E = W; -//const int INV_W = E; -//const int INV_N = S; -//const int INV_S = N; -//const int INV_T = B; -//const int INV_B = T; -//const int INV_NE = SW; -//const int INV_SW = NE; -//const int INV_SE = NW; -//const int INV_NW = SE; -//const int INV_TE = BW; -//const int INV_BW = TE; -//const int INV_BE = TW; -//const int INV_TW = BE; -//const int INV_TN = BS; -//const int INV_BS = TN; -//const int INV_BN = TS; -//const int INV_TS = BN; -//const int INV_TNE = BSW; -//const int INV_TNW = BSE; -//const int INV_TSE = BNW; -//const int INV_TSW = BNE; -//const int INV_BNE = TSW; -//const int INV_BNW = TSE; -//const int INV_BSE = TNW; -//const int INV_BSW = TNE; - -//const int INVDIR[ENDDIR+1]; - -//const int M_RHO = 0; -//const int M_EN = 1; -//const int M_EPS = 2; -//const int M_JX1 = 3; -//const int M_QX1 = 4; -//const int M_JX2 = 5; -//const int M_QX2 = 6; -//const int M_JX3 = 7; -//const int M_QX3 = 8; -//const int M_3PX1X1 = 9; -//const int M_3PIX1X1 = 10; -//const int M_PWW = 11; -//const int M_PIWW = 12; -//const int M_PX1X2 = 13; -//const int M_PX2X3 = 14; -//const int M_PX1X3 = 15; -//const int M_MX1 = 16; -//const int M_MX2 = 17; -//const int M_MX3 = 18; - -//const int STARTM = 0; -//const int ENDM = 18; //D3Q27 diff --git a/src/VirtualFluids/LBM/D3Q27System.h b/src/VirtualFluids/LBM/D3Q27System.h deleted file mode 100644 index 47bd4d9d4..000000000 --- a/src/VirtualFluids/LBM/D3Q27System.h +++ /dev/null @@ -1,745 +0,0 @@ -#ifndef D3Q27SYSTEM_H -#define D3Q27SYSTEM_H - -#include <cmath> -#include <string> -#include <iostream> - -#ifdef RCF_USE_SF_SERIALIZATION - #include <SF/Serializer.hpp> - - #if CAB_RCF <= 903 - #include <SF/SerializeEnum.hpp> - #endif -#endif //RCF_USE_SF_SERIALIZATION - -#include <basics/utilities/UbException.h> -#include <basics/utilities/UbTuple.h> -#include <basics/utilities/UbMath.h> -#include <basics/utilities/UbSystem.h> -//#include "Patch3DSystem.h" -#include "LBMSystem.h" - -/*=========================================================================*/ -/* D3Q27System */ -/* */ -/** -class for global system-functions -<BR><BR> -@author <A HREF="mailto:kucher@irmb.tu-bs.de">K. Kucher</A> -@version 1.0 - 22.10.09 -*/ - -/* -usage: ... -*/ - - -#ifndef SWIG - using namespace UbMath; -#endif - -namespace D3Q27System -{ - //enum COLLISIONMODEL { UNDEFINED, INCOMPLBGKMODEL, COMPLBGKMODEL, COMPLBGKWTMODEL, INCOMPLBGKLESMODEL, INCOMPLBGKNONNEWTONIANMODEL - // , INCOMPGLBEJTMODEL, COMPGLBEJTMODEL, COMPGLBEJTWTMODEL, INCOMPGLBEJTLESMODEL, INCOMPGLBEJTWALEMODEL - // , CASCADEDMODEL}; - // - // #if defined(RCF_USE_SF_SERIALIZATION) && (CAB_RCF <= 903) - // SF_SERIALIZE_ENUM(COLLISIONMODEL) //muss im namespace stehen, sonst funzt es nicht! - // #endif - - ///*=====================================================================*/ - //std::string toString(const COLLISIONMODEL& model); - ///*=====================================================================*/ - //COLLISIONMODEL getCollModelByString(const std::string& str); - ///*=====================================================================*/ - - ///*=====================================================================*/ - //static bool isCompModel(const COLLISIONMODEL& model) - //{ - // switch(model) - // { - // case COMPLBGKMODEL : return true; - // case COMPLBGKWTMODEL : return true; - // case COMPGLBEJTWTMODEL : return true; - // case COMPGLBEJTMODEL : return true; - // case CASCADEDMODEL : return true; - // - // case INCOMPLBGKMODEL : return false; - // case INCOMPGLBEJTMODEL : return false; - // case INCOMPLBGKLESMODEL : return false; - // case INCOMPGLBEJTLESMODEL : return false; - // case INCOMPGLBEJTWALEMODEL : return false; - // case INCOMPLBGKNONNEWTONIANMODEL : return false; - - // default: throw UbException(UB_EXARGS,"unknown model"); - // } - //} - ///*=====================================================================*/ - //static bool isGLBEModel(const COLLISIONMODEL& model) - //{ - // switch(model) - // { - // case COMPGLBEJTWTMODEL : return true; - // case COMPGLBEJTMODEL : return true; - // case INCOMPGLBEJTMODEL : return true; - // case INCOMPGLBEJTLESMODEL : return true; - // case INCOMPGLBEJTWALEMODEL : return false; - - // case COMPLBGKMODEL : return false; - // case COMPLBGKWTMODEL : return false; - // case INCOMPLBGKMODEL : return false; - // case INCOMPLBGKLESMODEL : return false; - // case INCOMPLBGKNONNEWTONIANMODEL : return false; - - // default: throw UbException(UB_EXARGS,"unknown model"); - // } - //} - //static bool isLESModel(const COLLISIONMODEL& model) - //{ - // switch(model) - // { - // case INCOMPGLBEJTLESMODEL : return true; - // case INCOMPLBGKLESMODEL : return true; - // case INCOMPGLBEJTWALEMODEL : return true; - // - // case COMPGLBEJTWTMODEL : return false; - // case COMPGLBEJTMODEL : return false; - // case INCOMPGLBEJTMODEL : return false; - // case COMPLBGKMODEL : return false; - // case COMPLBGKWTMODEL : return false; - // case INCOMPLBGKMODEL : return false; - // case INCOMPLBGKNONNEWTONIANMODEL : return false; - - // default: throw UbException(UB_EXARGS,"unknown model"); - // } - //} - - ////////////////////////////////////////////////////////////////////////// - ////////////////////////////////////////////////////////////////////////// - //DIRECTION STUFF - static const int FSTARTDIR = 0; - static const int FENDDIR = 25; //D3Q27 - - //static const int FSTARTDIR = 1; - //static const int FENDDIR = 26; //D3Q27 - - static const int STARTF = 0; - static const int ENDF = 26; //D3Q27 - - //extern const int EX1[ENDF+1]; - //extern const int EX2[ENDF+1]; - //extern const int EX3[ENDF+1]; - - static const int STARTDIR = 0; - static const int ENDDIR = 26; //alle geometrischen richtungen - - extern const int DX1[ENDDIR+1]; - extern const int DX2[ENDDIR+1]; - extern const int DX3[ENDDIR+1]; - extern const double WEIGTH[ENDDIR+1]; - - extern const double cNorm[3][ENDDIR]; - - //static const int ZERO /*f0 */ = 0; - //static const int E /*f1 */ = 1; - //static const int W /*f2 */ = 2; - //static const int N /*f3 */ = 3; - //static const int S /*f4 */ = 4; - //static const int T /*f5 */ = 5; - //static const int B /*f6 */ = 6; - //static const int NE /*f7 */ = 7; - //static const int SW /*f8 */ = 8; - //static const int SE /*f9 */ = 9; - //static const int NW /*f10*/ = 10; - //static const int TE /*f11*/ = 11; - //static const int BW /*f12*/ = 12; - //static const int BE /*f13*/ = 13; - //static const int TW /*f14*/ = 14; - //static const int TN /*f15*/ = 15; - //static const int BS /*f16*/ = 16; - //static const int BN /*f17*/ = 17; - //static const int TS /*f18*/ = 18; - //static const int TNE = 19; - //static const int TNW = 20; - //static const int TSE = 21; - //static const int TSW = 22; - //static const int BNE = 23; - //static const int BNW = 24; - //static const int BSE = 25; - //static const int BSW = 26; - - static const int E /*f1 */ = 0; - static const int W /*f2 */ = 1; - static const int N /*f3 */ = 2; - static const int S /*f4 */ = 3; - static const int T /*f5 */ = 4; - static const int B /*f6 */ = 5; - static const int NE /*f7 */ = 6; - static const int SW /*f8 */ = 7; - static const int SE /*f9 */ = 8; - static const int NW /*f10*/ = 9; - static const int TE /*f11*/ = 10; - static const int BW /*f12*/ = 11; - static const int BE /*f13*/ = 12; - static const int TW /*f14*/ = 13; - static const int TN /*f15*/ = 14; - static const int BS /*f16*/ = 15; - static const int BN /*f17*/ = 16; - static const int TS /*f18*/ = 17; - static const int TNE = 18; - static const int TNW = 19; - static const int TSE = 20; - static const int TSW = 21; - static const int BNE = 22; - static const int BNW = 23; - static const int BSE = 24; - static const int BSW = 25; - static const int ZERO /*f0 */ = 26; - - static const int INV_E = W; - static const int INV_W = E; - static const int INV_N = S; - static const int INV_S = N; - static const int INV_T = B; - static const int INV_B = T; - static const int INV_NE = SW; - static const int INV_SW = NE; - static const int INV_SE = NW; - static const int INV_NW = SE; - static const int INV_TE = BW; - static const int INV_BW = TE; - static const int INV_BE = TW; - static const int INV_TW = BE; - static const int INV_TN = BS; - static const int INV_BS = TN; - static const int INV_BN = TS; - static const int INV_TS = BN; - static const int INV_TNE = BSW; - static const int INV_TNW = BSE; - static const int INV_TSE = BNW; - static const int INV_TSW = BNE; - static const int INV_BNE = TSW; - static const int INV_BNW = TSE; - static const int INV_BSE = TNW; - static const int INV_BSW = TNE; - - extern const int INVDIR[ENDDIR+1]; - - static const int ET_E = 0; - static const int ET_W = 0; - static const int ET_N = 1; - static const int ET_S = 1; - static const int ET_T = 2; - static const int ET_B = 2; - static const int ET_NE = 3; - static const int ET_SW = 3; - static const int ET_SE = 4; - static const int ET_NW = 4; - static const int ET_TE = 5; - static const int ET_BW = 5; - static const int ET_BE = 6; - static const int ET_TW = 6; - static const int ET_TN = 7; - static const int ET_BS = 7; - static const int ET_BN = 8; - static const int ET_TS = 8; - static const int ET_TNE = 9; - static const int ET_BSW = 9; - static const int ET_TNW = 10; - static const int ET_BSE = 10; - static const int ET_TSE = 11; - static const int ET_BNW = 11; - static const int ET_TSW = 12; - static const int ET_BNE = 12; - - static const int M_RHO = 0; - static const int M_EN = 1; - static const int M_EPS = 2; - static const int M_JX1 = 3; - static const int M_QX1 = 4; - static const int M_JX2 = 5; - static const int M_QX2 = 6; - static const int M_JX3 = 7; - static const int M_QX3 = 8; - static const int M_3PX1X1 = 9; - static const int M_3PIX1X1 = 10; - static const int M_PWW = 11; - static const int M_PIWW = 12; - static const int M_PX1X2 = 13; - static const int M_PX2X3 = 14; - static const int M_PX1X3 = 15; - static const int M_MX1 = 16; - static const int M_MX2 = 17; - static const int M_MX3 = 18; - - static const int STARTM = 0; - static const int ENDM = 18; //D3Q27 - - - - ////////////////////////////////////////////////////////////////////////// - //MACROSCOPIC VALUES - /*=====================================================================*/ - static LBMReal getDensity(const LBMReal* const& f/*[27]*/) - { - return ((f[TNE] + f[BSW])+(f[TSE]+f[BNW]))+((f[BSE]+f[TNW])+ (f[TSW]+f[BNE])) - +(((f[NE] + f[SW]) + (f[SE] + f[NW]))+((f[TE] + f[BW])+(f[BE]+ f[TW])) - +((f[BN] + f[TS]) + (f[TN] + f[BS])))+((f[E] + f[W])+(f[N] + f[S]) - +(f[T] + f[B]))+f[ZERO]; - } - /*=====================================================================*/ - //ACHTUNG: gilt nicht fuer alle modelle -> praedikat verwenden anstelle static! toDo - static LBMReal getPressure(const LBMReal* const& f/*[27]*/) - { - return REAL_CAST( c1o3 )*getDensity(f); - } - /*=====================================================================*/ - static LBMReal getIncompVelocityX1(const LBMReal* const& f/*[27]*/) - { - return ((((f[TNE]-f[BSW]) + (f[TSE]-f[BNW])) + ((f[BSE]-f[TNW]) + (f[BNE]-f[TSW]))) + - (((f[BE]-f[TW]) + (f[TE]-f[BW])) + ((f[SE]-f[NW]) + (f[NE]-f[SW]))) + - (f[E]-f[W])); - } - /*=====================================================================*/ - static LBMReal getIncompVelocityX2(const LBMReal* const& f/*[27]*/) - { - return ((((f[TNE]-f[BSW]) + (f[BNW]-f[TSE])) + ((f[TNW]-f[BSE]) + (f[BNE]-f[TSW]))) + - (((f[BN]-f[TS]) + (f[TN]-f[BS])) + ((f[NW]-f[SE]) + (f[NE]-f[SW]))) + - (f[N]-f[S])); - } - /*=====================================================================*/ - static LBMReal getIncompVelocityX3(const LBMReal* const& f/*[27]*/) - { - return ((((f[TNE] - f[BSW]) + (f[TSE] - f[BNW])) + ((f[TNW] - f[BSE]) + (f[TSW] - f[BNE]))) + - (((f[TS] - f[BN]) + (f[TN] - f[BS])) + ((f[TW] - f[BE]) + (f[TE] - f[BW]))) + - (f[T] - f[B])); - } - /*=====================================================================*/ - static void calcDensity(const LBMReal* const& f/*[27]*/, LBMReal& rho) - { - rho = ((f[TNE] + f[BSW])+(f[TSE]+f[BNW]))+((f[BSE]+f[TNW])+ (f[TSW]+f[BNE])) - +(((f[NE] + f[SW]) + (f[SE] + f[NW]))+((f[TE] + f[BW])+(f[BE]+ f[TW])) - +((f[BN] + f[TS]) + (f[TN] + f[BS])))+((f[E] + f[W])+(f[N] + f[S]) - +(f[T] + f[B]))+f[ZERO]; - - } - /*=====================================================================*/ - static void calcIncompVelocityX1(const LBMReal* const& f/*[27]*/, LBMReal& vx1) - { - vx1 = ((((f[TNE]-f[BSW]) + (f[TSE]-f[BNW])) + ((f[BSE]-f[TNW]) + (f[BNE]-f[TSW]))) + - (((f[BE]-f[TW]) + (f[TE]-f[BW])) + ((f[SE]-f[NW]) + (f[NE]-f[SW]))) + - (f[E]-f[W])); - } - /*=====================================================================*/ - static void calcIncompVelocityX2(const LBMReal* const& f/*[27]*/, LBMReal& vx2) - { - vx2 = ((((f[TNE]-f[BSW]) + (f[BNW]-f[TSE])) + ((f[TNW]-f[BSE]) + (f[BNE]-f[TSW]))) + - (((f[BN]-f[TS]) + (f[TN]-f[BS])) + ((f[NW]-f[SE]) + (f[NE]-f[SW]))) + - (f[N]-f[S])); - } - /*=====================================================================*/ - static void calcIncompVelocityX3(const LBMReal* const& f/*[27]*/, LBMReal& vx3) - { - vx3 =((((f[TNE]-f[BSW]) + (f[TSE]-f[BNW])) + ((f[TNW]-f[BSE]) + (f[TSW]-f[BNE]))) + - (((f[TS]-f[BN]) + (f[TN]-f[BS])) + ((f[TW]-f[BE]) + (f[TE]-f[BW]))) + - (f[T]-f[B])); - } - /*=====================================================================*/ - static LBMReal getCompVelocityX1(const LBMReal* const& f/*[27]*/) - { - return ((((f[TNE]-f[BSW]) + (f[TSE]-f[BNW])) + ((f[BSE]-f[TNW]) + (f[BNE]-f[TSW]))) + - (((f[BE]-f[TW]) + (f[TE]-f[BW])) + ((f[SE]-f[NW]) + (f[NE]-f[SW]))) + - (f[E]-f[W]))/getDensity(f); - } - /*=====================================================================*/ - static LBMReal getCompVelocityX2(const LBMReal* const& f/*[27]*/) - { - return ((((f[TNE]-f[BSW]) + (f[BNW]-f[TSE])) + ((f[TNW]-f[BSE]) + (f[BNE]-f[TSW]))) + - (((f[BN]-f[TS]) + (f[TN]-f[BS])) + ((f[NW]-f[SE]) + (f[NE]-f[SW]))) + - (f[N]-f[S]))/getDensity(f); - } - /*=====================================================================*/ - static LBMReal getCompVelocityX3(const LBMReal* const& f/*[27]*/) - { - return ((((f[TNE]-f[BSW]) + (f[TSE]-f[BNW])) + ((f[TNW]-f[BSE]) + (f[TSW]-f[BNE]))) + - (((f[TS]-f[BN]) + (f[TN]-f[BS])) + ((f[TW]-f[BE]) + (f[TE]-f[BW]))) + - (f[T]-f[B]))/getDensity(f); - } - /*=====================================================================*/ - static void calcCompVelocityX1(const LBMReal* const& f/*[27]*/, LBMReal& vx1) - { - vx1 = ((((f[TNE]-f[BSW]) + (f[TSE]-f[BNW])) + ((f[BSE]-f[TNW]) + (f[BNE]-f[TSW]))) + - (((f[BE]-f[TW]) + (f[TE]-f[BW])) + ((f[SE]-f[NW]) + (f[NE]-f[SW]))) + - (f[E]-f[W]))/getDensity(f); - } - /*=====================================================================*/ - static void calcCompVelocityX2(const LBMReal* const& f/*[27]*/, LBMReal& vx2) - { - vx2 = ((((f[TNE]-f[BSW]) + (f[BNW]-f[TSE])) + ((f[TNW]-f[BSE]) + (f[BNE]-f[TSW]))) + - (((f[BN]-f[TS]) + (f[TN]-f[BS])) + ((f[NW]-f[SE]) + (f[NE]-f[SW]))) + - (f[N]-f[S]))/getDensity(f); - } - /*=====================================================================*/ - static void calcCompVelocityX3(const LBMReal* const& f/*[27]*/, LBMReal& vx3) - { - vx3 = ((((f[TNE]-f[BSW]) + (f[TSE]-f[BNW])) + ((f[TNW]-f[BSE]) + (f[TSW]-f[BNE]))) + - (((f[TS]-f[BN]) + (f[TN]-f[BS])) + ((f[TW]-f[BE]) + (f[TE]-f[BW]))) + - (f[T]-f[B]))/getDensity(f); - } - /*=====================================================================*/ - static void calcIncompMacroscopicValues(const LBMReal* const& f/*[27]*/, LBMReal& rho, LBMReal& vx1, LBMReal& vx2, LBMReal& vx3) - { - D3Q27System::calcDensity(f, rho); - D3Q27System::calcIncompVelocityX1(f, vx1); - D3Q27System::calcIncompVelocityX2(f, vx2); - D3Q27System::calcIncompVelocityX3(f, vx3); - } - - /*=====================================================================*/ - static void calcCompMacroscopicValues(const LBMReal* const& f/*[27]*/, LBMReal& drho, LBMReal& vx1, LBMReal& vx2, LBMReal& vx3) - { - D3Q27System::calcDensity(f, drho); - D3Q27System::calcIncompVelocityX1(f, vx1); - D3Q27System::calcIncompVelocityX2(f, vx2); - D3Q27System::calcIncompVelocityX3(f, vx3); - LBMReal rho = drho+one; - vx1/=rho; - vx2/=rho; - vx3/=rho; - } - ////////////////////////////////////////////////////////////////////////// - static LBMReal getCompFeqForDirection(const int& direction, const LBMReal& drho,const LBMReal& vx1,const LBMReal& vx2,const LBMReal& vx3) - { - LBMReal cu_sq=1.5*(vx1*vx1+vx2*vx2+vx3*vx3); - - //switch(direction) - //{ - // case ZERO : return REAL_CAST( c8o27*rho*(1.0-cu_sq)); - // case E : return REAL_CAST( c2o27*rho*(1.0+3.0*( vx1 )+c9o2*( vx1 )*( vx1 )-cu_sq)); - // case W : return REAL_CAST( c2o27*rho*(1.0+3.0*(-vx1 )+c9o2*(-vx1 )*(-vx1 )-cu_sq)); - // case N : return REAL_CAST( c2o27*rho*(1.0+3.0*( vx2)+c9o2*( vx2)*( vx2)-cu_sq)); - // case S : return REAL_CAST( c2o27*rho*(1.0+3.0*( -vx2)+c9o2*( -vx2)*( -vx2)-cu_sq)); - // case T : return REAL_CAST( c2o27*rho*(1.0+3.0*( vx3 )+c9o2*( vx3)*( vx3)-cu_sq)); - // case B : return REAL_CAST( c2o27*rho*(1.0+3.0*( -vx3)+c9o2*( -vx3)*( -vx3)-cu_sq)); - // case NE : return REAL_CAST( c1o54*rho*(1.0+3.0*( vx1+vx2)+c9o2*( vx1+vx2)*( vx1+vx2)-cu_sq)); - // case SW : return REAL_CAST( c1o54*rho*(1.0+3.0*(-vx1-vx2)+c9o2*(-vx1-vx2)*(-vx1-vx2)-cu_sq)); - // case SE : return REAL_CAST( c1o54*rho*(1.0+3.0*( vx1-vx2)+c9o2*( vx1-vx2)*( vx1-vx2)-cu_sq)); - // case NW : return REAL_CAST( c1o54*rho*(1.0+3.0*(-vx1+vx2)+c9o2*(-vx1+vx2)*(-vx1+vx2)-cu_sq)); - // case TE : return REAL_CAST( c1o54*rho*(1.0+3.0*( vx1+vx3)+c9o2*( vx1+vx3)*( vx1+vx3)-cu_sq)); - // case BW : return REAL_CAST( c1o54*rho*(1.0+3.0*(-vx1-vx3)+c9o2*(-vx1-vx3)*(-vx1-vx3)-cu_sq)); - // case BE : return REAL_CAST( c1o54*rho*(1.0+3.0*( vx1-vx3)+c9o2*( vx1-vx3)*( vx1-vx3)-cu_sq)); - // case TW : return REAL_CAST( c1o54*rho*(1.0+3.0*(-vx1+vx3)+c9o2*(-vx1+vx3)*(-vx1+vx3)-cu_sq)); - // case TN : return REAL_CAST( c1o54*rho*(1.0+3.0*( vx2+vx3)+c9o2*( vx2+vx3)*( vx2+vx3)-cu_sq)); - // case BS : return REAL_CAST( c1o54*rho*(1.0+3.0*(-vx2-vx3)+c9o2*(-vx2-vx3)*(-vx2-vx3)-cu_sq)); - // case BN : return REAL_CAST( c1o54*rho*(1.0+3.0*( vx2-vx3)+c9o2*( vx2-vx3)*( vx2-vx3)-cu_sq)); - // case TS : return REAL_CAST( c1o54*rho*(1.0+3.0*(-vx2+vx3)+c9o2*(-vx2+vx3)*(-vx2+vx3)-cu_sq)); - // case TNE : return REAL_CAST(c1o216*rho*(1.0+3.0*( vx1+vx2+vx3)+c9o2*( vx1+vx2+vx3)*( vx1+vx2+vx3)-cu_sq)); - // case BSW : return REAL_CAST(c1o216*rho*(1.0+3.0*(-vx1-vx2-vx3)+c9o2*(-vx1-vx2-vx3)*(-vx1-vx2-vx3)-cu_sq)); - // case BNE : return REAL_CAST(c1o216*rho*(1.0+3.0*( vx1+vx2-vx3)+c9o2*( vx1+vx2-vx3)*( vx1+vx2-vx3)-cu_sq)); - // case TSW : return REAL_CAST(c1o216*rho*(1.0+3.0*(-vx1-vx2+vx3)+c9o2*(-vx1-vx2+vx3)*(-vx1-vx2+vx3)-cu_sq)); - // case TSE : return REAL_CAST(c1o216*rho*(1.0+3.0*( vx1-vx2+vx3)+c9o2*( vx1-vx2+vx3)*( vx1-vx2+vx3)-cu_sq)); - // case BNW : return REAL_CAST(c1o216*rho*(1.0+3.0*(-vx1+vx2-vx3)+c9o2*(-vx1+vx2-vx3)*(-vx1+vx2-vx3)-cu_sq)); - // case BSE : return REAL_CAST(c1o216*rho*(1.0+3.0*( vx1-vx2-vx3)+c9o2*( vx1-vx2-vx3)*( vx1-vx2-vx3)-cu_sq)); - // case TNW : return REAL_CAST(c1o216*rho*(1.0+3.0*(-vx1+vx2+vx3)+c9o2*(-vx1+vx2+vx3)*(-vx1+vx2+vx3)-cu_sq)); - // default: throw UbException(UB_EXARGS,"unknown dir"); - //} - - - ////----- - LBMReal rho = drho+one; - switch (direction) - { - case ZERO: return REAL_CAST(c8o27*(drho+rho*(-cu_sq))); - case E: return REAL_CAST(c2o27*(drho+rho*(3.0*(vx1)+c9o2*(vx1)*(vx1)-cu_sq))); - case W: return REAL_CAST(c2o27*(drho+rho*(3.0*(-vx1)+c9o2*(-vx1)*(-vx1)-cu_sq))); - case N: return REAL_CAST(c2o27*(drho+rho*(3.0*(vx2)+c9o2*(vx2)*(vx2)-cu_sq))); - case S: return REAL_CAST(c2o27*(drho+rho*(3.0*(-vx2)+c9o2*(-vx2)*(-vx2)-cu_sq))); - case T: return REAL_CAST(c2o27*(drho+rho*(3.0*(vx3)+c9o2*(vx3)*(vx3)-cu_sq))); - case B: return REAL_CAST(c2o27*(drho+rho*(3.0*(-vx3)+c9o2*(-vx3)*(-vx3)-cu_sq))); - case NE: return REAL_CAST(c1o54*(drho+rho*(3.0*(vx1+vx2)+c9o2*(vx1+vx2)*(vx1+vx2)-cu_sq))); - case SW: return REAL_CAST(c1o54*(drho+rho*(3.0*(-vx1-vx2)+c9o2*(-vx1-vx2)*(-vx1-vx2)-cu_sq))); - case SE: return REAL_CAST(c1o54*(drho+rho*(3.0*(vx1-vx2)+c9o2*(vx1-vx2)*(vx1-vx2)-cu_sq))); - case NW: return REAL_CAST(c1o54*(drho+rho*(3.0*(-vx1+vx2)+c9o2*(-vx1+vx2)*(-vx1+vx2)-cu_sq))); - case TE: return REAL_CAST(c1o54*(drho+rho*(3.0*(vx1+vx3)+c9o2*(vx1+vx3)*(vx1+vx3)-cu_sq))); - case BW: return REAL_CAST(c1o54*(drho+rho*(3.0*(-vx1-vx3)+c9o2*(-vx1-vx3)*(-vx1-vx3)-cu_sq))); - case BE: return REAL_CAST(c1o54*(drho+rho*(3.0*(vx1-vx3)+c9o2*(vx1-vx3)*(vx1-vx3)-cu_sq))); - case TW: return REAL_CAST(c1o54*(drho+rho*(3.0*(-vx1+vx3)+c9o2*(-vx1+vx3)*(-vx1+vx3)-cu_sq))); - case TN: return REAL_CAST(c1o54*(drho+rho*(3.0*(vx2+vx3)+c9o2*(vx2+vx3)*(vx2+vx3)-cu_sq))); - case BS: return REAL_CAST(c1o54*(drho+rho*(3.0*(-vx2-vx3)+c9o2*(-vx2-vx3)*(-vx2-vx3)-cu_sq))); - case BN: return REAL_CAST(c1o54*(drho+rho*(3.0*(vx2-vx3)+c9o2*(vx2-vx3)*(vx2-vx3)-cu_sq))); - case TS: return REAL_CAST(c1o54*(drho+rho*(3.0*(-vx2+vx3)+c9o2*(-vx2+vx3)*(-vx2+vx3)-cu_sq))); - case TNE: return REAL_CAST(c1o216*(drho+rho*(3.0*(vx1+vx2+vx3)+c9o2*(vx1+vx2+vx3)*(vx1+vx2+vx3)-cu_sq))); - case BSW: return REAL_CAST(c1o216*(drho+rho*(3.0*(-vx1-vx2-vx3)+c9o2*(-vx1-vx2-vx3)*(-vx1-vx2-vx3)-cu_sq))); - case BNE: return REAL_CAST(c1o216*(drho+rho*(3.0*(vx1+vx2-vx3)+c9o2*(vx1+vx2-vx3)*(vx1+vx2-vx3)-cu_sq))); - case TSW: return REAL_CAST(c1o216*(drho+rho*(3.0*(-vx1-vx2+vx3)+c9o2*(-vx1-vx2+vx3)*(-vx1-vx2+vx3)-cu_sq))); - case TSE: return REAL_CAST(c1o216*(drho+rho*(3.0*(vx1-vx2+vx3)+c9o2*(vx1-vx2+vx3)*(vx1-vx2+vx3)-cu_sq))); - case BNW: return REAL_CAST(c1o216*(drho+rho*(3.0*(-vx1+vx2-vx3)+c9o2*(-vx1+vx2-vx3)*(-vx1+vx2-vx3)-cu_sq))); - case BSE: return REAL_CAST(c1o216*(drho+rho*(3.0*(vx1-vx2-vx3)+c9o2*(vx1-vx2-vx3)*(vx1-vx2-vx3)-cu_sq))); - case TNW: return REAL_CAST(c1o216*(drho+rho*(3.0*(-vx1+vx2+vx3)+c9o2*(-vx1+vx2+vx3)*(-vx1+vx2+vx3)-cu_sq))); - default: throw UbException(UB_EXARGS, "unknown dir"); - } - - } - ////////////////////////////////////////////////////////////////////////// - static void calcCompFeq(LBMReal* const& feq/*[27]*/,const LBMReal& drho,const LBMReal& vx1,const LBMReal& vx2,const LBMReal& vx3) - { - //LBMReal cu_sq=1.5*(vx1*vx1+vx2*vx2+vx3*vx3); - - //feq[ZERO] = c8o27*rho*(1.0-cu_sq); - //feq[E] = c2o27*rho*(1.0+3.0*( vx1 )+c9o2*( vx1 )*( vx1 )-cu_sq); - //feq[W] = c2o27*rho*(1.0+3.0*(-vx1 )+c9o2*(-vx1 )*(-vx1 )-cu_sq); - //feq[N] = c2o27*rho*(1.0+3.0*( vx2)+c9o2*( vx2)*( vx2)-cu_sq); - //feq[S] = c2o27*rho*(1.0+3.0*( -vx2)+c9o2*( -vx2)*( -vx2)-cu_sq); - //feq[T] = c2o27*rho*(1.0+3.0*( vx3 )+c9o2*( vx3)*( vx3)-cu_sq); - //feq[B] = c2o27*rho*(1.0+3.0*( -vx3)+c9o2*( -vx3)*( -vx3)-cu_sq); - //feq[NE] = c1o54*rho*(1.0+3.0*( vx1+vx2)+c9o2*( vx1+vx2)*( vx1+vx2)-cu_sq); - //feq[SW] = c1o54*rho*(1.0+3.0*(-vx1-vx2)+c9o2*(-vx1-vx2)*(-vx1-vx2)-cu_sq); - //feq[SE] = c1o54*rho*(1.0+3.0*( vx1-vx2)+c9o2*( vx1-vx2)*( vx1-vx2)-cu_sq); - //feq[NW] = c1o54*rho*(1.0+3.0*(-vx1+vx2)+c9o2*(-vx1+vx2)*(-vx1+vx2)-cu_sq); - //feq[TE] = c1o54*rho*(1.0+3.0*( vx1+vx3)+c9o2*( vx1+vx3)*( vx1+vx3)-cu_sq); - //feq[BW] = c1o54*rho*(1.0+3.0*(-vx1-vx3)+c9o2*(-vx1-vx3)*(-vx1-vx3)-cu_sq); - //feq[BE] = c1o54*rho*(1.0+3.0*( vx1-vx3)+c9o2*( vx1-vx3)*( vx1-vx3)-cu_sq); - //feq[TW] = c1o54*rho*(1.0+3.0*(-vx1+vx3)+c9o2*(-vx1+vx3)*(-vx1+vx3)-cu_sq); - //feq[TN] = c1o54*rho*(1.0+3.0*( vx2+vx3)+c9o2*( vx2+vx3)*( vx2+vx3)-cu_sq); - //feq[BS] = c1o54*rho*(1.0+3.0*(-vx2-vx3)+c9o2*(-vx2-vx3)*(-vx2-vx3)-cu_sq); - //feq[BN] = c1o54*rho*(1.0+3.0*( vx2-vx3)+c9o2*( vx2-vx3)*( vx2-vx3)-cu_sq); - //feq[TS] = c1o54*rho*(1.0+3.0*(-vx2+vx3)+c9o2*(-vx2+vx3)*(-vx2+vx3)-cu_sq); - //feq[TNE] = c1o216*rho*(1.0+3.0*( vx1+vx2+vx3)+c9o2*( vx1+vx2+vx3)*( vx1+vx2+vx3)-cu_sq); - //feq[BSW] = c1o216*rho*(1.0+3.0*(-vx1-vx2-vx3)+c9o2*(-vx1-vx2-vx3)*(-vx1-vx2-vx3)-cu_sq); - //feq[BNE] = c1o216*rho*(1.0+3.0*( vx1+vx2-vx3)+c9o2*( vx1+vx2-vx3)*( vx1+vx2-vx3)-cu_sq); - //feq[TSW] = c1o216*rho*(1.0+3.0*(-vx1-vx2+vx3)+c9o2*(-vx1-vx2+vx3)*(-vx1-vx2+vx3)-cu_sq); - //feq[TSE] = c1o216*rho*(1.0+3.0*( vx1-vx2+vx3)+c9o2*( vx1-vx2+vx3)*( vx1-vx2+vx3)-cu_sq); - //feq[BNW] = c1o216*rho*(1.0+3.0*(-vx1+vx2-vx3)+c9o2*(-vx1+vx2-vx3)*(-vx1+vx2-vx3)-cu_sq); - //feq[BSE] = c1o216*rho*(1.0+3.0*( vx1-vx2-vx3)+c9o2*( vx1-vx2-vx3)*( vx1-vx2-vx3)-cu_sq); - //feq[TNW] = c1o216*rho*(1.0+3.0*(-vx1+vx2+vx3)+c9o2*(-vx1+vx2+vx3)*(-vx1+vx2+vx3)-cu_sq); - - ////////////////////////////////////////////////////////////////////////// - - LBMReal cu_sq = 1.5*(vx1*vx1+vx2*vx2+vx3*vx3); - LBMReal rho = drho+one; - - feq[ZERO] = c8o27*(drho+rho*(-cu_sq)); - feq[E] = c2o27*(drho+rho*(3.0*(vx1)+c9o2*(vx1)*(vx1)-cu_sq)); - feq[W] = c2o27*(drho+rho*(3.0*(-vx1)+c9o2*(-vx1)*(-vx1)-cu_sq)); - feq[N] = c2o27*(drho+rho*(3.0*(vx2)+c9o2*(vx2)*(vx2)-cu_sq)); - feq[S] = c2o27*(drho+rho*(3.0*(-vx2)+c9o2*(-vx2)*(-vx2)-cu_sq)); - feq[T] = c2o27*(drho+rho*(3.0*(vx3)+c9o2*(vx3)*(vx3)-cu_sq)); - feq[B] = c2o27*(drho+rho*(3.0*(-vx3)+c9o2*(-vx3)*(-vx3)-cu_sq)); - feq[NE] = c1o54*(drho+rho*(3.0*(vx1+vx2)+c9o2*(vx1+vx2)*(vx1+vx2)-cu_sq)); - feq[SW] = c1o54*(drho+rho*(3.0*(-vx1-vx2)+c9o2*(-vx1-vx2)*(-vx1-vx2)-cu_sq)); - feq[SE] = c1o54*(drho+rho*(3.0*(vx1-vx2)+c9o2*(vx1-vx2)*(vx1-vx2)-cu_sq)); - feq[NW] = c1o54*(drho+rho*(3.0*(-vx1+vx2)+c9o2*(-vx1+vx2)*(-vx1+vx2)-cu_sq)); - feq[TE] = c1o54*(drho+rho*(3.0*(vx1+vx3)+c9o2*(vx1+vx3)*(vx1+vx3)-cu_sq)); - feq[BW] = c1o54*(drho+rho*(3.0*(-vx1-vx3)+c9o2*(-vx1-vx3)*(-vx1-vx3)-cu_sq)); - feq[BE] = c1o54*(drho+rho*(3.0*(vx1-vx3)+c9o2*(vx1-vx3)*(vx1-vx3)-cu_sq)); - feq[TW] = c1o54*(drho+rho*(3.0*(-vx1+vx3)+c9o2*(-vx1+vx3)*(-vx1+vx3)-cu_sq)); - feq[TN] = c1o54*(drho+rho*(3.0*(vx2+vx3)+c9o2*(vx2+vx3)*(vx2+vx3)-cu_sq)); - feq[BS] = c1o54*(drho+rho*(3.0*(-vx2-vx3)+c9o2*(-vx2-vx3)*(-vx2-vx3)-cu_sq)); - feq[BN] = c1o54*(drho+rho*(3.0*(vx2-vx3)+c9o2*(vx2-vx3)*(vx2-vx3)-cu_sq)); - feq[TS] = c1o54*(drho+rho*(3.0*(-vx2+vx3)+c9o2*(-vx2+vx3)*(-vx2+vx3)-cu_sq)); - feq[TNE] = c1o216*(drho+rho*(3.0*(vx1+vx2+vx3)+c9o2*(vx1+vx2+vx3)*(vx1+vx2+vx3)-cu_sq)); - feq[BSW] = c1o216*(drho+rho*(3.0*(-vx1-vx2-vx3)+c9o2*(-vx1-vx2-vx3)*(-vx1-vx2-vx3)-cu_sq)); - feq[BNE] = c1o216*(drho+rho*(3.0*(vx1+vx2-vx3)+c9o2*(vx1+vx2-vx3)*(vx1+vx2-vx3)-cu_sq)); - feq[TSW] = c1o216*(drho+rho*(3.0*(-vx1-vx2+vx3)+c9o2*(-vx1-vx2+vx3)*(-vx1-vx2+vx3)-cu_sq)); - feq[TSE] = c1o216*(drho+rho*(3.0*(vx1-vx2+vx3)+c9o2*(vx1-vx2+vx3)*(vx1-vx2+vx3)-cu_sq)); - feq[BNW] = c1o216*(drho+rho*(3.0*(-vx1+vx2-vx3)+c9o2*(-vx1+vx2-vx3)*(-vx1+vx2-vx3)-cu_sq)); - feq[BSE] = c1o216*(drho+rho*(3.0*(vx1-vx2-vx3)+c9o2*(vx1-vx2-vx3)*(vx1-vx2-vx3)-cu_sq)); - feq[TNW] = c1o216*(drho+rho*(3.0*(-vx1+vx2+vx3)+c9o2*(-vx1+vx2+vx3)*(-vx1+vx2+vx3)-cu_sq)); - } - ////////////////////////////////////////////////////////////////////////// - static LBMReal getIncompFeqForDirection(const int& direction,const LBMReal& drho, const LBMReal& vx1,const LBMReal& vx2,const LBMReal& vx3) - { - LBMReal cu_sq=1.5f*(vx1*vx1+vx2*vx2+vx3*vx3); - - switch(direction) - { - case ZERO : return REAL_CAST( c8o27*(drho-cu_sq)); - case E : return REAL_CAST( c2o27*(drho+3.0*( vx1 )+c9o2*( vx1 )*( vx1 )-cu_sq)); - case W : return REAL_CAST( c2o27*(drho+3.0*(-vx1 )+c9o2*(-vx1 )*(-vx1 )-cu_sq)); - case N : return REAL_CAST( c2o27*(drho+3.0*( vx2)+c9o2*( vx2)*( vx2)-cu_sq)); - case S : return REAL_CAST( c2o27*(drho+3.0*( -vx2)+c9o2*( -vx2)*( -vx2)-cu_sq)); - case T : return REAL_CAST( c2o27*(drho+3.0*( vx3 )+c9o2*( vx3)*( vx3)-cu_sq)); - case B : return REAL_CAST( c2o27*(drho+3.0*( -vx3)+c9o2*( -vx3)*( -vx3)-cu_sq)); - case NE : return REAL_CAST( c1o54*(drho+3.0*( vx1+vx2)+c9o2*( vx1+vx2)*( vx1+vx2)-cu_sq)); - case SW : return REAL_CAST( c1o54*(drho+3.0*(-vx1-vx2)+c9o2*(-vx1-vx2)*(-vx1-vx2)-cu_sq)); - case SE : return REAL_CAST( c1o54*(drho+3.0*( vx1-vx2)+c9o2*( vx1-vx2)*( vx1-vx2)-cu_sq)); - case NW : return REAL_CAST( c1o54*(drho+3.0*(-vx1+vx2)+c9o2*(-vx1+vx2)*(-vx1+vx2)-cu_sq)); - case TE : return REAL_CAST( c1o54*(drho+3.0*( vx1+vx3)+c9o2*( vx1+vx3)*( vx1+vx3)-cu_sq)); - case BW : return REAL_CAST( c1o54*(drho+3.0*(-vx1-vx3)+c9o2*(-vx1-vx3)*(-vx1-vx3)-cu_sq)); - case BE : return REAL_CAST( c1o54*(drho+3.0*( vx1-vx3)+c9o2*( vx1-vx3)*( vx1-vx3)-cu_sq)); - case TW : return REAL_CAST( c1o54*(drho+3.0*(-vx1+vx3)+c9o2*(-vx1+vx3)*(-vx1+vx3)-cu_sq)); - case TN : return REAL_CAST( c1o54*(drho+3.0*( vx2+vx3)+c9o2*( vx2+vx3)*( vx2+vx3)-cu_sq)); - case BS : return REAL_CAST( c1o54*(drho+3.0*(-vx2-vx3)+c9o2*(-vx2-vx3)*(-vx2-vx3)-cu_sq)); - case BN : return REAL_CAST( c1o54*(drho+3.0*( vx2-vx3)+c9o2*( vx2-vx3)*( vx2-vx3)-cu_sq)); - case TS : return REAL_CAST( c1o54*(drho+3.0*(-vx2+vx3)+c9o2*(-vx2+vx3)*(-vx2+vx3)-cu_sq)); - case TNE : return REAL_CAST(c1o216*(drho+3.0*( vx1+vx2+vx3)+c9o2*( vx1+vx2+vx3)*( vx1+vx2+vx3)-cu_sq)); - case BSW : return REAL_CAST(c1o216*(drho+3.0*(-vx1-vx2-vx3)+c9o2*(-vx1-vx2-vx3)*(-vx1-vx2-vx3)-cu_sq)); - case BNE : return REAL_CAST(c1o216*(drho+3.0*( vx1+vx2-vx3)+c9o2*( vx1+vx2-vx3)*( vx1+vx2-vx3)-cu_sq)); - case TSW : return REAL_CAST(c1o216*(drho+3.0*(-vx1-vx2+vx3)+c9o2*(-vx1-vx2+vx3)*(-vx1-vx2+vx3)-cu_sq)); - case TSE : return REAL_CAST(c1o216*(drho+3.0*( vx1-vx2+vx3)+c9o2*( vx1-vx2+vx3)*( vx1-vx2+vx3)-cu_sq)); - case BNW : return REAL_CAST(c1o216*(drho+3.0*(-vx1+vx2-vx3)+c9o2*(-vx1+vx2-vx3)*(-vx1+vx2-vx3)-cu_sq)); - case BSE : return REAL_CAST(c1o216*(drho+3.0*( vx1-vx2-vx3)+c9o2*( vx1-vx2-vx3)*( vx1-vx2-vx3)-cu_sq)); - case TNW : return REAL_CAST(c1o216*(drho+3.0*(-vx1+vx2+vx3)+c9o2*(-vx1+vx2+vx3)*(-vx1+vx2+vx3)-cu_sq)); - default: throw UbException(UB_EXARGS,"unknown dir"); - } - } - ////////////////////////////////////////////////////////////////////////// - static void calcIncompFeq(LBMReal* const& feq/*[27]*/,const LBMReal& drho,const LBMReal& vx1,const LBMReal& vx2,const LBMReal& vx3) - { - LBMReal cu_sq=1.5*(vx1*vx1+vx2*vx2+vx3*vx3); - - feq[ZERO] = c8o27*(drho-cu_sq); - feq[E] = c2o27*(drho+3.0*( vx1 )+c9o2*( vx1 )*( vx1 )-cu_sq); - feq[W] = c2o27*(drho+3.0*(-vx1 )+c9o2*(-vx1 )*(-vx1 )-cu_sq); - feq[N] = c2o27*(drho+3.0*( vx2)+c9o2*( vx2)*( vx2)-cu_sq); - feq[S] = c2o27*(drho+3.0*( -vx2)+c9o2*( -vx2)*( -vx2)-cu_sq); - feq[T] = c2o27*(drho+3.0*( vx3 )+c9o2*( vx3)*( vx3)-cu_sq); - feq[B] = c2o27*(drho+3.0*( -vx3)+c9o2*( -vx3)*( -vx3)-cu_sq); - feq[NE] = c1o54*(drho+3.0*( vx1+vx2)+c9o2*( vx1+vx2)*( vx1+vx2)-cu_sq); - feq[SW] = c1o54*(drho+3.0*(-vx1-vx2)+c9o2*(-vx1-vx2)*(-vx1-vx2)-cu_sq); - feq[SE] = c1o54*(drho+3.0*( vx1-vx2)+c9o2*( vx1-vx2)*( vx1-vx2)-cu_sq); - feq[NW] = c1o54*(drho+3.0*(-vx1+vx2)+c9o2*(-vx1+vx2)*(-vx1+vx2)-cu_sq); - feq[TE] = c1o54*(drho+3.0*( vx1+vx3)+c9o2*( vx1+vx3)*( vx1+vx3)-cu_sq); - feq[BW] = c1o54*(drho+3.0*(-vx1-vx3)+c9o2*(-vx1-vx3)*(-vx1-vx3)-cu_sq); - feq[BE] = c1o54*(drho+3.0*( vx1-vx3)+c9o2*( vx1-vx3)*( vx1-vx3)-cu_sq); - feq[TW] = c1o54*(drho+3.0*(-vx1+vx3)+c9o2*(-vx1+vx3)*(-vx1+vx3)-cu_sq); - feq[TN] = c1o54*(drho+3.0*( vx2+vx3)+c9o2*( vx2+vx3)*( vx2+vx3)-cu_sq); - feq[BS] = c1o54*(drho+3.0*(-vx2-vx3)+c9o2*(-vx2-vx3)*(-vx2-vx3)-cu_sq); - feq[BN] = c1o54*(drho+3.0*( vx2-vx3)+c9o2*( vx2-vx3)*( vx2-vx3)-cu_sq); - feq[TS] = c1o54*(drho+3.0*(-vx2+vx3)+c9o2*(-vx2+vx3)*(-vx2+vx3)-cu_sq); - feq[TNE] = c1o216*(drho+3.0*( vx1+vx2+vx3)+c9o2*( vx1+vx2+vx3)*( vx1+vx2+vx3)-cu_sq); - feq[BSW] = c1o216*(drho+3.0*(-vx1-vx2-vx3)+c9o2*(-vx1-vx2-vx3)*(-vx1-vx2-vx3)-cu_sq); - feq[BNE] = c1o216*(drho+3.0*( vx1+vx2-vx3)+c9o2*( vx1+vx2-vx3)*( vx1+vx2-vx3)-cu_sq); - feq[TSW] = c1o216*(drho+3.0*(-vx1-vx2+vx3)+c9o2*(-vx1-vx2+vx3)*(-vx1-vx2+vx3)-cu_sq); - feq[TSE] = c1o216*(drho+3.0*( vx1-vx2+vx3)+c9o2*( vx1-vx2+vx3)*( vx1-vx2+vx3)-cu_sq); - feq[BNW] = c1o216*(drho+3.0*(-vx1+vx2-vx3)+c9o2*(-vx1+vx2-vx3)*(-vx1+vx2-vx3)-cu_sq); - feq[BSE] = c1o216*(drho+3.0*( vx1-vx2-vx3)+c9o2*( vx1-vx2-vx3)*( vx1-vx2-vx3)-cu_sq); - feq[TNW] = c1o216*(drho+3.0*(-vx1+vx2+vx3)+c9o2*(-vx1+vx2+vx3)*(-vx1+vx2+vx3)-cu_sq); - } - ////////////////////////////////////////////////////////////////////////// - static inline float getBoundaryVelocityForDirection(const int& direction, const float& bcVelocityX1,const float& bcVelocityX2,const float& bcVelocityX3) - { - switch(direction) - { - case E: return (float)( UbMath::c4o9*(+bcVelocityX1) ); - case W: return (float)( UbMath::c4o9*(-bcVelocityX1) ); - case N: return (float)( UbMath::c4o9*(+bcVelocityX2) ); - case S: return (float)( UbMath::c4o9*(-bcVelocityX2) ); - case T: return (float)( UbMath::c4o9*(+bcVelocityX3) ); - case B: return (float)( UbMath::c4o9*(-bcVelocityX3) ); - case NE: return (float)( UbMath::c1o9*(+bcVelocityX1+bcVelocityX2 ) ); - case SW: return (float)( UbMath::c1o9*(-bcVelocityX1-bcVelocityX2 ) ); - case SE: return (float)( UbMath::c1o9*(+bcVelocityX1-bcVelocityX2 ) ); - case NW: return (float)( UbMath::c1o9*(-bcVelocityX1+bcVelocityX2 ) ); - case TE: return (float)( UbMath::c1o9*(+bcVelocityX1 +bcVelocityX3) ); - case BW: return (float)( UbMath::c1o9*(-bcVelocityX1 -bcVelocityX3) ); - case BE: return (float)( UbMath::c1o9*(+bcVelocityX1 -bcVelocityX3) ); - case TW: return (float)( UbMath::c1o9*(-bcVelocityX1 +bcVelocityX3) ); - case TN: return (float)( UbMath::c1o9*( +bcVelocityX2+bcVelocityX3) ); - case BS: return (float)( UbMath::c1o9*( -bcVelocityX2-bcVelocityX3) ); - case BN: return (float)( UbMath::c1o9*( +bcVelocityX2-bcVelocityX3) ); - case TS: return (float)( UbMath::c1o9*( -bcVelocityX2+bcVelocityX3) ); - case TNE: return (float)( UbMath::c1o36*(+bcVelocityX1+bcVelocityX2+bcVelocityX3) ); - case BSW: return (float)( UbMath::c1o36*(-bcVelocityX1-bcVelocityX2-bcVelocityX3) ); - case BNE: return (float)( UbMath::c1o36*(+bcVelocityX1+bcVelocityX2-bcVelocityX3) ); - case TSW: return (float)( UbMath::c1o36*(-bcVelocityX1-bcVelocityX2+bcVelocityX3) ); - case TSE: return (float)( UbMath::c1o36*(+bcVelocityX1-bcVelocityX2+bcVelocityX3) ); - case BNW: return (float)( UbMath::c1o36*(-bcVelocityX1+bcVelocityX2-bcVelocityX3) ); - case BSE: return (float)( UbMath::c1o36*(+bcVelocityX1-bcVelocityX2-bcVelocityX3) ); - case TNW: return (float)( UbMath::c1o36*(-bcVelocityX1+bcVelocityX2+bcVelocityX3) ); - default: throw UbException(UB_EXARGS,"unknown direction"); - } - } - /*=====================================================================*/ - static const int& getInvertDirection(const int& direction) - { - #ifdef _DEBUG - if(direction<STARTDIR || direction>ENDDIR) - throw UbException(UB_EXARGS,"unknown direction"); - #endif - return INVDIR[direction]; - } - /*=====================================================================*/ - static void getLBMDirections(std::vector<int>& dirs, bool onlyLBdirs = false) - { - std::vector<int> D3Q27Dirs; - if(onlyLBdirs) /*FSTARTDIR->FENDDIR*/ - { - dirs.resize(FENDDIR+1); - for(int dir=FSTARTDIR; dir<=FENDDIR; ++dir) - dirs[dir] = dir; - } - else /*STARTDIR->ENDDIR*/ - { - dirs.resize(ENDDIR+1); - for(int dir=STARTDIR; dir<=ENDDIR; ++dir) - dirs[dir] = dir; - } - } -////////////////////////////////////////////////////////////////////////// - static std::vector<int> getEX(const int& exn) - { - std::vector<int> ex; - ex.resize(ENDDIR+1); - switch (exn) - { - case 1: - for(int dir=STARTDIR; dir<ENDDIR; ++dir) - ex[dir] = DX1[dir]; - break; - case 2: - for(int dir=STARTDIR; dir<ENDDIR; ++dir) - ex[dir] = DX2[dir]; - break; - case 3: - for(int dir=STARTDIR; dir<ENDDIR; ++dir) - ex[dir] = DX3[dir]; - break; - } - return ex; - } -////////////////////////////////////////////////////////////////////////// - static inline void calcDistanceToNeighbors(std::vector<double>& distNeigh, const double& deltaX1) - { - //distNeigh.resize(FENDDIR+1, UbMath::sqrt2*deltaX1); - double sqrt3 = UbMath::sqrt3; - double sqrt2 = UbMath::sqrt2; - distNeigh[E] = distNeigh[W] = distNeigh[N] = deltaX1; - distNeigh[S] = distNeigh[T] = distNeigh[B] = deltaX1; - distNeigh[NE] = distNeigh[NW] = distNeigh[SW] = distNeigh[SE] = sqrt2*deltaX1; - distNeigh[TE] = distNeigh[TN] = distNeigh[TW] = distNeigh[TS] = sqrt2*deltaX1; - distNeigh[BE] = distNeigh[BN] = distNeigh[BW] = distNeigh[BS] = sqrt2*deltaX1; - distNeigh[TNE] = distNeigh[TNW] = distNeigh[TSE] = distNeigh[TSW] = sqrt3*deltaX1; - distNeigh[BNE] = distNeigh[BNW] = distNeigh[BSE] = distNeigh[BSW] = sqrt3*deltaX1; - } -////////////////////////////////////////////////////////////////////////// - static inline void calcDistanceToNeighbors(std::vector<double>& distNeigh, const double& deltaX1,const double& deltaX2,const double& deltaX3) - { - //distNeigh.resize(FENDDIR+1, UbMath::sqrt2*deltaX1); - double sqrt3 = UbMath::sqrt3; - double sqrt2 = UbMath::sqrt2; - distNeigh[E] = distNeigh[W] = deltaX1; - distNeigh[N] = distNeigh[S] = deltaX2; - distNeigh[T] = distNeigh[B] = deltaX3; - distNeigh[NE] = distNeigh[NW] = distNeigh[SW] = distNeigh[SE] = sqrt(deltaX1*deltaX1+deltaX2*deltaX2); - distNeigh[TE] = distNeigh[TN] = distNeigh[TW] = distNeigh[TS] = sqrt(deltaX1*deltaX1+deltaX3*deltaX3); - distNeigh[BE] = distNeigh[BN] = distNeigh[BW] = distNeigh[BS] = sqrt(deltaX2*deltaX2+deltaX3*deltaX3); - distNeigh[TNE] = distNeigh[TNW] = distNeigh[TSE] = distNeigh[TSW] = sqrt(deltaX1*deltaX1+deltaX2*deltaX2+deltaX3*deltaX3); - distNeigh[BNE] = distNeigh[BNW] = distNeigh[BSE] = distNeigh[BSW] = sqrt(deltaX1*deltaX1+deltaX2*deltaX2+deltaX3*deltaX3); - } -////////////////////////////////////////////////////////////////////////// - static inline LBMReal calcPress(const LBMReal* const f, LBMReal rho, LBMReal vx1, LBMReal vx2, LBMReal vx3) - { - LBMReal op=1.0; - return ((f[E]+f[W]+f[N]+f[S]+f[T]+f[B]+2.*(f[NE]+f[SW]+f[SE]+f[NW]+f[TE]+f[BW]+f[BE]+f[TW]+f[TN]+f[BS]+f[BN]+f[TS])+ - 3.*(f[TNE]+f[TSW]+f[TSE]+f[TNW]+f[BNE]+f[BSW]+f[BSE]+f[BNW])-(vx1*vx1+vx2*vx2+vx3*vx3))*(1-0.5*op)+op*0.5*(rho))*c1o3; - - } -} - -#endif - - - diff --git a/src/VirtualFluids/LBM/D3Q27SystemTest.cpp b/src/VirtualFluids/LBM/D3Q27SystemTest.cpp deleted file mode 100644 index af9185143..000000000 --- a/src/VirtualFluids/LBM/D3Q27SystemTest.cpp +++ /dev/null @@ -1,14 +0,0 @@ -#include "gmock/gmock.h" - -#include "D3Q27System.h" - - - -TEST(D3Q27SystemTest, expectThatNormOfDirectionsIsOne) -{ - for (int fDir = D3Q27System::FSTARTDIR; fDir <= D3Q27System::FENDDIR; fDir++) - { - double norm = std::sqrt(std::pow(D3Q27System::cNorm[0][fDir], 2) + std::pow(D3Q27System::cNorm[1][fDir], 2) + std::pow(D3Q27System::cNorm[2][fDir], 2)); - EXPECT_THAT(1.0, testing::DoubleEq(norm)); - } -} diff --git a/src/VirtualFluids/LBM/ICell.h b/src/VirtualFluids/LBM/ICell.h deleted file mode 100644 index 76922d58d..000000000 --- a/src/VirtualFluids/LBM/ICell.h +++ /dev/null @@ -1,33 +0,0 @@ -#ifndef ICell_H -#define ICell_H - -#include "LBMSystem.h" -#include <vector> - -struct ICell3D -{ - ICell3D(int size); - - std::vector<LBMReal> TSW; - std::vector<LBMReal> TNW; - std::vector<LBMReal> TNE; - std::vector<LBMReal> TSE; - std::vector<LBMReal> BSW; - std::vector<LBMReal> BNW; - std::vector<LBMReal> BNE; - std::vector<LBMReal> BSE; -}; - -ICell3D::ICell3D(int size) -{ - TSW.resize(size); - TNW.resize(size); - TNE.resize(size); - TSE.resize(size); - BSW.resize(size); - BNW.resize(size); - BNE.resize(size); - BSE.resize(size); -} - -#endif diff --git a/src/VirtualFluids/LBM/ILBMKernel.h b/src/VirtualFluids/LBM/ILBMKernel.h deleted file mode 100644 index bcebbe941..000000000 --- a/src/VirtualFluids/LBM/ILBMKernel.h +++ /dev/null @@ -1,34 +0,0 @@ -#ifndef I_LBMKERNEL_H -#define I_LBMKERNEL_H - -#include <memory> - - -class ILBMKernel; -typedef std::shared_ptr<ILBMKernel> ILBMKernelPtr; - -class BCProcessor; -class DataSet3D; - -class ILBMKernel -{ -public: - virtual ~ILBMKernel() {}; - - virtual void calculate() = 0; - virtual double getCalculationTime() = 0; - virtual void swapDistributions() = 0; - - virtual bool getCompressible() const = 0; - virtual std::shared_ptr<BCProcessor> getBCProcessor() const = 0; - virtual void setBCProcessor(std::shared_ptr<BCProcessor> bcProcessor) = 0; - virtual std::shared_ptr<DataSet3D> getDataSet() const = 0; - virtual double getCollisionFactor() const = 0; - virtual void setCollisionFactor(double collFactor) = 0; - virtual bool isInsideOfDomain(const int &x1, const int &x2, const int &x3) const = 0; - virtual int getGhostLayerWidth() const = 0; - virtual double getDeltaT() const = 0; - virtual bool getWithForcing() const = 0; -}; - -#endif diff --git a/src/VirtualFluids/LBM/IncompressibleCumulantLBMKernel.cpp b/src/VirtualFluids/LBM/IncompressibleCumulantLBMKernel.cpp deleted file mode 100644 index 1af8ad8c4..000000000 --- a/src/VirtualFluids/LBM/IncompressibleCumulantLBMKernel.cpp +++ /dev/null @@ -1,919 +0,0 @@ -#include "IncompressibleCumulantLBMKernel.h" -#include "D3Q27System.h" -#include "InterpolationProcessor.h" -#include "D3Q27EsoTwist3DSplittedVector.h" -#include "DataSet3D.h" -#include <math.h> -//#include <omp.h> - -#define PROOF_CORRECTNESS - -////////////////////////////////////////////////////////////////////////// -IncompressibleCumulantLBMKernel::IncompressibleCumulantLBMKernel() -{ - this->nx1 = 0; - this->nx2 = 0; - this->nx3 = 0; - this->parameter = NORMAL; - this->OxyyMxzz = 1.0; - this->compressible = false; -} -////////////////////////////////////////////////////////////////////////// -IncompressibleCumulantLBMKernel::IncompressibleCumulantLBMKernel(int nx1, int nx2, int nx3, Parameter p) -{ - this->nx1 = nx1; - this->nx2 = nx2; - this->nx3 = nx3; - parameter = p; - this->compressible = false; -} -////////////////////////////////////////////////////////////////////////// -IncompressibleCumulantLBMKernel::~IncompressibleCumulantLBMKernel(void) -{ - -} -////////////////////////////////////////////////////////////////////////// -void IncompressibleCumulantLBMKernel::init() -{ - //DistributionArray3DPtr d(new D3Q27EsoTwist3DSplittedVector(nx1+ghostLayerWitdh*2, nx2+ghostLayerWitdh*2, nx3+ghostLayerWitdh*2, -999.0)); - DistributionArray3DPtr d(new D3Q27EsoTwist3DSplittedVector(nx1+2, nx2+2, nx3+2, -999.0)); - dataSet->setFdistributions(d); -} -////////////////////////////////////////////////////////////////////////// -LBMKernelPtr IncompressibleCumulantLBMKernel::clone() -{ - LBMKernelPtr kernel(new IncompressibleCumulantLBMKernel(nx1, nx2, nx3, parameter)); - std::dynamic_pointer_cast<IncompressibleCumulantLBMKernel>(kernel)->init(); - kernel->setCollisionFactor(this->collFactor); - kernel->setBCProcessor(bcProcessor->clone(kernel)); - kernel->setWithForcing(withForcing); - kernel->setForcingX1(muForcingX1); - kernel->setForcingX2(muForcingX2); - kernel->setForcingX3(muForcingX3); - kernel->setIndex(ix1, ix2, ix3); - kernel->setDeltaT(deltaT); - switch (parameter) - { - case NORMAL: - std::dynamic_pointer_cast<IncompressibleCumulantLBMKernel>(kernel)->OxyyMxzz = 1.0; - break; - case MAGIC: - std::dynamic_pointer_cast<IncompressibleCumulantLBMKernel>(kernel)->OxyyMxzz = 2.0 +(-collFactor); - break; - } - return kernel; -} -////////////////////////////////////////////////////////////////////////// -void IncompressibleCumulantLBMKernel::calculate() -{ - timer.resetAndStart(); - collideAll(); - timer.stop(); -} -////////////////////////////////////////////////////////////////////////// -void IncompressibleCumulantLBMKernel::collideAll() -{ - using namespace D3Q27System; - - //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; - } - ///////////////////////////////////// - - localDistributions = std::dynamic_pointer_cast<D3Q27EsoTwist3DSplittedVector>(dataSet->getFdistributions())->getLocalDistributions(); - nonLocalDistributions = std::dynamic_pointer_cast<D3Q27EsoTwist3DSplittedVector>(dataSet->getFdistributions())->getNonLocalDistributions(); - zeroDistributions = std::dynamic_pointer_cast<D3Q27EsoTwist3DSplittedVector>(dataSet->getFdistributions())->getZeroDistributions(); - - BCArray3DPtr bcArray = this->getBCProcessor()->getBCArray(); - - const int bcArrayMaxX1 = (int)bcArray->getNX1(); - const int bcArrayMaxX2 = (int)bcArray->getNX2(); - const int bcArrayMaxX3 = (int)bcArray->getNX3(); - - int minX1 = ghostLayerWidth; - int minX2 = ghostLayerWidth; - int minX3 = ghostLayerWidth; - int maxX1 = bcArrayMaxX1-ghostLayerWidth; - int maxX2 = bcArrayMaxX2-ghostLayerWidth; - int maxX3 = bcArrayMaxX3-ghostLayerWidth; - - -//#pragma omp parallel num_threads(8) - { - // int i = omp_get_thread_num(); - // printf_s("Hello from thread %d\n", i); - //} -//#pragma omp for - for(int x3 = minX3; x3 < maxX3; x3++) - { - for(int x2 = minX2; x2 < maxX2; x2++) - { - for(int x1 = minX1; x1 < maxX1; x1++) - { - if(!bcArray->isSolid(x1,x2,x3) && !bcArray->isUndefined(x1,x2,x3)) - { - int x1p = x1 + 1; - int x2p = x2 + 1; - int x3p = x3 + 1; - ////////////////////////////////////////////////////////////////////////// - //read distribution - //////////////////////////////////////////////////////////////////////////// - ////////////////////////////////////////////////////////////////////////// - - //E N T - //c c c - ////////// - //W S B - //a a a - - //Rest ist b - - //mfxyz - //a - negative - //b - null - //c - positive - - // a b c - //-1 0 1 - - LBMReal mfcbb = (*this->localDistributions)(D3Q27System::ET_E, x1,x2,x3); - LBMReal mfbcb = (*this->localDistributions)(D3Q27System::ET_N,x1,x2,x3); - LBMReal mfbbc = (*this->localDistributions)(D3Q27System::ET_T,x1,x2,x3); - LBMReal mfccb = (*this->localDistributions)(D3Q27System::ET_NE,x1,x2,x3); - LBMReal mfacb = (*this->localDistributions)(D3Q27System::ET_NW,x1p,x2,x3); - LBMReal mfcbc = (*this->localDistributions)(D3Q27System::ET_TE,x1,x2,x3); - LBMReal mfabc = (*this->localDistributions)(D3Q27System::ET_TW, x1p,x2,x3); - LBMReal mfbcc = (*this->localDistributions)(D3Q27System::ET_TN,x1,x2,x3); - LBMReal mfbac = (*this->localDistributions)(D3Q27System::ET_TS,x1,x2p,x3); - LBMReal mfccc = (*this->localDistributions)(D3Q27System::ET_TNE,x1,x2,x3); - LBMReal mfacc = (*this->localDistributions)(D3Q27System::ET_TNW,x1p,x2,x3); - LBMReal mfcac = (*this->localDistributions)(D3Q27System::ET_TSE,x1,x2p,x3); - LBMReal mfaac = (*this->localDistributions)(D3Q27System::ET_TSW,x1p,x2p,x3); - - LBMReal mfabb = (*this->nonLocalDistributions)(D3Q27System::ET_W,x1p,x2,x3 ); - LBMReal mfbab = (*this->nonLocalDistributions)(D3Q27System::ET_S,x1,x2p,x3 ); - LBMReal mfbba = (*this->nonLocalDistributions)(D3Q27System::ET_B,x1,x2,x3p ); - LBMReal mfaab = (*this->nonLocalDistributions)(D3Q27System::ET_SW,x1p,x2p,x3 ); - LBMReal mfcab = (*this->nonLocalDistributions)(D3Q27System::ET_SE,x1,x2p,x3 ); - LBMReal mfaba = (*this->nonLocalDistributions)(D3Q27System::ET_BW,x1p,x2,x3p ); - LBMReal mfcba = (*this->nonLocalDistributions)(D3Q27System::ET_BE,x1,x2,x3p ); - LBMReal mfbaa = (*this->nonLocalDistributions)(D3Q27System::ET_BS,x1,x2p,x3p ); - LBMReal mfbca = (*this->nonLocalDistributions)(D3Q27System::ET_BN,x1,x2,x3p ); - LBMReal mfaaa = (*this->nonLocalDistributions)(D3Q27System::ET_BSW,x1p,x2p,x3p); - LBMReal mfcaa = (*this->nonLocalDistributions)(D3Q27System::ET_BSE,x1,x2p,x3p); - LBMReal mfaca = (*this->nonLocalDistributions)(D3Q27System::ET_BNW,x1p,x2,x3p); - LBMReal mfcca = (*this->nonLocalDistributions)(D3Q27System::ET_BNE,x1,x2,x3p); - - LBMReal mfbbb = (*this->zeroDistributions)(x1,x2,x3); - - LBMReal m0, m1, m2; - - LBMReal rho=(mfaaa+mfaac+mfaca+mfcaa+mfacc+mfcac+mfccc+mfcca) - +(mfaab+mfacb+mfcab+mfccb)+(mfaba+mfabc+mfcba+mfcbc)+(mfbaa+mfbac+mfbca+mfbcc) - +(mfabb+mfcbb)+(mfbab+mfbcb)+(mfbba+mfbbc)+mfbbb; - - LBMReal vvx =((((mfccc-mfaaa) + (mfcac-mfaca)) + ((mfcaa-mfacc) + (mfcca-mfaac))) + - (((mfcba-mfabc) + (mfcbc-mfaba)) + ((mfcab-mfacb) + (mfccb-mfaab))) + - (mfcbb-mfabb)); - LBMReal vvy =((((mfccc-mfaaa) + (mfaca-mfcac)) + ((mfacc-mfcaa) + (mfcca-mfaac))) + - (((mfbca-mfbac) + (mfbcc-mfbaa)) + ((mfacb-mfcab) + (mfccb-mfaab))) + - (mfbcb-mfbab)); - LBMReal vvz =((((mfccc-mfaaa) + (mfcac-mfaca)) + ((mfacc-mfcaa) + (mfaac-mfcca))) + - (((mfbac-mfbca) + (mfbcc-mfbaa)) + ((mfabc-mfcba) + (mfcbc-mfaba))) + - (mfbbc-mfbba)); - - //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; - - oMdrho=mfccc+mfaaa; - m0=mfaca+mfcac; - m1=mfacc+mfcaa; - m2=mfaac+mfcca; - oMdrho+=m0; - m1+=m2; - oMdrho+=m1; - m0=mfbac+mfbca; - m1=mfbaa+mfbcc; - m0+=m1; - m1=mfabc+mfcba; - m2=mfaba+mfcbc; - m1+=m2; - m0+=m1; - m1=mfacb+mfcab; - m2=mfaab+mfccb; - m1+=m2; - m0+=m1; - oMdrho+=m0; - m0=mfabb+mfcbb; - m1=mfbab+mfbcb; - m2=mfbba+mfbbc; - m0+=m1+m2; - m0+=mfbbb; //hat gefehlt - oMdrho = 1. - (oMdrho + m0); - - LBMReal vx2; - LBMReal vy2; - LBMReal vz2; - vx2=vvx*vvx; - vy2=vvy*vvy; - vz2=vvz*vvz; - //////////////////////////////////////////////////////////////////////////////////// - LBMReal wadjust; - LBMReal qudricLimit = 0.01; - //////////////////////////////////////////////////////////////////////////////////// - //Hin - //////////////////////////////////////////////////////////////////////////////////// - // mit 1/36, 1/9, 1/36, 1/9, 4/9, 1/9, 1/36, 1/9, 1/36 Konditionieren - //////////////////////////////////////////////////////////////////////////////////// - // Z - Dir - m2 = mfaaa + mfaac; - m1 = mfaac - mfaaa; - m0 = m2 + mfaab; - mfaaa = m0; - m0 += c1o36 * oMdrho; - mfaab = m1 - m0 * vvz; - mfaac = m2 - 2. * m1 * vvz + vz2 * m0; - //////////////////////////////////////////////////////////////////////////////////// - m2 = mfaba + mfabc; - m1 = mfabc - mfaba; - m0 = m2 + mfabb; - mfaba = m0; - m0 += c1o9 * oMdrho; - mfabb = m1 - m0 * vvz; - mfabc = m2 - 2. * m1 * vvz + vz2 * m0; - //////////////////////////////////////////////////////////////////////////////////// - m2 = mfaca + mfacc; - m1 = mfacc - mfaca; - m0 = m2 + mfacb; - mfaca = m0; - m0 += c1o36 * oMdrho; - mfacb = m1 - m0 * vvz; - mfacc = m2 - 2. * m1 * vvz + vz2 * m0; - //////////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////////// - m2 = mfbaa + mfbac; - m1 = mfbac - mfbaa; - m0 = m2 + mfbab; - mfbaa = m0; - m0 += c1o9 * oMdrho; - mfbab = m1 - m0 * vvz; - mfbac = m2 - 2. * m1 * vvz + vz2 * m0; - //////////////////////////////////////////////////////////////////////////////////// - m2 = mfbba + mfbbc; - m1 = mfbbc - mfbba; - m0 = m2 + mfbbb; - mfbba = m0; - m0 += c4o9 * oMdrho; - mfbbb = m1 - m0 * vvz; - mfbbc = m2 - 2. * m1 * vvz + vz2 * m0; - //////////////////////////////////////////////////////////////////////////////////// - m2 = mfbca + mfbcc; - m1 = mfbcc - mfbca; - m0 = m2 + mfbcb; - mfbca = m0; - m0 += c1o9 * oMdrho; - mfbcb = m1 - m0 * vvz; - mfbcc = m2 - 2. * m1 * vvz + vz2 * m0; - //////////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////////// - m2 = mfcaa + mfcac; - m1 = mfcac - mfcaa; - m0 = m2 + mfcab; - mfcaa = m0; - m0 += c1o36 * oMdrho; - mfcab = m1 - m0 * vvz; - mfcac = m2 - 2. * m1 * vvz + vz2 * m0; - //////////////////////////////////////////////////////////////////////////////////// - m2 = mfcba + mfcbc; - m1 = mfcbc - mfcba; - m0 = m2 + mfcbb; - mfcba = m0; - m0 += c1o9 * oMdrho; - mfcbb = m1 - m0 * vvz; - mfcbc = m2 - 2. * m1 * vvz + vz2 * m0; - //////////////////////////////////////////////////////////////////////////////////// - m2 = mfcca + mfccc; - m1 = mfccc - mfcca; - m0 = m2 + mfccb; - mfcca = m0; - m0 += c1o36 * oMdrho; - mfccb = m1 - m0 * vvz; - mfccc = m2 - 2. * m1 * vvz + vz2 * m0; - //////////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////////// - // mit 1/6, 0, 1/18, 2/3, 0, 2/9, 1/6, 0, 1/18 Konditionieren - //////////////////////////////////////////////////////////////////////////////////// - // Y - Dir - m2 = mfaaa + mfaca; - m1 = mfaca - mfaaa; - m0 = m2 + mfaba; - mfaaa = m0; - m0 += c1o6 * oMdrho; - mfaba = m1 - m0 * vvy; - mfaca = m2 - 2. * m1 * vvy + vy2 * m0; - //////////////////////////////////////////////////////////////////////////////////// - m2 = mfaab + mfacb; - m1 = mfacb - mfaab; - m0 = m2 + mfabb; - mfaab = m0; - mfabb = m1 - m0 * vvy; - mfacb = m2 - 2. * m1 * vvy + vy2 * m0; - //////////////////////////////////////////////////////////////////////////////////// - m2 = mfaac + mfacc; - m1 = mfacc - mfaac; - m0 = m2 + mfabc; - mfaac = m0; - m0 += c1o18 * oMdrho; - mfabc = m1 - m0 * vvy; - mfacc = m2 - 2. * m1 * vvy + vy2 * m0; - //////////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////////// - m2 = mfbaa + mfbca; - m1 = mfbca - mfbaa; - m0 = m2 + mfbba; - mfbaa = m0; - m0 += c2o3 * oMdrho; - mfbba = m1 - m0 * vvy; - mfbca = m2 - 2. * m1 * vvy + vy2 * m0; - //////////////////////////////////////////////////////////////////////////////////// - m2 = mfbab + mfbcb; - m1 = mfbcb - mfbab; - m0 = m2 + mfbbb; - mfbab = m0; - mfbbb = m1 - m0 * vvy; - mfbcb = m2 - 2. * m1 * vvy + vy2 * m0; - //////////////////////////////////////////////////////////////////////////////////// - m2 = mfbac + mfbcc; - m1 = mfbcc - mfbac; - m0 = m2 + mfbbc; - mfbac = m0; - m0 += c2o9 * oMdrho; - mfbbc = m1 - m0 * vvy; - mfbcc = m2 - 2. * m1 * vvy + vy2 * m0; - //////////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////////// - m2 = mfcaa + mfcca; - m1 = mfcca - mfcaa; - m0 = m2 + mfcba; - mfcaa = m0; - m0 += c1o6 * oMdrho; - mfcba = m1 - m0 * vvy; - mfcca = m2 - 2. * m1 * vvy + vy2 * m0; - //////////////////////////////////////////////////////////////////////////////////// - m2 = mfcab + mfccb; - m1 = mfccb - mfcab; - m0 = m2 + mfcbb; - mfcab = m0; - mfcbb = m1 - m0 * vvy; - mfccb = m2 - 2. * m1 * vvy + vy2 * m0; - //////////////////////////////////////////////////////////////////////////////////// - m2 = mfcac + mfccc; - m1 = mfccc - mfcac; - m0 = m2 + mfcbc; - mfcac = m0; - m0 += c1o18 * oMdrho; - mfcbc = m1 - m0 * vvy; - mfccc = m2 - 2. * m1 * vvy + vy2 * m0; - //////////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////////// - // mit 1, 0, 1/3, 0, 0, 0, 1/3, 0, 1/9 Konditionieren - //////////////////////////////////////////////////////////////////////////////////// - // X - Dir - m2 = mfaaa + mfcaa; - m1 = mfcaa - mfaaa; - m0 = m2 + mfbaa; - mfaaa = m0; - m0 += 1. * oMdrho; - mfbaa = m1 - m0 * vvx; - mfcaa = m2 - 2. * m1 * vvx + vx2 * m0; - //////////////////////////////////////////////////////////////////////////////////// - m2 = mfaba + mfcba; - m1 = mfcba - mfaba; - m0 = m2 + mfbba; - mfaba = m0; - mfbba = m1 - m0 * vvx; - mfcba = m2 - 2. * m1 * vvx + vx2 * m0; - //////////////////////////////////////////////////////////////////////////////////// - m2 = mfaca + mfcca; - m1 = mfcca - mfaca; - m0 = m2 + mfbca; - mfaca = m0; - m0 += c1o3 * oMdrho; - mfbca = m1 - m0 * vvx; - mfcca = m2 - 2. * m1 * vvx + vx2 * m0; - //////////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////////// - m2 = mfaab + mfcab; - m1 = mfcab - mfaab; - m0 = m2 + mfbab; - mfaab = m0; - mfbab = m1 - m0 * vvx; - mfcab = m2 - 2. * m1 * vvx + vx2 * m0; - //////////////////////////////////////////////////////////////////////////////////// - m2 = mfabb + mfcbb; - m1 = mfcbb - mfabb; - m0 = m2 + mfbbb; - mfabb = m0; - mfbbb = m1 - m0 * vvx; - mfcbb = m2 - 2. * m1 * vvx + vx2 * m0; - //////////////////////////////////////////////////////////////////////////////////// - m2 = mfacb + mfccb; - m1 = mfccb - mfacb; - m0 = m2 + mfbcb; - mfacb = m0; - mfbcb = m1 - m0 * vvx; - mfccb = m2 - 2. * m1 * vvx + vx2 * m0; - //////////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////////// - m2 = mfaac + mfcac; - m1 = mfcac - mfaac; - m0 = m2 + mfbac; - mfaac = m0; - m0 += c1o3 * oMdrho; - mfbac = m1 - m0 * vvx; - mfcac = m2 - 2. * m1 * vvx + vx2 * m0; - //////////////////////////////////////////////////////////////////////////////////// - m2 = mfabc + mfcbc; - m1 = mfcbc - mfabc; - m0 = m2 + mfbbc; - mfabc = m0; - mfbbc = m1 - m0 * vvx; - mfcbc = m2 - 2. * m1 * vvx + vx2 * m0; - //////////////////////////////////////////////////////////////////////////////////// - m2 = mfacc + mfccc; - m1 = mfccc - mfacc; - m0 = m2 + mfbcc; - mfacc = m0; - m0 += c1o9 * oMdrho; - mfbcc = m1 - m0 * vvx; - mfccc = m2 - 2. * m1 * vvx + vx2 * m0; - //////////////////////////////////////////////////////////////////////////////////// - // Cumulants - //////////////////////////////////////////////////////////////////////////////////// - LBMReal OxxPyyPzz = 1.; //omega2 or bulk viscosity - LBMReal OxyyPxzz = 1.;//-s9;//2+s9;// - //LBMReal OxyyMxzz = 1.;//2+s9;// - LBMReal O4 = 1.; - LBMReal O5 = 1.; - LBMReal O6 = 1.; - - //Cum 4. - //LBMReal CUMcbb = mfcbb - ((mfcaa + c1o3 * oMdrho) * mfabb + 2. * mfbba * mfbab); // till 18.05.2015 - //LBMReal CUMbcb = mfbcb - ((mfaca + c1o3 * oMdrho) * mfbab + 2. * mfbba * mfabb); // till 18.05.2015 - //LBMReal CUMbbc = mfbbc - ((mfaac + c1o3 * oMdrho) * mfbba + 2. * mfbab * mfabb); // till 18.05.2015 - - LBMReal CUMcbb = mfcbb - ((mfcaa + c1o3 ) * mfabb + 2. * mfbba * mfbab); - LBMReal CUMbcb = mfbcb - ((mfaca + c1o3 ) * mfbab + 2. * mfbba * mfabb); - LBMReal CUMbbc = mfbbc - ((mfaac + c1o3 ) * mfbba + 2. * mfbab * mfabb); - - LBMReal CUMcca = mfcca - ((mfcaa * mfaca + 2. * mfbba * mfbba) + c1o3 * (mfcaa + mfaca) * oMdrho + c1o9*(oMdrho-1)*oMdrho); - LBMReal CUMcac = mfcac - ((mfcaa * mfaac + 2. * mfbab * mfbab) + c1o3 * (mfcaa + mfaac) * oMdrho + c1o9*(oMdrho-1)*oMdrho); - LBMReal CUMacc = mfacc - ((mfaac * mfaca + 2. * mfabb * mfabb) + c1o3 * (mfaac + mfaca) * oMdrho + c1o9*(oMdrho-1)*oMdrho); - - //Cum 5. - LBMReal CUMbcc = mfbcc - (mfaac * mfbca + mfaca * mfbac + 4. * mfabb * mfbbb + 2. * (mfbab * mfacb + mfbba * mfabc)) - c1o3 * (mfbca + mfbac) * oMdrho; - LBMReal CUMcbc = mfcbc - (mfaac * mfcba + mfcaa * mfabc + 4. * mfbab * mfbbb + 2. * (mfabb * mfcab + mfbba * mfbac)) - c1o3 * (mfcba + mfabc) * oMdrho; - LBMReal CUMccb = mfccb - (mfcaa * mfacb + mfaca * mfcab + 4. * mfbba * mfbbb + 2. * (mfbab * mfbca + mfabb * mfcba)) - c1o3 * (mfacb + mfcab) * oMdrho; - - //Cum 6. - LBMReal CUMccc = mfccc +((-4. * mfbbb * mfbbb - - (mfcaa * mfacc + mfaca * mfcac + mfaac * mfcca) - - 4. * (mfabb * mfcbb + mfbab * mfbcb + mfbba * mfbbc) - - 2. * (mfbca * mfbac + mfcba * mfabc + mfcab * mfacb)) - +( 4. * (mfbab * mfbab * mfaca + mfabb * mfabb * mfcaa + mfbba * mfbba * mfaac) - + 2. * (mfcaa * mfaca * mfaac) - + 16. * mfbba * mfbab * mfabb) - - c1o3* (mfacc + mfcac + mfcca) * oMdrho -c1o9*oMdrho*oMdrho - - c1o9* (mfcaa + mfaca + mfaac) * oMdrho*(1.-2.* oMdrho)- c1o27* oMdrho * oMdrho*(-2.* oMdrho) - +( 2. * (mfbab * mfbab + mfabb * mfabb + mfbba * mfbba) - + (mfaac * mfaca + mfaac * mfcaa + mfaca * mfcaa)) * c2o3*oMdrho) +c1o27*oMdrho; - - //2. - // linear combinations - LBMReal mxxPyyPzz = mfcaa + mfaca + mfaac; - LBMReal mxxMyy = mfcaa - mfaca; - LBMReal mxxMzz = mfcaa - mfaac; - - LBMReal dxux = -c1o2 * collFactor *(mxxMyy + mxxMzz) + c1o2 * OxxPyyPzz*(mfaaa - mxxPyyPzz); - LBMReal dyuy = dxux + collFactor * c3o2 * mxxMyy; - LBMReal dzuz = dxux + collFactor * c3o2 * mxxMzz; - - //relax - mxxPyyPzz += OxxPyyPzz*(mfaaa - mxxPyyPzz)- 3. * (1. - c1o2 * OxxPyyPzz) * (vx2 * dxux + vy2 * dyuy + vz2 * dzuz); - mxxMyy += collFactor * (-mxxMyy) - 3. * (1. - c1o2 * collFactor) * (vx2 * dxux - vy2 * dyuy); - mxxMzz += collFactor * (-mxxMzz) - 3. * (1. - c1o2 * collFactor) * (vx2 * dxux - vz2 * dzuz); - - mfabb += collFactor * (-mfabb); - mfbab += collFactor * (-mfbab); - mfbba += collFactor * (-mfbba); - - // linear combinations back - mfcaa = c1o3 * ( mxxMyy + mxxMzz + mxxPyyPzz); - mfaca = c1o3 * (-2. * mxxMyy + mxxMzz + mxxPyyPzz); - mfaac = c1o3 * ( mxxMyy - 2. * mxxMzz + mxxPyyPzz); - - //3. - // linear combinations - LBMReal mxxyPyzz = mfcba + mfabc; - LBMReal mxxyMyzz = mfcba - mfabc; - - LBMReal mxxzPyyz = mfcab + mfacb; - LBMReal mxxzMyyz = mfcab - mfacb; - - LBMReal mxyyPxzz = mfbca + mfbac; - LBMReal mxyyMxzz = mfbca - mfbac; - - //relax - wadjust = OxyyMxzz+(1.-OxyyMxzz)*fabs(mfbbb)/(fabs(mfbbb)+qudricLimit); - mfbbb += wadjust * (-mfbbb); - wadjust = OxyyPxzz+(1.-OxyyPxzz)*fabs(mxxyPyzz)/(fabs(mxxyPyzz)+qudricLimit); - mxxyPyzz += wadjust * (-mxxyPyzz); - wadjust = OxyyMxzz+(1.-OxyyMxzz)*fabs(mxxyMyzz)/(fabs(mxxyMyzz)+qudricLimit); - mxxyMyzz += wadjust * (-mxxyMyzz); - wadjust = OxyyPxzz+(1.-OxyyPxzz)*fabs(mxxzPyyz)/(fabs(mxxzPyyz)+qudricLimit); - mxxzPyyz += wadjust * (-mxxzPyyz); - wadjust = OxyyMxzz+(1.-OxyyMxzz)*fabs(mxxzMyyz)/(fabs(mxxzMyyz)+qudricLimit); - mxxzMyyz += wadjust * (-mxxzMyyz); - wadjust = OxyyPxzz+(1.-OxyyPxzz)*fabs(mxyyPxzz)/(fabs(mxyyPxzz)+qudricLimit); - mxyyPxzz += wadjust * (-mxyyPxzz); - wadjust = OxyyMxzz+(1.-OxyyMxzz)*fabs(mxyyMxzz)/(fabs(mxyyMxzz)+qudricLimit); - mxyyMxzz += wadjust * (-mxyyMxzz); - - // linear combinations back - mfcba = ( mxxyMyzz + mxxyPyzz) * c1o2; - mfabc = (-mxxyMyzz + mxxyPyzz) * c1o2; - mfcab = ( mxxzMyyz + mxxzPyyz) * c1o2; - mfacb = (-mxxzMyyz + mxxzPyyz) * c1o2; - mfbca = ( mxyyMxzz + mxyyPxzz) * c1o2; - mfbac = (-mxyyMxzz + mxyyPxzz) * c1o2; - - //4. - CUMacc += O4 * (-CUMacc); - CUMcac += O4 * (-CUMcac); - CUMcca += O4 * (-CUMcca); - - CUMbbc += O4 * (-CUMbbc); - CUMbcb += O4 * (-CUMbcb); - CUMcbb += O4 * (-CUMcbb); - - //5. - CUMbcc += O5 * (-CUMbcc); - CUMcbc += O5 * (-CUMcbc); - CUMccb += O5 * (-CUMccb); - - //6. - CUMccc += O6 * (-CUMccc); - - //back cumulants to central moments - //4. - //mfcbb = CUMcbb + ((mfcaa + c1o3 * oMdrho) * mfabb + 2. * mfbba * mfbab); // till 18.05.2015 - //mfbcb = CUMbcb + ((mfaca + c1o3 * oMdrho) * mfbab + 2. * mfbba * mfabb); // till 18.05.2015 - //mfbbc = CUMbbc + ((mfaac + c1o3 * oMdrho) * mfbba + 2. * mfbab * mfabb); // till 18.05.2015 - - mfcbb = CUMcbb + ((mfcaa + c1o3 ) * mfabb + 2. * mfbba * mfbab); - mfbcb = CUMbcb + ((mfaca + c1o3 ) * mfbab + 2. * mfbba * mfabb); - mfbbc = CUMbbc + ((mfaac + c1o3 ) * mfbba + 2. * mfbab * mfabb); - - mfcca = CUMcca + (mfcaa * mfaca + 2. * mfbba * mfbba) + c1o3 * (mfcaa + mfaca) * oMdrho + c1o9*(oMdrho-1)*oMdrho; - mfcac = CUMcac + (mfcaa * mfaac + 2. * mfbab * mfbab) + c1o3 * (mfcaa + mfaac) * oMdrho + c1o9*(oMdrho-1)*oMdrho; - mfacc = CUMacc + (mfaac * mfaca + 2. * mfabb * mfabb) + c1o3 * (mfaac + mfaca) * oMdrho + c1o9*(oMdrho-1)*oMdrho; - - //5. - mfbcc = CUMbcc + (mfaac * mfbca + mfaca * mfbac + 4. * mfabb * mfbbb + 2. * (mfbab * mfacb + mfbba * mfabc)) + c1o3 * (mfbca + mfbac) * oMdrho; - mfcbc = CUMcbc + (mfaac * mfcba + mfcaa * mfabc + 4. * mfbab * mfbbb + 2. * (mfabb * mfcab + mfbba * mfbac)) + c1o3 * (mfcba + mfabc) * oMdrho; - mfccb = CUMccb + (mfcaa * mfacb + mfaca * mfcab + 4. * mfbba * mfbbb + 2. * (mfbab * mfbca + mfabb * mfcba)) + c1o3 * (mfacb + mfcab) * oMdrho; - - //6. - mfccc = CUMccc -((-4. * mfbbb * mfbbb - - (mfcaa * mfacc + mfaca * mfcac + mfaac * mfcca) - - 4. * (mfabb * mfcbb + mfbac * mfbca + mfbba * mfbbc) - - 2. * (mfbca * mfbac + mfcba * mfabc + mfcab * mfacb)) - +( 4. * (mfbab * mfbab * mfaca + mfabb * mfabb * mfcaa + mfbba * mfbba * mfaac) - + 2. * (mfcaa * mfaca * mfaac) - + 16. * mfbba * mfbab * mfabb) - - c1o3* (mfacc + mfcac + mfcca) * oMdrho -c1o9*oMdrho*oMdrho - - c1o9* (mfcaa + mfaca + mfaac) * oMdrho*(1.-2.* oMdrho)- c1o27* oMdrho * oMdrho*(-2.* oMdrho) - +( 2. * (mfbab * mfbab + mfabb * mfabb + mfbba * mfbba) - + (mfaac * mfaca + mfaac * mfcaa + mfaca * mfcaa)) * c2o3*oMdrho) -c1o27*oMdrho; - - //////////////////////////////////////////////////////////////////////////////////// - //forcing - mfbaa=-mfbaa; - mfaba=-mfaba; - mfaab=-mfaab; - ////////////////////////////////////////////////////////////////////////////////////// - - //////////////////////////////////////////////////////////////////////////////////// - //back - //////////////////////////////////////////////////////////////////////////////////// - //mit 1, 0, 1/3, 0, 0, 0, 1/3, 0, 1/9 Konditionieren - //////////////////////////////////////////////////////////////////////////////////// - // Z - Dir - m0 = mfaac * c1o2 + mfaab * (vvz - c1o2) + (mfaaa + 1. * oMdrho) * ( vz2 - vvz) * c1o2; - m1 = -mfaac - 2. * mfaab * vvz + mfaaa * (1. - vz2) - 1. * oMdrho * vz2; - m2 = mfaac * c1o2 + mfaab * (vvz + c1o2) + (mfaaa + 1. * oMdrho) * ( vz2 + vvz) * c1o2; - mfaaa = m0; - mfaab = m1; - mfaac = m2; - //////////////////////////////////////////////////////////////////////////////////// - m0 = mfabc * c1o2 + mfabb * (vvz - c1o2) + mfaba * ( vz2 - vvz) * c1o2; - m1 = -mfabc - 2. * mfabb * vvz + mfaba * (1. - vz2); - m2 = mfabc * c1o2 + mfabb * (vvz + c1o2) + mfaba * ( vz2 + vvz) * c1o2; - mfaba = m0; - mfabb = m1; - mfabc = m2; - //////////////////////////////////////////////////////////////////////////////////// - m0 = mfacc * c1o2 + mfacb * (vvz - c1o2) + (mfaca + c1o3 * oMdrho) * ( vz2 - vvz) * c1o2; - m1 = -mfacc - 2. * mfacb * vvz + mfaca * (1. - vz2) - c1o3 * oMdrho * vz2; - m2 = mfacc * c1o2 + mfacb * (vvz + c1o2) + (mfaca + c1o3 * oMdrho) * ( vz2 + vvz) * c1o2; - mfaca = m0; - mfacb = m1; - mfacc = m2; - //////////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////////// - m0 = mfbac * c1o2 + mfbab * (vvz - c1o2) + mfbaa * ( vz2 - vvz) * c1o2; - m1 = -mfbac - 2. * mfbab * vvz + mfbaa * (1. - vz2); - m2 = mfbac * c1o2 + mfbab * (vvz + c1o2) + mfbaa * ( vz2 + vvz) * c1o2; - mfbaa = m0; - mfbab = m1; - mfbac = m2; - /////////b////////////////////////////////////////////////////////////////////////// - m0 = mfbbc * c1o2 + mfbbb * (vvz - c1o2) + mfbba * ( vz2 - vvz) * c1o2; - m1 = -mfbbc - 2. * mfbbb * vvz + mfbba * (1. - vz2); - m2 = mfbbc * c1o2 + mfbbb * (vvz + c1o2) + mfbba * ( vz2 + vvz) * c1o2; - mfbba = m0; - mfbbb = m1; - mfbbc = m2; - /////////b////////////////////////////////////////////////////////////////////////// - m0 = mfbcc * c1o2 + mfbcb * (vvz - c1o2) + mfbca * ( vz2 - vvz) * c1o2; - m1 = -mfbcc - 2. * mfbcb * vvz + mfbca * (1. - vz2); - m2 = mfbcc * c1o2 + mfbcb * (vvz + c1o2) + mfbca * ( vz2 + vvz) * c1o2; - mfbca = m0; - mfbcb = m1; - mfbcc = m2; - //////////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////////// - m0 = mfcac * c1o2 + mfcab * (vvz - c1o2) + (mfcaa + c1o3 * oMdrho) * ( vz2 - vvz) * c1o2; - m1 = -mfcac - 2. * mfcab * vvz + mfcaa * (1. - vz2) - c1o3 * oMdrho * vz2; - m2 = mfcac * c1o2 + mfcab * (vvz + c1o2) + (mfcaa + c1o3 * oMdrho) * ( vz2 + vvz) * c1o2; - mfcaa = m0; - mfcab = m1; - mfcac = m2; - /////////c////////////////////////////////////////////////////////////////////////// - m0 = mfcbc * c1o2 + mfcbb * (vvz - c1o2) + mfcba * ( vz2 - vvz) * c1o2; - m1 = -mfcbc - 2. * mfcbb * vvz + mfcba * (1. - vz2); - m2 = mfcbc * c1o2 + mfcbb * (vvz + c1o2) + mfcba * ( vz2 + vvz) * c1o2; - mfcba = m0; - mfcbb = m1; - mfcbc = m2; - /////////c////////////////////////////////////////////////////////////////////////// - m0 = mfccc * c1o2 + mfccb * (vvz - c1o2) + (mfcca + c1o9 * oMdrho) * ( vz2 - vvz) * c1o2; - m1 = -mfccc - 2. * mfccb * vvz + mfcca * (1. - vz2) - c1o9 * oMdrho * vz2; - m2 = mfccc * c1o2 + mfccb * (vvz + c1o2) + (mfcca + c1o9 * oMdrho) * ( vz2 + vvz) * c1o2; - mfcca = m0; - mfccb = m1; - mfccc = m2; - //////////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////////// - //mit 1/6, 2/3, 1/6, 0, 0, 0, 1/18, 2/9, 1/18 Konditionieren - //////////////////////////////////////////////////////////////////////////////////// - // Y - Dir - m0 = mfaca * c1o2 + mfaba * (vvy - c1o2) + (mfaaa + c1o6 * oMdrho) * ( vy2 - vvy) * c1o2; - m1 = -mfaca - 2. * mfaba * vvy + mfaaa * (1. - vy2) - c1o6 * oMdrho * vy2; - m2 = mfaca * c1o2 + mfaba * (vvy + c1o2) + (mfaaa + c1o6 * oMdrho) * ( vy2 + vvy) * c1o2; - mfaaa = m0; - mfaba = m1; - mfaca = m2; - //////////////////////////////////////////////////////////////////////////////////// - m0 = mfacb * c1o2 + mfabb * (vvy - c1o2) + (mfaab + c2o3 * oMdrho) * ( vy2 - vvy) * c1o2; - m1 = -mfacb - 2. * mfabb * vvy + mfaab * (1. - vy2) - c2o3 * oMdrho * vy2; - m2 = mfacb * c1o2 + mfabb * (vvy + c1o2) + (mfaab + c2o3 * oMdrho) * ( vy2 + vvy) * c1o2; - mfaab = m0; - mfabb = m1; - mfacb = m2; - //////////////////////////////////////////////////////////////////////////////////// - m0 = mfacc * c1o2 + mfabc * (vvy - c1o2) + (mfaac + c1o6 * oMdrho) * ( vy2 - vvy) * c1o2; - m1 = -mfacc - 2. * mfabc * vvy + mfaac * (1. - vy2) - c1o6 * oMdrho * vy2; - m2 = mfacc * c1o2 + mfabc * (vvy + c1o2) + (mfaac + c1o6 * oMdrho) * ( vy2 + vvy) * c1o2; - mfaac = m0; - mfabc = m1; - mfacc = m2; - //////////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////////// - m0 = mfbca * c1o2 + mfbba * (vvy - c1o2) + mfbaa * ( vy2 - vvy) * c1o2; - m1 = -mfbca - 2. * mfbba * vvy + mfbaa * (1. - vy2); - m2 = mfbca * c1o2 + mfbba * (vvy + c1o2) + mfbaa * ( vy2 + vvy) * c1o2; - mfbaa = m0; - mfbba = m1; - mfbca = m2; - /////////b////////////////////////////////////////////////////////////////////////// - m0 = mfbcb * c1o2 + mfbbb * (vvy - c1o2) + mfbab * ( vy2 - vvy) * c1o2; - m1 = -mfbcb - 2. * mfbbb * vvy + mfbab * (1. - vy2); - m2 = mfbcb * c1o2 + mfbbb * (vvy + c1o2) + mfbab * ( vy2 + vvy) * c1o2; - mfbab = m0; - mfbbb = m1; - mfbcb = m2; - /////////b////////////////////////////////////////////////////////////////////////// - m0 = mfbcc * c1o2 + mfbbc * (vvy - c1o2) + mfbac * ( vy2 - vvy) * c1o2; - m1 = -mfbcc - 2. * mfbbc * vvy + mfbac * (1. - vy2); - m2 = mfbcc * c1o2 + mfbbc * (vvy + c1o2) + mfbac * ( vy2 + vvy) * c1o2; - mfbac = m0; - mfbbc = m1; - mfbcc = m2; - //////////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////////// - m0 = mfcca * c1o2 + mfcba * (vvy - c1o2) + (mfcaa + c1o18 * oMdrho) * ( vy2 - vvy) * c1o2; - m1 = -mfcca - 2. * mfcba * vvy + mfcaa * (1. - vy2) - c1o18 * oMdrho * vy2; - m2 = mfcca * c1o2 + mfcba * (vvy + c1o2) + (mfcaa + c1o18 * oMdrho) * ( vy2 + vvy) * c1o2; - mfcaa = m0; - mfcba = m1; - mfcca = m2; - /////////c////////////////////////////////////////////////////////////////////////// - m0 = mfccb * c1o2 + mfcbb * (vvy - c1o2) + (mfcab + c2o9 * oMdrho) * ( vy2 - vvy) * c1o2; - m1 = -mfccb - 2. * mfcbb * vvy + mfcab * (1. - vy2) - c2o9 * oMdrho * vy2; - m2 = mfccb * c1o2 + mfcbb * (vvy + c1o2) + (mfcab + c2o9 * oMdrho) * ( vy2 + vvy) * c1o2; - mfcab = m0; - mfcbb = m1; - mfccb = m2; - /////////c////////////////////////////////////////////////////////////////////////// - m0 = mfccc * c1o2 + mfcbc * (vvy - c1o2) + (mfcac + c1o18 * oMdrho) * ( vy2 - vvy) * c1o2; - m1 = -mfccc - 2. * mfcbc * vvy + mfcac * (1. - vy2) - c1o18 * oMdrho * vy2; - m2 = mfccc * c1o2 + mfcbc * (vvy + c1o2) + (mfcac + c1o18 * oMdrho) * ( vy2 + vvy) * c1o2; - mfcac = m0; - mfcbc = m1; - mfccc = m2; - //////////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////////// - //mit 1/36, 1/9, 1/36, 1/9, 4/9, 1/9, 1/36, 1/9, 1/36 Konditionieren - //////////////////////////////////////////////////////////////////////////////////// - // X - Dir - m0 = mfcaa * c1o2 + mfbaa * (vvx - c1o2) + (mfaaa + c1o36 * oMdrho) * ( vx2 - vvx) * c1o2; - m1 = -mfcaa - 2. * mfbaa * vvx + mfaaa * (1. - vx2) - c1o36 * oMdrho * vx2; - m2 = mfcaa * c1o2 + mfbaa * (vvx + c1o2) + (mfaaa + c1o36 * oMdrho) * ( vx2 + vvx) * c1o2; - mfaaa = m0; - mfbaa = m1; - mfcaa = m2; - //////////////////////////////////////////////////////////////////////////////////// - m0 = mfcba * c1o2 + mfbba * (vvx - c1o2) + (mfaba + c1o9 * oMdrho) * ( vx2 - vvx) * c1o2; - m1 = -mfcba - 2. * mfbba * vvx + mfaba * (1. - vx2) - c1o9 * oMdrho * vx2; - m2 = mfcba * c1o2 + mfbba * (vvx + c1o2) + (mfaba + c1o9 * oMdrho) * ( vx2 + vvx) * c1o2; - mfaba = m0; - mfbba = m1; - mfcba = m2; - //////////////////////////////////////////////////////////////////////////////////// - m0 = mfcca * c1o2 + mfbca * (vvx - c1o2) + (mfaca + c1o36 * oMdrho) * ( vx2 - vvx) * c1o2; - m1 = -mfcca - 2. * mfbca * vvx + mfaca * (1. - vx2) - c1o36 * oMdrho * vx2; - m2 = mfcca * c1o2 + mfbca * (vvx + c1o2) + (mfaca + c1o36 * oMdrho) * ( vx2 + vvx) * c1o2; - mfaca = m0; - mfbca = m1; - mfcca = m2; - //////////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////////// - m0 = mfcab * c1o2 + mfbab * (vvx - c1o2) + (mfaab + c1o9 * oMdrho) * ( vx2 - vvx) * c1o2; - m1 = -mfcab - 2. * mfbab * vvx + mfaab * (1. - vx2) - c1o9 * oMdrho * vx2; - m2 = mfcab * c1o2 + mfbab * (vvx + c1o2) + (mfaab + c1o9 * oMdrho) * ( vx2 + vvx) * c1o2; - mfaab = m0; - mfbab = m1; - mfcab = m2; - ///////////b//////////////////////////////////////////////////////////////////////// - m0 = mfcbb * c1o2 + mfbbb * (vvx - c1o2) + (mfabb + c4o9 * oMdrho) * ( vx2 - vvx) * c1o2; - m1 = -mfcbb - 2. * mfbbb * vvx + mfabb * (1. - vx2) - c4o9 * oMdrho * vx2; - m2 = mfcbb * c1o2 + mfbbb * (vvx + c1o2) + (mfabb + c4o9 * oMdrho) * ( vx2 + vvx) * c1o2; - mfabb = m0; - mfbbb = m1; - mfcbb = m2; - ///////////b//////////////////////////////////////////////////////////////////////// - m0 = mfccb * c1o2 + mfbcb * (vvx - c1o2) + (mfacb + c1o9 * oMdrho) * ( vx2 - vvx) * c1o2; - m1 = -mfccb - 2. * mfbcb * vvx + mfacb * (1. - vx2) - c1o9 * oMdrho * vx2; - m2 = mfccb * c1o2 + mfbcb * (vvx + c1o2) + (mfacb + c1o9 * oMdrho) * ( vx2 + vvx) * c1o2; - mfacb = m0; - mfbcb = m1; - mfccb = m2; - //////////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////////// - m0 = mfcac * c1o2 + mfbac * (vvx - c1o2) + (mfaac + c1o36 * oMdrho) * ( vx2 - vvx) * c1o2; - m1 = -mfcac - 2. * mfbac * vvx + mfaac * (1. - vx2) - c1o36 * oMdrho * vx2; - m2 = mfcac * c1o2 + mfbac * (vvx + c1o2) + (mfaac + c1o36 * oMdrho) * ( vx2 + vvx) * c1o2; - mfaac = m0; - mfbac = m1; - mfcac = m2; - ///////////c//////////////////////////////////////////////////////////////////////// - m0 = mfcbc * c1o2 + mfbbc * (vvx - c1o2) + (mfabc + c1o9 * oMdrho) * ( vx2 - vvx) * c1o2; - m1 = -mfcbc - 2. * mfbbc * vvx + mfabc * (1. - vx2) - c1o9 * oMdrho * vx2; - m2 = mfcbc * c1o2 + mfbbc * (vvx + c1o2) + (mfabc + c1o9 * oMdrho) * ( vx2 + vvx) * c1o2; - mfabc = m0; - mfbbc = m1; - mfcbc = m2; - ///////////c//////////////////////////////////////////////////////////////////////// - m0 = mfccc * c1o2 + mfbcc * (vvx - c1o2) + (mfacc + c1o36 * oMdrho) * ( vx2 - vvx) * c1o2; - m1 = -mfccc - 2. * mfbcc * vvx + mfacc * (1. - vx2) - c1o36 * oMdrho * vx2; - m2 = mfccc * c1o2 + mfbcc * (vvx + c1o2) + (mfacc + c1o36 * oMdrho) * ( vx2 + vvx) * c1o2; - mfacc = m0; - mfbcc = m1; - mfccc = m2; - - ////////////////////////////////////////////////////////////////////////// - //proof correctness - ////////////////////////////////////////////////////////////////////////// -#ifdef PROOF_CORRECTNESS - LBMReal rho_post = (mfaaa+mfaac+mfaca+mfcaa+mfacc+mfcac+mfccc+mfcca) - +(mfaab+mfacb+mfcab+mfccb)+(mfaba+mfabc+mfcba+mfcbc)+(mfbaa+mfbac+mfbca+mfbcc) - +(mfabb+mfcbb)+(mfbab+mfbcb)+(mfbba+mfbbc)+mfbbb; - //LBMReal dif = fabs(rho - rho_post); - LBMReal dif = rho - rho_post; -#ifdef SINGLEPRECISION - if(dif > 10.0E-7 || dif < -10.0E-7) -#else - if(dif > 10.0E-15 || dif < -10.0E-15) -#endif - { - UB_THROW(UbException(UB_EXARGS,"rho="+UbSystem::toString(rho)+", rho_post="+UbSystem::toString(rho_post) - +" dif="+UbSystem::toString(dif) - +" rho is not correct for node "+UbSystem::toString(x1)+","+UbSystem::toString(x2)+","+UbSystem::toString(x3))); - //UBLOG(logERROR,"LBMKernelETD3Q27CCLB::collideAll(): rho is not correct for node "+UbSystem::toString(x1)+","+UbSystem::toString(x2)+","+UbSystem::toString(x3)); - //exit(EXIT_FAILURE); - } -#endif - ////////////////////////////////////////////////////////////////////////// - //write distribution - ////////////////////////////////////////////////////////////////////////// - (*this->localDistributions)(D3Q27System::ET_E,x1, x2, x3) = mfabb; - (*this->localDistributions)(D3Q27System::ET_N,x1, x2, x3) = mfbab; - (*this->localDistributions)(D3Q27System::ET_T,x1, x2, x3) = mfbba; - (*this->localDistributions)(D3Q27System::ET_NE,x1, x2, x3) = mfaab; - (*this->localDistributions)(D3Q27System::ET_NW,x1p,x2, x3) = mfcab; - (*this->localDistributions)(D3Q27System::ET_TE,x1, x2, x3) = mfaba; - (*this->localDistributions)(D3Q27System::ET_TW,x1p,x2, x3) = mfcba; - (*this->localDistributions)(D3Q27System::ET_TN,x1, x2, x3) = mfbaa; - (*this->localDistributions)(D3Q27System::ET_TS,x1, x2p,x3) = mfbca; - (*this->localDistributions)(D3Q27System::ET_TNE,x1, x2, x3) = mfaaa; - (*this->localDistributions)(D3Q27System::ET_TNW,x1p,x2, x3) = mfcaa; - (*this->localDistributions)(D3Q27System::ET_TSE,x1, x2p,x3) = mfaca; - (*this->localDistributions)(D3Q27System::ET_TSW,x1p,x2p,x3) = mfcca; - - (*this->nonLocalDistributions)(D3Q27System::ET_W,x1p,x2, x3 ) = mfcbb; - (*this->nonLocalDistributions)(D3Q27System::ET_S,x1, x2p,x3 ) = mfbcb; - (*this->nonLocalDistributions)(D3Q27System::ET_B,x1, x2, x3p ) = mfbbc; - (*this->nonLocalDistributions)(D3Q27System::ET_SW,x1p,x2p,x3 ) = mfccb; - (*this->nonLocalDistributions)(D3Q27System::ET_SE,x1, x2p,x3 ) = mfacb; - (*this->nonLocalDistributions)(D3Q27System::ET_BW,x1p,x2, x3p ) = mfcbc; - (*this->nonLocalDistributions)(D3Q27System::ET_BE,x1, x2, x3p ) = mfabc; - (*this->nonLocalDistributions)(D3Q27System::ET_BS,x1, x2p,x3p ) = mfbcc; - (*this->nonLocalDistributions)(D3Q27System::ET_BN,x1, x2, x3p ) = mfbac; - (*this->nonLocalDistributions)(D3Q27System::ET_BSW,x1p,x2p,x3p) = mfccc; - (*this->nonLocalDistributions)(D3Q27System::ET_BSE,x1, x2p,x3p) = mfacc; - (*this->nonLocalDistributions)(D3Q27System::ET_BNW,x1p,x2, x3p) = mfcac; - (*this->nonLocalDistributions)(D3Q27System::ET_BNE,x1, x2, x3p) = mfaac; - - (*this->zeroDistributions)(x1,x2,x3) = mfbbb; - ////////////////////////////////////////////////////////////////////////// - - } - } - } - } - - } -} -////////////////////////////////////////////////////////////////////////// -double IncompressibleCumulantLBMKernel::getCalculationTime() -{ - //return timer.getDuration(); - return timer.getTotalTime(); -} diff --git a/src/VirtualFluids/LBM/IncompressibleCumulantLBMKernel.h b/src/VirtualFluids/LBM/IncompressibleCumulantLBMKernel.h deleted file mode 100644 index accfba7ed..000000000 --- a/src/VirtualFluids/LBM/IncompressibleCumulantLBMKernel.h +++ /dev/null @@ -1,69 +0,0 @@ -//Cascaded Cumulant LBM - -#ifndef IncompressibleCumulantLBMKernel_H -#define IncompressibleCumulantLBMKernel_H - -#include "LBMKernel.h" -#include "BCProcessor.h" -#include "D3Q27System.h" -#include <boost/serialization/export.hpp> -#include "basics/utilities/UbTiming.h" -#include "basics/container/CbArray4D.h" -#include "basics/container/CbArray3D.h" - -class IncompressibleCumulantLBMKernel; -typedef std::shared_ptr<IncompressibleCumulantLBMKernel> LBMKernelETD3Q27CCLBPtr; - -//! \brief Cascaded Cumulant LBM kernel. -//! \details CFD solver that use Cascaded Cumulant Lattice Boltzmann method for D3Q27 model -//! \author K. Kutscher, M. Geier -class IncompressibleCumulantLBMKernel : public LBMKernel -{ -public: - //! This option set relaxation parameter: NORMAL - enum Parameter{NORMAL, MAGIC}; -public: - IncompressibleCumulantLBMKernel(); - //! Constructor - //! \param nx1 number of nodes in x dimension - //! \param nx2 number of nodes in y dimension - //! \param nx3 number of nodes in z dimension - //! \param p set relaxation parameter: NORMAL is OxyyMxzz = 1.0 and MAGIC is OxyyMxzz = 2.0 +(-collFactor) - IncompressibleCumulantLBMKernel(int nx1, int nx2, int nx3, Parameter p); - virtual ~IncompressibleCumulantLBMKernel(void); - virtual void calculate(); - virtual LBMKernelPtr clone(); - double getCalculationTime(); - -protected: - friend class boost::serialization::access; - template<class Archive> - void serialize(Archive & ar, const unsigned int version) - { - ar & boost::serialization::base_object<LBMKernel>(*this); - ar & OxyyMxzz; - ar & parameter; - } - - virtual void collideAll(); - virtual void init(); - LBMReal f[D3Q27System::ENDF+1]; - - UbTimer timer; - - LBMReal OxyyMxzz; - Parameter parameter; - - CbArray4D<LBMReal,IndexerX4X3X2X1>::CbArray4DPtr localDistributions; - CbArray4D<LBMReal,IndexerX4X3X2X1>::CbArray4DPtr nonLocalDistributions; - CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr zeroDistributions; - - mu::value_type muX1,muX2,muX3; - mu::value_type muDeltaT; - mu::value_type muNu; - LBMReal forcingX1; - LBMReal forcingX2; - LBMReal forcingX3; -}; - -#endif diff --git a/src/VirtualFluids/LBM/IncompressibleCumulantWithSpongeLayerLBMKernel.cpp b/src/VirtualFluids/LBM/IncompressibleCumulantWithSpongeLayerLBMKernel.cpp deleted file mode 100644 index 325e1c800..000000000 --- a/src/VirtualFluids/LBM/IncompressibleCumulantWithSpongeLayerLBMKernel.cpp +++ /dev/null @@ -1,1021 +0,0 @@ -#include "IncompressibleCumulantWithSpongeLayerLBMKernel.h" -#include "D3Q27System.h" -#include "D3Q27EsoTwist3DSplittedVector.h" -#include <math.h> -#include "DataSet3D.h" -#include "BCArray3D.h" - -#define PROOF_CORRECTNESS - -////////////////////////////////////////////////////////////////////////// -IncompressibleCumulantWithSpongeLayerLBMKernel::IncompressibleCumulantWithSpongeLayerLBMKernel() -{ - -} -////////////////////////////////////////////////////////////////////////// -IncompressibleCumulantWithSpongeLayerLBMKernel::IncompressibleCumulantWithSpongeLayerLBMKernel(int nx1, int nx2, int nx3, Parameter p) - : IncompressibleCumulantLBMKernel(nx1, nx2, nx3, p) -{ - -} -////////////////////////////////////////////////////////////////////////// -IncompressibleCumulantWithSpongeLayerLBMKernel::~IncompressibleCumulantWithSpongeLayerLBMKernel(void) -{ - -} -////////////////////////////////////////////////////////////////////////// -void IncompressibleCumulantWithSpongeLayerLBMKernel::init() -{ - //DistributionArray3DPtr d(new D3Q27EsoTwist3DSplittedVector(nx1+ghostLayerWitdh*2, nx2+ghostLayerWitdh*2, nx3+ghostLayerWitdh*2, -999.0)); - DistributionArray3DPtr d(new D3Q27EsoTwist3DSplittedVector(nx1+2, nx2+2, nx3+2, -999.0)); - dataSet->setFdistributions(d); -} -////////////////////////////////////////////////////////////////////////// -void IncompressibleCumulantWithSpongeLayerLBMKernel::setRelaxFactorParam(int vdir, double vL1, double vdx, double vSP) -{ - direction = vdir; - L1 = vL1; - dx = vdx; - SP = vSP; -} -////////////////////////////////////////////////////////////////////////// -void IncompressibleCumulantWithSpongeLayerLBMKernel::initRelaxFactor(int vdir, double vL1, double vdx, double vSP) -{ - direction = vdir; - L1 = vL1; - dx = vdx; - SP = vSP; - - double sizeX = L1 / dx; - double sizeSP = SP / dx; - double muX1, muX2, muX3; - - LBMReal spongeFactor; - - BCArray3DPtr bcArray = this->getBCProcessor()->getBCArray(); - - const int bcArrayMaxX1 = (int)bcArray->getNX1(); - const int bcArrayMaxX2 = (int)bcArray->getNX2(); - const int bcArrayMaxX3 = (int)bcArray->getNX3(); - - int minX1 = 0; - int minX2 = 0; - int minX3 = 0; - int maxX1 = bcArrayMaxX1 - ghostLayerWidth - 1; - int maxX2 = bcArrayMaxX2 - ghostLayerWidth - 1; - int maxX3 = bcArrayMaxX3 - ghostLayerWidth - 1; - - RelaxationFactorArray3DPtr relaxationFactorPtr = CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<LBMReal, IndexerX3X2X1>(maxX1, maxX2, maxX3)); - dataSet->setRelaxationFactor(relaxationFactorPtr); - - for (int x3 = minX3; x3 < maxX3; x3++) - { - for (int x2 = minX2; x2 < maxX2; x2++) - { - for (int x1 = minX1; x1 < maxX1; x1++) - { - switch (direction) - { - case D3Q27System::E: - muX1 = (double)(x1 + ix1 * maxX1); - if (muX1 >= (sizeX - sizeSP) / deltaT) - spongeFactor = (sizeX - (muX1 * deltaT + 1)) / sizeSP / 2.0 + 0.5; - else spongeFactor = 1.0; - break; - case D3Q27System::W: - muX1 = (double)(x1 + ix1 * maxX1); - if (muX1 <= sizeSP / deltaT) - spongeFactor = (sizeSP - (muX1 * deltaT + 1)) / sizeSP / 2.0 + 0.5; - else spongeFactor = 1.0; - break; - case D3Q27System::N: - muX2 = (double)(x2 + ix2 * maxX2); - if (muX2 >= (sizeX - sizeSP) / deltaT) - spongeFactor = (sizeX - (muX2 * deltaT + 1)) / sizeSP / 2.0 + 0.5; - else spongeFactor = 1.0; - break; - case D3Q27System::S: - muX2 = (double)(x2 + ix2 * maxX2); - if (muX2 <= sizeSP / deltaT) - spongeFactor = (sizeSP - (muX2 * deltaT + 1)) / sizeSP / 2.0 + 0.5; - else spongeFactor = 1.0; - break; - case D3Q27System::T: - muX3 = (double)(x3 + ix3 * maxX3); - if (muX3 >= (sizeX - sizeSP) / deltaT) - spongeFactor = (sizeX - (muX3 * deltaT + 1)) / sizeSP / 2.0 + 0.5; - else spongeFactor = 1.0; - break; - case D3Q27System::B: - muX3 = (double)(x3 + ix3 * maxX3); - if (muX3 <= sizeSP / deltaT) - spongeFactor = (sizeSP - (muX3 * deltaT + 1)) / sizeSP / 2.0 + 0.5; - else spongeFactor = 1.0; - break; - default: throw UbException(UB_EXARGS, "unknown dir"); - } - (*relaxationFactorPtr)(x1, x2, x3) = spongeFactor; - } - } - } -} - -////////////////////////////////////////////////////////////////////////// -LBMKernelPtr IncompressibleCumulantWithSpongeLayerLBMKernel::clone() -{ - LBMKernelPtr kernel(new IncompressibleCumulantWithSpongeLayerLBMKernel(nx1, nx2, nx3, parameter)); - std::dynamic_pointer_cast<IncompressibleCumulantWithSpongeLayerLBMKernel>(kernel)->init(); - kernel->setCollisionFactor(this->collFactor); - kernel->setBCProcessor(bcProcessor->clone(kernel)); - kernel->setWithForcing(withForcing); - kernel->setForcingX1(muForcingX1); - kernel->setForcingX2(muForcingX2); - kernel->setForcingX3(muForcingX3); - kernel->setIndex(ix1, ix2, ix3); - kernel->setDeltaT(deltaT); - switch (parameter) - { - case NORMAL: - std::dynamic_pointer_cast<IncompressibleCumulantWithSpongeLayerLBMKernel>(kernel)->OxyyMxzz = 1.0; - break; - case MAGIC: - std::dynamic_pointer_cast<IncompressibleCumulantWithSpongeLayerLBMKernel>(kernel)->OxyyMxzz = 2.0 +(-collFactor); - break; - } - - kernel->setWithSpongeLayer(withSpongeLayer); - if(withSpongeLayer) kernel->setSpongeLayer(muSpongeLayer); - std::dynamic_pointer_cast<IncompressibleCumulantWithSpongeLayerLBMKernel>(kernel)->initRelaxFactor(direction, L1, dx, SP); - return kernel; -} -////////////////////////////////////////////////////////////////////////// -void IncompressibleCumulantWithSpongeLayerLBMKernel::calculate() -{ - timer.resetAndStart(); - collideAll(); - timer.stop(); -} -////////////////////////////////////////////////////////////////////////// -void IncompressibleCumulantWithSpongeLayerLBMKernel::collideAll() -{ - using namespace D3Q27System; - - if(!withSpongeLayer) - { - UB_THROW(UbException(UB_EXARGS,"Sponge layer isn't initialized!")); - } - //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("dx",&muDeltaT); - // muForcingX2.DefineVar("dx",&muDeltaT); - // muForcingX3.DefineVar("dx",&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; - //} - ///////////////////////////////////// - //initialization of sponge layer variables - //if (withSpongeLayer) - //{ - //muDeltaT = deltaT; - //muSpongeLayer.DefineVar("dt",&muDeltaT); - //muSpongeLayer.DefineVar("x1",&muX1); muSpongeLayer.DefineVar("x2",&muX2); muSpongeLayer.DefineVar("x3",&muX3); - //} - ///////////////////////////////////// - - localDistributions = std::dynamic_pointer_cast<D3Q27EsoTwist3DSplittedVector>(dataSet->getFdistributions())->getLocalDistributions(); - nonLocalDistributions = std::dynamic_pointer_cast<D3Q27EsoTwist3DSplittedVector>(dataSet->getFdistributions())->getNonLocalDistributions(); - zeroDistributions = std::dynamic_pointer_cast<D3Q27EsoTwist3DSplittedVector>(dataSet->getFdistributions())->getZeroDistributions(); - - BCArray3DPtr bcArray = this->getBCProcessor()->getBCArray(); - RelaxationFactorArray3DPtr relaxationFactorPtr = dataSet->getRelaxationFactor(); - - const int bcArrayMaxX1 = (int)bcArray->getNX1(); - const int bcArrayMaxX2 = (int)bcArray->getNX2(); - const int bcArrayMaxX3 = (int)bcArray->getNX3(); - - int minX1 = ghostLayerWidth; - int minX2 = ghostLayerWidth; - int minX3 = ghostLayerWidth; - int maxX1 = bcArrayMaxX1-ghostLayerWidth-1; - int maxX2 = bcArrayMaxX2-ghostLayerWidth-1; - int maxX3 = bcArrayMaxX3-ghostLayerWidth-1; - - LBMReal collFactor0 = collFactor; - LBMReal spongeFactor; - - for(int x3 = minX3; x3 <= maxX3; x3++) - { - for(int x2 = minX2; x2 <= maxX2; x2++) - { - for(int x1 = minX1; x1 <= maxX1; x1++) - { - if(!bcArray->isSolid(x1,x2,x3) && !bcArray->isUndefined(x1,x2,x3)) - { - int x1p = x1 + 1; - int x2p = x2 + 1; - int x3p = x3 + 1; - ////////////////////////////////////////////////////////////////////////// - //read distribution - //////////////////////////////////////////////////////////////////////////// - ////////////////////////////////////////////////////////////////////////// - - //E N T - //c c c - ////////// - //W S B - //a a a - - //Rest ist b - - LBMReal mfcbb = (*this->localDistributions)(D3Q27System::ET_E, x1,x2,x3); - LBMReal mfbcb = (*this->localDistributions)(D3Q27System::ET_N,x1,x2,x3); - LBMReal mfbbc = (*this->localDistributions)(D3Q27System::ET_T,x1,x2,x3); - LBMReal mfccb = (*this->localDistributions)(D3Q27System::ET_NE,x1,x2,x3); - LBMReal mfacb = (*this->localDistributions)(D3Q27System::ET_NW,x1p,x2,x3); - LBMReal mfcbc = (*this->localDistributions)(D3Q27System::ET_TE,x1,x2,x3); - LBMReal mfabc = (*this->localDistributions)(D3Q27System::ET_TW, x1p,x2,x3); - LBMReal mfbcc = (*this->localDistributions)(D3Q27System::ET_TN,x1,x2,x3); - LBMReal mfbac = (*this->localDistributions)(D3Q27System::ET_TS,x1,x2p,x3); - LBMReal mfccc = (*this->localDistributions)(D3Q27System::ET_TNE,x1,x2,x3); - LBMReal mfacc = (*this->localDistributions)(D3Q27System::ET_TNW,x1p,x2,x3); - LBMReal mfcac = (*this->localDistributions)(D3Q27System::ET_TSE,x1,x2p,x3); - LBMReal mfaac = (*this->localDistributions)(D3Q27System::ET_TSW,x1p,x2p,x3); - - LBMReal mfabb = (*this->nonLocalDistributions)(D3Q27System::ET_W,x1p,x2,x3 ); - LBMReal mfbab = (*this->nonLocalDistributions)(D3Q27System::ET_S,x1,x2p,x3 ); - LBMReal mfbba = (*this->nonLocalDistributions)(D3Q27System::ET_B,x1,x2,x3p ); - LBMReal mfaab = (*this->nonLocalDistributions)(D3Q27System::ET_SW,x1p,x2p,x3 ); - LBMReal mfcab = (*this->nonLocalDistributions)(D3Q27System::ET_SE,x1,x2p,x3 ); - LBMReal mfaba = (*this->nonLocalDistributions)(D3Q27System::ET_BW,x1p,x2,x3p ); - LBMReal mfcba = (*this->nonLocalDistributions)(D3Q27System::ET_BE,x1,x2,x3p ); - LBMReal mfbaa = (*this->nonLocalDistributions)(D3Q27System::ET_BS,x1,x2p,x3p ); - LBMReal mfbca = (*this->nonLocalDistributions)(D3Q27System::ET_BN,x1,x2,x3p ); - LBMReal mfaaa = (*this->nonLocalDistributions)(D3Q27System::ET_BSW,x1p,x2p,x3p); - LBMReal mfcaa = (*this->nonLocalDistributions)(D3Q27System::ET_BSE,x1,x2p,x3p); - LBMReal mfaca = (*this->nonLocalDistributions)(D3Q27System::ET_BNW,x1p,x2,x3p); - LBMReal mfcca = (*this->nonLocalDistributions)(D3Q27System::ET_BNE,x1,x2,x3p); - - LBMReal mfbbb = (*this->zeroDistributions)(x1,x2,x3); - - LBMReal m0, m1, m2; - - LBMReal rho=(mfaaa+mfaac+mfaca+mfcaa+mfacc+mfcac+mfccc+mfcca) - +(mfaab+mfacb+mfcab+mfccb)+(mfaba+mfabc+mfcba+mfcbc)+(mfbaa+mfbac+mfbca+mfbcc) - +(mfabb+mfcbb)+(mfbab+mfbcb)+(mfbba+mfbbc)+mfbbb; - - LBMReal vvx =((((mfccc-mfaaa) + (mfcac-mfaca)) + ((mfcaa-mfacc) + (mfcca-mfaac))) + - (((mfcba-mfabc) + (mfcbc-mfaba)) + ((mfcab-mfacb) + (mfccb-mfaab))) + - (mfcbb-mfabb)); - LBMReal vvy =((((mfccc-mfaaa) + (mfaca-mfcac)) + ((mfacc-mfcaa) + (mfcca-mfaac))) + - (((mfbca-mfbac) + (mfbcc-mfbaa)) + ((mfacb-mfcab) + (mfccb-mfaab))) + - (mfbcb-mfbab)); - LBMReal vvz =((((mfccc-mfaaa) + (mfcac-mfaca)) + ((mfacc-mfcaa) + (mfaac-mfcca))) + - (((mfbac-mfbca) + (mfbcc-mfbaa)) + ((mfabc-mfcba) + (mfcbc-mfaba))) + - (mfbbc-mfbba)); - ////////////////////////////////////////////////////////////////////////// - //forcing - /////////////////////////////////////////////////////////////////////////////////////////// - //if (withForcing) - //{ - // muX1 = (double)(x1-1+ix1*maxX1); - // muX2 = (double)(x2-1+ix2*maxX2); - // muX3 = (double)(x3-1+ix3*maxX3); - - // forcingX1 = muForcingX1.Eval(); - // forcingX2 = muForcingX2.Eval(); - // forcingX3 = muForcingX3.Eval(); - - // vvx += forcingX1*0.5; // X - // vvy += forcingX2*0.5; // Y - // vvz += forcingX3*0.5; // Z - //} - /////////////////////////////////////////////////////////////////////////////////////////// - //sponge layer - /////////////////////////////////////////////////////////////////////////////////////////// - //if (withSpongeLayer) - //{ - //if (!withForcing) - //{ - //lk// muX1 = (double)(x1-1+ix1*maxX1); - //muX2 = (double)(x2-1+ix2*maxX2); - //muX3 = (double)(x3-1+ix3*maxX3); - //} - //spongeFactor ist von Funktion in muSpongeLayer abhängich und variiert zwischen 1 (nix tun) und 0.5 (collFactor etwa auf 1); - //lk //LBMReal spongeFactor = muSpongeLayer.Eval(); - - //if (spongeFactor == 0.5) - //{ - // int Test=0; - //} - - //if(muX3 == ix3*maxX3/2 && muX2==ix2*maxX2/2) - // UBLOG(logINFO," x1="<<muX1<<" spongeFactor = " << spongeFactor <<" collFactor="<<collFactor); - - spongeFactor = (*relaxationFactorPtr)(x1-1, x2-1, x3-1); - collFactor *= spongeFactor; - //if(muX3 == ix3*maxX3/2 && muX2==ix2*maxX2/2) - // UBLOG(logINFO," x1="<<muX1<<" spongeFactor = " << spongeFactor <<" collFactor="<<collFactor); - - //} - ////////////////////////////////////////////////////////////////////////// - - LBMReal oMdrho; - - oMdrho=mfccc+mfaaa; - m0=mfaca+mfcac; - m1=mfacc+mfcaa; - m2=mfaac+mfcca; - oMdrho+=m0; - m1+=m2; - oMdrho+=m1; - m0=mfbac+mfbca; - m1=mfbaa+mfbcc; - m0+=m1; - m1=mfabc+mfcba; - m2=mfaba+mfcbc; - m1+=m2; - m0+=m1; - m1=mfacb+mfcab; - m2=mfaab+mfccb; - m1+=m2; - m0+=m1; - oMdrho+=m0; - m0=mfabb+mfcbb; - m1=mfbab+mfbcb; - m2=mfbba+mfbbc; - m0+=m1+m2; - m0+=mfbbb; //hat gefehlt - oMdrho = 1. - (oMdrho + m0); - - LBMReal vx2; - LBMReal vy2; - LBMReal vz2; - vx2=vvx*vvx; - vy2=vvy*vvy; - vz2=vvz*vvz; - //////////////////////////////////////////////////////////////////////////////////// - LBMReal wadjust; - LBMReal qudricLimit = 0.01; - //////////////////////////////////////////////////////////////////////////////////// - //Hin - //////////////////////////////////////////////////////////////////////////////////// - // mit 1/36, 1/9, 1/36, 1/9, 4/9, 1/9, 1/36, 1/9, 1/36 Konditionieren - //////////////////////////////////////////////////////////////////////////////////// - // Z - Dir - m2 = mfaaa + mfaac; - m1 = mfaac - mfaaa; - m0 = m2 + mfaab; - mfaaa = m0; - m0 += c1o36 * oMdrho; - mfaab = m1 - m0 * vvz; - mfaac = m2 - 2. * m1 * vvz + vz2 * m0; - //////////////////////////////////////////////////////////////////////////////////// - m2 = mfaba + mfabc; - m1 = mfabc - mfaba; - m0 = m2 + mfabb; - mfaba = m0; - m0 += c1o9 * oMdrho; - mfabb = m1 - m0 * vvz; - mfabc = m2 - 2. * m1 * vvz + vz2 * m0; - //////////////////////////////////////////////////////////////////////////////////// - m2 = mfaca + mfacc; - m1 = mfacc - mfaca; - m0 = m2 + mfacb; - mfaca = m0; - m0 += c1o36 * oMdrho; - mfacb = m1 - m0 * vvz; - mfacc = m2 - 2. * m1 * vvz + vz2 * m0; - //////////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////////// - m2 = mfbaa + mfbac; - m1 = mfbac - mfbaa; - m0 = m2 + mfbab; - mfbaa = m0; - m0 += c1o9 * oMdrho; - mfbab = m1 - m0 * vvz; - mfbac = m2 - 2. * m1 * vvz + vz2 * m0; - //////////////////////////////////////////////////////////////////////////////////// - m2 = mfbba + mfbbc; - m1 = mfbbc - mfbba; - m0 = m2 + mfbbb; - mfbba = m0; - m0 += c4o9 * oMdrho; - mfbbb = m1 - m0 * vvz; - mfbbc = m2 - 2. * m1 * vvz + vz2 * m0; - //////////////////////////////////////////////////////////////////////////////////// - m2 = mfbca + mfbcc; - m1 = mfbcc - mfbca; - m0 = m2 + mfbcb; - mfbca = m0; - m0 += c1o9 * oMdrho; - mfbcb = m1 - m0 * vvz; - mfbcc = m2 - 2. * m1 * vvz + vz2 * m0; - //////////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////////// - m2 = mfcaa + mfcac; - m1 = mfcac - mfcaa; - m0 = m2 + mfcab; - mfcaa = m0; - m0 += c1o36 * oMdrho; - mfcab = m1 - m0 * vvz; - mfcac = m2 - 2. * m1 * vvz + vz2 * m0; - //////////////////////////////////////////////////////////////////////////////////// - m2 = mfcba + mfcbc; - m1 = mfcbc - mfcba; - m0 = m2 + mfcbb; - mfcba = m0; - m0 += c1o9 * oMdrho; - mfcbb = m1 - m0 * vvz; - mfcbc = m2 - 2. * m1 * vvz + vz2 * m0; - //////////////////////////////////////////////////////////////////////////////////// - m2 = mfcca + mfccc; - m1 = mfccc - mfcca; - m0 = m2 + mfccb; - mfcca = m0; - m0 += c1o36 * oMdrho; - mfccb = m1 - m0 * vvz; - mfccc = m2 - 2. * m1 * vvz + vz2 * m0; - //////////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////////// - // mit 1/6, 0, 1/18, 2/3, 0, 2/9, 1/6, 0, 1/18 Konditionieren - //////////////////////////////////////////////////////////////////////////////////// - // Y - Dir - m2 = mfaaa + mfaca; - m1 = mfaca - mfaaa; - m0 = m2 + mfaba; - mfaaa = m0; - m0 += c1o6 * oMdrho; - mfaba = m1 - m0 * vvy; - mfaca = m2 - 2. * m1 * vvy + vy2 * m0; - //////////////////////////////////////////////////////////////////////////////////// - m2 = mfaab + mfacb; - m1 = mfacb - mfaab; - m0 = m2 + mfabb; - mfaab = m0; - mfabb = m1 - m0 * vvy; - mfacb = m2 - 2. * m1 * vvy + vy2 * m0; - //////////////////////////////////////////////////////////////////////////////////// - m2 = mfaac + mfacc; - m1 = mfacc - mfaac; - m0 = m2 + mfabc; - mfaac = m0; - m0 += c1o18 * oMdrho; - mfabc = m1 - m0 * vvy; - mfacc = m2 - 2. * m1 * vvy + vy2 * m0; - //////////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////////// - m2 = mfbaa + mfbca; - m1 = mfbca - mfbaa; - m0 = m2 + mfbba; - mfbaa = m0; - m0 += c2o3 * oMdrho; - mfbba = m1 - m0 * vvy; - mfbca = m2 - 2. * m1 * vvy + vy2 * m0; - //////////////////////////////////////////////////////////////////////////////////// - m2 = mfbab + mfbcb; - m1 = mfbcb - mfbab; - m0 = m2 + mfbbb; - mfbab = m0; - mfbbb = m1 - m0 * vvy; - mfbcb = m2 - 2. * m1 * vvy + vy2 * m0; - //////////////////////////////////////////////////////////////////////////////////// - m2 = mfbac + mfbcc; - m1 = mfbcc - mfbac; - m0 = m2 + mfbbc; - mfbac = m0; - m0 += c2o9 * oMdrho; - mfbbc = m1 - m0 * vvy; - mfbcc = m2 - 2. * m1 * vvy + vy2 * m0; - //////////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////////// - m2 = mfcaa + mfcca; - m1 = mfcca - mfcaa; - m0 = m2 + mfcba; - mfcaa = m0; - m0 += c1o6 * oMdrho; - mfcba = m1 - m0 * vvy; - mfcca = m2 - 2. * m1 * vvy + vy2 * m0; - //////////////////////////////////////////////////////////////////////////////////// - m2 = mfcab + mfccb; - m1 = mfccb - mfcab; - m0 = m2 + mfcbb; - mfcab = m0; - mfcbb = m1 - m0 * vvy; - mfccb = m2 - 2. * m1 * vvy + vy2 * m0; - //////////////////////////////////////////////////////////////////////////////////// - m2 = mfcac + mfccc; - m1 = mfccc - mfcac; - m0 = m2 + mfcbc; - mfcac = m0; - m0 += c1o18 * oMdrho; - mfcbc = m1 - m0 * vvy; - mfccc = m2 - 2. * m1 * vvy + vy2 * m0; - //////////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////////// - // mit 1, 0, 1/3, 0, 0, 0, 1/3, 0, 1/9 Konditionieren - //////////////////////////////////////////////////////////////////////////////////// - // X - Dir - m2 = mfaaa + mfcaa; - m1 = mfcaa - mfaaa; - m0 = m2 + mfbaa; - mfaaa = m0; - m0 += 1. * oMdrho; - mfbaa = m1 - m0 * vvx; - mfcaa = m2 - 2. * m1 * vvx + vx2 * m0; - //////////////////////////////////////////////////////////////////////////////////// - m2 = mfaba + mfcba; - m1 = mfcba - mfaba; - m0 = m2 + mfbba; - mfaba = m0; - mfbba = m1 - m0 * vvx; - mfcba = m2 - 2. * m1 * vvx + vx2 * m0; - //////////////////////////////////////////////////////////////////////////////////// - m2 = mfaca + mfcca; - m1 = mfcca - mfaca; - m0 = m2 + mfbca; - mfaca = m0; - m0 += c1o3 * oMdrho; - mfbca = m1 - m0 * vvx; - mfcca = m2 - 2. * m1 * vvx + vx2 * m0; - //////////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////////// - m2 = mfaab + mfcab; - m1 = mfcab - mfaab; - m0 = m2 + mfbab; - mfaab = m0; - mfbab = m1 - m0 * vvx; - mfcab = m2 - 2. * m1 * vvx + vx2 * m0; - //////////////////////////////////////////////////////////////////////////////////// - m2 = mfabb + mfcbb; - m1 = mfcbb - mfabb; - m0 = m2 + mfbbb; - mfabb = m0; - mfbbb = m1 - m0 * vvx; - mfcbb = m2 - 2. * m1 * vvx + vx2 * m0; - //////////////////////////////////////////////////////////////////////////////////// - m2 = mfacb + mfccb; - m1 = mfccb - mfacb; - m0 = m2 + mfbcb; - mfacb = m0; - mfbcb = m1 - m0 * vvx; - mfccb = m2 - 2. * m1 * vvx + vx2 * m0; - //////////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////////// - m2 = mfaac + mfcac; - m1 = mfcac - mfaac; - m0 = m2 + mfbac; - mfaac = m0; - m0 += c1o3 * oMdrho; - mfbac = m1 - m0 * vvx; - mfcac = m2 - 2. * m1 * vvx + vx2 * m0; - //////////////////////////////////////////////////////////////////////////////////// - m2 = mfabc + mfcbc; - m1 = mfcbc - mfabc; - m0 = m2 + mfbbc; - mfabc = m0; - mfbbc = m1 - m0 * vvx; - mfcbc = m2 - 2. * m1 * vvx + vx2 * m0; - //////////////////////////////////////////////////////////////////////////////////// - m2 = mfacc + mfccc; - m1 = mfccc - mfacc; - m0 = m2 + mfbcc; - mfacc = m0; - m0 += c1o9 * oMdrho; - mfbcc = m1 - m0 * vvx; - mfccc = m2 - 2. * m1 * vvx + vx2 * m0; - //////////////////////////////////////////////////////////////////////////////////// - // Cumulants - //////////////////////////////////////////////////////////////////////////////////// - LBMReal OxxPyyPzz = 1.; - LBMReal OxyyPxzz = 1.;//-s9;//2+s9;// - //LBMReal OxyyMxzz = 1.;//2+s9;// - LBMReal O4 = 1.; - LBMReal O5 = 1.; - LBMReal O6 = 1.; - - //Cum 4. - LBMReal CUMcbb = mfcbb - ((mfcaa + c1o3 * oMdrho) * mfabb + 2. * mfbba * mfbab); - LBMReal CUMbcb = mfbcb - ((mfaca + c1o3 * oMdrho) * mfbab + 2. * mfbba * mfabb); - LBMReal CUMbbc = mfbbc - ((mfaac + c1o3 * oMdrho) * mfbba + 2. * mfbab * mfabb); - - LBMReal CUMcca = mfcca - (mfcaa * mfaca + 2. * mfbba * mfbba) + c1o3 * (mfcaa + mfaca) * oMdrho + c1o9*(oMdrho-1)*oMdrho; - LBMReal CUMcac = mfcac - (mfcaa * mfaac + 2. * mfbab * mfbab) + c1o3 * (mfcaa + mfaac) * oMdrho + c1o9*(oMdrho-1)*oMdrho; - LBMReal CUMacc = mfacc - (mfaac * mfaca + 2. * mfabb * mfabb) + c1o3 * (mfaac + mfaca) * oMdrho + c1o9*(oMdrho-1)*oMdrho; - - //Cum 5. - LBMReal CUMbcc = mfbcc - (mfaac * mfbca + mfaca * mfbac + 4. * mfabb * mfbbb + 2. * (mfbab * mfacb + mfbba * mfabc)) - c1o3 * (mfbca + mfbac) * oMdrho; - LBMReal CUMcbc = mfcbc - (mfaac * mfcba + mfcaa * mfabc + 4. * mfbab * mfbbb + 2. * (mfabb * mfcab + mfbba * mfbac)) - c1o3 * (mfcba + mfabc) * oMdrho; - LBMReal CUMccb = mfccb - (mfcaa * mfacb + mfaca * mfcab + 4. * mfbba * mfbbb + 2. * (mfbab * mfbca + mfabb * mfcba)) - c1o3 * (mfacb + mfcab) * oMdrho; - - //Cum 6. - LBMReal CUMccc = mfccc +((-4. * mfbbb * mfbbb - - (mfcaa * mfacc + mfaca * mfcac + mfaac * mfcca) - - 4. * (mfabb * mfcbb + mfbab * mfbcb + mfbba * mfbbc) - - 2. * (mfbca * mfbac + mfcba * mfabc + mfcab * mfacb)) - +( 4. * (mfbab * mfbab * mfaca + mfabb * mfabb * mfcaa + mfbba * mfbba * mfaac) - + 2. * (mfcaa * mfaca * mfaac) - + 16. * mfbba * mfbab * mfabb) - - c1o3* (mfacc + mfcac + mfcca) * oMdrho -c1o9*oMdrho*oMdrho - - c1o9* (mfcaa + mfaca + mfaac) * oMdrho*(1.-2.* oMdrho)- c1o27* oMdrho * oMdrho*(-2.* oMdrho) - +( 2. * (mfbab * mfbab + mfabb * mfabb + mfbba * mfbba) - + (mfaac * mfaca + mfaac * mfcaa + mfaca * mfcaa)) * c2o3*oMdrho) +c1o27*oMdrho; - - //2. - // linear combinations - LBMReal mxxPyyPzz = mfcaa + mfaca + mfaac; - LBMReal mxxMyy = mfcaa - mfaca; - LBMReal mxxMzz = mfcaa - mfaac; - - LBMReal dxux = -c1o2 * collFactor *(mxxMyy + mxxMzz) + c1o2 * OxxPyyPzz*(mfaaa - mxxPyyPzz); - LBMReal dyuy = dxux + collFactor * c3o2 * mxxMyy; - LBMReal dzuz = dxux + collFactor * c3o2 * mxxMzz; - - //relax - mxxPyyPzz += OxxPyyPzz*(mfaaa - mxxPyyPzz)- 3. * (1. - c1o2 * OxxPyyPzz) * (vx2 * dxux + vy2 * dyuy + vz2 * dzuz); - mxxMyy += collFactor * (-mxxMyy) - 3. * (1. - c1o2 * collFactor) * (vx2 * dxux - vy2 * dyuy); - mxxMzz += collFactor * (-mxxMzz) - 3. * (1. - c1o2 * collFactor) * (vx2 * dxux - vz2 * dzuz); - - mfabb += collFactor * (-mfabb); - mfbab += collFactor * (-mfbab); - mfbba += collFactor * (-mfbba); - - // linear combinations back - mfcaa = c1o3 * ( mxxMyy + mxxMzz + mxxPyyPzz); - mfaca = c1o3 * (-2. * mxxMyy + mxxMzz + mxxPyyPzz); - mfaac = c1o3 * ( mxxMyy - 2. * mxxMzz + mxxPyyPzz); - - //3. - // linear combinations - LBMReal mxxyPyzz = mfcba + mfabc; - LBMReal mxxyMyzz = mfcba - mfabc; - - LBMReal mxxzPyyz = mfcab + mfacb; - LBMReal mxxzMyyz = mfcab - mfacb; - - LBMReal mxyyPxzz = mfbca + mfbac; - LBMReal mxyyMxzz = mfbca - mfbac; - - //relax - wadjust = OxyyMxzz+(1.-OxyyMxzz)*fabs(mfbbb)/(fabs(mfbbb)+qudricLimit); - mfbbb += wadjust * (-mfbbb); - wadjust = OxyyPxzz+(1.-OxyyPxzz)*fabs(mxxyPyzz)/(fabs(mxxyPyzz)+qudricLimit); - mxxyPyzz += wadjust * (-mxxyPyzz); - wadjust = OxyyMxzz+(1.-OxyyMxzz)*fabs(mxxyMyzz)/(fabs(mxxyMyzz)+qudricLimit); - mxxyMyzz += wadjust * (-mxxyMyzz); - wadjust = OxyyPxzz+(1.-OxyyPxzz)*fabs(mxxzPyyz)/(fabs(mxxzPyyz)+qudricLimit); - mxxzPyyz += wadjust * (-mxxzPyyz); - wadjust = OxyyMxzz+(1.-OxyyMxzz)*fabs(mxxzMyyz)/(fabs(mxxzMyyz)+qudricLimit); - mxxzMyyz += wadjust * (-mxxzMyyz); - wadjust = OxyyPxzz+(1.-OxyyPxzz)*fabs(mxyyPxzz)/(fabs(mxyyPxzz)+qudricLimit); - mxyyPxzz += wadjust * (-mxyyPxzz); - wadjust = OxyyMxzz+(1.-OxyyMxzz)*fabs(mxyyMxzz)/(fabs(mxyyMxzz)+qudricLimit); - mxyyMxzz += wadjust * (-mxyyMxzz); - - // linear combinations back - mfcba = ( mxxyMyzz + mxxyPyzz) * c1o2; - mfabc = (-mxxyMyzz + mxxyPyzz) * c1o2; - mfcab = ( mxxzMyyz + mxxzPyyz) * c1o2; - mfacb = (-mxxzMyyz + mxxzPyyz) * c1o2; - mfbca = ( mxyyMxzz + mxyyPxzz) * c1o2; - mfbac = (-mxyyMxzz + mxyyPxzz) * c1o2; - - //4. - CUMacc += O4 * (-CUMacc); - CUMcac += O4 * (-CUMcac); - CUMcca += O4 * (-CUMcca); - - CUMbbc += O4 * (-CUMbbc); - CUMbcb += O4 * (-CUMbcb); - CUMcbb += O4 * (-CUMcbb); - - //5. - CUMbcc += O5 * (-CUMbcc); - CUMcbc += O5 * (-CUMcbc); - CUMccb += O5 * (-CUMccb); - - //6. - CUMccc += O6 * (-CUMccc); - - //back cumulants to central moments - //4. - mfcbb = CUMcbb + ((mfcaa + c1o3 * oMdrho) * mfabb + 2. * mfbba * mfbab); - mfbcb = CUMbcb + ((mfaca + c1o3 * oMdrho) * mfbab + 2. * mfbba * mfabb); - mfbbc = CUMbbc + ((mfaac + c1o3 * oMdrho) * mfbba + 2. * mfbab * mfabb); - - mfcca = CUMcca + (mfcaa * mfaca + 2. * mfbba * mfbba) + c1o3 * (mfcaa + mfaca) * oMdrho + c1o9*(oMdrho-1)*oMdrho; - mfcac = CUMcac + (mfcaa * mfaac + 2. * mfbab * mfbab) + c1o3 * (mfcaa + mfaac) * oMdrho + c1o9*(oMdrho-1)*oMdrho; - mfacc = CUMacc + (mfaac * mfaca + 2. * mfabb * mfabb) + c1o3 * (mfaac + mfaca) * oMdrho + c1o9*(oMdrho-1)*oMdrho; - - //5. - mfbcc = CUMbcc + (mfaac * mfbca + mfaca * mfbac + 4. * mfabb * mfbbb + 2. * (mfbab * mfacb + mfbba * mfabc)) + c1o3 * (mfbca + mfbac) * oMdrho; - mfcbc = CUMcbc + (mfaac * mfcba + mfcaa * mfabc + 4. * mfbab * mfbbb + 2. * (mfabb * mfcab + mfbba * mfbac)) + c1o3 * (mfcba + mfabc) * oMdrho; - mfccb = CUMccb + (mfcaa * mfacb + mfaca * mfcab + 4. * mfbba * mfbbb + 2. * (mfbab * mfbca + mfabb * mfcba)) + c1o3 * (mfacb + mfcab) * oMdrho; - - //6. - mfccc = CUMccc -((-4. * mfbbb * mfbbb - - (mfcaa * mfacc + mfaca * mfcac + mfaac * mfcca) - - 4. * (mfabb * mfcbb + mfbac * mfbca + mfbba * mfbbc) - - 2. * (mfbca * mfbac + mfcba * mfabc + mfcab * mfacb)) - +( 4. * (mfbab * mfbab * mfaca + mfabb * mfabb * mfcaa + mfbba * mfbba * mfaac) - + 2. * (mfcaa * mfaca * mfaac) - + 16. * mfbba * mfbab * mfabb) - - c1o3* (mfacc + mfcac + mfcca) * oMdrho -c1o9*oMdrho*oMdrho - - c1o9* (mfcaa + mfaca + mfaac) * oMdrho*(1.-2.* oMdrho)- c1o27* oMdrho * oMdrho*(-2.* oMdrho) - +( 2. * (mfbab * mfbab + mfabb * mfabb + mfbba * mfbba) - + (mfaac * mfaca + mfaac * mfcaa + mfaca * mfcaa)) * c2o3*oMdrho) -c1o27*oMdrho; - - //////////////////////////////////////////////////////////////////////////////////// - //forcing - mfbaa=-mfbaa; - mfaba=-mfaba; - mfaab=-mfaab; - ////////////////////////////////////////////////////////////////////////////////////// - - //////////////////////////////////////////////////////////////////////////////////// - //back - //////////////////////////////////////////////////////////////////////////////////// - //mit 1, 0, 1/3, 0, 0, 0, 1/3, 0, 1/9 Konditionieren - //////////////////////////////////////////////////////////////////////////////////// - // Z - Dir - m0 = mfaac * c1o2 + mfaab * (vvz - c1o2) + (mfaaa + 1. * oMdrho) * ( vz2 - vvz) * c1o2; - m1 = -mfaac - 2. * mfaab * vvz + mfaaa * (1. - vz2) - 1. * oMdrho * vz2; - m2 = mfaac * c1o2 + mfaab * (vvz + c1o2) + (mfaaa + 1. * oMdrho) * ( vz2 + vvz) * c1o2; - mfaaa = m0; - mfaab = m1; - mfaac = m2; - //////////////////////////////////////////////////////////////////////////////////// - m0 = mfabc * c1o2 + mfabb * (vvz - c1o2) + mfaba * ( vz2 - vvz) * c1o2; - m1 = -mfabc - 2. * mfabb * vvz + mfaba * (1. - vz2); - m2 = mfabc * c1o2 + mfabb * (vvz + c1o2) + mfaba * ( vz2 + vvz) * c1o2; - mfaba = m0; - mfabb = m1; - mfabc = m2; - //////////////////////////////////////////////////////////////////////////////////// - m0 = mfacc * c1o2 + mfacb * (vvz - c1o2) + (mfaca + c1o3 * oMdrho) * ( vz2 - vvz) * c1o2; - m1 = -mfacc - 2. * mfacb * vvz + mfaca * (1. - vz2) - c1o3 * oMdrho * vz2; - m2 = mfacc * c1o2 + mfacb * (vvz + c1o2) + (mfaca + c1o3 * oMdrho) * ( vz2 + vvz) * c1o2; - mfaca = m0; - mfacb = m1; - mfacc = m2; - //////////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////////// - m0 = mfbac * c1o2 + mfbab * (vvz - c1o2) + mfbaa * ( vz2 - vvz) * c1o2; - m1 = -mfbac - 2. * mfbab * vvz + mfbaa * (1. - vz2); - m2 = mfbac * c1o2 + mfbab * (vvz + c1o2) + mfbaa * ( vz2 + vvz) * c1o2; - mfbaa = m0; - mfbab = m1; - mfbac = m2; - /////////b////////////////////////////////////////////////////////////////////////// - m0 = mfbbc * c1o2 + mfbbb * (vvz - c1o2) + mfbba * ( vz2 - vvz) * c1o2; - m1 = -mfbbc - 2. * mfbbb * vvz + mfbba * (1. - vz2); - m2 = mfbbc * c1o2 + mfbbb * (vvz + c1o2) + mfbba * ( vz2 + vvz) * c1o2; - mfbba = m0; - mfbbb = m1; - mfbbc = m2; - /////////b////////////////////////////////////////////////////////////////////////// - m0 = mfbcc * c1o2 + mfbcb * (vvz - c1o2) + mfbca * ( vz2 - vvz) * c1o2; - m1 = -mfbcc - 2. * mfbcb * vvz + mfbca * (1. - vz2); - m2 = mfbcc * c1o2 + mfbcb * (vvz + c1o2) + mfbca * ( vz2 + vvz) * c1o2; - mfbca = m0; - mfbcb = m1; - mfbcc = m2; - //////////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////////// - m0 = mfcac * c1o2 + mfcab * (vvz - c1o2) + (mfcaa + c1o3 * oMdrho) * ( vz2 - vvz) * c1o2; - m1 = -mfcac - 2. * mfcab * vvz + mfcaa * (1. - vz2) - c1o3 * oMdrho * vz2; - m2 = mfcac * c1o2 + mfcab * (vvz + c1o2) + (mfcaa + c1o3 * oMdrho) * ( vz2 + vvz) * c1o2; - mfcaa = m0; - mfcab = m1; - mfcac = m2; - /////////c////////////////////////////////////////////////////////////////////////// - m0 = mfcbc * c1o2 + mfcbb * (vvz - c1o2) + mfcba * ( vz2 - vvz) * c1o2; - m1 = -mfcbc - 2. * mfcbb * vvz + mfcba * (1. - vz2); - m2 = mfcbc * c1o2 + mfcbb * (vvz + c1o2) + mfcba * ( vz2 + vvz) * c1o2; - mfcba = m0; - mfcbb = m1; - mfcbc = m2; - /////////c////////////////////////////////////////////////////////////////////////// - m0 = mfccc * c1o2 + mfccb * (vvz - c1o2) + (mfcca + c1o9 * oMdrho) * ( vz2 - vvz) * c1o2; - m1 = -mfccc - 2. * mfccb * vvz + mfcca * (1. - vz2) - c1o9 * oMdrho * vz2; - m2 = mfccc * c1o2 + mfccb * (vvz + c1o2) + (mfcca + c1o9 * oMdrho) * ( vz2 + vvz) * c1o2; - mfcca = m0; - mfccb = m1; - mfccc = m2; - //////////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////////// - //mit 1/6, 2/3, 1/6, 0, 0, 0, 1/18, 2/9, 1/18 Konditionieren - //////////////////////////////////////////////////////////////////////////////////// - // Y - Dir - m0 = mfaca * c1o2 + mfaba * (vvy - c1o2) + (mfaaa + c1o6 * oMdrho) * ( vy2 - vvy) * c1o2; - m1 = -mfaca - 2. * mfaba * vvy + mfaaa * (1. - vy2) - c1o6 * oMdrho * vy2; - m2 = mfaca * c1o2 + mfaba * (vvy + c1o2) + (mfaaa + c1o6 * oMdrho) * ( vy2 + vvy) * c1o2; - mfaaa = m0; - mfaba = m1; - mfaca = m2; - //////////////////////////////////////////////////////////////////////////////////// - m0 = mfacb * c1o2 + mfabb * (vvy - c1o2) + (mfaab + c2o3 * oMdrho) * ( vy2 - vvy) * c1o2; - m1 = -mfacb - 2. * mfabb * vvy + mfaab * (1. - vy2) - c2o3 * oMdrho * vy2; - m2 = mfacb * c1o2 + mfabb * (vvy + c1o2) + (mfaab + c2o3 * oMdrho) * ( vy2 + vvy) * c1o2; - mfaab = m0; - mfabb = m1; - mfacb = m2; - //////////////////////////////////////////////////////////////////////////////////// - m0 = mfacc * c1o2 + mfabc * (vvy - c1o2) + (mfaac + c1o6 * oMdrho) * ( vy2 - vvy) * c1o2; - m1 = -mfacc - 2. * mfabc * vvy + mfaac * (1. - vy2) - c1o6 * oMdrho * vy2; - m2 = mfacc * c1o2 + mfabc * (vvy + c1o2) + (mfaac + c1o6 * oMdrho) * ( vy2 + vvy) * c1o2; - mfaac = m0; - mfabc = m1; - mfacc = m2; - //////////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////////// - m0 = mfbca * c1o2 + mfbba * (vvy - c1o2) + mfbaa * ( vy2 - vvy) * c1o2; - m1 = -mfbca - 2. * mfbba * vvy + mfbaa * (1. - vy2); - m2 = mfbca * c1o2 + mfbba * (vvy + c1o2) + mfbaa * ( vy2 + vvy) * c1o2; - mfbaa = m0; - mfbba = m1; - mfbca = m2; - /////////b////////////////////////////////////////////////////////////////////////// - m0 = mfbcb * c1o2 + mfbbb * (vvy - c1o2) + mfbab * ( vy2 - vvy) * c1o2; - m1 = -mfbcb - 2. * mfbbb * vvy + mfbab * (1. - vy2); - m2 = mfbcb * c1o2 + mfbbb * (vvy + c1o2) + mfbab * ( vy2 + vvy) * c1o2; - mfbab = m0; - mfbbb = m1; - mfbcb = m2; - /////////b////////////////////////////////////////////////////////////////////////// - m0 = mfbcc * c1o2 + mfbbc * (vvy - c1o2) + mfbac * ( vy2 - vvy) * c1o2; - m1 = -mfbcc - 2. * mfbbc * vvy + mfbac * (1. - vy2); - m2 = mfbcc * c1o2 + mfbbc * (vvy + c1o2) + mfbac * ( vy2 + vvy) * c1o2; - mfbac = m0; - mfbbc = m1; - mfbcc = m2; - //////////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////////// - m0 = mfcca * c1o2 + mfcba * (vvy - c1o2) + (mfcaa + c1o18 * oMdrho) * ( vy2 - vvy) * c1o2; - m1 = -mfcca - 2. * mfcba * vvy + mfcaa * (1. - vy2) - c1o18 * oMdrho * vy2; - m2 = mfcca * c1o2 + mfcba * (vvy + c1o2) + (mfcaa + c1o18 * oMdrho) * ( vy2 + vvy) * c1o2; - mfcaa = m0; - mfcba = m1; - mfcca = m2; - /////////c////////////////////////////////////////////////////////////////////////// - m0 = mfccb * c1o2 + mfcbb * (vvy - c1o2) + (mfcab + c2o9 * oMdrho) * ( vy2 - vvy) * c1o2; - m1 = -mfccb - 2. * mfcbb * vvy + mfcab * (1. - vy2) - c2o9 * oMdrho * vy2; - m2 = mfccb * c1o2 + mfcbb * (vvy + c1o2) + (mfcab + c2o9 * oMdrho) * ( vy2 + vvy) * c1o2; - mfcab = m0; - mfcbb = m1; - mfccb = m2; - /////////c////////////////////////////////////////////////////////////////////////// - m0 = mfccc * c1o2 + mfcbc * (vvy - c1o2) + (mfcac + c1o18 * oMdrho) * ( vy2 - vvy) * c1o2; - m1 = -mfccc - 2. * mfcbc * vvy + mfcac * (1. - vy2) - c1o18 * oMdrho * vy2; - m2 = mfccc * c1o2 + mfcbc * (vvy + c1o2) + (mfcac + c1o18 * oMdrho) * ( vy2 + vvy) * c1o2; - mfcac = m0; - mfcbc = m1; - mfccc = m2; - //////////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////////// - //mit 1/36, 1/9, 1/36, 1/9, 4/9, 1/9, 1/36, 1/9, 1/36 Konditionieren - //////////////////////////////////////////////////////////////////////////////////// - // X - Dir - m0 = mfcaa * c1o2 + mfbaa * (vvx - c1o2) + (mfaaa + c1o36 * oMdrho) * ( vx2 - vvx) * c1o2; - m1 = -mfcaa - 2. * mfbaa * vvx + mfaaa * (1. - vx2) - c1o36 * oMdrho * vx2; - m2 = mfcaa * c1o2 + mfbaa * (vvx + c1o2) + (mfaaa + c1o36 * oMdrho) * ( vx2 + vvx) * c1o2; - mfaaa = m0; - mfbaa = m1; - mfcaa = m2; - //////////////////////////////////////////////////////////////////////////////////// - m0 = mfcba * c1o2 + mfbba * (vvx - c1o2) + (mfaba + c1o9 * oMdrho) * ( vx2 - vvx) * c1o2; - m1 = -mfcba - 2. * mfbba * vvx + mfaba * (1. - vx2) - c1o9 * oMdrho * vx2; - m2 = mfcba * c1o2 + mfbba * (vvx + c1o2) + (mfaba + c1o9 * oMdrho) * ( vx2 + vvx) * c1o2; - mfaba = m0; - mfbba = m1; - mfcba = m2; - //////////////////////////////////////////////////////////////////////////////////// - m0 = mfcca * c1o2 + mfbca * (vvx - c1o2) + (mfaca + c1o36 * oMdrho) * ( vx2 - vvx) * c1o2; - m1 = -mfcca - 2. * mfbca * vvx + mfaca * (1. - vx2) - c1o36 * oMdrho * vx2; - m2 = mfcca * c1o2 + mfbca * (vvx + c1o2) + (mfaca + c1o36 * oMdrho) * ( vx2 + vvx) * c1o2; - mfaca = m0; - mfbca = m1; - mfcca = m2; - //////////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////////// - m0 = mfcab * c1o2 + mfbab * (vvx - c1o2) + (mfaab + c1o9 * oMdrho) * ( vx2 - vvx) * c1o2; - m1 = -mfcab - 2. * mfbab * vvx + mfaab * (1. - vx2) - c1o9 * oMdrho * vx2; - m2 = mfcab * c1o2 + mfbab * (vvx + c1o2) + (mfaab + c1o9 * oMdrho) * ( vx2 + vvx) * c1o2; - mfaab = m0; - mfbab = m1; - mfcab = m2; - ///////////b//////////////////////////////////////////////////////////////////////// - m0 = mfcbb * c1o2 + mfbbb * (vvx - c1o2) + (mfabb + c4o9 * oMdrho) * ( vx2 - vvx) * c1o2; - m1 = -mfcbb - 2. * mfbbb * vvx + mfabb * (1. - vx2) - c4o9 * oMdrho * vx2; - m2 = mfcbb * c1o2 + mfbbb * (vvx + c1o2) + (mfabb + c4o9 * oMdrho) * ( vx2 + vvx) * c1o2; - mfabb = m0; - mfbbb = m1; - mfcbb = m2; - ///////////b//////////////////////////////////////////////////////////////////////// - m0 = mfccb * c1o2 + mfbcb * (vvx - c1o2) + (mfacb + c1o9 * oMdrho) * ( vx2 - vvx) * c1o2; - m1 = -mfccb - 2. * mfbcb * vvx + mfacb * (1. - vx2) - c1o9 * oMdrho * vx2; - m2 = mfccb * c1o2 + mfbcb * (vvx + c1o2) + (mfacb + c1o9 * oMdrho) * ( vx2 + vvx) * c1o2; - mfacb = m0; - mfbcb = m1; - mfccb = m2; - //////////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////////// - m0 = mfcac * c1o2 + mfbac * (vvx - c1o2) + (mfaac + c1o36 * oMdrho) * ( vx2 - vvx) * c1o2; - m1 = -mfcac - 2. * mfbac * vvx + mfaac * (1. - vx2) - c1o36 * oMdrho * vx2; - m2 = mfcac * c1o2 + mfbac * (vvx + c1o2) + (mfaac + c1o36 * oMdrho) * ( vx2 + vvx) * c1o2; - mfaac = m0; - mfbac = m1; - mfcac = m2; - ///////////c//////////////////////////////////////////////////////////////////////// - m0 = mfcbc * c1o2 + mfbbc * (vvx - c1o2) + (mfabc + c1o9 * oMdrho) * ( vx2 - vvx) * c1o2; - m1 = -mfcbc - 2. * mfbbc * vvx + mfabc * (1. - vx2) - c1o9 * oMdrho * vx2; - m2 = mfcbc * c1o2 + mfbbc * (vvx + c1o2) + (mfabc + c1o9 * oMdrho) * ( vx2 + vvx) * c1o2; - mfabc = m0; - mfbbc = m1; - mfcbc = m2; - ///////////c//////////////////////////////////////////////////////////////////////// - m0 = mfccc * c1o2 + mfbcc * (vvx - c1o2) + (mfacc + c1o36 * oMdrho) * ( vx2 - vvx) * c1o2; - m1 = -mfccc - 2. * mfbcc * vvx + mfacc * (1. - vx2) - c1o36 * oMdrho * vx2; - m2 = mfccc * c1o2 + mfbcc * (vvx + c1o2) + (mfacc + c1o36 * oMdrho) * ( vx2 + vvx) * c1o2; - mfacc = m0; - mfbcc = m1; - mfccc = m2; - - ////////////////////////////////////////////////////////////////////////// - //proof correctness - ////////////////////////////////////////////////////////////////////////// -#ifdef PROOF_CORRECTNESS - LBMReal rho_post = (mfaaa+mfaac+mfaca+mfcaa+mfacc+mfcac+mfccc+mfcca) - +(mfaab+mfacb+mfcab+mfccb)+(mfaba+mfabc+mfcba+mfcbc)+(mfbaa+mfbac+mfbca+mfbcc) - +(mfabb+mfcbb)+(mfbab+mfbcb)+(mfbba+mfbbc)+mfbbb; - //LBMReal dif = fabs(rho - rho_post); - LBMReal dif = rho - rho_post; -#ifdef SINGLEPRECISION - if(dif > 10.0E-7 || dif < -10.0E-7) -#else - if(dif > 10.0E-15 || dif < -10.0E-15) -#endif - { - UB_THROW(UbException(UB_EXARGS,"rho="+UbSystem::toString(rho)+", rho_post="+UbSystem::toString(rho_post) - +" dif="+UbSystem::toString(dif) - +" rho is not correct for node "+UbSystem::toString(x1)+","+UbSystem::toString(x2)+","+UbSystem::toString(x3))); - //UBLOG(logERROR,"LBMKernelETD3Q27CCLB::collideAll(): rho is not correct for node "+UbSystem::toString(x1)+","+UbSystem::toString(x2)+","+UbSystem::toString(x3)); - //exit(EXIT_FAILURE); - } -#endif - ////////////////////////////////////////////////////////////////////////// - //write distribution - ////////////////////////////////////////////////////////////////////////// - (*this->localDistributions)(D3Q27System::ET_E,x1, x2, x3) = mfabb; - (*this->localDistributions)(D3Q27System::ET_N,x1, x2, x3) = mfbab; - (*this->localDistributions)(D3Q27System::ET_T,x1, x2, x3) = mfbba; - (*this->localDistributions)(D3Q27System::ET_NE,x1, x2, x3) = mfaab; - (*this->localDistributions)(D3Q27System::ET_NW,x1p,x2, x3) = mfcab; - (*this->localDistributions)(D3Q27System::ET_TE,x1, x2, x3) = mfaba; - (*this->localDistributions)(D3Q27System::ET_TW,x1p,x2, x3) = mfcba; - (*this->localDistributions)(D3Q27System::ET_TN,x1, x2, x3) = mfbaa; - (*this->localDistributions)(D3Q27System::ET_TS,x1, x2p,x3) = mfbca; - (*this->localDistributions)(D3Q27System::ET_TNE,x1, x2, x3) = mfaaa; - (*this->localDistributions)(D3Q27System::ET_TNW,x1p,x2, x3) = mfcaa; - (*this->localDistributions)(D3Q27System::ET_TSE,x1, x2p,x3) = mfaca; - (*this->localDistributions)(D3Q27System::ET_TSW,x1p,x2p,x3) = mfcca; - - (*this->nonLocalDistributions)(D3Q27System::ET_W,x1p,x2, x3 ) = mfcbb; - (*this->nonLocalDistributions)(D3Q27System::ET_S,x1, x2p,x3 ) = mfbcb; - (*this->nonLocalDistributions)(D3Q27System::ET_B,x1, x2, x3p ) = mfbbc; - (*this->nonLocalDistributions)(D3Q27System::ET_SW,x1p,x2p,x3 ) = mfccb; - (*this->nonLocalDistributions)(D3Q27System::ET_SE,x1, x2p,x3 ) = mfacb; - (*this->nonLocalDistributions)(D3Q27System::ET_BW,x1p,x2, x3p ) = mfcbc; - (*this->nonLocalDistributions)(D3Q27System::ET_BE,x1, x2, x3p ) = mfabc; - (*this->nonLocalDistributions)(D3Q27System::ET_BS,x1, x2p,x3p ) = mfbcc; - (*this->nonLocalDistributions)(D3Q27System::ET_BN,x1, x2, x3p ) = mfbac; - (*this->nonLocalDistributions)(D3Q27System::ET_BSW,x1p,x2p,x3p) = mfccc; - (*this->nonLocalDistributions)(D3Q27System::ET_BSE,x1, x2p,x3p) = mfacc; - (*this->nonLocalDistributions)(D3Q27System::ET_BNW,x1p,x2, x3p) = mfcac; - (*this->nonLocalDistributions)(D3Q27System::ET_BNE,x1, x2, x3p) = mfaac; - - (*this->zeroDistributions)(x1,x2,x3) = mfbbb; - ////////////////////////////////////////////////////////////////////////// - - collFactor = collFactor0; - - } - } - } - } -} - diff --git a/src/VirtualFluids/LBM/IncompressibleCumulantWithSpongeLayerLBMKernel.h b/src/VirtualFluids/LBM/IncompressibleCumulantWithSpongeLayerLBMKernel.h deleted file mode 100644 index f35510f12..000000000 --- a/src/VirtualFluids/LBM/IncompressibleCumulantWithSpongeLayerLBMKernel.h +++ /dev/null @@ -1,67 +0,0 @@ -#ifndef IncompressibleCumulantWithSpongeLayerLBMKernel_H -#define IncompressibleCumulantWithSpongeLayerLBMKernel_H - -#include "IncompressibleCumulantLBMKernel.h" -#include "BCProcessor.h" -#include "D3Q27System.h" -#include <boost/serialization/export.hpp> -#include "basics/utilities/UbTiming.h" -#include "basics/container/CbArray4D.h" -#include "basics/container/CbArray3D.h" - -class IncompressibleCumulantWithSpongeLayerLBMKernel; -typedef std::shared_ptr<IncompressibleCumulantWithSpongeLayerLBMKernel> LBMKernelETD3Q27CCLBWithSpongeLayerPtr; - -//! \brief Cascaded Cumulant LBM kernel. -//! \details CFD solver with sponge layer that use Cascaded Cumulant Lattice Boltzmann method for D3Q27 model <br> -//! variable spongeFactor is depending on funktion in muSpongeLayer and varies between 1 (do nothing) und 0.5 (collFactor about 1); -//! Initialization in test case (example): <br> -//! \code{.cpp} -//! int sizeSP=8; //width of sponge layer in blocks -//! mu::Parser spongeLayer; -//! spongeLayer.SetExpr("x1>=(sizeX-sizeSP)/dt ? (sizeX-(x1+1))/sizeSP/2.0 + 0.5 : 1.0"); -//! spongeLayer.DefineConst("sizeX", nx[0]*blocknx[0]); // width of grid for X in coarse nodes -//! spongeLayer.DefineConst("sizeSP", sizeSP*blocknx[0]); // width of sponge layer in coarse nodes -//! kernel->setWithSpongeLayer(true); -//! kernel->setSpongeLayer(spongeLayer); -//! \endcode -//! \author K. Kucher, M. Geier, A. Karanchuk -class IncompressibleCumulantWithSpongeLayerLBMKernel : public IncompressibleCumulantLBMKernel -{ -public: - IncompressibleCumulantWithSpongeLayerLBMKernel(); - //! Constructor - //! \param nx1 number of nodes in x dimension - //! \param nx2 number of nodes in y dimension - //! \param nx3 number of nodes in z dimension - //! \param p set relaxation parameter: NORMAL is OxyyMxzz = 1.0 and MAGIC is OxyyMxzz = 2.0 +(-collFactor) - IncompressibleCumulantWithSpongeLayerLBMKernel(int nx1, int nx2, int nx3, Parameter p); - virtual ~IncompressibleCumulantWithSpongeLayerLBMKernel(void); - LBMKernelPtr clone(); - void calculate(); - void initRelaxFactor(int vdir, double vL1, double vdx, double vSP); - //! \param vdir where the sponge layer is placed - //! \param vL1 length of simulation domain - //! \param vdx subgrid space - //! \param vSP length of sponge layer - void setRelaxFactorParam(int vdir, double vL1, double vdx, double vSP); -protected: - void init(); - LBMReal OxyyMxzz; - int direction; - double L1; - double dx; - double SP; - - friend class boost::serialization::access; - template<class Archive> - void serialize(Archive & ar, const unsigned int version) - { - ar & boost::serialization::base_object<IncompressibleCumulantLBMKernel>(*this); - ar & OxyyMxzz; - } - - void collideAll(); -}; - -#endif diff --git a/src/VirtualFluids/LBM/IncompressibleOffsetInterpolationProcessor.cpp b/src/VirtualFluids/LBM/IncompressibleOffsetInterpolationProcessor.cpp deleted file mode 100644 index e4abe11d1..000000000 --- a/src/VirtualFluids/LBM/IncompressibleOffsetInterpolationProcessor.cpp +++ /dev/null @@ -1,794 +0,0 @@ -#include "IncompressibleOffsetInterpolationProcessor.h" -#include "D3Q27System.h" - - - -IncompressibleOffsetInterpolationProcessor::IncompressibleOffsetInterpolationProcessor() - : omegaC(0.0), omegaF(0.0) -{ - //forcingC = 0; //9.99685e-7; - //forcingF = 0; //forcingC*0.5; -} -////////////////////////////////////////////////////////////////////////// -IncompressibleOffsetInterpolationProcessor::IncompressibleOffsetInterpolationProcessor(LBMReal omegaC, LBMReal omegaF) - : omegaC(omegaC), omegaF(omegaF) -{ - -} -////////////////////////////////////////////////////////////////////////// -IncompressibleOffsetInterpolationProcessor::~IncompressibleOffsetInterpolationProcessor() -{ - -} -////////////////////////////////////////////////////////////////////////// -InterpolationProcessorPtr IncompressibleOffsetInterpolationProcessor::clone() -{ - InterpolationProcessorPtr iproc = InterpolationProcessorPtr (new IncompressibleOffsetInterpolationProcessor(this->omegaC, this->omegaF)); - //std::dynamic_pointer_cast<D3Q27IncompressibleOffsetInterpolationProcessor>(iproc)->forcingC = forcingC; - //std::dynamic_pointer_cast<D3Q27IncompressibleOffsetInterpolationProcessor>(iproc)->forcingF = forcingF; - return iproc; -} -////////////////////////////////////////////////////////////////////////// -void IncompressibleOffsetInterpolationProcessor::setOmegas( LBMReal omegaC, LBMReal omegaF ) -{ - this->omegaC = omegaC; - this->omegaF = omegaF; -} -////////////////////////////////////////////////////////////////////////// -void IncompressibleOffsetInterpolationProcessor::setOffsets(LBMReal xoff, LBMReal yoff, LBMReal zoff) -{ - this->xoff = xoff; - this->yoff = yoff; - this->zoff = zoff; - this->xoff_sq = xoff * xoff; - this->yoff_sq = yoff * yoff; - this->zoff_sq = zoff * zoff; -} -////////////////////////////////////////////////////////////////////////// -void IncompressibleOffsetInterpolationProcessor::interpolateCoarseToFine(D3Q27ICell& icellC, D3Q27ICell& icellF, LBMReal xoff, LBMReal yoff, LBMReal zoff) -{ - setOffsets(xoff, yoff, zoff); - calcInterpolatedCoefficiets(icellC, omegaC, 0.5); - calcInterpolatedNode(icellF.BSW, omegaF, -0.25, -0.25, -0.25, calcPressBSW(), -1, -1, -1); - calcInterpolatedNode(icellF.BNE, omegaF, 0.25, 0.25, -0.25, calcPressBNE(), 1, 1, -1); - calcInterpolatedNode(icellF.TNW, omegaF, -0.25, 0.25, 0.25, calcPressTNW(), -1, 1, 1); - calcInterpolatedNode(icellF.TSE, omegaF, 0.25, -0.25, 0.25, calcPressTSE(), 1, -1, 1); - calcInterpolatedNode(icellF.BNW, omegaF, -0.25, 0.25, -0.25, calcPressBNW(), -1, 1, -1); - calcInterpolatedNode(icellF.BSE, omegaF, 0.25, -0.25, -0.25, calcPressBSE(), 1, -1, -1); - calcInterpolatedNode(icellF.TSW, omegaF, -0.25, -0.25, 0.25, calcPressTSW(), -1, -1, 1); - calcInterpolatedNode(icellF.TNE, omegaF, 0.25, 0.25, 0.25, calcPressTNE(), 1, 1, 1); -} -////////////////////////////////////////////////////////////////////////// -void IncompressibleOffsetInterpolationProcessor::interpolateFineToCoarse(D3Q27ICell& icellF, LBMReal* icellC, LBMReal xoff, LBMReal yoff, LBMReal zoff) -{ - setOffsets(xoff, yoff, zoff); - calcInterpolatedCoefficiets(icellF, omegaF, 2.0); - calcInterpolatedNodeFC(icellC, omegaC); -} -////////////////////////////////////////////////////////////////////////// -void IncompressibleOffsetInterpolationProcessor::calcMoments(const LBMReal* const f, LBMReal omega, LBMReal& press, LBMReal& vx1, LBMReal& vx2, LBMReal& vx3, - LBMReal& kxy, LBMReal& kyz, LBMReal& kxz, LBMReal& kxxMyy, LBMReal& kxxMzz) -{ - using namespace D3Q27System; - - //UBLOG(logINFO,"D3Q27System::BW = " << D3Q27System::BW); - //UBLOG(logINFO,"BW = " << BW); - - LBMReal rho = 0.0; - D3Q27System::calcIncompMacroscopicValues(f,rho,vx1,vx2,vx3); - - ////////////////////////////////////////////////////////////////////////// - //DRAFT - //if (omega == omegaC) - //{ - // vx1 += forcingC*0.5; - //} - //else - //{ - // vx1 += forcingF*0.5; - //} - ////////////////////////////////////////////////////////////////////////// - - //press = D3Q27System::calcPress(f,rho,vx1,vx2,vx3); - press = rho; //interpolate rho! - - kxy = -3.*omega*((((f[TSW]+f[BNE])-(f[TNW]+f[BSE]))+((f[BSW]+f[TNE])-(f[BNW]+f[TSE])))+((f[SW]+f[NE])-(f[NW]+f[SE]))-(vx1*vx2));// might not be optimal MG 25.2.13 - kyz = -3.*omega*((((f[BSW]+f[TNE])-(f[TSE]+f[BNW]))+((f[BSE]+f[TNW])-(f[TSW]+f[BNE])))+((f[BS]+f[TN])-(f[TS]+f[BN]))-(vx2*vx3)); - kxz = -3.*omega*((((f[BNW]+f[TSE])-(f[TSW]+f[BNE]))+((f[BSW]+f[TNE])-(f[BSE]+f[TNW])))+((f[BW]+f[TE])-(f[TW]+f[BE]))-(vx1*vx3)); - kxxMyy = -3./2.*omega*((((f[D3Q27System::BW]+f[TE])-(f[BS]+f[TN]))+((f[TW]+f[BE])-(f[TS]+f[BN])))+((f[W]+f[E])-(f[S]+f[N]))-(vx1*vx1-vx2*vx2)); - kxxMzz = -3./2.*omega*((((f[NW]+f[SE])-(f[BS]+f[TN]))+((f[SW]+f[NE])-(f[TS]+f[BN])))+((f[W]+f[E])-(f[B]+f[T]))-(vx1*vx1-vx3*vx3)); - //kxxMzz = -3./2.*omega*(((((f[NW]+f[SE])-(f[BS]+f[TN]))+((f[SW]+f[NE])-(f[17]+f[BN])))+((f[W]+f[E])-(f[B]+f[T])))-(vx1*vx1-vx3*vx3)); - - //UBLOG(logINFO, "t1 = "<<(((f[NW]+f[SE])-(f[BS]+f[TN]))+((f[SW]+f[NE])-(f[17]+f[BN])))+((f[W]+f[E])-(f[B]+f[T]))); - //UBLOG(logINFO, "kxxMzz = "<<kxxMzz); - - //UBLOG(logINFO,"f[BW] = " << f[BW] << " BW = " << BW); - //UBLOG(logINFO,"f[BE] = " << f[BE] << " BE = " << BE); - //UBLOG(logINFO,"f[NW] = " << f[NW] << " NW = " << NW); - //UBLOG(logINFO,"f[SE] = " << f[SE] << " SE = " << SE); - //UBLOG(logINFO,"f[BS] = " << f[BS] << " BS = " << BS); - //UBLOG(logINFO,"f[TN] = " << f[TN] << " TN = " << TN); -} -////////////////////////////////////////////////////////////////////////// -void IncompressibleOffsetInterpolationProcessor::calcInterpolatedCoefficiets(const D3Q27ICell& icell, LBMReal omega, LBMReal eps_new) -{ - LBMReal vx1_SWT,vx2_SWT,vx3_SWT; - LBMReal vx1_NWT,vx2_NWT,vx3_NWT; - LBMReal vx1_NET,vx2_NET,vx3_NET; - LBMReal vx1_SET,vx2_SET,vx3_SET; - LBMReal vx1_SWB,vx2_SWB,vx3_SWB; - LBMReal vx1_NWB,vx2_NWB,vx3_NWB; - LBMReal vx1_NEB,vx2_NEB,vx3_NEB; - LBMReal vx1_SEB,vx2_SEB,vx3_SEB; - - LBMReal kxyFromfcNEQ_SWT, kyzFromfcNEQ_SWT, kxzFromfcNEQ_SWT, kxxMyyFromfcNEQ_SWT, kxxMzzFromfcNEQ_SWT; - LBMReal kxyFromfcNEQ_NWT, kyzFromfcNEQ_NWT, kxzFromfcNEQ_NWT, kxxMyyFromfcNEQ_NWT, kxxMzzFromfcNEQ_NWT; - LBMReal kxyFromfcNEQ_NET, kyzFromfcNEQ_NET, kxzFromfcNEQ_NET, kxxMyyFromfcNEQ_NET, kxxMzzFromfcNEQ_NET; - LBMReal kxyFromfcNEQ_SET, kyzFromfcNEQ_SET, kxzFromfcNEQ_SET, kxxMyyFromfcNEQ_SET, kxxMzzFromfcNEQ_SET; - LBMReal kxyFromfcNEQ_SWB, kyzFromfcNEQ_SWB, kxzFromfcNEQ_SWB, kxxMyyFromfcNEQ_SWB, kxxMzzFromfcNEQ_SWB; - LBMReal kxyFromfcNEQ_NWB, kyzFromfcNEQ_NWB, kxzFromfcNEQ_NWB, kxxMyyFromfcNEQ_NWB, kxxMzzFromfcNEQ_NWB; - LBMReal kxyFromfcNEQ_NEB, kyzFromfcNEQ_NEB, kxzFromfcNEQ_NEB, kxxMyyFromfcNEQ_NEB, kxxMzzFromfcNEQ_NEB; - LBMReal kxyFromfcNEQ_SEB, kyzFromfcNEQ_SEB, kxzFromfcNEQ_SEB, kxxMyyFromfcNEQ_SEB, kxxMzzFromfcNEQ_SEB; - - calcMoments(icell.TSW,omega,press_SWT,vx1_SWT,vx2_SWT,vx3_SWT, kxyFromfcNEQ_SWT, kyzFromfcNEQ_SWT, kxzFromfcNEQ_SWT, kxxMyyFromfcNEQ_SWT, kxxMzzFromfcNEQ_SWT); - calcMoments(icell.TNW,omega,press_NWT,vx1_NWT,vx2_NWT,vx3_NWT, kxyFromfcNEQ_NWT, kyzFromfcNEQ_NWT, kxzFromfcNEQ_NWT, kxxMyyFromfcNEQ_NWT, kxxMzzFromfcNEQ_NWT); - calcMoments(icell.TNE,omega,press_NET,vx1_NET,vx2_NET,vx3_NET, kxyFromfcNEQ_NET, kyzFromfcNEQ_NET, kxzFromfcNEQ_NET, kxxMyyFromfcNEQ_NET, kxxMzzFromfcNEQ_NET); - calcMoments(icell.TSE,omega,press_SET,vx1_SET,vx2_SET,vx3_SET, kxyFromfcNEQ_SET, kyzFromfcNEQ_SET, kxzFromfcNEQ_SET, kxxMyyFromfcNEQ_SET, kxxMzzFromfcNEQ_SET); - calcMoments(icell.BSW,omega,press_SWB,vx1_SWB,vx2_SWB,vx3_SWB, kxyFromfcNEQ_SWB, kyzFromfcNEQ_SWB, kxzFromfcNEQ_SWB, kxxMyyFromfcNEQ_SWB, kxxMzzFromfcNEQ_SWB); - calcMoments(icell.BNW,omega,press_NWB,vx1_NWB,vx2_NWB,vx3_NWB, kxyFromfcNEQ_NWB, kyzFromfcNEQ_NWB, kxzFromfcNEQ_NWB, kxxMyyFromfcNEQ_NWB, kxxMzzFromfcNEQ_NWB); - calcMoments(icell.BNE,omega,press_NEB,vx1_NEB,vx2_NEB,vx3_NEB, kxyFromfcNEQ_NEB, kyzFromfcNEQ_NEB, kxzFromfcNEQ_NEB, kxxMyyFromfcNEQ_NEB, kxxMzzFromfcNEQ_NEB); - calcMoments(icell.BSE,omega,press_SEB,vx1_SEB,vx2_SEB,vx3_SEB, kxyFromfcNEQ_SEB, kyzFromfcNEQ_SEB, kxzFromfcNEQ_SEB, kxxMyyFromfcNEQ_SEB, kxxMzzFromfcNEQ_SEB); - - //LBMReal dxRho=c1o4*((press_NET-press_SWB)+(press_SET-press_NWB)+(press_NEB-press_SWT)+(press_SEB-press_NWT)); - //LBMReal dyRho=c1o4*((press_NET-press_SWB)-(press_SET-press_NWB)+(press_NEB-press_SWT)-(press_SEB-press_NWT)); - //LBMReal dzRho=c1o4*((press_NET-press_SWB)+(press_SET-press_NWB)-(press_NEB-press_SWT)-(press_SEB-press_NWT)); - - // kxyFromfcNEQ_SWT+=vx1_SWT*dyRho+vx2_SWT*dxRho; - // kxyFromfcNEQ_NWT+=vx1_NWT*dyRho+vx2_NWT*dxRho; - // kxyFromfcNEQ_NET+=vx1_NET*dyRho+vx2_NET*dxRho; - // kxyFromfcNEQ_SET+=vx1_SET*dyRho+vx2_SET*dxRho; - // kxyFromfcNEQ_SWB+=vx1_SWB*dyRho+vx2_SWB*dxRho; - // kxyFromfcNEQ_NWB+=vx1_NWB*dyRho+vx2_NWB*dxRho; - // kxyFromfcNEQ_NEB+=vx1_NEB*dyRho+vx2_NEB*dxRho; - // kxyFromfcNEQ_SEB+=vx1_SEB*dyRho+vx2_SEB*dxRho; - - // kyzFromfcNEQ_SWT+=vx3_SWT*dyRho+vx2_SWT*dzRho; - // kyzFromfcNEQ_NWT+=vx3_NWT*dyRho+vx2_NWT*dzRho; - // kyzFromfcNEQ_NET+=vx3_NET*dyRho+vx2_NET*dzRho; - // kyzFromfcNEQ_SET+=vx3_SET*dyRho+vx2_SET*dzRho; - // kyzFromfcNEQ_SWB+=vx3_SWB*dyRho+vx2_SWB*dzRho; - // kyzFromfcNEQ_NWB+=vx3_NWB*dyRho+vx2_NWB*dzRho; - // kyzFromfcNEQ_NEB+=vx3_NEB*dyRho+vx2_NEB*dzRho; - // kyzFromfcNEQ_SEB+=vx3_SEB*dyRho+vx2_SEB*dzRho; - - // kxzFromfcNEQ_SWT+=vx1_SWT*dzRho+vx3_SWT*dxRho; - // kxzFromfcNEQ_NWT+=vx1_NWT*dzRho+vx3_NWT*dxRho; - // kxzFromfcNEQ_NET+=vx1_NET*dzRho+vx3_NET*dxRho; - // kxzFromfcNEQ_SET+=vx1_SET*dzRho+vx3_SET*dxRho; - // kxzFromfcNEQ_SWB+=vx1_SWB*dzRho+vx3_SWB*dxRho; - // kxzFromfcNEQ_NWB+=vx1_NWB*dzRho+vx3_NWB*dxRho; - // kxzFromfcNEQ_NEB+=vx1_NEB*dzRho+vx3_NEB*dxRho; - // kxzFromfcNEQ_SEB+=vx1_SEB*dzRho+vx3_SEB*dxRho; - - // kxxMyyFromfcNEQ_SWT+=vx1_SWT*dxRho-vx2_SWT*dyRho; - // kxxMyyFromfcNEQ_NWT+=vx1_NWT*dxRho-vx2_NWT*dyRho; - // kxxMyyFromfcNEQ_NET+=vx1_NET*dxRho-vx2_NET*dyRho; - // kxxMyyFromfcNEQ_SET+=vx1_SET*dxRho-vx2_SET*dyRho; - // kxxMyyFromfcNEQ_SWB+=vx1_SWB*dxRho-vx2_SWB*dyRho; - // kxxMyyFromfcNEQ_NWB+=vx1_NWB*dxRho-vx2_NWB*dyRho; - // kxxMyyFromfcNEQ_NEB+=vx1_NEB*dxRho-vx2_NEB*dyRho; - // kxxMyyFromfcNEQ_SEB+=vx1_SEB*dxRho-vx2_SEB*dyRho; - - // kxxMzzFromfcNEQ_SWT+=vx1_SWT*dxRho-vx3_SWT*dzRho; - // kxxMzzFromfcNEQ_NWT+=vx1_NWT*dxRho-vx3_NWT*dzRho; - // kxxMzzFromfcNEQ_NET+=vx1_NET*dxRho-vx3_NET*dzRho; - // kxxMzzFromfcNEQ_SET+=vx1_SET*dxRho-vx3_SET*dzRho; - // kxxMzzFromfcNEQ_SWB+=vx1_SWB*dxRho-vx3_SWB*dzRho; - // kxxMzzFromfcNEQ_NWB+=vx1_NWB*dxRho-vx3_NWB*dzRho; - // kxxMzzFromfcNEQ_NEB+=vx1_NEB*dxRho-vx3_NEB*dzRho; - // kxxMzzFromfcNEQ_SEB+=vx1_SEB*dxRho-vx3_SEB*dzRho; - - - //kxxMzzFromfcNEQ_SWT=0.0; - //kxxMzzFromfcNEQ_NWT=0.0; - //kxxMzzFromfcNEQ_NET=0.0; - //kxxMzzFromfcNEQ_SET=0.0; - //kxxMzzFromfcNEQ_SWB=0.0; - //kxxMzzFromfcNEQ_NWB=0.0; - //kxxMzzFromfcNEQ_NEB=0.0; - //kxxMzzFromfcNEQ_SEB=0.0; - - - - - - a0 = (-kxxMyyFromfcNEQ_NEB - kxxMyyFromfcNEQ_NET + kxxMyyFromfcNEQ_NWB + kxxMyyFromfcNEQ_NWT - - kxxMyyFromfcNEQ_SEB - kxxMyyFromfcNEQ_SET + kxxMyyFromfcNEQ_SWB + kxxMyyFromfcNEQ_SWT - - kxxMzzFromfcNEQ_NEB - kxxMzzFromfcNEQ_NET + kxxMzzFromfcNEQ_NWB + kxxMzzFromfcNEQ_NWT - - kxxMzzFromfcNEQ_SEB - kxxMzzFromfcNEQ_SET + kxxMzzFromfcNEQ_SWB + kxxMzzFromfcNEQ_SWT - - 2.*kxyFromfcNEQ_NEB - 2.*kxyFromfcNEQ_NET - 2.*kxyFromfcNEQ_NWB - 2.*kxyFromfcNEQ_NWT + - 2.*kxyFromfcNEQ_SEB + 2.*kxyFromfcNEQ_SET + 2.*kxyFromfcNEQ_SWB + 2.*kxyFromfcNEQ_SWT + - 2.*kxzFromfcNEQ_NEB - 2.*kxzFromfcNEQ_NET + 2.*kxzFromfcNEQ_NWB - 2.*kxzFromfcNEQ_NWT + - 2.*kxzFromfcNEQ_SEB - 2.*kxzFromfcNEQ_SET + 2.*kxzFromfcNEQ_SWB - 2.*kxzFromfcNEQ_SWT + - 8.*vx1_NEB + 8.*vx1_NET + 8.*vx1_NWB + 8.*vx1_NWT + 8.*vx1_SEB + - 8.*vx1_SET + 8.*vx1_SWB + 8.*vx1_SWT + 2.*vx2_NEB + 2.*vx2_NET - - 2.*vx2_NWB - 2.*vx2_NWT - 2.*vx2_SEB - 2.*vx2_SET + 2.*vx2_SWB + - 2.*vx2_SWT - 2.*vx3_NEB + 2.*vx3_NET + 2.*vx3_NWB - 2.*vx3_NWT - - 2.*vx3_SEB + 2.*vx3_SET + 2.*vx3_SWB - 2.*vx3_SWT)/64.; - b0 = (2.*kxxMyyFromfcNEQ_NEB + 2.*kxxMyyFromfcNEQ_NET + 2.*kxxMyyFromfcNEQ_NWB + 2.*kxxMyyFromfcNEQ_NWT - - 2.*kxxMyyFromfcNEQ_SEB - 2.*kxxMyyFromfcNEQ_SET - 2.*kxxMyyFromfcNEQ_SWB - 2.*kxxMyyFromfcNEQ_SWT - - kxxMzzFromfcNEQ_NEB - kxxMzzFromfcNEQ_NET - kxxMzzFromfcNEQ_NWB - kxxMzzFromfcNEQ_NWT + - kxxMzzFromfcNEQ_SEB + kxxMzzFromfcNEQ_SET + kxxMzzFromfcNEQ_SWB + kxxMzzFromfcNEQ_SWT - - 2.*kxyFromfcNEQ_NEB - 2.*kxyFromfcNEQ_NET + 2.*kxyFromfcNEQ_NWB + 2.*kxyFromfcNEQ_NWT - - 2.*kxyFromfcNEQ_SEB - 2.*kxyFromfcNEQ_SET + 2.*kxyFromfcNEQ_SWB + 2.*kxyFromfcNEQ_SWT + - 2.*kyzFromfcNEQ_NEB - 2.*kyzFromfcNEQ_NET + 2.*kyzFromfcNEQ_NWB - 2.*kyzFromfcNEQ_NWT + - 2.*kyzFromfcNEQ_SEB - 2.*kyzFromfcNEQ_SET + 2.*kyzFromfcNEQ_SWB - 2.*kyzFromfcNEQ_SWT + - 2.*vx1_NEB + 2.*vx1_NET - 2.*vx1_NWB - 2.*vx1_NWT - - 2.*vx1_SEB - 2.*vx1_SET + 2.*vx1_SWB + 2.*vx1_SWT + - 8.*vx2_NEB + 8.*vx2_NET + 8.*vx2_NWB + 8.*vx2_NWT + - 8.*vx2_SEB + 8.*vx2_SET + 8.*vx2_SWB + 8.*vx2_SWT - - 2.*vx3_NEB + 2.*vx3_NET - 2.*vx3_NWB + 2.*vx3_NWT + - 2.*vx3_SEB - 2.*vx3_SET + 2.*vx3_SWB - 2.*vx3_SWT)/64.; - c0 = (kxxMyyFromfcNEQ_NEB - kxxMyyFromfcNEQ_NET + kxxMyyFromfcNEQ_NWB - kxxMyyFromfcNEQ_NWT + - kxxMyyFromfcNEQ_SEB - kxxMyyFromfcNEQ_SET + kxxMyyFromfcNEQ_SWB - kxxMyyFromfcNEQ_SWT - - 2.*kxxMzzFromfcNEQ_NEB + 2.*kxxMzzFromfcNEQ_NET - 2.*kxxMzzFromfcNEQ_NWB + 2.*kxxMzzFromfcNEQ_NWT - - 2.*kxxMzzFromfcNEQ_SEB + 2.*kxxMzzFromfcNEQ_SET - 2.*kxxMzzFromfcNEQ_SWB + 2.*kxxMzzFromfcNEQ_SWT - - 2.*kxzFromfcNEQ_NEB - 2.*kxzFromfcNEQ_NET + 2.*kxzFromfcNEQ_NWB + 2.*kxzFromfcNEQ_NWT - - 2.*kxzFromfcNEQ_SEB - 2.*kxzFromfcNEQ_SET + 2.*kxzFromfcNEQ_SWB + 2.*kxzFromfcNEQ_SWT - - 2.*kyzFromfcNEQ_NEB - 2.*kyzFromfcNEQ_NET - 2.*kyzFromfcNEQ_NWB - 2.*kyzFromfcNEQ_NWT + - 2.*kyzFromfcNEQ_SEB + 2.*kyzFromfcNEQ_SET + 2.*kyzFromfcNEQ_SWB + 2.*kyzFromfcNEQ_SWT - - 2.*vx1_NEB + 2.*vx1_NET + 2.*vx1_NWB - 2.*vx1_NWT - - 2.*vx1_SEB + 2.*vx1_SET + 2.*vx1_SWB - 2.*vx1_SWT - - 2.*vx2_NEB + 2.*vx2_NET - 2.*vx2_NWB + 2.*vx2_NWT + - 2.*vx2_SEB - 2.*vx2_SET + 2.*vx2_SWB - 2.*vx2_SWT + - 8.*vx3_NEB + 8.*vx3_NET + 8.*vx3_NWB + 8.*vx3_NWT + - 8.*vx3_SEB + 8.*vx3_SET + 8.*vx3_SWB + 8.*vx3_SWT)/64.; - ax = (vx1_NEB + vx1_NET - vx1_NWB - vx1_NWT + vx1_SEB + vx1_SET - vx1_SWB - vx1_SWT)/4.; - bx = (vx2_NEB + vx2_NET - vx2_NWB - vx2_NWT + vx2_SEB + vx2_SET - vx2_SWB - vx2_SWT)/4.; - cx = (vx3_NEB + vx3_NET - vx3_NWB - vx3_NWT + vx3_SEB + vx3_SET - vx3_SWB - vx3_SWT)/4.; - axx= (kxxMyyFromfcNEQ_NEB + kxxMyyFromfcNEQ_NET - kxxMyyFromfcNEQ_NWB - kxxMyyFromfcNEQ_NWT + - kxxMyyFromfcNEQ_SEB + kxxMyyFromfcNEQ_SET - kxxMyyFromfcNEQ_SWB - kxxMyyFromfcNEQ_SWT + - kxxMzzFromfcNEQ_NEB + kxxMzzFromfcNEQ_NET - kxxMzzFromfcNEQ_NWB - kxxMzzFromfcNEQ_NWT + - kxxMzzFromfcNEQ_SEB + kxxMzzFromfcNEQ_SET - kxxMzzFromfcNEQ_SWB - kxxMzzFromfcNEQ_SWT + - 2.*vx2_NEB + 2.*vx2_NET - 2.*vx2_NWB - 2.*vx2_NWT - - 2.*vx2_SEB - 2.*vx2_SET + 2.*vx2_SWB + 2.*vx2_SWT - - 2.*vx3_NEB + 2.*vx3_NET + 2.*vx3_NWB - 2.*vx3_NWT - - 2.*vx3_SEB + 2.*vx3_SET + 2.*vx3_SWB - 2.*vx3_SWT)/16.; - bxx= (kxyFromfcNEQ_NEB + kxyFromfcNEQ_NET - kxyFromfcNEQ_NWB - kxyFromfcNEQ_NWT + - kxyFromfcNEQ_SEB + kxyFromfcNEQ_SET - kxyFromfcNEQ_SWB - kxyFromfcNEQ_SWT - - 2.*vx1_NEB - 2.*vx1_NET + 2.*vx1_NWB + 2.*vx1_NWT + - 2.*vx1_SEB + 2.*vx1_SET - 2.*vx1_SWB - 2.*vx1_SWT)/8.; - cxx= (kxzFromfcNEQ_NEB + kxzFromfcNEQ_NET - kxzFromfcNEQ_NWB - kxzFromfcNEQ_NWT + - kxzFromfcNEQ_SEB + kxzFromfcNEQ_SET - kxzFromfcNEQ_SWB - kxzFromfcNEQ_SWT + - 2.*vx1_NEB - 2.*vx1_NET - 2.*vx1_NWB + 2.*vx1_NWT + - 2.*vx1_SEB - 2.*vx1_SET - 2.*vx1_SWB + 2.*vx1_SWT)/8.; - ay = (vx1_NEB + vx1_NET + vx1_NWB + vx1_NWT - vx1_SEB - vx1_SET - vx1_SWB - vx1_SWT)/4.; - by = (vx2_NEB + vx2_NET + vx2_NWB + vx2_NWT - vx2_SEB - vx2_SET - vx2_SWB - vx2_SWT)/4.; - cy = (vx3_NEB + vx3_NET + vx3_NWB + vx3_NWT - vx3_SEB - vx3_SET - vx3_SWB - vx3_SWT)/4.; - ayy= (kxyFromfcNEQ_NEB + kxyFromfcNEQ_NET + kxyFromfcNEQ_NWB + kxyFromfcNEQ_NWT - - kxyFromfcNEQ_SEB - kxyFromfcNEQ_SET - kxyFromfcNEQ_SWB - kxyFromfcNEQ_SWT - - 2.*vx2_NEB - 2.*vx2_NET + 2.*vx2_NWB + 2.*vx2_NWT + - 2.*vx2_SEB + 2.*vx2_SET - 2.*vx2_SWB - 2.*vx2_SWT)/8.; - byy= (-2.*kxxMyyFromfcNEQ_NEB - 2.*kxxMyyFromfcNEQ_NET - 2.*kxxMyyFromfcNEQ_NWB - 2.*kxxMyyFromfcNEQ_NWT + - 2.*kxxMyyFromfcNEQ_SEB + 2.*kxxMyyFromfcNEQ_SET + 2.*kxxMyyFromfcNEQ_SWB + 2.*kxxMyyFromfcNEQ_SWT + - kxxMzzFromfcNEQ_NEB + kxxMzzFromfcNEQ_NET + kxxMzzFromfcNEQ_NWB + kxxMzzFromfcNEQ_NWT - - kxxMzzFromfcNEQ_SEB - kxxMzzFromfcNEQ_SET - kxxMzzFromfcNEQ_SWB - kxxMzzFromfcNEQ_SWT + - 2.*vx1_NEB + 2.*vx1_NET - 2.*vx1_NWB - 2.*vx1_NWT - - 2.*vx1_SEB - 2.*vx1_SET + 2.*vx1_SWB + 2.*vx1_SWT - - 2.*vx3_NEB + 2.*vx3_NET - 2.*vx3_NWB + 2.*vx3_NWT + - 2.*vx3_SEB - 2.*vx3_SET + 2.*vx3_SWB - 2.*vx3_SWT)/16.; - cyy= (kyzFromfcNEQ_NEB + kyzFromfcNEQ_NET + kyzFromfcNEQ_NWB + kyzFromfcNEQ_NWT - - kyzFromfcNEQ_SEB - kyzFromfcNEQ_SET - kyzFromfcNEQ_SWB - kyzFromfcNEQ_SWT + - 2.*vx2_NEB - 2.*vx2_NET + 2.*vx2_NWB - 2.*vx2_NWT - - 2.*vx2_SEB + 2.*vx2_SET - 2.*vx2_SWB + 2.*vx2_SWT)/8.; - az = (-vx1_NEB + vx1_NET - vx1_NWB + vx1_NWT - vx1_SEB + vx1_SET - vx1_SWB + vx1_SWT)/4.; - bz = (-vx2_NEB + vx2_NET - vx2_NWB + vx2_NWT - vx2_SEB + vx2_SET - vx2_SWB + vx2_SWT)/4.; - cz = (-vx3_NEB + vx3_NET - vx3_NWB + vx3_NWT - vx3_SEB + vx3_SET - vx3_SWB + vx3_SWT)/4.; - azz= (-kxzFromfcNEQ_NEB + kxzFromfcNEQ_NET - kxzFromfcNEQ_NWB + kxzFromfcNEQ_NWT - - kxzFromfcNEQ_SEB + kxzFromfcNEQ_SET - kxzFromfcNEQ_SWB + kxzFromfcNEQ_SWT + - 2.*vx3_NEB - 2.*vx3_NET - 2.*vx3_NWB + 2.*vx3_NWT + - 2.*vx3_SEB - 2.*vx3_SET - 2.*vx3_SWB + 2.*vx3_SWT)/8.; - bzz= (-kyzFromfcNEQ_NEB + kyzFromfcNEQ_NET - kyzFromfcNEQ_NWB + kyzFromfcNEQ_NWT - - kyzFromfcNEQ_SEB + kyzFromfcNEQ_SET - kyzFromfcNEQ_SWB + kyzFromfcNEQ_SWT + - 2.*vx3_NEB - 2.*vx3_NET + 2.*vx3_NWB - 2.*vx3_NWT - - 2.*vx3_SEB + 2.*vx3_SET - 2.*vx3_SWB + 2.*vx3_SWT)/8.; - czz= (-kxxMyyFromfcNEQ_NEB + kxxMyyFromfcNEQ_NET - kxxMyyFromfcNEQ_NWB + kxxMyyFromfcNEQ_NWT - - kxxMyyFromfcNEQ_SEB + kxxMyyFromfcNEQ_SET - kxxMyyFromfcNEQ_SWB + kxxMyyFromfcNEQ_SWT + - 2.*kxxMzzFromfcNEQ_NEB - 2.*kxxMzzFromfcNEQ_NET + 2.*kxxMzzFromfcNEQ_NWB - 2.*kxxMzzFromfcNEQ_NWT + - 2.*kxxMzzFromfcNEQ_SEB - 2.*kxxMzzFromfcNEQ_SET + 2.*kxxMzzFromfcNEQ_SWB - 2.*kxxMzzFromfcNEQ_SWT - - 2.*vx1_NEB + 2.*vx1_NET + 2.*vx1_NWB - 2.*vx1_NWT - - 2.*vx1_SEB + 2.*vx1_SET + 2.*vx1_SWB - 2.*vx1_SWT - - 2.*vx2_NEB + 2.*vx2_NET - 2.*vx2_NWB + 2.*vx2_NWT + - 2.*vx2_SEB - 2.*vx2_SET + 2.*vx2_SWB - 2.*vx2_SWT)/16.; - axy= (vx1_NEB + vx1_NET - vx1_NWB - vx1_NWT - vx1_SEB - vx1_SET + vx1_SWB + vx1_SWT)/2.; - bxy= (vx2_NEB + vx2_NET - vx2_NWB - vx2_NWT - vx2_SEB - vx2_SET + vx2_SWB + vx2_SWT)/2.; - cxy= (vx3_NEB + vx3_NET - vx3_NWB - vx3_NWT - vx3_SEB - vx3_SET + vx3_SWB + vx3_SWT)/2.; - axz= (-vx1_NEB + vx1_NET + vx1_NWB - vx1_NWT - vx1_SEB + vx1_SET + vx1_SWB - vx1_SWT)/2.; - bxz= (-vx2_NEB + vx2_NET + vx2_NWB - vx2_NWT - vx2_SEB + vx2_SET + vx2_SWB - vx2_SWT)/2.; - cxz= (-vx3_NEB + vx3_NET + vx3_NWB - vx3_NWT - vx3_SEB + vx3_SET + vx3_SWB - vx3_SWT)/2.; - ayz= (-vx1_NEB + vx1_NET - vx1_NWB + vx1_NWT + vx1_SEB - vx1_SET + vx1_SWB - vx1_SWT)/2.; - byz= (-vx2_NEB + vx2_NET - vx2_NWB + vx2_NWT + vx2_SEB - vx2_SET + vx2_SWB - vx2_SWT)/2.; - cyz= (-vx3_NEB + vx3_NET - vx3_NWB + vx3_NWT + vx3_SEB - vx3_SET + vx3_SWB - vx3_SWT)/2.; - axyz=-vx1_NEB + vx1_NET + vx1_NWB - vx1_NWT + vx1_SEB - vx1_SET - vx1_SWB + vx1_SWT; - bxyz=-vx2_NEB + vx2_NET + vx2_NWB - vx2_NWT + vx2_SEB - vx2_SET - vx2_SWB + vx2_SWT; - cxyz=-vx3_NEB + vx3_NET + vx3_NWB - vx3_NWT + vx3_SEB - vx3_SET - vx3_SWB + vx3_SWT; - - /////////////////////BÖSE!!! - //axx=0; ayy=0; azz=0; - //bxx=0; byy=0; bzz=0; - //cxx=0; cyy=0; czz=0; - ////////////////////!!!BÖSE - - ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //kxyAverage =(kxyFromfcNEQ_SWB+ - // kxyFromfcNEQ_SWT+ - // kxyFromfcNEQ_SET+ - // kxyFromfcNEQ_SEB+ - // kxyFromfcNEQ_NWB+ - // kxyFromfcNEQ_NWT+ - // kxyFromfcNEQ_NET+ - // kxyFromfcNEQ_NEB)*c1o8-(ay+bx); - //kyzAverage =(kyzFromfcNEQ_SWB+ - // kyzFromfcNEQ_SWT+ - // kyzFromfcNEQ_SET+ - // kyzFromfcNEQ_SEB+ - // kyzFromfcNEQ_NWB+ - // kyzFromfcNEQ_NWT+ - // kyzFromfcNEQ_NET+ - // kyzFromfcNEQ_NEB)*c1o8-(bz+cy); - //kxzAverage =(kxzFromfcNEQ_SWB+ - // kxzFromfcNEQ_SWT+ - // kxzFromfcNEQ_SET+ - // kxzFromfcNEQ_SEB+ - // kxzFromfcNEQ_NWB+ - // kxzFromfcNEQ_NWT+ - // kxzFromfcNEQ_NET+ - // kxzFromfcNEQ_NEB)*c1o8-(az+cx); - //kxxMyyAverage =(kxxMyyFromfcNEQ_SWB+ - // kxxMyyFromfcNEQ_SWT+ - // kxxMyyFromfcNEQ_SET+ - // kxxMyyFromfcNEQ_SEB+ - // kxxMyyFromfcNEQ_NWB+ - // kxxMyyFromfcNEQ_NWT+ - // kxxMyyFromfcNEQ_NET+ - // kxxMyyFromfcNEQ_NEB)*c1o8-(ax-by); - //kxxMzzAverage =(kxxMzzFromfcNEQ_SWB+ - // kxxMzzFromfcNEQ_SWT+ - // kxxMzzFromfcNEQ_SET+ - // kxxMzzFromfcNEQ_SEB+ - // kxxMzzFromfcNEQ_NWB+ - // kxxMzzFromfcNEQ_NWT+ - // kxxMzzFromfcNEQ_NET+ - // kxxMzzFromfcNEQ_NEB)*c1o8-(ax-cz); - kxyAverage =0;//(kxyFromfcNEQ_SWB+ - //kxyFromfcNEQ_SWT+ - //kxyFromfcNEQ_SET+ - //kxyFromfcNEQ_SEB+ - //kxyFromfcNEQ_NWB+ - //kxyFromfcNEQ_NWT+ - //kxyFromfcNEQ_NET+ - //kxyFromfcNEQ_NEB)*c1o8-(ay+bx); - kyzAverage =0;//(kyzFromfcNEQ_SWB+ - //kyzFromfcNEQ_SWT+ - //kyzFromfcNEQ_SET+ - //kyzFromfcNEQ_SEB+ - //kyzFromfcNEQ_NWB+ - //kyzFromfcNEQ_NWT+ - //kyzFromfcNEQ_NET+ - //kyzFromfcNEQ_NEB)*c1o8-(bz+cy); - kxzAverage =0;//(kxzFromfcNEQ_SWB+ - //kxzFromfcNEQ_SWT+ - //kxzFromfcNEQ_SET+ - //kxzFromfcNEQ_SEB+ - //kxzFromfcNEQ_NWB+ - //kxzFromfcNEQ_NWT+ - //kxzFromfcNEQ_NET+ - //kxzFromfcNEQ_NEB)*c1o8-(az+cx); - kxxMyyAverage =0;//(kxxMyyFromfcNEQ_SWB+ - //kxxMyyFromfcNEQ_SWT+ - //kxxMyyFromfcNEQ_SET+ - //kxxMyyFromfcNEQ_SEB+ - //kxxMyyFromfcNEQ_NWB+ - //kxxMyyFromfcNEQ_NWT+ - //kxxMyyFromfcNEQ_NET+ - //kxxMyyFromfcNEQ_NEB)*c1o8-(ax-by); - kxxMzzAverage =0;//(kxxMzzFromfcNEQ_SWB+ - //kxxMzzFromfcNEQ_SWT+ - //kxxMzzFromfcNEQ_SET+ - //kxxMzzFromfcNEQ_SEB+ - //kxxMzzFromfcNEQ_NWB+ - //kxxMzzFromfcNEQ_NWT+ - //kxxMzzFromfcNEQ_NET+ - //kxxMzzFromfcNEQ_NEB)*c1o8-(ax-cz); - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - // - // Bernd das Brot - // - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - a0 = a0 + xoff * ax + yoff * ay + zoff * az + xoff_sq * axx + yoff_sq * ayy + zoff_sq * azz + xoff*yoff*axy + xoff*zoff*axz + yoff*zoff*ayz + xoff*yoff*zoff*axyz ; - ax = ax + 2. * xoff * axx + yoff * axy + zoff * axz + yoff*zoff*axyz; - ay = ay + 2. * yoff * ayy + xoff * axy + zoff * ayz + xoff*zoff*axyz; - az = az + 2. * zoff * azz + xoff * axz + yoff * ayz + xoff*yoff*axyz; - b0 = b0 + xoff * bx + yoff * by + zoff * bz + xoff_sq * bxx + yoff_sq * byy + zoff_sq * bzz + xoff*yoff*bxy + xoff*zoff*bxz + yoff*zoff*byz + xoff*yoff*zoff*bxyz; - bx = bx + 2. * xoff * bxx + yoff * bxy + zoff * bxz + yoff*zoff*bxyz; - by = by + 2. * yoff * byy + xoff * bxy + zoff * byz + xoff*zoff*bxyz; - bz = bz + 2. * zoff * bzz + xoff * bxz + yoff * byz + xoff*yoff*bxyz; - c0 = c0 + xoff * cx + yoff * cy + zoff * cz + xoff_sq * cxx + yoff_sq * cyy + zoff_sq * czz + xoff*yoff*cxy + xoff*zoff*cxz + yoff*zoff*cyz + xoff*yoff*zoff*cxyz; - cx = cx + 2. * xoff * cxx + yoff * cxy + zoff * cxz + yoff*zoff*cxyz; - cy = cy + 2. * yoff * cyy + xoff * cxy + zoff * cyz + xoff*zoff*cxyz; - cz = cz + 2. * zoff * czz + xoff * cxz + yoff * cyz + xoff*yoff*cxyz; - axy= axy + zoff*axyz; - axz= axz + yoff*axyz; - ayz= ayz + xoff*axyz; - bxy= bxy + zoff*bxyz; - bxz= bxz + yoff*bxyz; - byz= byz + xoff*bxyz; - cxy= cxy + zoff*cxyz; - cxz= cxz + yoff*cxyz; - cyz= cyz + xoff*cxyz; - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - const LBMReal o = omega; - - f_E = eps_new*((2*(-2*ax + by + cz-kxxMzzAverage-kxxMyyAverage))/(27.*o)); - f_N = eps_new*((2*(ax - 2*by + cz+2*kxxMyyAverage-kxxMzzAverage))/(27.*o)); - f_T = eps_new*((2*(ax + by - 2*cz-kxxMyyAverage+2*kxxMzzAverage))/(27.*o)); - f_NE = eps_new*(-(ax + 3*ay + 3*bx + by - 2*cz+2*kxxMyyAverage-kxxMyyAverage+3*kxyAverage)/(54.*o)); - f_SE = eps_new*(-(ax - 3*ay - 3*bx + by - 2*cz+2*kxxMyyAverage-kxxMyyAverage-3*kxyAverage)/(54.*o)); - f_TE = eps_new*(-(ax + 3*az - 2*by + 3*cx + cz+2*kxxMyyAverage-kxxMzzAverage+3*kxzAverage)/(54.*o)); - f_BE = eps_new*(-(ax - 3*az - 2*by - 3*cx + cz+2*kxxMyyAverage-kxxMzzAverage-3*kxzAverage)/(54.*o)); - f_TN = eps_new*(-(-2*ax + by + 3*bz + 3*cy + cz-kxxMyyAverage-kxxMzzAverage+3*kyzAverage)/(54.*o)); - f_BN = eps_new*(-(-2*ax + by - 3*bz - 3*cy + cz-kxxMyyAverage-kxxMzzAverage-3*kyzAverage)/(54.*o)); - f_ZERO = 0.; - f_TNE = eps_new*(-(ay + az + bx + bz + cx + cy+kxyAverage+kxzAverage+kyzAverage)/(72.*o)); - f_TSW = eps_new*((-ay + az - bx + bz + cx + cy-kxyAverage+kxzAverage+kyzAverage)/(72.*o)); - f_TSE = eps_new*((ay - az + bx + bz - cx + cy+kxyAverage-kxzAverage+kyzAverage)/(72.*o)); - f_TNW = eps_new*((ay + az + bx - bz + cx - cy+kxyAverage+kxzAverage-kyzAverage)/(72.*o)); - - x_E = 0.25*eps_new*((2*(-4*axx + bxy + cxz))/(27.*o)); - x_N = 0.25*eps_new*((2*(2*axx - 2*bxy + cxz))/(27.*o)); - x_T = 0.25*eps_new*((2*(2*axx + bxy - 2*cxz))/(27.*o)); - x_NE = 0.25*eps_new*(-((2*axx + 3*axy + 6*bxx + bxy - 2*cxz))/(54.*o)); - x_SE = 0.25*eps_new*(-((2*axx - 3*axy - 6*bxx + bxy - 2*cxz))/(54.*o)); - x_TE = 0.25*eps_new*(-((2*axx + 3*axz - 2*bxy + 6*cxx + cxz))/(54.*o)); - x_BE = 0.25*eps_new*(-((2*axx - 3*axz - 2*bxy - 6*cxx + cxz))/(54.*o)); - x_TN = 0.25*eps_new*(-((-4*axx + bxy + 3*bxz + 3*cxy + cxz))/(54.*o)); - x_BN = 0.25*eps_new*(-((-4*axx + bxy - 3*bxz - 3*cxy + cxz))/(54.*o)); - x_ZERO = 0.; - x_TNE = 0.25*eps_new*(-((axy + axz + 2*bxx + bxz + 2*cxx + cxy))/(72.*o)); - x_TSW = 0.25*eps_new*(((-axy + axz - 2*bxx + bxz + 2*cxx + cxy))/(72.*o)); - x_TSE = 0.25*eps_new*(((axy - axz + 2*bxx + bxz - 2*cxx + cxy))/(72.*o)); - x_TNW = 0.25*eps_new*(((axy + axz + 2*bxx - bxz + 2*cxx - cxy))/(72.*o)); - - y_E = 0.25*eps_new*(2*(-2*axy + 2*byy + cyz))/(27.*o); - y_N = 0.25*eps_new*(2*(axy - 4*byy + cyz))/(27.*o); - y_T = 0.25*eps_new*(2*(axy + 2*byy - 2*cyz))/(27.*o); - y_NE = 0.25*eps_new*(-((axy + 6*ayy + 3*bxy + 2*byy - 2*cyz))/(54.*o)); - y_SE = 0.25*eps_new*(-((axy - 6*ayy - 3*bxy + 2*byy - 2*cyz))/(54.*o)); - y_TE = 0.25*eps_new*(-((axy + 3*ayz - 4*byy + 3*cxy + cyz))/(54.*o)); - y_BE = 0.25*eps_new*(-((axy - 3*ayz - 4*byy - 3*cxy + cyz))/(54.*o)); - y_TN = 0.25*eps_new*(-((-2*axy + 2*byy + 3*byz + 6*cyy + cyz))/(54.*o)); - y_BN = 0.25*eps_new*(-((-2*axy + 2*byy - 3*byz - 6*cyy + cyz))/(54.*o)); - y_ZERO = 0.; - y_TNE = 0.25*eps_new*(-((2*ayy + ayz + bxy + byz + cxy + 2*cyy))/(72.*o)); - y_TSW = 0.25*eps_new*(((-2*ayy + ayz - bxy + byz + cxy + 2*cyy))/(72.*o)); - y_TSE = 0.25*eps_new*(((2*ayy - ayz + bxy + byz - cxy + 2*cyy))/(72.*o)); - y_TNW = 0.25*eps_new*(((2*ayy + ayz + bxy - byz + cxy - 2*cyy))/(72.*o)); - - z_E = 0.25*eps_new*((2*(-2*axz + byz + 2*czz))/(27.*o)); - z_N = 0.25*eps_new*((2*(axz - 2*byz + 2*czz))/(27.*o)); - z_T = 0.25*eps_new*((2*(axz + byz - 4*czz))/(27.*o)); - z_NE = 0.25*eps_new*(-((axz + 3*ayz + 3*bxz + byz - 4*czz))/(54.*o)); - z_SE = 0.25*eps_new*(-((axz - 3*ayz - 3*bxz + byz - 4*czz))/(54.*o)); - z_TE = 0.25*eps_new*(-((axz + 6*azz - 2*byz + 3*cxz + 2*czz))/(54.*o)); - z_BE = 0.25*eps_new*(-((axz - 6*azz - 2*byz - 3*cxz + 2*czz))/(54.*o)); - z_TN = 0.25*eps_new*(-((-2*axz + byz + 6*bzz + 3*cyz + 2*czz))/(54.*o)); - z_BN = 0.25*eps_new*(-((-2*axz + byz - 6*bzz - 3*cyz + 2*czz))/(54.*o)); - z_ZERO = 0.; - z_TNE = 0.25*eps_new*(-((ayz + 2*azz + bxz + 2*bzz + cxz + cyz))/(72.*o)); - z_TSW = 0.25*eps_new*(((-ayz + 2*azz - bxz + 2*bzz + cxz + cyz))/(72.*o)); - z_TSE = 0.25*eps_new*(((ayz - 2*azz + bxz + 2*bzz - cxz + cyz))/(72.*o)); - z_TNW = 0.25*eps_new*(((ayz + 2*azz + bxz - 2*bzz + cxz - cyz))/(72.*o)); - - xy_E = 0.0625*eps_new *(( 2.*cxyz)/(27.*o)); - xy_N = 0.0625*eps_new *(( 2.*cxyz)/(27.*o)); - xy_T = -(0.0625*eps_new *(( 4.*cxyz)/(27.*o))); - xy_NE = 0.0625*eps_new *( cxyz /(27.*o)); - xy_SE = 0.0625*eps_new *( cxyz /(27.*o)); - xy_TE = -(0.0625*eps_new *(( 3.*axyz + cxyz)/(54.*o))); - xy_BE = -(0.0625*eps_new *((-3.*axyz + cxyz)/(54.*o))); - xy_TN = -(0.0625*eps_new *(( 3.*bxyz + cxyz)/(54.*o))); - xy_BN = -(0.0625*eps_new *(( - 3.*bxyz + cxyz)/(54.*o))); - //xy_ZERO= 0.0625*eps_new; - xy_TNE = -(0.0625*eps_new *(( axyz + bxyz )/(72.*o))); - xy_TSW = 0.0625*eps_new *(( axyz + bxyz )/(72.*o)); - xy_TSE = 0.0625*eps_new *((- axyz + bxyz )/(72.*o)); - xy_TNW = 0.0625*eps_new *(( axyz - bxyz )/(72.*o)); - - xz_E = 0.0625*eps_new *(( 2.*bxyz )/(27.*o)); - xz_N = -(0.0625*eps_new *(( 4.*bxyz )/(27.*o))); - xz_T = 0.0625*eps_new *(( 2.*bxyz )/(27.*o)); - xz_NE = -(0.0625*eps_new *(( 3.*axyz + bxyz )/(54.*o))); - xz_SE = -(0.0625*eps_new *((-3.*axyz + bxyz )/(54.*o))); - xz_TE = 0.0625*eps_new *(( bxyz )/(27.*o)); - xz_BE = 0.0625*eps_new *(( bxyz )/(27.*o)); - xz_TN = -(0.0625*eps_new *(( bxyz + 3.*cxyz)/(54.*o))); - xz_BN = -(0.0625*eps_new *(( bxyz - 3.*cxyz)/(54.*o))); - //xz_ZERO= 0.0625*eps_new; - xz_TNE = -(0.0625*eps_new *(( axyz + cxyz)/(72.*o))); - xz_TSW = 0.0625*eps_new *((- axyz + cxyz)/(72.*o)); - xz_TSE = 0.0625*eps_new *(( axyz + cxyz)/(72.*o)); - xz_TNW = 0.0625*eps_new *(( axyz - cxyz)/(72.*o)); - - yz_E = -(0.0625*eps_new *(( 4.*axyz )/(27.*o))); - yz_N = 0.0625*eps_new *(( 2.*axyz )/(27.*o)); - yz_T = 0.0625*eps_new *(( 2.*axyz )/(27.*o)); - yz_NE = -(0.0625*eps_new *(( axyz + 3.*bxyz )/(54.*o))); - yz_SE = -(0.0625*eps_new *(( axyz - 3.*bxyz )/(54.*o))); - yz_TE = -(0.0625*eps_new *(( axyz + 3.*cxyz)/(54.*o))); - yz_BE = -(0.0625*eps_new *(( axyz - 3.*cxyz)/(54.*o))); - yz_TN = 0.0625*eps_new *(( axyz )/(27.*o)); - yz_BN = 0.0625*eps_new *(( axyz )/(27.*o)); - //yz_ZERO= 0.0625*eps_new; - yz_TNE = -(0.0625*eps_new *(( bxyz + cxyz)/(72.*o))); - yz_TSW = 0.0625*eps_new *(( - bxyz + cxyz)/(72.*o)); - yz_TSE = 0.0625*eps_new *(( bxyz - cxyz)/(72.*o)); - yz_TNW = 0.0625*eps_new *(( bxyz + cxyz)/(72.*o)); -} -////////////////////////////////////////////////////////////////////////// -void IncompressibleOffsetInterpolationProcessor::calcInterpolatedNode(LBMReal* f, LBMReal omega, LBMReal x, LBMReal y, LBMReal z, LBMReal press, LBMReal xs, LBMReal ys, LBMReal zs) -{ - using namespace D3Q27System; - - LBMReal rho = press ;//+ (2.*axx*x+axy*y+axz*z+axyz*y*z+ax + 2.*byy*y+bxy*x+byz*z+bxyz*x*z+by + 2.*czz*z+cxz*x+cyz*y+cxyz*x*y+cz)/3.; - LBMReal vx1 = a0 + 0.25*( xs*ax + ys*ay + zs*az) + 0.0625*(axx + xs*ys*axy + xs*zs*axz + ayy + ys*zs*ayz + azz) + 0.015625*(xs*ys*zs*axyz); - LBMReal vx2 = b0 + 0.25*( xs*bx + ys*by + zs*bz) + 0.0625*(bxx + xs*ys*bxy + xs*zs*bxz + byy + ys*zs*byz + bzz) + 0.015625*(xs*ys*zs*bxyz); - LBMReal vx3 = c0 + 0.25*( xs*cx + ys*cy + zs*cz) + 0.0625*(cxx + xs*ys*cxy + xs*zs*cxz + cyy + ys*zs*cyz + czz) + 0.015625*(xs*ys*zs*cxyz); - - ////////////////////////////////////////////////////////////////////////// - //DRAFT - //vx1 -= forcingF*0.5; - ////////////////////////////////////////////////////////////////////////// - - LBMReal feq[ENDF+1]; - D3Q27System::calcIncompFeq(feq,rho,vx1,vx2,vx3); - - f[E] = f_E + xs*x_E + ys*y_E + zs*z_E + xs*ys*xy_E + xs*zs*xz_E + ys*zs*yz_E + feq[E]; - f[W] = f_E + xs*x_E + ys*y_E + zs*z_E + xs*ys*xy_E + xs*zs*xz_E + ys*zs*yz_E + feq[W]; - f[N] = f_N + xs*x_N + ys*y_N + zs*z_N + xs*ys*xy_N + xs*zs*xz_N + ys*zs*yz_N + feq[N]; - f[S] = f_N + xs*x_N + ys*y_N + zs*z_N + xs*ys*xy_N + xs*zs*xz_N + ys*zs*yz_N + feq[S]; - f[T] = f_T + xs*x_T + ys*y_T + zs*z_T + xs*ys*xy_T + xs*zs*xz_T + ys*zs*yz_T + feq[T]; - f[B] = f_T + xs*x_T + ys*y_T + zs*z_T + xs*ys*xy_T + xs*zs*xz_T + ys*zs*yz_T + feq[B]; - f[NE] = f_NE + xs*x_NE + ys*y_NE + zs*z_NE + xs*ys*xy_NE + xs*zs*xz_NE + ys*zs*yz_NE + feq[NE]; - f[SW] = f_NE + xs*x_NE + ys*y_NE + zs*z_NE + xs*ys*xy_NE + xs*zs*xz_NE + ys*zs*yz_NE + feq[SW]; - f[SE] = f_SE + xs*x_SE + ys*y_SE + zs*z_SE + xs*ys*xy_SE + xs*zs*xz_SE + ys*zs*yz_SE + feq[SE]; - f[NW] = f_SE + xs*x_SE + ys*y_SE + zs*z_SE + xs*ys*xy_SE + xs*zs*xz_SE + ys*zs*yz_SE + feq[NW]; - f[TE] = f_TE + xs*x_TE + ys*y_TE + zs*z_TE + xs*ys*xy_TE + xs*zs*xz_TE + ys*zs*yz_TE + feq[TE]; - f[BW] = f_TE + xs*x_TE + ys*y_TE + zs*z_TE + xs*ys*xy_TE + xs*zs*xz_TE + ys*zs*yz_TE + feq[BW]; - f[BE] = f_BE + xs*x_BE + ys*y_BE + zs*z_BE + xs*ys*xy_BE + xs*zs*xz_BE + ys*zs*yz_BE + feq[BE]; - f[TW] = f_BE + xs*x_BE + ys*y_BE + zs*z_BE + xs*ys*xy_BE + xs*zs*xz_BE + ys*zs*yz_BE + feq[TW]; - f[TN] = f_TN + xs*x_TN + ys*y_TN + zs*z_TN + xs*ys*xy_TN + xs*zs*xz_TN + ys*zs*yz_TN + feq[TN]; - f[BS] = f_TN + xs*x_TN + ys*y_TN + zs*z_TN + xs*ys*xy_TN + xs*zs*xz_TN + ys*zs*yz_TN + feq[BS]; - f[BN] = f_BN + xs*x_BN + ys*y_BN + zs*z_BN + xs*ys*xy_BN + xs*zs*xz_BN + ys*zs*yz_BN + feq[BN]; - f[TS] = f_BN + xs*x_BN + ys*y_BN + zs*z_BN + xs*ys*xy_BN + xs*zs*xz_BN + ys*zs*yz_BN + feq[TS]; - f[TNE] = f_TNE + xs*x_TNE + ys*y_TNE + zs*z_TNE + xs*ys*xy_TNE + xs*zs*xz_TNE + ys*zs*yz_TNE + feq[TNE]; - f[TSW] = f_TSW + xs*x_TSW + ys*y_TSW + zs*z_TSW + xs*ys*xy_TSW + xs*zs*xz_TSW + ys*zs*yz_TSW + feq[TSW]; - f[TSE] = f_TSE + xs*x_TSE + ys*y_TSE + zs*z_TSE + xs*ys*xy_TSE + xs*zs*xz_TSE + ys*zs*yz_TSE + feq[TSE]; - f[TNW] = f_TNW + xs*x_TNW + ys*y_TNW + zs*z_TNW + xs*ys*xy_TNW + xs*zs*xz_TNW + ys*zs*yz_TNW + feq[TNW]; - f[BNE] = f_TSW + xs*x_TSW + ys*y_TSW + zs*z_TSW + xs*ys*xy_TSW + xs*zs*xz_TSW + ys*zs*yz_TSW + feq[BNE]; - f[BSW] = f_TNE + xs*x_TNE + ys*y_TNE + zs*z_TNE + xs*ys*xy_TNE + xs*zs*xz_TNE + ys*zs*yz_TNE + feq[BSW]; - f[BSE] = f_TNW + xs*x_TNW + ys*y_TNW + zs*z_TNW + xs*ys*xy_TNW + xs*zs*xz_TNW + ys*zs*yz_TNW + feq[BSE]; - f[BNW] = f_TSE + xs*x_TSE + ys*y_TSE + zs*z_TSE + xs*ys*xy_TSE + xs*zs*xz_TSE + ys*zs*yz_TSE + feq[BNW]; - f[ZERO] = f_ZERO + xs*x_ZERO + ys*y_ZERO + zs*z_ZERO + feq[ZERO]; -} -////////////////////////////////////////////////////////////////////////// -//Position SWB -0.25, -0.25, -0.25 -LBMReal IncompressibleOffsetInterpolationProcessor::calcPressBSW() -{ - return press_SWT * (0.140625 + 0.1875 * xoff + 0.1875 * yoff - 0.5625 * zoff) + - press_NWT * (0.046875 + 0.0625 * xoff - 0.1875 * yoff - 0.1875 * zoff) + - press_SET * (0.046875 - 0.1875 * xoff + 0.0625 * yoff - 0.1875 * zoff) + - press_NET * (0.015625 - 0.0625 * xoff - 0.0625 * yoff - 0.0625 * zoff) + - press_NEB * (0.046875 - 0.1875 * xoff - 0.1875 * yoff + 0.0625 * zoff) + - press_NWB * (0.140625 + 0.1875 * xoff - 0.5625 * yoff + 0.1875 * zoff) + - press_SEB * (0.140625 - 0.5625 * xoff + 0.1875 * yoff + 0.1875 * zoff) + - press_SWB * (0.421875 + 0.5625 * xoff + 0.5625 * yoff + 0.5625 * zoff); -} -////////////////////////////////////////////////////////////////////////// -//Position SWT -0.25, -0.25, 0.25 -LBMReal IncompressibleOffsetInterpolationProcessor::calcPressTSW() -{ - return press_SWT * (0.421875 + 0.5625 * xoff + 0.5625 * yoff - 0.5625 * zoff) + - press_NWT * (0.140625 + 0.1875 * xoff - 0.5625 * yoff - 0.1875 * zoff) + - press_SET * (0.140625 - 0.5625 * xoff + 0.1875 * yoff - 0.1875 * zoff) + - press_NET * (0.046875 - 0.1875 * xoff - 0.1875 * yoff - 0.0625 * zoff) + - press_NEB * (0.015625 - 0.0625 * xoff - 0.0625 * yoff + 0.0625 * zoff) + - press_NWB * (0.046875 + 0.0625 * xoff - 0.1875 * yoff + 0.1875 * zoff) + - press_SEB * (0.046875 - 0.1875 * xoff + 0.0625 * yoff + 0.1875 * zoff) + - press_SWB * (0.140625 + 0.1875 * xoff + 0.1875 * yoff + 0.5625 * zoff); -} -////////////////////////////////////////////////////////////////////////// -//Position SET 0.25, -0.25, 0.25 -LBMReal IncompressibleOffsetInterpolationProcessor::calcPressTSE() -{ - return press_SET * (0.421875 - 0.5625 * xoff + 0.5625 * yoff - 0.5625 * zoff) + - press_NET * (0.140625 - 0.1875 * xoff - 0.5625 * yoff - 0.1875 * zoff) + - press_SWT * (0.140625 + 0.5625 * xoff + 0.1875 * yoff - 0.1875 * zoff) + - press_NWT * (0.046875 + 0.1875 * xoff - 0.1875 * yoff - 0.0625 * zoff) + - press_NWB * (0.015625 + 0.0625 * xoff - 0.0625 * yoff + 0.0625 * zoff) + - press_NEB * (0.046875 - 0.0625 * xoff - 0.1875 * yoff + 0.1875 * zoff) + - press_SWB * (0.046875 + 0.1875 * xoff + 0.0625 * yoff + 0.1875 * zoff) + - press_SEB * (0.140625 - 0.1875 * xoff + 0.1875 * yoff + 0.5625 * zoff); -} -////////////////////////////////////////////////////////////////////////// -//Position SEB 0.25, -0.25, -0.25 -LBMReal IncompressibleOffsetInterpolationProcessor::calcPressBSE() -{ - return press_SET * (0.140625 - 0.1875 * xoff + 0.1875 * yoff - 0.5625 * zoff) + - press_NET * (0.046875 - 0.0625 * xoff - 0.1875 * yoff - 0.1875 * zoff) + - press_SWT * (0.046875 + 0.1875 * xoff + 0.0625 * yoff - 0.1875 * zoff) + - press_NWT * (0.015625 + 0.0625 * xoff - 0.0625 * yoff - 0.0625 * zoff) + - press_NWB * (0.046875 + 0.1875 * xoff - 0.1875 * yoff + 0.0625 * zoff) + - press_NEB * (0.140625 - 0.1875 * xoff - 0.5625 * yoff + 0.1875 * zoff) + - press_SWB * (0.140625 + 0.5625 * xoff + 0.1875 * yoff + 0.1875 * zoff) + - press_SEB * (0.421875 - 0.5625 * xoff + 0.5625 * yoff + 0.5625 * zoff); -} -////////////////////////////////////////////////////////////////////////// -//Position NWB -0.25, 0.25, -0.25 -LBMReal IncompressibleOffsetInterpolationProcessor::calcPressBNW() -{ - return press_NWT * (0.140625 + 0.1875 * xoff - 0.1875 * yoff - 0.5625 * zoff) + - press_NET * (0.046875 - 0.1875 * xoff - 0.0625 * yoff - 0.1875 * zoff) + - press_SWT * (0.046875 + 0.0625 * xoff + 0.1875 * yoff - 0.1875 * zoff) + - press_SET * (0.015625 - 0.0625 * xoff + 0.0625 * yoff - 0.0625 * zoff) + - press_SEB * (0.046875 - 0.1875 * xoff + 0.1875 * yoff + 0.0625 * zoff) + - press_NEB * (0.140625 - 0.5625 * xoff - 0.1875 * yoff + 0.1875 * zoff) + - press_SWB * (0.140625 + 0.1875 * xoff + 0.5625 * yoff + 0.1875 * zoff) + - press_NWB * (0.421875 + 0.5625 * xoff - 0.5625 * yoff + 0.5625 * zoff); -} -////////////////////////////////////////////////////////////////////////// -//Position NWT -0.25, 0.25, 0.25 -LBMReal IncompressibleOffsetInterpolationProcessor::calcPressTNW() -{ - return press_NWT * (0.421875 + 0.5625 * xoff - 0.5625 * yoff - 0.5625 * zoff) + - press_NET * (0.140625 - 0.5625 * xoff - 0.1875 * yoff - 0.1875 * zoff) + - press_SWT * (0.140625 + 0.1875 * xoff + 0.5625 * yoff - 0.1875 * zoff) + - press_SET * (0.046875 - 0.1875 * xoff + 0.1875 * yoff - 0.0625 * zoff) + - press_SEB * (0.015625 - 0.0625 * xoff + 0.0625 * yoff + 0.0625 * zoff) + - press_NEB * (0.046875 - 0.1875 * xoff - 0.0625 * yoff + 0.1875 * zoff) + - press_SWB * (0.046875 + 0.0625 * xoff + 0.1875 * yoff + 0.1875 * zoff) + - press_NWB * (0.140625 + 0.1875 * xoff - 0.1875 * yoff + 0.5625 * zoff); -} -////////////////////////////////////////////////////////////////////////// -//Position NET 0.25, 0.25, 0.25 -LBMReal IncompressibleOffsetInterpolationProcessor::calcPressTNE() -{ - return press_NET * (0.421875 - 0.5625 * xoff - 0.5625 * yoff - 0.5625 * zoff) + - press_NWT * (0.140625 + 0.5625 * xoff - 0.1875 * yoff - 0.1875 * zoff) + - press_SET * (0.140625 - 0.1875 * xoff + 0.5625 * yoff - 0.1875 * zoff) + - press_SWT * (0.046875 + 0.1875 * xoff + 0.1875 * yoff - 0.0625 * zoff) + - press_SWB * (0.015625 + 0.0625 * xoff + 0.0625 * yoff + 0.0625 * zoff) + - press_NWB * (0.046875 + 0.1875 * xoff - 0.0625 * yoff + 0.1875 * zoff) + - press_SEB * (0.046875 - 0.0625 * xoff + 0.1875 * yoff + 0.1875 * zoff) + - press_NEB * (0.140625 - 0.1875 * xoff - 0.1875 * yoff + 0.5625 * zoff); -} -////////////////////////////////////////////////////////////////////////// -//Position NEB 0.25, 0.25, -0.25 -LBMReal IncompressibleOffsetInterpolationProcessor::calcPressBNE() -{ - return press_NET * (0.140625 - 0.1875 * xoff - 0.1875 * yoff - 0.5625 * zoff) + - press_NWT * (0.046875 + 0.1875 * xoff - 0.0625 * yoff - 0.1875 * zoff) + - press_SET * (0.046875 - 0.0625 * xoff + 0.1875 * yoff - 0.1875 * zoff) + - press_SWT * (0.015625 + 0.0625 * xoff + 0.0625 * yoff - 0.0625 * zoff) + - press_SWB * (0.046875 + 0.1875 * xoff + 0.1875 * yoff + 0.0625 * zoff) + - press_NWB * (0.140625 + 0.5625 * xoff - 0.1875 * yoff + 0.1875 * zoff) + - press_SEB * (0.140625 - 0.1875 * xoff + 0.5625 * yoff + 0.1875 * zoff) + - press_NEB * (0.421875 - 0.5625 * xoff - 0.5625 * yoff + 0.5625 * zoff); -} -////////////////////////////////////////////////////////////////////////// -//Position C 0.0, 0.0, 0.0 -void IncompressibleOffsetInterpolationProcessor::calcInterpolatedNodeFC(LBMReal* f, LBMReal omega) -{ - using namespace D3Q27System; - - LBMReal press = press_NET * (0.125 - 0.25 * xoff - 0.25 * yoff - 0.25 * zoff) + - press_NWT * (0.125 + 0.25 * xoff - 0.25 * yoff - 0.25 * zoff) + - press_SET * (0.125 - 0.25 * xoff + 0.25 * yoff - 0.25 * zoff) + - press_SWT * (0.125 + 0.25 * xoff + 0.25 * yoff - 0.25 * zoff) + - press_NEB * (0.125 - 0.25 * xoff - 0.25 * yoff + 0.25 * zoff) + - press_NWB * (0.125 + 0.25 * xoff - 0.25 * yoff + 0.25 * zoff) + - press_SEB * (0.125 - 0.25 * xoff + 0.25 * yoff + 0.25 * zoff) + - press_SWB * (0.125 + 0.25 * xoff + 0.25 * yoff + 0.25 * zoff); - LBMReal vx1 = a0; - LBMReal vx2 = b0; - LBMReal vx3 = c0; - - LBMReal rho = press ;//+ (ax+by+cz)/3.; - - ////////////////////////////////////////////////////////////////////////// - //DRAFT - //vx1 -= forcingC*0.5; - ////////////////////////////////////////////////////////////////////////// - - LBMReal feq[ENDF+1]; - D3Q27System::calcIncompFeq(feq,rho,vx1,vx2,vx3); - - LBMReal eps_new = 2.; - LBMReal o = omega; - LBMReal op = 1.; - - //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)); - //f_N = f_E + eps_new *((2.*(ax - by))/(9.*o)); - //f_T = f_E + eps_new *((2.*(ax - cz))/(9.*o)); - //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)); - //f_SE = f_NE + eps_new *(( ay + bx )/(9.*o)); - //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)); - //f_BE = f_TE + eps_new *(( az + cx )/(9.*o)); - //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)); - //f_BN = f_TN + eps_new *(( bz + cy )/(9.*o)); - //f_ZERO = eps_new *((5.*(ax + by + cz))/(9.*op)); - //f_TNE = eps_new *(-(ay + az + bx + bz + cx + cy)/(72.*o)); - //f_TSW = - eps_new *((ay + bx)/(36.*o)) - f_TNE; - //f_TSE = - eps_new *((az + cx)/(36.*o)) - f_TNE; - //f_TNW = - eps_new *((bz + cy)/(36.*o)) - f_TNE; - - f_E = eps_new*((2*(-2*ax + by + cz-kxxMzzAverage-kxxMyyAverage))/(27.*o)); - f_N = eps_new*((2*(ax - 2*by + cz+2*kxxMyyAverage-kxxMzzAverage))/(27.*o)); - f_T = eps_new*((2*(ax + by - 2*cz-kxxMyyAverage+2*kxxMzzAverage))/(27.*o)); - f_NE = eps_new*(-(ax + 3*ay + 3*bx + by - 2*cz+2*kxxMyyAverage-kxxMyyAverage+3*kxyAverage)/(54.*o)); - f_SE = eps_new*(-(ax - 3*ay - 3*bx + by - 2*cz+2*kxxMyyAverage-kxxMyyAverage-3*kxyAverage)/(54.*o)); - f_TE = eps_new*(-(ax + 3*az - 2*by + 3*cx + cz+2*kxxMyyAverage-kxxMzzAverage+3*kxzAverage)/(54.*o)); - f_BE = eps_new*(-(ax - 3*az - 2*by - 3*cx + cz+2*kxxMyyAverage-kxxMzzAverage-3*kxzAverage)/(54.*o)); - f_TN = eps_new*(-(-2*ax + by + 3*bz + 3*cy + cz-kxxMyyAverage-kxxMzzAverage+3*kyzAverage)/(54.*o)); - f_BN = eps_new*(-(-2*ax + by - 3*bz - 3*cy + cz-kxxMyyAverage-kxxMzzAverage-3*kyzAverage)/(54.*o)); - f_ZERO = 0.; - f_TNE = eps_new*(-(ay + az + bx + bz + cx + cy+kxyAverage+kxzAverage+kyzAverage)/(72.*o)); - f_TSW = eps_new*((-ay + az - bx + bz + cx + cy-kxyAverage+kxzAverage+kyzAverage)/(72.*o)); - f_TSE = eps_new*((ay - az + bx + bz - cx + cy+kxyAverage-kxzAverage+kyzAverage)/(72.*o)); - f_TNW = eps_new*((ay + az + bx - bz + cx - cy+kxyAverage+kxzAverage-kyzAverage)/(72.*o)); - - f[E] = 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[ZERO] = f_ZERO + feq[ZERO]; -} -////////////////////////////////////////////////////////////////////////// -void IncompressibleOffsetInterpolationProcessor::calcInterpolatedVelocity(LBMReal x, LBMReal y, LBMReal z, LBMReal& vx1, LBMReal& vx2, LBMReal& vx3) -{ - vx1 = a0 + ax*x + ay*y + az*z + axx*x*x + ayy*y*y + azz*z*z + axy*x*y + axz*x*z + ayz*y*z+axyz*x*y*z; - vx2 = b0 + bx*x + by*y + bz*z + bxx*x*x + byy*y*y + bzz*z*z + bxy*x*y + bxz*x*z + byz*y*z+bxyz*x*y*z; - vx3 = c0 + cx*x + cy*y + cz*z + cxx*x*x + cyy*y*y + czz*z*z + cxy*x*y + cxz*x*z + cyz*y*z+cxyz*x*y*z; -} -////////////////////////////////////////////////////////////////////////// -void IncompressibleOffsetInterpolationProcessor::calcInterpolatedShearStress(LBMReal x, LBMReal y, LBMReal z,LBMReal& tauxx, LBMReal& tauyy, LBMReal& tauzz,LBMReal& tauxy, LBMReal& tauxz, LBMReal& tauyz) -{ - tauxx=ax+2*axx*x+axy*y+axz*z+axyz*y*z; - tauyy=by+2*byy*y+bxy*x+byz*z+bxyz*x*z; - tauzz=cz+2*czz*z+cxz*x+cyz*y+cxyz*x*y; - tauxy=0.5*((ay+2.0*ayy*y+axy*x+ayz*z+axyz*x*z)+(bx+2.0*bxx*x+bxy*y+bxz*z+bxyz*y*z)); - tauxz=0.5*((az+2.0*azz*z+axz*x+ayz*y+axyz*x*y)+(cx+2.0*cxx*x+cxy*y+cxz*z+cxyz*y*z)); - tauyz=0.5*((bz+2.0*bzz*z+bxz*x+byz*y+bxyz*x*y)+(cy+2.0*cyy*y+cxy*x+cyz*z+cxyz*x*z)); -} diff --git a/src/VirtualFluids/LBM/IncompressibleOffsetInterpolationProcessor.h b/src/VirtualFluids/LBM/IncompressibleOffsetInterpolationProcessor.h deleted file mode 100644 index ad3f3bf5d..000000000 --- a/src/VirtualFluids/LBM/IncompressibleOffsetInterpolationProcessor.h +++ /dev/null @@ -1,77 +0,0 @@ -#ifndef IncompressibleOffsetInterpolationProcessor_H_ -#define IncompressibleOffsetInterpolationProcessor_H_ - -#include "InterpolationProcessor.h" -#include "D3Q27System.h" - -////////////////////////////////////////////////////////////////////////// -//it works only for cascaded LBM -//super compact interpolation method by Martin Geier -////////////////////////////////////////////////////////////////////////// - -class IncompressibleOffsetInterpolationProcessor; -typedef std::shared_ptr<IncompressibleOffsetInterpolationProcessor> D3Q27IncompressibleOffsetInterpolationProcessorPtr; - -class IncompressibleOffsetInterpolationProcessor : public InterpolationProcessor -{ -public: - IncompressibleOffsetInterpolationProcessor(); - IncompressibleOffsetInterpolationProcessor(LBMReal omegaC, LBMReal omegaF); - virtual ~IncompressibleOffsetInterpolationProcessor(); - InterpolationProcessorPtr clone(); - void setOmegas(LBMReal omegaC, LBMReal omegaF); - void interpolateCoarseToFine(D3Q27ICell& icellC, D3Q27ICell& icellF); - void interpolateCoarseToFine(D3Q27ICell& icellC, D3Q27ICell& icellF, LBMReal xoff, LBMReal yoff, LBMReal zoff); - void interpolateFineToCoarse(D3Q27ICell& icellF, LBMReal* icellC); - void interpolateFineToCoarse(D3Q27ICell& icellF, LBMReal* icellC, LBMReal xoff, LBMReal yoff, LBMReal zoff); - //LBMReal forcingC, forcingF; -protected: -private: - LBMReal omegaC, omegaF; - LBMReal a0, ax, ay, az, axx, ayy, azz, axy, axz, ayz, b0, bx, by, bz, bxx, byy, bzz, bxy, bxz, byz, c0, cx, cy, cz, cxx, cyy, czz, cxy, cxz, cyz, axyz, bxyz, cxyz; - LBMReal xoff, yoff, zoff; - LBMReal xoff_sq, yoff_sq, zoff_sq; - LBMReal press_SWT, press_NWT, press_NET, press_SET, press_SWB, press_NWB, press_NEB, press_SEB; - - LBMReal f_E, f_N, f_T, f_NE, f_SE, f_BE, f_TE, f_TN, f_BN, f_TNE, f_TNW, f_TSE, f_TSW, f_ZERO; - LBMReal x_E, x_N, x_T, x_NE, x_SE, x_BE, x_TE, x_TN, x_BN, x_TNE, x_TNW, x_TSE, x_TSW, x_ZERO; - LBMReal y_E, y_N, y_T, y_NE, y_SE, y_BE, y_TE, y_TN, y_BN, y_TNE, y_TNW, y_TSE, y_TSW, y_ZERO; - LBMReal z_E, z_N, z_T, z_NE, z_SE, z_BE, z_TE, z_TN, z_BN, z_TNE, z_TNW, z_TSE, z_TSW, z_ZERO; - LBMReal xy_E, xy_N, xy_T, xy_NE, xy_SE, xy_BE, xy_TE, xy_TN, xy_BN, xy_TNE, xy_TNW, xy_TSE, xy_TSW/*, xy_ZERO*/; - LBMReal xz_E, xz_N, xz_T, xz_NE, xz_SE, xz_BE, xz_TE, xz_TN, xz_BN, xz_TNE, xz_TNW, xz_TSE, xz_TSW/*, xz_ZERO*/; - LBMReal yz_E, yz_N, yz_T, yz_NE, yz_SE, yz_BE, yz_TE, yz_TN, yz_BN, yz_TNE, yz_TNW, yz_TSE, yz_TSW/*, yz_ZERO*/; - - LBMReal kxyAverage, kyzAverage, kxzAverage, kxxMyyAverage, kxxMzzAverage; - - LBMReal a,b,c; - - void setOffsets(LBMReal xoff, LBMReal yoff, LBMReal zoff); - void calcMoments(const LBMReal* const f, LBMReal omega, LBMReal& rho, LBMReal& vx1, LBMReal& vx2, LBMReal& vx3, - LBMReal& kxy, LBMReal& kyz, LBMReal& kxz, LBMReal& kxxMyy, LBMReal& kxxMzz); - void calcInterpolatedCoefficiets(const D3Q27ICell& icell, LBMReal omega, LBMReal eps_new); - void calcInterpolatedNode(LBMReal* f, LBMReal omega, LBMReal x, LBMReal y, LBMReal z, LBMReal press, LBMReal xs, LBMReal ys, LBMReal zs); - LBMReal calcPressBSW(); - LBMReal calcPressTSW(); - LBMReal calcPressTSE(); - LBMReal calcPressBSE(); - LBMReal calcPressBNW(); - LBMReal calcPressTNW(); - LBMReal calcPressTNE(); - LBMReal calcPressBNE(); - void calcInterpolatedNodeFC(LBMReal* f, LBMReal omega); - void calcInterpolatedVelocity(LBMReal x, LBMReal y, LBMReal z,LBMReal& vx1, LBMReal& vx2, LBMReal& vx3); - void calcInterpolatedShearStress(LBMReal x, LBMReal y, LBMReal z,LBMReal& tauxx, LBMReal& tauyy, LBMReal& tauzz,LBMReal& tauxy, LBMReal& tauxz, LBMReal& tauyz); -}; - -////////////////////////////////////////////////////////////////////////// -inline void IncompressibleOffsetInterpolationProcessor::interpolateCoarseToFine(D3Q27ICell& icellC, D3Q27ICell& icellF) -{ - this->interpolateCoarseToFine(icellC, icellF, 0.0, 0.0, 0.0); -} -////////////////////////////////////////////////////////////////////////// -inline void IncompressibleOffsetInterpolationProcessor::interpolateFineToCoarse(D3Q27ICell& icellF, LBMReal* icellC) -{ - this->interpolateFineToCoarse(icellF, icellC, 0.0, 0.0, 0.0); -} - -#endif diff --git a/src/VirtualFluids/LBM/InitDensityLBMKernel.cpp b/src/VirtualFluids/LBM/InitDensityLBMKernel.cpp deleted file mode 100644 index a8f4aa4c0..000000000 --- a/src/VirtualFluids/LBM/InitDensityLBMKernel.cpp +++ /dev/null @@ -1,1080 +0,0 @@ -#include "InitDensityLBMKernel.h" -#include "D3Q27EsoTwist3DSplittedVector.h" -#include "BCProcessor.h" -#include "DataSet3D.h" -#include "BCArray3D.h" - -InitDensityLBMKernel::InitDensityLBMKernel() -{ -} - -InitDensityLBMKernel::~InitDensityLBMKernel() -{ -} - -InitDensityLBMKernel::InitDensityLBMKernel(int nx1, int nx2, int nx3) -{ - this->nx1 = nx1; - this->nx2 = nx2; - this->nx3 = nx3; - this->compressible = false; -} - -void InitDensityLBMKernel::calculate() -{ - collideAll(); -} - -LBMKernelPtr InitDensityLBMKernel::clone() -{ - LBMKernelPtr kernel(new InitDensityLBMKernel(nx1, nx2, nx3)); - std::dynamic_pointer_cast<InitDensityLBMKernel>(kernel)->init(); - kernel->setCollisionFactor(this->collFactor); - kernel->setBCProcessor(bcProcessor->clone(kernel)); - kernel->setWithForcing(withForcing); - kernel->setForcingX1(muForcingX1); - kernel->setForcingX2(muForcingX2); - kernel->setForcingX3(muForcingX3); - kernel->setIndex(ix1, ix2, ix3); - kernel->setDeltaT(deltaT); - std::dynamic_pointer_cast<InitDensityLBMKernel>(kernel)->OxyyMxzz = 1.0; - return kernel; -} - -void InitDensityLBMKernel::setVelocity(int x1, int x2, int x3, LBMReal vvx, LBMReal vvy, LBMReal vvz) -{ - v(0, x1, x2, x3) = vvx; - v(1, x1, x2, x3) = vvy; - v(2, x1, x2, x3) = vvz; -} - -double InitDensityLBMKernel::getCalculationTime() -{ - return 0; -} - -//void InitDensityLBMKernel::collideAll() -//{ -// using namespace D3Q27System; -// -// localDistributions = std::dynamic_pointer_cast<D3Q27EsoTwist3DSplittedVector>(dataSet->getFdistributions())->getLocalDistributions(); -// nonLocalDistributions = std::dynamic_pointer_cast<D3Q27EsoTwist3DSplittedVector>(dataSet->getFdistributions())->getNonLocalDistributions(); -// zeroDistributions = std::dynamic_pointer_cast<D3Q27EsoTwist3DSplittedVector>(dataSet->getFdistributions())->getZeroDistributions(); -// -// BCArray3D<D3Q27BoundaryCondition>& bcArray = std::dynamic_pointer_cast<D3Q27ETBCProcessor>(this->getBCProcessor())->getBCArray(); -// -// const int bcArrayMaxX1 = (int)bcArray->getNX1(); -// const int bcArrayMaxX2 = (int)bcArray->getNX2(); -// const int bcArrayMaxX3 = (int)bcArray->getNX3(); -// -// int minX1 = ghostLayerWidth; -// int minX2 = ghostLayerWidth; -// int minX3 = ghostLayerWidth; -// int maxX1 = bcArrayMaxX1-ghostLayerWidth; -// int maxX2 = bcArrayMaxX2-ghostLayerWidth; -// int maxX3 = bcArrayMaxX3-ghostLayerWidth; -// -// -// for (int x3 = minX3; x3<maxX3; x3++) -// { -// for (int x2 = minX2; x2<maxX2; x2++) -// { -// for (int x1 = minX1; x1<maxX1; x1++) -// { -// if (!bcArray->isSolid(x1, x2, x3)&&!bcArray->isUndefined(x1, x2, x3)) -// { -// int x1p = x1+1; -// int x2p = x2+1; -// int x3p = x3+1; -// ////////////////////////////////////////////////////////////////////////// -// //read distribution -// //////////////////////////////////////////////////////////////////////////// -// ////////////////////////////////////////////////////////////////////////// -// -// //E N T -// //c c c -// ////////// -// //W S B -// //a a a -// -// //Rest ist b -// -// //mfxyz -// //a - negative -// //b - null -// //c - positive -// -// // a b c -// //-1 0 1 -// -// LBMReal mfcbb = (*this->localDistributions)(D3Q27System::ET_E, x1, x2, x3); -// LBMReal mfbcb = (*this->localDistributions)(D3Q27System::ET_N, x1, x2, x3); -// LBMReal mfbbc = (*this->localDistributions)(D3Q27System::ET_T, x1, x2, x3); -// LBMReal mfccb = (*this->localDistributions)(D3Q27System::ET_NE, x1, x2, x3); -// LBMReal mfacb = (*this->localDistributions)(D3Q27System::ET_NW, x1p, x2, x3); -// LBMReal mfcbc = (*this->localDistributions)(D3Q27System::ET_TE, x1, x2, x3); -// LBMReal mfabc = (*this->localDistributions)(D3Q27System::ET_TW, x1p, x2, x3); -// LBMReal mfbcc = (*this->localDistributions)(D3Q27System::ET_TN, x1, x2, x3); -// LBMReal mfbac = (*this->localDistributions)(D3Q27System::ET_TS, x1, x2p, x3); -// LBMReal mfccc = (*this->localDistributions)(D3Q27System::ET_TNE, x1, x2, x3); -// LBMReal mfacc = (*this->localDistributions)(D3Q27System::ET_TNW, x1p, x2, x3); -// LBMReal mfcac = (*this->localDistributions)(D3Q27System::ET_TSE, x1, x2p, x3); -// LBMReal mfaac = (*this->localDistributions)(D3Q27System::ET_TSW, x1p, x2p, x3); -// -// LBMReal mfabb = (*this->nonLocalDistributions)(D3Q27System::ET_W, x1p, x2, x3); -// LBMReal mfbab = (*this->nonLocalDistributions)(D3Q27System::ET_S, x1, x2p, x3); -// LBMReal mfbba = (*this->nonLocalDistributions)(D3Q27System::ET_B, x1, x2, x3p); -// LBMReal mfaab = (*this->nonLocalDistributions)(D3Q27System::ET_SW, x1p, x2p, x3); -// LBMReal mfcab = (*this->nonLocalDistributions)(D3Q27System::ET_SE, x1, x2p, x3); -// LBMReal mfaba = (*this->nonLocalDistributions)(D3Q27System::ET_BW, x1p, x2, x3p); -// LBMReal mfcba = (*this->nonLocalDistributions)(D3Q27System::ET_BE, x1, x2, x3p); -// LBMReal mfbaa = (*this->nonLocalDistributions)(D3Q27System::ET_BS, x1, x2p, x3p); -// LBMReal mfbca = (*this->nonLocalDistributions)(D3Q27System::ET_BN, x1, x2, x3p); -// LBMReal mfaaa = (*this->nonLocalDistributions)(D3Q27System::ET_BSW, x1p, x2p, x3p); -// LBMReal mfcaa = (*this->nonLocalDistributions)(D3Q27System::ET_BSE, x1, x2p, x3p); -// LBMReal mfaca = (*this->nonLocalDistributions)(D3Q27System::ET_BNW, x1p, x2, x3p); -// LBMReal mfcca = (*this->nonLocalDistributions)(D3Q27System::ET_BNE, x1, x2, x3p); -// -// LBMReal mfbbb = (*this->zeroDistributions)(x1, x2, x3); -// -// LBMReal m0, m1, m2; -// -// LBMReal rho = (mfaaa+mfaac+mfaca+mfcaa+mfacc+mfcac+mfccc+mfcca) -// +(mfaab+mfacb+mfcab+mfccb)+(mfaba+mfabc+mfcba+mfcbc)+(mfbaa+mfbac+mfbca+mfbcc) -// +(mfabb+mfcbb)+(mfbab+mfbcb)+(mfbba+mfbbc)+mfbbb; -// -// //LBMReal vvx = ((((mfccc-mfaaa)+(mfcac-mfaca))+((mfcaa-mfacc)+(mfcca-mfaac)))+ -// // (((mfcba-mfabc)+(mfcbc-mfaba))+((mfcab-mfacb)+(mfccb-mfaab)))+ -// // (mfcbb-mfabb)); -// //LBMReal vvy = ((((mfccc-mfaaa)+(mfaca-mfcac))+((mfacc-mfcaa)+(mfcca-mfaac)))+ -// // (((mfbca-mfbac)+(mfbcc-mfbaa))+((mfacb-mfcab)+(mfccb-mfaab)))+ -// // (mfbcb-mfbab)); -// //LBMReal vvz = ((((mfccc-mfaaa)+(mfcac-mfaca))+((mfacc-mfcaa)+(mfaac-mfcca)))+ -// // (((mfbac-mfbca)+(mfbcc-mfbaa))+((mfabc-mfcba)+(mfcbc-mfaba)))+ -// // (mfbbc-mfbba)); -// -// LBMReal vvx = v(0,x1,x2,x3); -// LBMReal vvy = v(1,x1,x2,x3); -// LBMReal vvz = v(2,x1,x2,x3); -// //LBMReal rho = v(3,x1,x2,x3); -// -// LBMReal oMdrho; -// -// oMdrho = mfccc+mfaaa; -// m0 = mfaca+mfcac; -// m1 = mfacc+mfcaa; -// m2 = mfaac+mfcca; -// oMdrho += m0; -// m1 += m2; -// oMdrho += m1; -// m0 = mfbac+mfbca; -// m1 = mfbaa+mfbcc; -// m0 += m1; -// m1 = mfabc+mfcba; -// m2 = mfaba+mfcbc; -// m1 += m2; -// m0 += m1; -// m1 = mfacb+mfcab; -// m2 = mfaab+mfccb; -// m1 += m2; -// m0 += m1; -// oMdrho += m0; -// m0 = mfabb+mfcbb; -// m1 = mfbab+mfbcb; -// m2 = mfbba+mfbbc; -// m0 += m1+m2; -// m0 += mfbbb; //hat gefehlt -// oMdrho = 1.-(oMdrho+m0); -// -// LBMReal vx2; -// LBMReal vy2; -// LBMReal vz2; -// vx2 = vvx*vvx; -// vy2 = vvy*vvy; -// vz2 = vvz*vvz; -// //////////////////////////////////////////////////////////////////////////////////// -// LBMReal wadjust; -// LBMReal qudricLimit = 0.01; -// //////////////////////////////////////////////////////////////////////////////////// -// //Hin -// //////////////////////////////////////////////////////////////////////////////////// -// // mit 1/36, 1/9, 1/36, 1/9, 4/9, 1/9, 1/36, 1/9, 1/36 Konditionieren -// //////////////////////////////////////////////////////////////////////////////////// -// // Z - Dir -// m2 = mfaaa+mfaac; -// m1 = mfaac-mfaaa; -// m0 = m2+mfaab; -// mfaaa = m0; -// m0 += c1o36 * oMdrho; -// mfaab = m1-m0 * vvz; -// mfaac = m2-2. * m1 * vvz+vz2 * m0; -// //////////////////////////////////////////////////////////////////////////////////// -// m2 = mfaba+mfabc; -// m1 = mfabc-mfaba; -// m0 = m2+mfabb; -// mfaba = m0; -// m0 += c1o9 * oMdrho; -// mfabb = m1-m0 * vvz; -// mfabc = m2-2. * m1 * vvz+vz2 * m0; -// //////////////////////////////////////////////////////////////////////////////////// -// m2 = mfaca+mfacc; -// m1 = mfacc-mfaca; -// m0 = m2+mfacb; -// mfaca = m0; -// m0 += c1o36 * oMdrho; -// mfacb = m1-m0 * vvz; -// mfacc = m2-2. * m1 * vvz+vz2 * m0; -// //////////////////////////////////////////////////////////////////////////////////// -// //////////////////////////////////////////////////////////////////////////////////// -// m2 = mfbaa+mfbac; -// m1 = mfbac-mfbaa; -// m0 = m2+mfbab; -// mfbaa = m0; -// m0 += c1o9 * oMdrho; -// mfbab = m1-m0 * vvz; -// mfbac = m2-2. * m1 * vvz+vz2 * m0; -// //////////////////////////////////////////////////////////////////////////////////// -// m2 = mfbba+mfbbc; -// m1 = mfbbc-mfbba; -// m0 = m2+mfbbb; -// mfbba = m0; -// m0 += c4o9 * oMdrho; -// mfbbb = m1-m0 * vvz; -// mfbbc = m2-2. * m1 * vvz+vz2 * m0; -// //////////////////////////////////////////////////////////////////////////////////// -// m2 = mfbca+mfbcc; -// m1 = mfbcc-mfbca; -// m0 = m2+mfbcb; -// mfbca = m0; -// m0 += c1o9 * oMdrho; -// mfbcb = m1-m0 * vvz; -// mfbcc = m2-2. * m1 * vvz+vz2 * m0; -// //////////////////////////////////////////////////////////////////////////////////// -// //////////////////////////////////////////////////////////////////////////////////// -// m2 = mfcaa+mfcac; -// m1 = mfcac-mfcaa; -// m0 = m2+mfcab; -// mfcaa = m0; -// m0 += c1o36 * oMdrho; -// mfcab = m1-m0 * vvz; -// mfcac = m2-2. * m1 * vvz+vz2 * m0; -// //////////////////////////////////////////////////////////////////////////////////// -// m2 = mfcba+mfcbc; -// m1 = mfcbc-mfcba; -// m0 = m2+mfcbb; -// mfcba = m0; -// m0 += c1o9 * oMdrho; -// mfcbb = m1-m0 * vvz; -// mfcbc = m2-2. * m1 * vvz+vz2 * m0; -// //////////////////////////////////////////////////////////////////////////////////// -// m2 = mfcca+mfccc; -// m1 = mfccc-mfcca; -// m0 = m2+mfccb; -// mfcca = m0; -// m0 += c1o36 * oMdrho; -// mfccb = m1-m0 * vvz; -// mfccc = m2-2. * m1 * vvz+vz2 * m0; -// //////////////////////////////////////////////////////////////////////////////////// -// //////////////////////////////////////////////////////////////////////////////////// -// // mit 1/6, 0, 1/18, 2/3, 0, 2/9, 1/6, 0, 1/18 Konditionieren -// //////////////////////////////////////////////////////////////////////////////////// -// // Y - Dir -// m2 = mfaaa+mfaca; -// m1 = mfaca-mfaaa; -// m0 = m2+mfaba; -// mfaaa = m0; -// m0 += c1o6 * oMdrho; -// mfaba = m1-m0 * vvy; -// mfaca = m2-2. * m1 * vvy+vy2 * m0; -// //////////////////////////////////////////////////////////////////////////////////// -// m2 = mfaab+mfacb; -// m1 = mfacb-mfaab; -// m0 = m2+mfabb; -// mfaab = m0; -// mfabb = m1-m0 * vvy; -// mfacb = m2-2. * m1 * vvy+vy2 * m0; -// //////////////////////////////////////////////////////////////////////////////////// -// m2 = mfaac+mfacc; -// m1 = mfacc-mfaac; -// m0 = m2+mfabc; -// mfaac = m0; -// m0 += c1o18 * oMdrho; -// mfabc = m1-m0 * vvy; -// mfacc = m2-2. * m1 * vvy+vy2 * m0; -// //////////////////////////////////////////////////////////////////////////////////// -// //////////////////////////////////////////////////////////////////////////////////// -// m2 = mfbaa+mfbca; -// m1 = mfbca-mfbaa; -// m0 = m2+mfbba; -// mfbaa = m0; -// m0 += c2o3 * oMdrho; -// mfbba = m1-m0 * vvy; -// mfbca = m2-2. * m1 * vvy+vy2 * m0; -// //////////////////////////////////////////////////////////////////////////////////// -// m2 = mfbab+mfbcb; -// m1 = mfbcb-mfbab; -// m0 = m2+mfbbb; -// mfbab = m0; -// mfbbb = m1-m0 * vvy; -// mfbcb = m2-2. * m1 * vvy+vy2 * m0; -// //////////////////////////////////////////////////////////////////////////////////// -// m2 = mfbac+mfbcc; -// m1 = mfbcc-mfbac; -// m0 = m2+mfbbc; -// mfbac = m0; -// m0 += c2o9 * oMdrho; -// mfbbc = m1-m0 * vvy; -// mfbcc = m2-2. * m1 * vvy+vy2 * m0; -// //////////////////////////////////////////////////////////////////////////////////// -// //////////////////////////////////////////////////////////////////////////////////// -// m2 = mfcaa+mfcca; -// m1 = mfcca-mfcaa; -// m0 = m2+mfcba; -// mfcaa = m0; -// m0 += c1o6 * oMdrho; -// mfcba = m1-m0 * vvy; -// mfcca = m2-2. * m1 * vvy+vy2 * m0; -// //////////////////////////////////////////////////////////////////////////////////// -// m2 = mfcab+mfccb; -// m1 = mfccb-mfcab; -// m0 = m2+mfcbb; -// mfcab = m0; -// mfcbb = m1-m0 * vvy; -// mfccb = m2-2. * m1 * vvy+vy2 * m0; -// //////////////////////////////////////////////////////////////////////////////////// -// m2 = mfcac+mfccc; -// m1 = mfccc-mfcac; -// m0 = m2+mfcbc; -// mfcac = m0; -// m0 += c1o18 * oMdrho; -// mfcbc = m1-m0 * vvy; -// mfccc = m2-2. * m1 * vvy+vy2 * m0; -// //////////////////////////////////////////////////////////////////////////////////// -// //////////////////////////////////////////////////////////////////////////////////// -// // mit 1, 0, 1/3, 0, 0, 0, 1/3, 0, 1/9 Konditionieren -// //////////////////////////////////////////////////////////////////////////////////// -// // X - Dir -// m2 = mfaaa+mfcaa; -// m1 = mfcaa-mfaaa; -// m0 = m2+mfbaa; -// mfaaa = m0; -// m0 += 1. * oMdrho; -// mfbaa = m1-m0 * vvx; -// mfcaa = m2-2. * m1 * vvx+vx2 * m0; -// //////////////////////////////////////////////////////////////////////////////////// -// m2 = mfaba+mfcba; -// m1 = mfcba-mfaba; -// m0 = m2+mfbba; -// mfaba = m0; -// mfbba = m1-m0 * vvx; -// mfcba = m2-2. * m1 * vvx+vx2 * m0; -// //////////////////////////////////////////////////////////////////////////////////// -// m2 = mfaca+mfcca; -// m1 = mfcca-mfaca; -// m0 = m2+mfbca; -// mfaca = m0; -// m0 += c1o3 * oMdrho; -// mfbca = m1-m0 * vvx; -// mfcca = m2-2. * m1 * vvx+vx2 * m0; -// //////////////////////////////////////////////////////////////////////////////////// -// //////////////////////////////////////////////////////////////////////////////////// -// m2 = mfaab+mfcab; -// m1 = mfcab-mfaab; -// m0 = m2+mfbab; -// mfaab = m0; -// mfbab = m1-m0 * vvx; -// mfcab = m2-2. * m1 * vvx+vx2 * m0; -// //////////////////////////////////////////////////////////////////////////////////// -// m2 = mfabb+mfcbb; -// m1 = mfcbb-mfabb; -// m0 = m2+mfbbb; -// mfabb = m0; -// mfbbb = m1-m0 * vvx; -// mfcbb = m2-2. * m1 * vvx+vx2 * m0; -// //////////////////////////////////////////////////////////////////////////////////// -// m2 = mfacb+mfccb; -// m1 = mfccb-mfacb; -// m0 = m2+mfbcb; -// mfacb = m0; -// mfbcb = m1-m0 * vvx; -// mfccb = m2-2. * m1 * vvx+vx2 * m0; -// //////////////////////////////////////////////////////////////////////////////////// -// //////////////////////////////////////////////////////////////////////////////////// -// m2 = mfaac+mfcac; -// m1 = mfcac-mfaac; -// m0 = m2+mfbac; -// mfaac = m0; -// m0 += c1o3 * oMdrho; -// mfbac = m1-m0 * vvx; -// mfcac = m2-2. * m1 * vvx+vx2 * m0; -// //////////////////////////////////////////////////////////////////////////////////// -// m2 = mfabc+mfcbc; -// m1 = mfcbc-mfabc; -// m0 = m2+mfbbc; -// mfabc = m0; -// mfbbc = m1-m0 * vvx; -// mfcbc = m2-2. * m1 * vvx+vx2 * m0; -// //////////////////////////////////////////////////////////////////////////////////// -// m2 = mfacc+mfccc; -// m1 = mfccc-mfacc; -// m0 = m2+mfbcc; -// mfacc = m0; -// m0 += c1o9 * oMdrho; -// mfbcc = m1-m0 * vvx; -// mfccc = m2-2. * m1 * vvx+vx2 * m0; -// //////////////////////////////////////////////////////////////////////////////////// -// // Cumulants -// //////////////////////////////////////////////////////////////////////////////////// -// LBMReal OxxPyyPzz = 1.; //omega2 or bulk viscosity -// LBMReal OxyyPxzz = 1.;//-s9;//2+s9;// -// //LBMReal OxyyMxzz = 1.;//2+s9;// -// LBMReal O4 = 1.; -// LBMReal O5 = 1.; -// LBMReal O6 = 1.; -// -// //Cum 4. -// //LBMReal CUMcbb = mfcbb - ((mfcaa + c1o3 * oMdrho) * mfabb + 2. * mfbba * mfbab); // till 18.05.2015 -// //LBMReal CUMbcb = mfbcb - ((mfaca + c1o3 * oMdrho) * mfbab + 2. * mfbba * mfabb); // till 18.05.2015 -// //LBMReal CUMbbc = mfbbc - ((mfaac + c1o3 * oMdrho) * mfbba + 2. * mfbab * mfabb); // till 18.05.2015 -// -// LBMReal CUMcbb = mfcbb-((mfcaa+c1o3) * mfabb+2. * mfbba * mfbab); -// LBMReal CUMbcb = mfbcb-((mfaca+c1o3) * mfbab+2. * mfbba * mfabb); -// LBMReal CUMbbc = mfbbc-((mfaac+c1o3) * mfbba+2. * mfbab * mfabb); -// -// LBMReal CUMcca = mfcca-((mfcaa * mfaca+2. * mfbba * mfbba)+c1o3 * (mfcaa+mfaca) * oMdrho+c1o9*(oMdrho-1)*oMdrho); -// LBMReal CUMcac = mfcac-((mfcaa * mfaac+2. * mfbab * mfbab)+c1o3 * (mfcaa+mfaac) * oMdrho+c1o9*(oMdrho-1)*oMdrho); -// LBMReal CUMacc = mfacc-((mfaac * mfaca+2. * mfabb * mfabb)+c1o3 * (mfaac+mfaca) * oMdrho+c1o9*(oMdrho-1)*oMdrho); -// -// //Cum 5. -// LBMReal CUMbcc = mfbcc-(mfaac * mfbca+mfaca * mfbac+4. * mfabb * mfbbb+2. * (mfbab * mfacb+mfbba * mfabc))-c1o3 * (mfbca+mfbac) * oMdrho; -// LBMReal CUMcbc = mfcbc-(mfaac * mfcba+mfcaa * mfabc+4. * mfbab * mfbbb+2. * (mfabb * mfcab+mfbba * mfbac))-c1o3 * (mfcba+mfabc) * oMdrho; -// LBMReal CUMccb = mfccb-(mfcaa * mfacb+mfaca * mfcab+4. * mfbba * mfbbb+2. * (mfbab * mfbca+mfabb * mfcba))-c1o3 * (mfacb+mfcab) * oMdrho; -// -// //Cum 6. -// LBMReal CUMccc = mfccc+((-4. * mfbbb * mfbbb -// -(mfcaa * mfacc+mfaca * mfcac+mfaac * mfcca) -// -4. * (mfabb * mfcbb+mfbab * mfbcb+mfbba * mfbbc) -// -2. * (mfbca * mfbac+mfcba * mfabc+mfcab * mfacb)) -// +(4. * (mfbab * mfbab * mfaca+mfabb * mfabb * mfcaa+mfbba * mfbba * mfaac) -// +2. * (mfcaa * mfaca * mfaac) -// +16. * mfbba * mfbab * mfabb) -// -c1o3* (mfacc+mfcac+mfcca) * oMdrho-c1o9*oMdrho*oMdrho -// -c1o9* (mfcaa+mfaca+mfaac) * oMdrho*(1.-2.* oMdrho)-c1o27* oMdrho * oMdrho*(-2.* oMdrho) -// +(2. * (mfbab * mfbab+mfabb * mfabb+mfbba * mfbba) -// +(mfaac * mfaca+mfaac * mfcaa+mfaca * mfcaa)) * c2o3*oMdrho)+c1o27*oMdrho; -// -// //2. -// // linear combinations -// LBMReal mxxPyyPzz = mfcaa+mfaca+mfaac; -// LBMReal mxxMyy = mfcaa-mfaca; -// LBMReal mxxMzz = mfcaa-mfaac; -// -// LBMReal dxux = -c1o2 * collFactor *(mxxMyy+mxxMzz)+c1o2 * OxxPyyPzz*(mfaaa-mxxPyyPzz); -// LBMReal dyuy = dxux+collFactor * c3o2 * mxxMyy; -// LBMReal dzuz = dxux+collFactor * c3o2 * mxxMzz; -// -// //relax -// mxxPyyPzz += OxxPyyPzz*(mfaaa-mxxPyyPzz)-3. * (1.-c1o2 * OxxPyyPzz) * (vx2 * dxux+vy2 * dyuy+vz2 * dzuz); -// mxxMyy += collFactor * (-mxxMyy)-3. * (1.-c1o2 * collFactor) * (vx2 * dxux-vy2 * dyuy); -// mxxMzz += collFactor * (-mxxMzz)-3. * (1.-c1o2 * collFactor) * (vx2 * dxux-vz2 * dzuz); -// -// mfabb += collFactor * (-mfabb); -// mfbab += collFactor * (-mfbab); -// mfbba += collFactor * (-mfbba); -// -// // linear combinations back -// mfcaa = c1o3 * (mxxMyy+mxxMzz+mxxPyyPzz); -// mfaca = c1o3 * (-2. * mxxMyy+mxxMzz+mxxPyyPzz); -// mfaac = c1o3 * (mxxMyy-2. * mxxMzz+mxxPyyPzz); -// -// //3. -// // linear combinations -// LBMReal mxxyPyzz = mfcba+mfabc; -// LBMReal mxxyMyzz = mfcba-mfabc; -// -// LBMReal mxxzPyyz = mfcab+mfacb; -// LBMReal mxxzMyyz = mfcab-mfacb; -// -// LBMReal mxyyPxzz = mfbca+mfbac; -// LBMReal mxyyMxzz = mfbca-mfbac; -// -// //relax -// wadjust = OxyyMxzz+(1.-OxyyMxzz)*fabs(mfbbb)/(fabs(mfbbb)+qudricLimit); -// mfbbb += wadjust * (-mfbbb); -// wadjust = OxyyPxzz+(1.-OxyyPxzz)*fabs(mxxyPyzz)/(fabs(mxxyPyzz)+qudricLimit); -// mxxyPyzz += wadjust * (-mxxyPyzz); -// wadjust = OxyyMxzz+(1.-OxyyMxzz)*fabs(mxxyMyzz)/(fabs(mxxyMyzz)+qudricLimit); -// mxxyMyzz += wadjust * (-mxxyMyzz); -// wadjust = OxyyPxzz+(1.-OxyyPxzz)*fabs(mxxzPyyz)/(fabs(mxxzPyyz)+qudricLimit); -// mxxzPyyz += wadjust * (-mxxzPyyz); -// wadjust = OxyyMxzz+(1.-OxyyMxzz)*fabs(mxxzMyyz)/(fabs(mxxzMyyz)+qudricLimit); -// mxxzMyyz += wadjust * (-mxxzMyyz); -// wadjust = OxyyPxzz+(1.-OxyyPxzz)*fabs(mxyyPxzz)/(fabs(mxyyPxzz)+qudricLimit); -// mxyyPxzz += wadjust * (-mxyyPxzz); -// wadjust = OxyyMxzz+(1.-OxyyMxzz)*fabs(mxyyMxzz)/(fabs(mxyyMxzz)+qudricLimit); -// mxyyMxzz += wadjust * (-mxyyMxzz); -// -// // linear combinations back -// mfcba = (mxxyMyzz+mxxyPyzz) * c1o2; -// mfabc = (-mxxyMyzz+mxxyPyzz) * c1o2; -// mfcab = (mxxzMyyz+mxxzPyyz) * c1o2; -// mfacb = (-mxxzMyyz+mxxzPyyz) * c1o2; -// mfbca = (mxyyMxzz+mxyyPxzz) * c1o2; -// mfbac = (-mxyyMxzz+mxyyPxzz) * c1o2; -// -// //4. -// CUMacc += O4 * (-CUMacc); -// CUMcac += O4 * (-CUMcac); -// CUMcca += O4 * (-CUMcca); -// -// CUMbbc += O4 * (-CUMbbc); -// CUMbcb += O4 * (-CUMbcb); -// CUMcbb += O4 * (-CUMcbb); -// -// //5. -// CUMbcc += O5 * (-CUMbcc); -// CUMcbc += O5 * (-CUMcbc); -// CUMccb += O5 * (-CUMccb); -// -// //6. -// CUMccc += O6 * (-CUMccc); -// -// //back cumulants to central moments -// //4. -// //mfcbb = CUMcbb + ((mfcaa + c1o3 * oMdrho) * mfabb + 2. * mfbba * mfbab); // till 18.05.2015 -// //mfbcb = CUMbcb + ((mfaca + c1o3 * oMdrho) * mfbab + 2. * mfbba * mfabb); // till 18.05.2015 -// //mfbbc = CUMbbc + ((mfaac + c1o3 * oMdrho) * mfbba + 2. * mfbab * mfabb); // till 18.05.2015 -// -// mfcbb = CUMcbb+((mfcaa+c1o3) * mfabb+2. * mfbba * mfbab); -// mfbcb = CUMbcb+((mfaca+c1o3) * mfbab+2. * mfbba * mfabb); -// mfbbc = CUMbbc+((mfaac+c1o3) * mfbba+2. * mfbab * mfabb); -// -// mfcca = CUMcca+(mfcaa * mfaca+2. * mfbba * mfbba)+c1o3 * (mfcaa+mfaca) * oMdrho+c1o9*(oMdrho-1)*oMdrho; -// mfcac = CUMcac+(mfcaa * mfaac+2. * mfbab * mfbab)+c1o3 * (mfcaa+mfaac) * oMdrho+c1o9*(oMdrho-1)*oMdrho; -// mfacc = CUMacc+(mfaac * mfaca+2. * mfabb * mfabb)+c1o3 * (mfaac+mfaca) * oMdrho+c1o9*(oMdrho-1)*oMdrho; -// -// //5. -// mfbcc = CUMbcc+(mfaac * mfbca+mfaca * mfbac+4. * mfabb * mfbbb+2. * (mfbab * mfacb+mfbba * mfabc))+c1o3 * (mfbca+mfbac) * oMdrho; -// mfcbc = CUMcbc+(mfaac * mfcba+mfcaa * mfabc+4. * mfbab * mfbbb+2. * (mfabb * mfcab+mfbba * mfbac))+c1o3 * (mfcba+mfabc) * oMdrho; -// mfccb = CUMccb+(mfcaa * mfacb+mfaca * mfcab+4. * mfbba * mfbbb+2. * (mfbab * mfbca+mfabb * mfcba))+c1o3 * (mfacb+mfcab) * oMdrho; -// -// //6. -// mfccc = CUMccc-((-4. * mfbbb * mfbbb -// -(mfcaa * mfacc+mfaca * mfcac+mfaac * mfcca) -// -4. * (mfabb * mfcbb+mfbac * mfbca+mfbba * mfbbc) -// -2. * (mfbca * mfbac+mfcba * mfabc+mfcab * mfacb)) -// +(4. * (mfbab * mfbab * mfaca+mfabb * mfabb * mfcaa+mfbba * mfbba * mfaac) -// +2. * (mfcaa * mfaca * mfaac) -// +16. * mfbba * mfbab * mfabb) -// -c1o3* (mfacc+mfcac+mfcca) * oMdrho-c1o9*oMdrho*oMdrho -// -c1o9* (mfcaa+mfaca+mfaac) * oMdrho*(1.-2.* oMdrho)-c1o27* oMdrho * oMdrho*(-2.* oMdrho) -// +(2. * (mfbab * mfbab+mfabb * mfabb+mfbba * mfbba) -// +(mfaac * mfaca+mfaac * mfcaa+mfaca * mfcaa)) * c2o3*oMdrho)-c1o27*oMdrho; -// -// mfaab = 0.0; -// mfaba = 0.0; -// mfbaa = 0.0; -// -// //mfaab *= -0.5; -// //mfaba *= -0.5; -// //mfbaa *= -0.5; -// -// -// //////////////////////////////////////////////////////////////////////////////////// -// //back -// //////////////////////////////////////////////////////////////////////////////////// -// //mit 1, 0, 1/3, 0, 0, 0, 1/3, 0, 1/9 Konditionieren -// //////////////////////////////////////////////////////////////////////////////////// -// // Z - Dir -// m0 = mfaac * c1o2+mfaab * (vvz-c1o2)+(mfaaa+1. * oMdrho) * (vz2-vvz) * c1o2; -// m1 = -mfaac-2. * mfaab * vvz+mfaaa * (1.-vz2)-1. * oMdrho * vz2; -// m2 = mfaac * c1o2+mfaab * (vvz+c1o2)+(mfaaa+1. * oMdrho) * (vz2+vvz) * c1o2; -// mfaaa = m0; -// mfaab = m1; -// mfaac = m2; -// //////////////////////////////////////////////////////////////////////////////////// -// m0 = mfabc * c1o2+mfabb * (vvz-c1o2)+mfaba * (vz2-vvz) * c1o2; -// m1 = -mfabc-2. * mfabb * vvz+mfaba * (1.-vz2); -// m2 = mfabc * c1o2+mfabb * (vvz+c1o2)+mfaba * (vz2+vvz) * c1o2; -// mfaba = m0; -// mfabb = m1; -// mfabc = m2; -// //////////////////////////////////////////////////////////////////////////////////// -// m0 = mfacc * c1o2+mfacb * (vvz-c1o2)+(mfaca+c1o3 * oMdrho) * (vz2-vvz) * c1o2; -// m1 = -mfacc-2. * mfacb * vvz+mfaca * (1.-vz2)-c1o3 * oMdrho * vz2; -// m2 = mfacc * c1o2+mfacb * (vvz+c1o2)+(mfaca+c1o3 * oMdrho) * (vz2+vvz) * c1o2; -// mfaca = m0; -// mfacb = m1; -// mfacc = m2; -// //////////////////////////////////////////////////////////////////////////////////// -// //////////////////////////////////////////////////////////////////////////////////// -// m0 = mfbac * c1o2+mfbab * (vvz-c1o2)+mfbaa * (vz2-vvz) * c1o2; -// m1 = -mfbac-2. * mfbab * vvz+mfbaa * (1.-vz2); -// m2 = mfbac * c1o2+mfbab * (vvz+c1o2)+mfbaa * (vz2+vvz) * c1o2; -// mfbaa = m0; -// mfbab = m1; -// mfbac = m2; -// /////////b////////////////////////////////////////////////////////////////////////// -// m0 = mfbbc * c1o2+mfbbb * (vvz-c1o2)+mfbba * (vz2-vvz) * c1o2; -// m1 = -mfbbc-2. * mfbbb * vvz+mfbba * (1.-vz2); -// m2 = mfbbc * c1o2+mfbbb * (vvz+c1o2)+mfbba * (vz2+vvz) * c1o2; -// mfbba = m0; -// mfbbb = m1; -// mfbbc = m2; -// /////////b////////////////////////////////////////////////////////////////////////// -// m0 = mfbcc * c1o2+mfbcb * (vvz-c1o2)+mfbca * (vz2-vvz) * c1o2; -// m1 = -mfbcc-2. * mfbcb * vvz+mfbca * (1.-vz2); -// m2 = mfbcc * c1o2+mfbcb * (vvz+c1o2)+mfbca * (vz2+vvz) * c1o2; -// mfbca = m0; -// mfbcb = m1; -// mfbcc = m2; -// //////////////////////////////////////////////////////////////////////////////////// -// //////////////////////////////////////////////////////////////////////////////////// -// m0 = mfcac * c1o2+mfcab * (vvz-c1o2)+(mfcaa+c1o3 * oMdrho) * (vz2-vvz) * c1o2; -// m1 = -mfcac-2. * mfcab * vvz+mfcaa * (1.-vz2)-c1o3 * oMdrho * vz2; -// m2 = mfcac * c1o2+mfcab * (vvz+c1o2)+(mfcaa+c1o3 * oMdrho) * (vz2+vvz) * c1o2; -// mfcaa = m0; -// mfcab = m1; -// mfcac = m2; -// /////////c////////////////////////////////////////////////////////////////////////// -// m0 = mfcbc * c1o2+mfcbb * (vvz-c1o2)+mfcba * (vz2-vvz) * c1o2; -// m1 = -mfcbc-2. * mfcbb * vvz+mfcba * (1.-vz2); -// m2 = mfcbc * c1o2+mfcbb * (vvz+c1o2)+mfcba * (vz2+vvz) * c1o2; -// mfcba = m0; -// mfcbb = m1; -// mfcbc = m2; -// /////////c////////////////////////////////////////////////////////////////////////// -// m0 = mfccc * c1o2+mfccb * (vvz-c1o2)+(mfcca+c1o9 * oMdrho) * (vz2-vvz) * c1o2; -// m1 = -mfccc-2. * mfccb * vvz+mfcca * (1.-vz2)-c1o9 * oMdrho * vz2; -// m2 = mfccc * c1o2+mfccb * (vvz+c1o2)+(mfcca+c1o9 * oMdrho) * (vz2+vvz) * c1o2; -// mfcca = m0; -// mfccb = m1; -// mfccc = m2; -// //////////////////////////////////////////////////////////////////////////////////// -// //////////////////////////////////////////////////////////////////////////////////// -// //mit 1/6, 2/3, 1/6, 0, 0, 0, 1/18, 2/9, 1/18 Konditionieren -// //////////////////////////////////////////////////////////////////////////////////// -// // Y - Dir -// m0 = mfaca * c1o2+mfaba * (vvy-c1o2)+(mfaaa+c1o6 * oMdrho) * (vy2-vvy) * c1o2; -// m1 = -mfaca-2. * mfaba * vvy+mfaaa * (1.-vy2)-c1o6 * oMdrho * vy2; -// m2 = mfaca * c1o2+mfaba * (vvy+c1o2)+(mfaaa+c1o6 * oMdrho) * (vy2+vvy) * c1o2; -// mfaaa = m0; -// mfaba = m1; -// mfaca = m2; -// //////////////////////////////////////////////////////////////////////////////////// -// m0 = mfacb * c1o2+mfabb * (vvy-c1o2)+(mfaab+c2o3 * oMdrho) * (vy2-vvy) * c1o2; -// m1 = -mfacb-2. * mfabb * vvy+mfaab * (1.-vy2)-c2o3 * oMdrho * vy2; -// m2 = mfacb * c1o2+mfabb * (vvy+c1o2)+(mfaab+c2o3 * oMdrho) * (vy2+vvy) * c1o2; -// mfaab = m0; -// mfabb = m1; -// mfacb = m2; -// //////////////////////////////////////////////////////////////////////////////////// -// m0 = mfacc * c1o2+mfabc * (vvy-c1o2)+(mfaac+c1o6 * oMdrho) * (vy2-vvy) * c1o2; -// m1 = -mfacc-2. * mfabc * vvy+mfaac * (1.-vy2)-c1o6 * oMdrho * vy2; -// m2 = mfacc * c1o2+mfabc * (vvy+c1o2)+(mfaac+c1o6 * oMdrho) * (vy2+vvy) * c1o2; -// mfaac = m0; -// mfabc = m1; -// mfacc = m2; -// //////////////////////////////////////////////////////////////////////////////////// -// //////////////////////////////////////////////////////////////////////////////////// -// m0 = mfbca * c1o2+mfbba * (vvy-c1o2)+mfbaa * (vy2-vvy) * c1o2; -// m1 = -mfbca-2. * mfbba * vvy+mfbaa * (1.-vy2); -// m2 = mfbca * c1o2+mfbba * (vvy+c1o2)+mfbaa * (vy2+vvy) * c1o2; -// mfbaa = m0; -// mfbba = m1; -// mfbca = m2; -// /////////b////////////////////////////////////////////////////////////////////////// -// m0 = mfbcb * c1o2+mfbbb * (vvy-c1o2)+mfbab * (vy2-vvy) * c1o2; -// m1 = -mfbcb-2. * mfbbb * vvy+mfbab * (1.-vy2); -// m2 = mfbcb * c1o2+mfbbb * (vvy+c1o2)+mfbab * (vy2+vvy) * c1o2; -// mfbab = m0; -// mfbbb = m1; -// mfbcb = m2; -// /////////b////////////////////////////////////////////////////////////////////////// -// m0 = mfbcc * c1o2+mfbbc * (vvy-c1o2)+mfbac * (vy2-vvy) * c1o2; -// m1 = -mfbcc-2. * mfbbc * vvy+mfbac * (1.-vy2); -// m2 = mfbcc * c1o2+mfbbc * (vvy+c1o2)+mfbac * (vy2+vvy) * c1o2; -// mfbac = m0; -// mfbbc = m1; -// mfbcc = m2; -// //////////////////////////////////////////////////////////////////////////////////// -// //////////////////////////////////////////////////////////////////////////////////// -// m0 = mfcca * c1o2+mfcba * (vvy-c1o2)+(mfcaa+c1o18 * oMdrho) * (vy2-vvy) * c1o2; -// m1 = -mfcca-2. * mfcba * vvy+mfcaa * (1.-vy2)-c1o18 * oMdrho * vy2; -// m2 = mfcca * c1o2+mfcba * (vvy+c1o2)+(mfcaa+c1o18 * oMdrho) * (vy2+vvy) * c1o2; -// mfcaa = m0; -// mfcba = m1; -// mfcca = m2; -// /////////c////////////////////////////////////////////////////////////////////////// -// m0 = mfccb * c1o2+mfcbb * (vvy-c1o2)+(mfcab+c2o9 * oMdrho) * (vy2-vvy) * c1o2; -// m1 = -mfccb-2. * mfcbb * vvy+mfcab * (1.-vy2)-c2o9 * oMdrho * vy2; -// m2 = mfccb * c1o2+mfcbb * (vvy+c1o2)+(mfcab+c2o9 * oMdrho) * (vy2+vvy) * c1o2; -// mfcab = m0; -// mfcbb = m1; -// mfccb = m2; -// /////////c////////////////////////////////////////////////////////////////////////// -// m0 = mfccc * c1o2+mfcbc * (vvy-c1o2)+(mfcac+c1o18 * oMdrho) * (vy2-vvy) * c1o2; -// m1 = -mfccc-2. * mfcbc * vvy+mfcac * (1.-vy2)-c1o18 * oMdrho * vy2; -// m2 = mfccc * c1o2+mfcbc * (vvy+c1o2)+(mfcac+c1o18 * oMdrho) * (vy2+vvy) * c1o2; -// mfcac = m0; -// mfcbc = m1; -// mfccc = m2; -// //////////////////////////////////////////////////////////////////////////////////// -// //////////////////////////////////////////////////////////////////////////////////// -// //mit 1/36, 1/9, 1/36, 1/9, 4/9, 1/9, 1/36, 1/9, 1/36 Konditionieren -// //////////////////////////////////////////////////////////////////////////////////// -// // X - Dir -// m0 = mfcaa * c1o2+mfbaa * (vvx-c1o2)+(mfaaa+c1o36 * oMdrho) * (vx2-vvx) * c1o2; -// m1 = -mfcaa-2. * mfbaa * vvx+mfaaa * (1.-vx2)-c1o36 * oMdrho * vx2; -// m2 = mfcaa * c1o2+mfbaa * (vvx+c1o2)+(mfaaa+c1o36 * oMdrho) * (vx2+vvx) * c1o2; -// mfaaa = m0; -// mfbaa = m1; -// mfcaa = m2; -// //////////////////////////////////////////////////////////////////////////////////// -// m0 = mfcba * c1o2+mfbba * (vvx-c1o2)+(mfaba+c1o9 * oMdrho) * (vx2-vvx) * c1o2; -// m1 = -mfcba-2. * mfbba * vvx+mfaba * (1.-vx2)-c1o9 * oMdrho * vx2; -// m2 = mfcba * c1o2+mfbba * (vvx+c1o2)+(mfaba+c1o9 * oMdrho) * (vx2+vvx) * c1o2; -// mfaba = m0; -// mfbba = m1; -// mfcba = m2; -// //////////////////////////////////////////////////////////////////////////////////// -// m0 = mfcca * c1o2+mfbca * (vvx-c1o2)+(mfaca+c1o36 * oMdrho) * (vx2-vvx) * c1o2; -// m1 = -mfcca-2. * mfbca * vvx+mfaca * (1.-vx2)-c1o36 * oMdrho * vx2; -// m2 = mfcca * c1o2+mfbca * (vvx+c1o2)+(mfaca+c1o36 * oMdrho) * (vx2+vvx) * c1o2; -// mfaca = m0; -// mfbca = m1; -// mfcca = m2; -// //////////////////////////////////////////////////////////////////////////////////// -// //////////////////////////////////////////////////////////////////////////////////// -// m0 = mfcab * c1o2+mfbab * (vvx-c1o2)+(mfaab+c1o9 * oMdrho) * (vx2-vvx) * c1o2; -// m1 = -mfcab-2. * mfbab * vvx+mfaab * (1.-vx2)-c1o9 * oMdrho * vx2; -// m2 = mfcab * c1o2+mfbab * (vvx+c1o2)+(mfaab+c1o9 * oMdrho) * (vx2+vvx) * c1o2; -// mfaab = m0; -// mfbab = m1; -// mfcab = m2; -// ///////////b//////////////////////////////////////////////////////////////////////// -// m0 = mfcbb * c1o2+mfbbb * (vvx-c1o2)+(mfabb+c4o9 * oMdrho) * (vx2-vvx) * c1o2; -// m1 = -mfcbb-2. * mfbbb * vvx+mfabb * (1.-vx2)-c4o9 * oMdrho * vx2; -// m2 = mfcbb * c1o2+mfbbb * (vvx+c1o2)+(mfabb+c4o9 * oMdrho) * (vx2+vvx) * c1o2; -// mfabb = m0; -// mfbbb = m1; -// mfcbb = m2; -// ///////////b//////////////////////////////////////////////////////////////////////// -// m0 = mfccb * c1o2+mfbcb * (vvx-c1o2)+(mfacb+c1o9 * oMdrho) * (vx2-vvx) * c1o2; -// m1 = -mfccb-2. * mfbcb * vvx+mfacb * (1.-vx2)-c1o9 * oMdrho * vx2; -// m2 = mfccb * c1o2+mfbcb * (vvx+c1o2)+(mfacb+c1o9 * oMdrho) * (vx2+vvx) * c1o2; -// mfacb = m0; -// mfbcb = m1; -// mfccb = m2; -// //////////////////////////////////////////////////////////////////////////////////// -// //////////////////////////////////////////////////////////////////////////////////// -// m0 = mfcac * c1o2+mfbac * (vvx-c1o2)+(mfaac+c1o36 * oMdrho) * (vx2-vvx) * c1o2; -// m1 = -mfcac-2. * mfbac * vvx+mfaac * (1.-vx2)-c1o36 * oMdrho * vx2; -// m2 = mfcac * c1o2+mfbac * (vvx+c1o2)+(mfaac+c1o36 * oMdrho) * (vx2+vvx) * c1o2; -// mfaac = m0; -// mfbac = m1; -// mfcac = m2; -// ///////////c//////////////////////////////////////////////////////////////////////// -// m0 = mfcbc * c1o2+mfbbc * (vvx-c1o2)+(mfabc+c1o9 * oMdrho) * (vx2-vvx) * c1o2; -// m1 = -mfcbc-2. * mfbbc * vvx+mfabc * (1.-vx2)-c1o9 * oMdrho * vx2; -// m2 = mfcbc * c1o2+mfbbc * (vvx+c1o2)+(mfabc+c1o9 * oMdrho) * (vx2+vvx) * c1o2; -// mfabc = m0; -// mfbbc = m1; -// mfcbc = m2; -// ///////////c//////////////////////////////////////////////////////////////////////// -// m0 = mfccc * c1o2+mfbcc * (vvx-c1o2)+(mfacc+c1o36 * oMdrho) * (vx2-vvx) * c1o2; -// m1 = -mfccc-2. * mfbcc * vvx+mfacc * (1.-vx2)-c1o36 * oMdrho * vx2; -// m2 = mfccc * c1o2+mfbcc * (vvx+c1o2)+(mfacc+c1o36 * oMdrho) * (vx2+vvx) * c1o2; -// mfacc = m0; -// mfbcc = m1; -// mfccc = m2; -// -// ////////////////////////////////////////////////////////////////////////// -// //proof correctness -// ////////////////////////////////////////////////////////////////////////// -//#ifdef PROOF_CORRECTNESS -// LBMReal rho_post = (mfaaa+mfaac+mfaca+mfcaa+mfacc+mfcac+mfccc+mfcca) -// +(mfaab+mfacb+mfcab+mfccb)+(mfaba+mfabc+mfcba+mfcbc)+(mfbaa+mfbac+mfbca+mfbcc) -// +(mfabb+mfcbb)+(mfbab+mfbcb)+(mfbba+mfbbc)+mfbbb; -// //LBMReal dif = fabs(rho - rho_post); -// LBMReal dif = rho-rho_post; -//#ifdef SINGLEPRECISION -// if (dif>10.0E-7||dif<-10.0E-7) -//#else -// if (dif>10.0E-15||dif<-10.0E-15) -//#endif -// { -// UB_THROW(UbException(UB_EXARGS, "rho="+UbSystem::toString(rho)+", rho_post="+UbSystem::toString(rho_post) -// +" dif="+UbSystem::toString(dif) -// +" rho is not correct for node "+UbSystem::toString(x1)+","+UbSystem::toString(x2)+","+UbSystem::toString(x3))); -// //UBLOG(logERROR,"LBMKernel3DCCLB::collideAll(): rho is not correct for node "+UbSystem::toString(x1)+","+UbSystem::toString(x2)+","+UbSystem::toString(x3)); -// //exit(EXIT_FAILURE); -// } -//#endif -// //////////////////////////////////////////////////////////////////////////// -// ////write distribution -// //////////////////////////////////////////////////////////////////////////// -// (*this->localDistributions)(D3Q27System::ET_E, x1, x2, x3) = mfabb; -// (*this->localDistributions)(D3Q27System::ET_N, x1, x2, x3) = mfbab; -// (*this->localDistributions)(D3Q27System::ET_T, x1, x2, x3) = mfbba; -// (*this->localDistributions)(D3Q27System::ET_NE, x1, x2, x3) = mfaab; -// (*this->localDistributions)(D3Q27System::ET_NW, x1p, x2, x3) = mfcab; -// (*this->localDistributions)(D3Q27System::ET_TE, x1, x2, x3) = mfaba; -// (*this->localDistributions)(D3Q27System::ET_TW, x1p, x2, x3) = mfcba; -// (*this->localDistributions)(D3Q27System::ET_TN, x1, x2, x3) = mfbaa; -// (*this->localDistributions)(D3Q27System::ET_TS, x1, x2p, x3) = mfbca; -// (*this->localDistributions)(D3Q27System::ET_TNE, x1, x2, x3) = mfaaa; -// (*this->localDistributions)(D3Q27System::ET_TNW, x1p, x2, x3) = mfcaa; -// (*this->localDistributions)(D3Q27System::ET_TSE, x1, x2p, x3) = mfaca; -// (*this->localDistributions)(D3Q27System::ET_TSW, x1p, x2p, x3) = mfcca; -// -// (*this->nonLocalDistributions)(D3Q27System::ET_W, x1p, x2, x3) = mfcbb; -// (*this->nonLocalDistributions)(D3Q27System::ET_S, x1, x2p, x3) = mfbcb; -// (*this->nonLocalDistributions)(D3Q27System::ET_B, x1, x2, x3p) = mfbbc; -// (*this->nonLocalDistributions)(D3Q27System::ET_SW, x1p, x2p, x3) = mfccb; -// (*this->nonLocalDistributions)(D3Q27System::ET_SE, x1, x2p, x3) = mfacb; -// (*this->nonLocalDistributions)(D3Q27System::ET_BW, x1p, x2, x3p) = mfcbc; -// (*this->nonLocalDistributions)(D3Q27System::ET_BE, x1, x2, x3p) = mfabc; -// (*this->nonLocalDistributions)(D3Q27System::ET_BS, x1, x2p, x3p) = mfbcc; -// (*this->nonLocalDistributions)(D3Q27System::ET_BN, x1, x2, x3p) = mfbac; -// (*this->nonLocalDistributions)(D3Q27System::ET_BSW, x1p, x2p, x3p) = mfccc; -// (*this->nonLocalDistributions)(D3Q27System::ET_BSE, x1, x2p, x3p) = mfacc; -// (*this->nonLocalDistributions)(D3Q27System::ET_BNW, x1p, x2, x3p) = mfcac; -// (*this->nonLocalDistributions)(D3Q27System::ET_BNE, x1, x2, x3p) = mfaac; -// -// (*this->zeroDistributions)(x1, x2, x3) = mfbbb; -// //////////////////////////////////////////////////////////////////////////// -// -// } -// } -// } -// } -// -//} - -void InitDensityLBMKernel::init() -{ - DistributionArray3DPtr d(new D3Q27EsoTwist3DSplittedVector(nx1+2, nx2+2, nx3+2, -999.0)); - dataSet->setFdistributions(d); - v.resize(3, nx1+2, nx2+2, nx3+2); - -} - - -void InitDensityLBMKernel::collideAll() -{ - using namespace D3Q27System; - - localDistributions = std::dynamic_pointer_cast<D3Q27EsoTwist3DSplittedVector>(dataSet->getFdistributions())->getLocalDistributions(); - nonLocalDistributions = std::dynamic_pointer_cast<D3Q27EsoTwist3DSplittedVector>(dataSet->getFdistributions())->getNonLocalDistributions(); - zeroDistributions = std::dynamic_pointer_cast<D3Q27EsoTwist3DSplittedVector>(dataSet->getFdistributions())->getZeroDistributions(); - - BCArray3DPtr bcArray = this->getBCProcessor()->getBCArray(); - BoundaryConditionsPtr bcPtr; - LBMReal f[D3Q27System::ENDF+1]; - LBMReal feq[D3Q27System::ENDF+1]; - LBMReal drho, vx1, vx2, vx3; - const int bcArrayMaxX1 = (int)bcArray->getNX1(); - const int bcArrayMaxX2 = (int)bcArray->getNX2(); - const int bcArrayMaxX3 = (int)bcArray->getNX3(); - - int minX1 = ghostLayerWidth; - int minX2 = ghostLayerWidth; - int minX3 = ghostLayerWidth; - int maxX1 = bcArrayMaxX1-ghostLayerWidth; - int maxX2 = bcArrayMaxX2-ghostLayerWidth; - int maxX3 = bcArrayMaxX3-ghostLayerWidth; - - //collFactor = 1.0/(1.0/2.0+1.0/sqrt(6.0)); - collFactor = 1.0; - - for (int x3 = minX3; x3<maxX3; x3++) - { - for (int x2 = minX2; x2<maxX2; x2++) - { - for (int x1 = minX1; x1<maxX1; x1++) - { - if (!bcArray->isSolid(x1, x2, x3)&&!bcArray->isUndefined(x1, x2, x3)) - { - int x1p = x1+1; - int x2p = x2+1; - int x3p = x3+1; - ////////////////////////////////////////////////////////////////////////// - //read distribution - //////////////////////////////////////////////////////////////////////////// - f[ZERO] = (*this->zeroDistributions)(x1, x2, x3); - - f[E] = (*this->localDistributions)(D3Q27System::ET_E, x1, x2, x3); - f[N] = (*this->localDistributions)(D3Q27System::ET_N, x1, x2, x3); - f[T] = (*this->localDistributions)(D3Q27System::ET_T, x1, x2, x3); - f[NE] = (*this->localDistributions)(D3Q27System::ET_NE, x1, x2, x3); - f[NW] = (*this->localDistributions)(D3Q27System::ET_NW, x1p, x2, x3); - f[TE] = (*this->localDistributions)(D3Q27System::ET_TE, x1, x2, x3); - f[TW] = (*this->localDistributions)(D3Q27System::ET_TW, x1p, x2, x3); - f[TN] = (*this->localDistributions)(D3Q27System::ET_TN, x1, x2, x3); - f[TS] = (*this->localDistributions)(D3Q27System::ET_TS, x1, x2p, x3); - f[TNE] = (*this->localDistributions)(D3Q27System::ET_TNE, x1, x2, x3); - f[TNW] = (*this->localDistributions)(D3Q27System::ET_TNW, x1p, x2, x3); - f[TSE] = (*this->localDistributions)(D3Q27System::ET_TSE, x1, x2p, x3); - f[TSW] = (*this->localDistributions)(D3Q27System::ET_TSW, x1p, x2p, x3); - - f[W] = (*this->nonLocalDistributions)(D3Q27System::ET_W, x1p, x2, x3); - f[S] = (*this->nonLocalDistributions)(D3Q27System::ET_S, x1, x2p, x3); - f[B] = (*this->nonLocalDistributions)(D3Q27System::ET_B, x1, x2, x3p); - f[SW] = (*this->nonLocalDistributions)(D3Q27System::ET_SW, x1p, x2p, x3); - f[SE] = (*this->nonLocalDistributions)(D3Q27System::ET_SE, x1, x2p, x3); - f[BW] = (*this->nonLocalDistributions)(D3Q27System::ET_BW, x1p, x2, x3p); - f[BE] = (*this->nonLocalDistributions)(D3Q27System::ET_BE, x1, x2, x3p); - f[BS] = (*this->nonLocalDistributions)(D3Q27System::ET_BS, x1, x2p, x3p); - f[BN] = (*this->nonLocalDistributions)(D3Q27System::ET_BN, x1, x2, x3p); - f[BSW] = (*this->nonLocalDistributions)(D3Q27System::ET_BSW, x1p, x2p, x3p); - f[BSE] = (*this->nonLocalDistributions)(D3Q27System::ET_BSE, x1, x2p, x3p); - f[BNW] = (*this->nonLocalDistributions)(D3Q27System::ET_BNW, x1p, x2, x3p); - f[BNE] = (*this->nonLocalDistributions)(D3Q27System::ET_BNE, x1, x2, x3p); - ////////////////////////////////////////////////////////////////////////// - - drho = ((f[TNE]+f[BSW])+(f[TSE]+f[BNW]))+((f[BSE]+f[TNW])+(f[TSW]+f[BNE])) - +(((f[NE]+f[SW])+(f[SE]+f[NW]))+((f[TE]+f[BW])+(f[BE]+f[TW])) - +((f[BN]+f[TS])+(f[TN]+f[BS])))+((f[E]+f[W])+(f[N]+f[S]) - +(f[T]+f[B]))+f[ZERO]; - - //vx1 = ((((f[TNE]-f[BSW])+(f[TSE]-f[BNW]))+((f[BSE]-f[TNW])+(f[BNE]-f[TSW])))+ - // (((f[BE]-f[TW])+(f[TE]-f[BW]))+((f[SE]-f[NW])+(f[NE]-f[SW])))+ - // (f[E]-f[W])); - - //vx2 = ((((f[TNE]-f[BSW])+(f[BNW]-f[TSE]))+((f[TNW]-f[BSE])+(f[BNE]-f[TSW])))+ - // (((f[BN]-f[TS])+(f[TN]-f[BS]))+((f[NW]-f[SE])+(f[NE]-f[SW])))+ - // (f[N]-f[S])); - - //vx3 = ((((f[TNE]-f[BSW])+(f[TSE]-f[BNW]))+((f[TNW]-f[BSE])+(f[TSW]-f[BNE])))+ - // (((f[TS]-f[BN])+(f[TN]-f[BS]))+((f[TW]-f[BE])+(f[TE]-f[BW])))+ - // (f[T]-f[B])); - - vx1 = v(0,x1,x2,x3); - vx2 = v(1,x1,x2,x3); - vx3 = v(2,x1,x2,x3); - - //LBMReal vvx = v(0,x1,x2,x3); - //LBMReal vvy = v(1,x1,x2,x3); - //LBMReal vvz = v(2,x1,x2,x3); - - //vx1 = vx1+(vvx-vx1); - //vx2 = vx2+(vvy-vx2); - //vx3 = vx3+(vvz-vx3); - - LBMReal cu_sq = 1.5*(vx1*vx1+vx2*vx2+vx3*vx3); - - feq[ZERO] = c8o27*(drho-cu_sq); - feq[E] = c2o27*(drho+3.0*(vx1)+c9o2*(vx1)*(vx1)-cu_sq); - feq[W] = c2o27*(drho+3.0*(-vx1)+c9o2*(-vx1)*(-vx1)-cu_sq); - feq[N] = c2o27*(drho+3.0*(vx2)+c9o2*(vx2)*(vx2)-cu_sq); - feq[S] = c2o27*(drho+3.0*(-vx2)+c9o2*(-vx2)*(-vx2)-cu_sq); - feq[T] = c2o27*(drho+3.0*(vx3)+c9o2*(vx3)*(vx3)-cu_sq); - feq[B] = c2o27*(drho+3.0*(-vx3)+c9o2*(-vx3)*(-vx3)-cu_sq); - feq[NE] = c1o54*(drho+3.0*(vx1+vx2)+c9o2*(vx1+vx2)*(vx1+vx2)-cu_sq); - feq[SW] = c1o54*(drho+3.0*(-vx1-vx2)+c9o2*(-vx1-vx2)*(-vx1-vx2)-cu_sq); - feq[SE] = c1o54*(drho+3.0*(vx1-vx2)+c9o2*(vx1-vx2)*(vx1-vx2)-cu_sq); - feq[NW] = c1o54*(drho+3.0*(-vx1+vx2)+c9o2*(-vx1+vx2)*(-vx1+vx2)-cu_sq); - feq[TE] = c1o54*(drho+3.0*(vx1+vx3)+c9o2*(vx1+vx3)*(vx1+vx3)-cu_sq); - feq[BW] = c1o54*(drho+3.0*(-vx1-vx3)+c9o2*(-vx1-vx3)*(-vx1-vx3)-cu_sq); - feq[BE] = c1o54*(drho+3.0*(vx1-vx3)+c9o2*(vx1-vx3)*(vx1-vx3)-cu_sq); - feq[TW] = c1o54*(drho+3.0*(-vx1+vx3)+c9o2*(-vx1+vx3)*(-vx1+vx3)-cu_sq); - feq[TN] = c1o54*(drho+3.0*(vx2+vx3)+c9o2*(vx2+vx3)*(vx2+vx3)-cu_sq); - feq[BS] = c1o54*(drho+3.0*(-vx2-vx3)+c9o2*(-vx2-vx3)*(-vx2-vx3)-cu_sq); - feq[BN] = c1o54*(drho+3.0*(vx2-vx3)+c9o2*(vx2-vx3)*(vx2-vx3)-cu_sq); - feq[TS] = c1o54*(drho+3.0*(-vx2+vx3)+c9o2*(-vx2+vx3)*(-vx2+vx3)-cu_sq); - feq[TNE] = c1o216*(drho+3.0*(vx1+vx2+vx3)+c9o2*(vx1+vx2+vx3)*(vx1+vx2+vx3)-cu_sq); - feq[BSW] = c1o216*(drho+3.0*(-vx1-vx2-vx3)+c9o2*(-vx1-vx2-vx3)*(-vx1-vx2-vx3)-cu_sq); - feq[BNE] = c1o216*(drho+3.0*(vx1+vx2-vx3)+c9o2*(vx1+vx2-vx3)*(vx1+vx2-vx3)-cu_sq); - feq[TSW] = c1o216*(drho+3.0*(-vx1-vx2+vx3)+c9o2*(-vx1-vx2+vx3)*(-vx1-vx2+vx3)-cu_sq); - feq[TSE] = c1o216*(drho+3.0*(vx1-vx2+vx3)+c9o2*(vx1-vx2+vx3)*(vx1-vx2+vx3)-cu_sq); - feq[BNW] = c1o216*(drho+3.0*(-vx1+vx2-vx3)+c9o2*(-vx1+vx2-vx3)*(-vx1+vx2-vx3)-cu_sq); - feq[BSE] = c1o216*(drho+3.0*(vx1-vx2-vx3)+c9o2*(vx1-vx2-vx3)*(vx1-vx2-vx3)-cu_sq); - feq[TNW] = c1o216*(drho+3.0*(-vx1+vx2+vx3)+c9o2*(-vx1+vx2+vx3)*(-vx1+vx2+vx3)-cu_sq); - - //Relaxation - f[ZERO] += (feq[ZERO]-f[ZERO])*collFactor; - f[E] += (feq[E]-f[E])*collFactor; - f[W] += (feq[W]-f[W])*collFactor; - f[N] += (feq[N]-f[N])*collFactor; - f[S] += (feq[S]-f[S])*collFactor; - f[T] += (feq[T]-f[T])*collFactor; - f[B] += (feq[B]-f[B])*collFactor; - f[NE] += (feq[NE]-f[NE])*collFactor; - f[SW] += (feq[SW]-f[SW])*collFactor; - f[SE] += (feq[SE]-f[SE])*collFactor; - f[NW] += (feq[NW]-f[NW])*collFactor; - f[TE] += (feq[TE]-f[TE])*collFactor; - f[BW] += (feq[BW]-f[BW])*collFactor; - f[BE] += (feq[BE]-f[BE])*collFactor; - f[TW] += (feq[TW]-f[TW])*collFactor; - f[TN] += (feq[TN]-f[TN])*collFactor; - f[BS] += (feq[BS]-f[BS])*collFactor; - f[BN] += (feq[BN]-f[BN])*collFactor; - f[TS] += (feq[TS]-f[TS])*collFactor; - - f[TNE] += (feq[TNE]-f[TNE])*collFactor; - f[BSW] += (feq[BSW]-f[BSW])*collFactor; - f[BNE] += (feq[BNE]-f[BNE])*collFactor; - f[TSW] += (feq[TSW]-f[TSW])*collFactor; - f[TSE] += (feq[TSE]-f[TSE])*collFactor; - f[BNW] += (feq[BNW]-f[BNW])*collFactor; - f[BSE] += (feq[BSE]-f[BSE])*collFactor; - f[TNW] += (feq[TNW]-f[TNW])*collFactor; - - ////////////////////////////////////////////////////////////////////////// -#ifdef PROOF_CORRECTNESS - LBMReal rho_post = f[ZERO]+f[E]+f[W]+f[N]+f[S]+f[T]+f[B] - +f[NE]+f[SW]+f[SE]+f[NW]+f[TE]+f[BW]+f[BE] - +f[TW]+f[TN]+f[BS]+f[BN]+f[TS]+f[TNE]+f[TSW] - +f[TSE]+f[TNW]+f[BNE]+f[BSW]+f[BSE]+f[BNW]; - LBMReal dif = drho-rho_post; -#ifdef SINGLEPRECISION - if (dif>10.0E-7||dif<-10.0E-7) -#else - if (dif>10.0E-15||dif<-10.0E-15) -#endif - { - UB_THROW(UbException(UB_EXARGS, "rho is not correct")); - } -#endif - ////////////////////////////////////////////////////////////////////////// - //write distribution - ////////////////////////////////////////////////////////////////////////// - (*this->localDistributions)(D3Q27System::ET_E, x1, x2, x3) = f[D3Q27System::INV_E]; - (*this->localDistributions)(D3Q27System::ET_N, x1, x2, x3) = f[D3Q27System::INV_N]; - (*this->localDistributions)(D3Q27System::ET_T, x1, x2, x3) = f[D3Q27System::INV_T]; - (*this->localDistributions)(D3Q27System::ET_NE, x1, x2, x3) = f[D3Q27System::INV_NE]; - (*this->localDistributions)(D3Q27System::ET_NW, x1p, x2, x3) = f[D3Q27System::INV_NW]; - (*this->localDistributions)(D3Q27System::ET_TE, x1, x2, x3) = f[D3Q27System::INV_TE]; - (*this->localDistributions)(D3Q27System::ET_TW, x1p, x2, x3) = f[D3Q27System::INV_TW]; - (*this->localDistributions)(D3Q27System::ET_TN, x1, x2, x3) = f[D3Q27System::INV_TN]; - (*this->localDistributions)(D3Q27System::ET_TS, x1, x2p, x3) = f[D3Q27System::INV_TS]; - (*this->localDistributions)(D3Q27System::ET_TNE, x1, x2, x3) = f[D3Q27System::INV_TNE]; - (*this->localDistributions)(D3Q27System::ET_TNW, x1p, x2, x3) = f[D3Q27System::INV_TNW]; - (*this->localDistributions)(D3Q27System::ET_TSE, x1, x2p, x3) = f[D3Q27System::INV_TSE]; - (*this->localDistributions)(D3Q27System::ET_TSW, x1p, x2p, x3) = f[D3Q27System::INV_TSW]; - - (*this->nonLocalDistributions)(D3Q27System::ET_W, x1p, x2, x3) = f[D3Q27System::INV_W]; - (*this->nonLocalDistributions)(D3Q27System::ET_S, x1, x2p, x3) = f[D3Q27System::INV_S]; - (*this->nonLocalDistributions)(D3Q27System::ET_B, x1, x2, x3p) = f[D3Q27System::INV_B]; - (*this->nonLocalDistributions)(D3Q27System::ET_SW, x1p, x2p, x3) = f[D3Q27System::INV_SW]; - (*this->nonLocalDistributions)(D3Q27System::ET_SE, x1, x2p, x3) = f[D3Q27System::INV_SE]; - (*this->nonLocalDistributions)(D3Q27System::ET_BW, x1p, x2, x3p) = f[D3Q27System::INV_BW]; - (*this->nonLocalDistributions)(D3Q27System::ET_BE, x1, x2, x3p) = f[D3Q27System::INV_BE]; - (*this->nonLocalDistributions)(D3Q27System::ET_BS, x1, x2p, x3p) = f[D3Q27System::INV_BS]; - (*this->nonLocalDistributions)(D3Q27System::ET_BN, x1, x2, x3p) = f[D3Q27System::INV_BN]; - (*this->nonLocalDistributions)(D3Q27System::ET_BSW, x1p, x2p, x3p) = f[D3Q27System::INV_BSW]; - (*this->nonLocalDistributions)(D3Q27System::ET_BSE, x1, x2p, x3p) = f[D3Q27System::INV_BSE]; - (*this->nonLocalDistributions)(D3Q27System::ET_BNW, x1p, x2, x3p) = f[D3Q27System::INV_BNW]; - (*this->nonLocalDistributions)(D3Q27System::ET_BNE, x1, x2, x3p) = f[D3Q27System::INV_BNE]; - - (*this->zeroDistributions)(x1, x2, x3) = f[D3Q27System::ZERO]; - ////////////////////////////////////////////////////////////////////////// - - - } - } - } - } -} \ No newline at end of file diff --git a/src/VirtualFluids/LBM/InitDensityLBMKernel.h b/src/VirtualFluids/LBM/InitDensityLBMKernel.h deleted file mode 100644 index 1c0bad607..000000000 --- a/src/VirtualFluids/LBM/InitDensityLBMKernel.h +++ /dev/null @@ -1,33 +0,0 @@ -#ifndef InitDensityLBMKernel_h__ -#define InitDensityLBMKernel_h__ - -#include "LBMKernel.h" -#include "basics/utilities/UbTiming.h" -#include "CbArray4D.h" -#include "D3Q27System.h" -#include "CbArray3D.h" - -class InitDensityLBMKernel : public LBMKernel -{ -public: - InitDensityLBMKernel(); - ~InitDensityLBMKernel(); - InitDensityLBMKernel(int nx1, int nx2, int nx3); - void calculate(); - LBMKernelPtr clone(); - void setVelocity(int x1, int x2, int x3, LBMReal vvx, LBMReal vvy, LBMReal vvz); - double getCalculationTime(); -protected: - void init(); - void collideAll(); -private: - LBMReal f[D3Q27System::ENDF+1]; - CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr localDistributions; - CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr nonLocalDistributions; - CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr zeroDistributions; - LBMReal OxyyMxzz; - CbArray4D<LBMReal, IndexerX4X3X2X1> v; -}; - -#endif // InitDensityLBMKernel_h__ - diff --git a/src/VirtualFluids/LBM/InterpolationHelper.cpp b/src/VirtualFluids/LBM/InterpolationHelper.cpp deleted file mode 100644 index 7a58d0dee..000000000 --- a/src/VirtualFluids/LBM/InterpolationHelper.cpp +++ /dev/null @@ -1,39 +0,0 @@ -#include "InterpolationHelper.h" - - - -InterpolationHelper::InterpolationHelper(InterpolationProcessorPtr iProcessor) : iProcessor(iProcessor) -{ - -} -////////////////////////////////////////////////////////////////////////// -InterpolationHelper::~InterpolationHelper() -{ - -} -////////////////////////////////////////////////////////////////////////// -void InterpolationHelper::interpolate8to1( D3Q27ICell& icellF, LBMReal* icellC, double x1, double x2, double x3, LBMReal omega ) -{ - iProcessor->calcInterpolatedCoefficiets(icellF, omega, 1.0); - iProcessor->calcInterpolatedNodeFC(icellC, omega); -} -////////////////////////////////////////////////////////////////////////// -void InterpolationHelper::interpolate8to1WithVelocity( D3Q27ICell& icellF, double x1, double x2, double x3, LBMReal omega, LBMReal &vx1, LBMReal &vx2, LBMReal &vx3 ) -{ - iProcessor->setOffsets(0.0, 0.0, 0.0); - iProcessor->calcInterpolatedCoefficiets(icellF, omega, 0.0); - iProcessor->calcInterpolatedVelocity(x1, x2, x3, vx1, vx2, vx3); -} -////////////////////////////////////////////////////////////////////////// -void InterpolationHelper::interpolate8to1WithVelocityWithShearStress( D3Q27ICell& icellF, double x1, double x2, double x3, LBMReal omega, - LBMReal &vx1, LBMReal &vx2, LBMReal &vx3, - LBMReal &tauxx, LBMReal &tauyy, LBMReal &tauzz,LBMReal &tauxy, LBMReal &tauxz, LBMReal &tauyz ) -{ - iProcessor->setOffsets(0.0, 0.0, 0.0); - iProcessor->calcInterpolatedCoefficiets(icellF, omega, 0.0); - iProcessor->calcInterpolatedVelocity(x1, x2, x3, vx1, vx2, vx3); - iProcessor->calcInterpolatedShearStress(x1,x2,x3,tauxx,tauyy,tauzz,tauxy,tauxz,tauyz); -} - -////////////////////////////////////////////////////////////////////////// - diff --git a/src/VirtualFluids/LBM/InterpolationHelper.h b/src/VirtualFluids/LBM/InterpolationHelper.h deleted file mode 100644 index 22b2275cc..000000000 --- a/src/VirtualFluids/LBM/InterpolationHelper.h +++ /dev/null @@ -1,25 +0,0 @@ -#ifndef D3Q27InterpolationHelper_H_ -#define D3Q27InterpolationHelper_H_ - -#include "InterpolationProcessor.h" - -class InterpolationHelper; -typedef std::shared_ptr<InterpolationHelper> InterpolationHelperPtr; - -class InterpolationHelper -{ -public: - InterpolationHelper(InterpolationProcessorPtr iProcessor); - ~InterpolationHelper(); - void interpolate8to1(D3Q27ICell& icellF, LBMReal* icellC, double x1, double x2, double x3, LBMReal omega); - void interpolate8to1WithVelocity(D3Q27ICell& icellF, double x1, double x2, double x3, LBMReal omega, LBMReal &vx1, LBMReal &vx2, LBMReal &vx3); - void interpolate8to1WithVelocityWithShearStress(D3Q27ICell& icellF, double x1, double x2, double x3, LBMReal omega, - LBMReal &vx1, LBMReal &vx2, LBMReal &vx3, - LBMReal &tauxx, LBMReal &tauyy, LBMReal &tauzz,LBMReal &tauxy, LBMReal &tauxz, LBMReal &tauyz); -protected: -private: - InterpolationProcessorPtr iProcessor; -}; - -#endif - diff --git a/src/VirtualFluids/LBM/InterpolationProcessor.cpp b/src/VirtualFluids/LBM/InterpolationProcessor.cpp deleted file mode 100644 index 5bca169a9..000000000 --- a/src/VirtualFluids/LBM/InterpolationProcessor.cpp +++ /dev/null @@ -1,314 +0,0 @@ -#include "InterpolationProcessor.h" -#include "StringUtil.hpp" - - -////////////////////////////////////////////////////////////////////////// -InterpolationProcessor::InterpolationProcessor() -{ - -} -////////////////////////////////////////////////////////////////////////// -InterpolationProcessor::~InterpolationProcessor() -{ - -} -////////////////////////////////////////////////////////////////////////// -void InterpolationProcessor::readICell(DistributionArray3DPtr f, D3Q27ICell& icell, int x1, int x2, int x3) -{ - f->getDistribution(icell.BSW, x1, x2, x3); - f->getDistribution(icell.BSE, x1+1, x2, x3); - f->getDistribution(icell.BNW, x1, x2+1, x3); - f->getDistribution(icell.BNE, x1+1, x2+1, x3); - f->getDistribution(icell.TSW, x1, x2, x3+1); - f->getDistribution(icell.TSE, x1+1, x2, x3+1); - f->getDistribution(icell.TNW, x1, x2+1, x3+1); - f->getDistribution(icell.TNE, x1+1, x2+1, x3+1); -} -////////////////////////////////////////////////////////////////////////// -void InterpolationProcessor::writeICell(DistributionArray3DPtr f, const D3Q27ICell& icell, int x1, int x2, int x3) -{ - f->setDistribution(icell.BSW, x1, x2, x3); - f->setDistribution(icell.BSE, x1+1, x2, x3); - f->setDistribution(icell.BNW, x1, x2+1, x3); - f->setDistribution(icell.BNE, x1+1, x2+1, x3); - f->setDistribution(icell.TSW, x1, x2, x3+1); - f->setDistribution(icell.TSE, x1+1, x2, x3+1); - f->setDistribution(icell.TNW, x1, x2+1, x3+1); - f->setDistribution(icell.TNE, x1+1, x2+1, x3+1); -} -////////////////////////////////////////////////////////////////////////// -void InterpolationProcessor::writeICellInv(DistributionArray3DPtr f, const D3Q27ICell& icell, int x1, int x2, int x3) -{ - f->setDistributionInv(icell.BSW, x1, x2, x3); - f->setDistributionInv(icell.BSE, x1+1, x2, x3); - f->setDistributionInv(icell.BNW, x1, x2+1, x3); - f->setDistributionInv(icell.BNE, x1+1, x2+1, x3); - f->setDistributionInv(icell.TSW, x1, x2, x3+1); - f->setDistributionInv(icell.TSE, x1+1, x2, x3+1); - f->setDistributionInv(icell.TNW, x1, x2+1, x3+1); - f->setDistributionInv(icell.TNE, x1+1, x2+1, x3+1); -} -////////////////////////////////////////////////////////////////////////// -void InterpolationProcessor::writeINode(DistributionArray3DPtr f, const LBMReal* const inode, int x1, int x2, int x3) -{ - f->setDistribution(inode, x1, x2, x3); -} -////////////////////////////////////////////////////////////////////////// -void InterpolationProcessor::writeINodeInv(DistributionArray3DPtr f, const LBMReal* const inode, int x1, int x2, int x3) -{ - f->setDistributionInv(inode, x1, x2, x3); -} -////////////////////////////////////////////////////////////////////////// -bool InterpolationProcessor::iCellHasSolid(const BCArray3DPtr bcArray, int x1, int x2, int x3) -{ - for (int ix3 = x3; ix3 <= x3 + 1; ix3++) - for(int ix2 = x2; ix2 <= x2 + 1; ix2++) - for(int ix1 = x1; ix1 <= x1 + 1; ix1++) - { - if(bcArray->isSolid(ix1, ix2, ix3)) - return true; - } - return false; -} -////////////////////////////////////////////////////////////////////////// -bool InterpolationProcessor::findNeighborICell(const BCArray3DPtr bcArray, DistributionArray3DPtr f, - D3Q27ICell& icell, int maxX1, int maxX2, int maxX3, - int x1, int x2, int x3, LBMReal& xoff, LBMReal& yoff, LBMReal& zoff) -{ - m_maxX1 = maxX1; - m_maxX2 = maxX2; - m_maxX3 = maxX3; - - //GoWest - if(inRange(x1-1,x2,x3) && !iCellHasSolid(bcArray, x1-1,x2,x3)) - { - readICell(f,icell,x1-1,x2,x3); - xoff = 1; - yoff = 0; - zoff = 0; - } - //GoEast - else if(inRange(x1+2,x2,x3) && !iCellHasSolid(bcArray, x1+1,x2,x3)) // ist übernächster Knoten auch im Gebiet (Grundknoten bei 0,0,0 - { - readICell(f,icell,x1+1,x2,x3); - xoff = -1; - yoff = 0; - zoff = 0; - } - //GoSouth - else if(inRange(x1,x2-1,x3) && !iCellHasSolid(bcArray, x1,x2-1,x3)) - { - readICell(f,icell,x1,x2-1,x3); - xoff = 0; - yoff = 1; - zoff = 0; - } - //GoNorth - else if(inRange(x1,x2+2,x3) && !iCellHasSolid(bcArray, x1,x2+1,x3)) // ist übernächster Knoten auch im Gebiet (Grundknoten bei 0,0,0 - { - readICell(f,icell,x1,x2+1,x3); - xoff = 0; - yoff = -1; - zoff = 0; - } - //GoBottom - else if(inRange(x1,x2,x3-1) && !iCellHasSolid(bcArray, x1,x2,x3-1)) - { - readICell(f,icell,x1,x2,x3-1); - xoff = 0; - yoff = 0; - zoff = 1; - } - //GoTop - else if(inRange(x1,x2,x3+2) && !iCellHasSolid(bcArray, x1,x2,x3+1)) // ist übernächster Knoten auch im Gebiet (Grundknoten bei 0,0,0 - { - readICell(f,icell,x1,x2,x3+1); - xoff = 0; - yoff = 0; - zoff = -1; - } - //GoNW - else if(inRange(x1-1,x2+2,x3) && !iCellHasSolid(bcArray, x1-1,x2+1,x3)) // ist übernächster Knoten auch im Gebiet (Grundknoten bei 0,0,0 - { - readICell(f,icell,x1-1,x2+1,x3); - xoff = 1; - yoff = -1; - zoff = 0; - } - //GoNE - else if(inRange(x1+2,x2+2,x3) && !iCellHasSolid(bcArray, x1+1,x2+1,x3)) // ist übernächster Knoten auch im Gebiet (Grundknoten bei 0,0,0 - { - readICell(f,icell,x1+1,x2+1,x3); - xoff = -1; - yoff = -1; - zoff = 0; - } - //GoSW - else if(inRange(x1-1,x2-1,x3) && !iCellHasSolid(bcArray, x1-1,x2-1,x3)) // ist übernächster Knoten auch im Gebiet (Grundknoten bei 0,0,0 - { - readICell(f,icell,x1-1,x2-1,x3); - xoff = 1; - yoff = 1; - zoff = 0; - } - //GoSE - else if(inRange(x1+2,x2-1,x3) && !iCellHasSolid(bcArray, x1+1,x2-1,x3)) // ist übernächster Knoten auch im Gebiet (Grundknoten bei 0,0,0 - { - readICell(f,icell,x1+1,x2-1,x3); - xoff = -1; - yoff = 1; - zoff = 0; - } - //GoBW - else if(inRange(x1-1,x2,x3-1) && !iCellHasSolid(bcArray, x1-1,x2,x3-1)) - { - readICell(f,icell,x1-1,x2,x3-1); - xoff = 1; - yoff = 0; - zoff = 1; - } - //GoBE - else if(inRange(x1+2,x2,x3-1) && !iCellHasSolid(bcArray, x1+1,x2,x3-1)) // ist übernächster Knoten auch im Gebiet (Grundknoten bei 0,0,0 - { - readICell(f,icell,x1+1,x2,x3-1); - xoff = -1; - yoff = 0; - zoff = 1; - } - //GoBS - else if(inRange(x1,x2-1,x3-1) && !iCellHasSolid(bcArray, x1,x2-1,x3-1)) - { - readICell(f,icell,x1,x2-1,x3-1); - xoff = 0; - yoff = 1; - zoff = 1; - } - //GoBN - else if(inRange(x1,x2+2,x3-1) && !iCellHasSolid(bcArray, x1,x2+1,x3-1)) // ist übernächster Knoten auch im Gebiet (Grundknoten bei 0,0,0 - { - readICell(f,icell,x1,x2+1,x3-1); - xoff = 0; - yoff = -1; - zoff = 1; - } - //GoTW - else if(inRange(x1-1,x2,x3+2) && !iCellHasSolid(bcArray, x1-1,x2,x3+1)) - { - readICell(f,icell,x1-1,x2,x3+1); - xoff = 1; - yoff = 0; - zoff = -1; - } - //GoTE - else if(inRange(x1+2,x2,x3+2) && !iCellHasSolid(bcArray, x1+1,x2,x3+1)) // ist übernächster Knoten auch im Gebiet (Grundknoten bei 0,0,0 - { - readICell(f,icell,x1+1,x2,x3+1); - xoff = -1; - yoff = 0; - zoff = -1; - } - //GoTS - else if(inRange(x1,x2-1,x3+2) && !iCellHasSolid(bcArray, x1,x2-1,x3+1)) - { - readICell(f,icell,x1,x2-1,x3+1); - xoff = 0; - yoff = 1; - zoff = -1; - } - //GoTN - else if(inRange(x1,x2+2,x3+2) && !iCellHasSolid(bcArray, x1,x2+1,x3+1)) // ist übernächster Knoten auch im Gebiet (Grundknoten bei 0,0,0 - { - readICell(f,icell,x1,x2+1,x3+1); - xoff = 0; - yoff = -1; - zoff = -1; - } - //GoTNW - else if(inRange(x1-1,x2+2,x3+2) && !iCellHasSolid(bcArray, x1-1,x2+1,x3+1)) // ist übernächster Knoten auch im Gebiet (Grundknoten bei 0,0,0 - { - readICell(f,icell,x1-1,x2+1,x3+1); - xoff = 1; - yoff = -1; - zoff = -1; - } - //GoTNE - else if(inRange(x1+2,x2+2,x3+2) && !iCellHasSolid(bcArray, x1+1,x2+1,x3+1)) // ist übernächster Knoten auch im Gebiet (Grundknoten bei 0,0,0 - { - readICell(f,icell,x1+1,x2+1,x3+1); - xoff = -1; - yoff = -1; - zoff = -1; - } - //GoTSE - else if(inRange(x1+2,x2-1,x3+2) && !iCellHasSolid(bcArray, x1+1,x2-1,x3+1)) // ist übernächster Knoten auch im Gebiet (Grundknoten bei 0,0,0 - { - readICell(f,icell,x1+1,x2-1,x3+1); - xoff = -1; - yoff = 1; - zoff = -1; - } - //GoTSW - else if(inRange(x1-1,x2-1,x3+2) && !iCellHasSolid(bcArray, x1-1,x2-1,x3+1)) // ist übernächster Knoten auch im Gebiet (Grundknoten bei 0,0,0 - { - readICell(f,icell,x1-1,x2-1,x3+1); - xoff = 1; - yoff = 1; - zoff = -1; - } - //GoBNW - else if(inRange(x1-1,x2+2,x3-1) && !iCellHasSolid(bcArray, x1-1,x2+1,x3-1)) // ist übernächster Knoten auch im Gebiet (Grundknoten bei 0,0,0 - { - readICell(f,icell,x1-1,x2+1,x3-1); - xoff = 1; - yoff = -1; - zoff = 1; - } - //GoBNE - else if(inRange(x1+2,x2+2,x3-1) && !iCellHasSolid(bcArray, x1+1,x2+1,x3-1)) // ist übernächster Knoten auch im Gebiet (Grundknoten bei 0,0,0 - { - readICell(f,icell,x1+1,x2+1,x3-1); - xoff = -1; - yoff = -1; - zoff = 1; - } - //GoBSE - else if(inRange(x1+2,x2-1,x3-1) && !iCellHasSolid(bcArray, x1+1,x2-1,x3-1)) // ist übernächster Knoten auch im Gebiet (Grundknoten bei 0,0,0 - { - readICell(f,icell,x1+1,x2-1,x3-1); - xoff = -1; - yoff = 1; - zoff = 1; - } - //GoBSW - else if(inRange(x1-1,x2-1,x3-1) && !iCellHasSolid(bcArray, x1-1,x2-1,x3-1)) // ist übernächster Knoten auch im Gebiet (Grundknoten bei 0,0,0 - { - readICell(f,icell,x1-1,x2-1,x3-1); - xoff = 1; - yoff = 1; - zoff = 1; - } - //default - else - { - //std::string err = "For x1="+StringUtil::toString(x1)+", x2=" + StringUtil::toString(x2)+", x3=" + StringUtil::toString(x3)+ - // " interpolation is not implemented for other direction"+ - // " by using in: "+(std::string)typeid(*this).name()+ - // " or maybe you have a solid on the block boundary"; - //UB_THROW(UbException(UB_EXARGS, err)); - return 0; - } - return 1; -} -////////////////////////////////////////////////////////////////////////// -int InterpolationProcessor::iCellHowManySolids( const BCArray3DPtr bcArray, int x1, int x2, int x3 ) -{ - int count = 0; - for (int ix3 = x3; ix3 <= x3 + 1; ix3++) - for(int ix2 = x2; ix2 <= x2 + 1; ix2++) - for(int ix1 = x1; ix1 <= x1 + 1; ix1++) - { - if(bcArray->isSolid(ix1, ix2, ix3)) - count++; - } - return count; -} diff --git a/src/VirtualFluids/LBM/InterpolationProcessor.h b/src/VirtualFluids/LBM/InterpolationProcessor.h deleted file mode 100644 index 18a48a013..000000000 --- a/src/VirtualFluids/LBM/InterpolationProcessor.h +++ /dev/null @@ -1,70 +0,0 @@ -#ifndef D3Q27INTRPOLATIOPROCESSOR_H_ -#define D3Q27INTRPOLATIOPROCESSOR_H_ - -#include "InterpolationProcessor.h" -#include "LBMSystem.h" -#include "DistributionArray3D.h" -#include "BoundaryConditions.h" -#include "BCArray3D.h" - - -struct D3Q27ICell -{ - LBMReal TSW[27]; - LBMReal TNW[27]; - LBMReal TNE[27]; - LBMReal TSE[27]; - LBMReal BSW[27]; - LBMReal BNW[27]; - LBMReal BNE[27]; - LBMReal BSE[27]; -}; - -class InterpolationProcessor; -typedef std::shared_ptr<InterpolationProcessor> InterpolationProcessorPtr; - -#include "InterpolationHelper.h" - -class InterpolationProcessor -{ -public: - InterpolationProcessor(); - virtual ~InterpolationProcessor(); - virtual InterpolationProcessorPtr clone() = 0; - virtual void setOmegas(LBMReal omegaC, LBMReal omegaF) = 0; - virtual void interpolateCoarseToFine(D3Q27ICell& icellC, D3Q27ICell& icellF) = 0; - virtual void interpolateCoarseToFine(D3Q27ICell& icellC, D3Q27ICell& icellF, LBMReal xoff, LBMReal yoff, LBMReal zoff) = 0; - virtual void interpolateFineToCoarse(D3Q27ICell& icellF, LBMReal* icellC) = 0; - virtual void interpolateFineToCoarse(D3Q27ICell& icellF, LBMReal* icellC, LBMReal xoff, LBMReal yoff, LBMReal zoff) = 0; - - static void readICell(DistributionArray3DPtr f, D3Q27ICell& icell, int x1, int x2, int x3); - static void writeICell(DistributionArray3DPtr f, const D3Q27ICell& icell, int x1, int x2, int x3); - static void writeICellInv(DistributionArray3DPtr f, const D3Q27ICell& icell, int x1, int x2, int x3); - static void writeINode(DistributionArray3DPtr f, const LBMReal* const inode, int x1, int x2, int x3); - static void writeINodeInv(DistributionArray3DPtr f, const LBMReal* const inode, int x1, int x2, int x3); - static bool iCellHasSolid(const BCArray3DPtr bcArray, int x1, int x2, int x3); - static int iCellHowManySolids(const BCArray3DPtr bcArray, int x1, int x2, int x3); - - bool findNeighborICell(const BCArray3DPtr bcArray, DistributionArray3DPtr f, - D3Q27ICell& icell, int maxX1, int maxX2, int maxX3, - int x1, int x2, int x3, LBMReal& xoff, LBMReal& yoff, LBMReal& zoff); - -protected: - virtual void calcInterpolatedCoefficiets(const D3Q27ICell& icell, LBMReal omega, LBMReal eps_new){} - virtual void calcInterpolatedNodeFC(LBMReal* f, LBMReal omega){} - virtual void calcInterpolatedVelocity(LBMReal x, LBMReal y, LBMReal z,LBMReal& vx1, LBMReal& vx2, LBMReal& vx3){} - virtual void calcInterpolatedShearStress(LBMReal x, LBMReal y, LBMReal z,LBMReal& tauxx, LBMReal& tauyy, LBMReal& tauzz,LBMReal& tauxy, LBMReal& tauxz, LBMReal& tauyz){} - virtual void setOffsets(LBMReal xoff, LBMReal yoff, LBMReal zoff){} - friend class InterpolationHelper; -private: - bool inRange(int x1, int x2, int x3); - int m_maxX1, m_maxX2, m_maxX3; -}; - -////////////////////////////////////////////////////////////////////////// -inline bool InterpolationProcessor::inRange(int x1, int x2, int x3) -{ - return x1 >= 0 && x1 < m_maxX1 && x2 >= 0 && x2 < m_maxX2 && x3 >= 0 && x3 < m_maxX3; -} - -#endif diff --git a/src/VirtualFluids/LBM/LBMKernel.cpp b/src/VirtualFluids/LBM/LBMKernel.cpp deleted file mode 100644 index 44a31a045..000000000 --- a/src/VirtualFluids/LBM/LBMKernel.cpp +++ /dev/null @@ -1,215 +0,0 @@ -#include "LBMKernel.h" -#include "DataSet3D.h" -#include "BCProcessor.h" -#include "Block3D.h" -#include "BCArray3D.h" - -LBMKernel::LBMKernel() : ghostLayerWidth(1), - deltaT(1.0), - withForcing(false), - withSpongeLayer(false), - compressible(false) -{ - this->setForcingX1(0.0); - this->setForcingX2(0.0); - this->setForcingX3(0.0); - dataSet = DataSet3DPtr(new DataSet3D()); -} -////////////////////////////////////////////////////////////////////////// -LBMKernel::~LBMKernel() -{ - -} -////////////////////////////////////////////////////////////////////////// -void LBMKernel::setBCProcessor(BCProcessorPtr bcp) -{ - bcProcessor = bcp; -} -////////////////////////////////////////////////////////////////////////// -BCProcessorPtr LBMKernel::getBCProcessor() const -{ - return bcProcessor; -} -////////////////////////////////////////////////////////////////////////// -void LBMKernel::setCollisionFactor(double collFactor) -{ - this->collFactor = collFactor; -} -////////////////////////////////////////////////////////////////////////// -double LBMKernel::getCollisionFactor() const -{ - return collFactor; -} -////////////////////////////////////////////////////////////////////////// -void LBMKernel::setForcingX1(LBMReal forcingX1) -{ - this->muForcingX1.SetExpr( UbSystem::toString(forcingX1,LBMRealLim::digits10) ); - this->checkFunction(muForcingX1); -} -////////////////////////////////////////////////////////////////////////// -void LBMKernel::setForcingX2(LBMReal forcingX2) -{ - this->muForcingX2.SetExpr( UbSystem::toString(forcingX2,LBMRealLim::digits10) ); - this->checkFunction(muForcingX2); -} -void LBMKernel::setForcingX3(LBMReal forcingX3) -{ - this->muForcingX3.SetExpr( UbSystem::toString(forcingX3,LBMRealLim::digits10) ); - this->checkFunction(muForcingX3); -} -////////////////////////////////////////////////////////////////////////// -void LBMKernel::setForcingX1( const mu::Parser& parser) -{ - this->checkFunction(parser); - this->muForcingX1 = parser; -} -////////////////////////////////////////////////////////////////////////// -void LBMKernel::setForcingX2( const mu::Parser& parser) -{ - this->checkFunction(parser); - this->muForcingX2 = parser; -} -////////////////////////////////////////////////////////////////////////// -void LBMKernel::setForcingX3( const mu::Parser& parser) -{ - this->checkFunction(parser); - this->muForcingX3 = parser; -} -////////////////////////////////////////////////////////////////////////// -void LBMKernel::setForcingX1( const std::string& muParserString) -{ - this->muForcingX1.SetExpr(muParserString); - this->checkFunction(muForcingX1); -} -////////////////////////////////////////////////////////////////////////// -void LBMKernel::setForcingX2( const std::string& muParserString) -{ - this->muForcingX2.SetExpr(muParserString); - this->checkFunction(muForcingX2); -} -void LBMKernel::setForcingX3( const std::string& muParserString) -{ - this->muForcingX3.SetExpr(muParserString); - this->checkFunction(muForcingX3); -} -////////////////////////////////////////////////////////////////////////// -void LBMKernel::checkFunction(mu::Parser fct) -{ - double x1=1.0,x2=1.0,x3=1.0, dt=1.0, nue=1.0; - fct.DefineVar("x1",&x1); - fct.DefineVar("x2",&x2); - fct.DefineVar("x3",&x3); - fct.DefineVar("dt",&dt); - fct.DefineVar("nue",&nue); - - try - { - fct.Eval(); - fct.ClearVar(); - } - catch(mu::ParserError& e) - { - throw UbException(UB_EXARGS,"function: "+e.GetExpr() + (std::string)"error: "+e.GetMsg() - +(std::string)", only x1,x2,x3,dx are allowed as variables" ); - } -} -////////////////////////////////////////////////////////////////////////// -void LBMKernel::setGhostLayerWidth(int witdh) -{ - ghostLayerWidth = witdh; -} -////////////////////////////////////////////////////////////////////////// -int LBMKernel::getGhostLayerWidth() const -{ - return ghostLayerWidth; -} -////////////////////////////////////////////////////////////////////////// -void LBMKernel::setIndex( int x1, int x2, int x3 ) -{ - this->ix1 = x1; - this->ix2 = x2; - this->ix3 = x3; -} -////////////////////////////////////////////////////////////////////////// -DataSet3DPtr LBMKernel::getDataSet() const -{ - return this->dataSet; -} -////////////////////////////////////////////////////////////////////////// -LBMReal LBMKernel::getDeltaT() const -{ - return this->deltaT; -} -////////////////////////////////////////////////////////////////////////// -void LBMKernel::setDeltaT( LBMReal dt ) -{ - deltaT = dt; -} -////////////////////////////////////////////////////////////////////////// -bool LBMKernel::getCompressible() const -{ - return compressible; -} -////////////////////////////////////////////////////////////////////////// -void LBMKernel::setCompressible(bool val) -{ - compressible = val; -} -////////////////////////////////////////////////////////////////////////// -bool LBMKernel::getWithForcing() const -{ - return withForcing; -} -////////////////////////////////////////////////////////////////////////// -void LBMKernel::setWithForcing( bool val ) -{ - withForcing = val; -} -////////////////////////////////////////////////////////////////////////// -void LBMKernel::setBlock( Block3DPtr block ) -{ - this->block = block; -} -////////////////////////////////////////////////////////////////////////// -Block3DPtr LBMKernel::getBlock() const -{ - return block.lock(); -} -////////////////////////////////////////////////////////////////////////// -bool LBMKernel::getWithSpongeLayer() const -{ - return withSpongeLayer; -} -////////////////////////////////////////////////////////////////////////// -void LBMKernel::setWithSpongeLayer( bool val ) -{ - withSpongeLayer = val; -} -////////////////////////////////////////////////////////////////////////// -void LBMKernel::setSpongeLayer( const mu::Parser& parser ) -{ - this->checkFunction(parser); - this->muSpongeLayer = parser; -} -////////////////////////////////////////////////////////////////////////// -void LBMKernel::setSpongeLayer( const std::string& muParserString ) -{ - this->muSpongeLayer.SetExpr(muParserString); - this->checkFunction(muSpongeLayer); -} -////////////////////////////////////////////////////////////////////////// -void LBMKernel::setDataSet(DataSet3DPtr dataSet) -{ - this->dataSet = dataSet; -} -////////////////////////////////////////////////////////////////////////// -void LBMKernel::swapDistributions() -{ - dataSet->getFdistributions()->swap(); -} -////////////////////////////////////////////////////////////////////////// -bool LBMKernel::isInsideOfDomain(const int& x1, const int& x2, const int& x3) const -{ - const BCArray3DPtr bcArray = this->bcProcessor->getBCArray(); - return bcArray->isInsideOfDomain(x1, x2, x3, ghostLayerWidth); -} diff --git a/src/VirtualFluids/LBM/LBMKernel.h b/src/VirtualFluids/LBM/LBMKernel.h deleted file mode 100644 index 6ad17dac1..000000000 --- a/src/VirtualFluids/LBM/LBMKernel.h +++ /dev/null @@ -1,126 +0,0 @@ -#ifndef LBMKERNEL_H -#define LBMKERNEL_H - -#include <memory> - -#include "LBMSystem.h" - -#include <MuParser/include/muParser.h> - -#include <boost/serialization/serialization.hpp> - -#include "ILBMKernel.h" - -class LBMKernel; -typedef std::shared_ptr<LBMKernel> LBMKernelPtr; - -class BCProcessor; -class DataSet3D; -class Block3D; - -class LBMKernel : public ILBMKernel, public std::enable_shared_from_this<LBMKernel> -{ -public: - typedef std::numeric_limits<LBMReal> LBMRealLim; -public: - LBMKernel(); - virtual ~LBMKernel(); - - virtual LBMKernelPtr clone() = 0; - - virtual void calculate() = 0; - virtual double getCalculationTime() = 0; - - void setBCProcessor(std::shared_ptr<BCProcessor> bcp); - std::shared_ptr<BCProcessor> getBCProcessor() const; - - void setCollisionFactor(double collFactor); - double getCollisionFactor() const; - - void setGhostLayerWidth(int witdh); - int getGhostLayerWidth() const; - - void setDataSet(std::shared_ptr<DataSet3D> dataSet); - std::shared_ptr<DataSet3D> getDataSet() const; - - void setForcingX1(LBMReal forcingX1); - void setForcingX2(LBMReal forcingX2); - void setForcingX3(LBMReal forcingX3); - - void setForcingX1(const mu::Parser& parser); - void setForcingX2(const mu::Parser& parser); - void setForcingX3(const mu::Parser& parser); - - void setForcingX1(const std::string& muParserString); - void setForcingX2(const std::string& muParserString); - void setForcingX3(const std::string& muParserString); - - void setIndex(int x1, int x2, int x3); - - LBMReal getDeltaT() const; - void setDeltaT(LBMReal dt); - - bool getCompressible() const; - void setCompressible(bool val); - - bool getWithForcing() const; - void setWithForcing(bool val); - - bool getWithSpongeLayer() const; - void setWithSpongeLayer(bool val); - - void setSpongeLayer(const mu::Parser& parser); - void setSpongeLayer(const std::string& muParserString); - - void setBlock(std::shared_ptr<Block3D> block); - std::shared_ptr<Block3D> getBlock() const; - - bool isInsideOfDomain(const int &x1, const int &x2, const int &x3) const; - - - void swapDistributions(); - -protected: - std::shared_ptr<DataSet3D> dataSet; - std::shared_ptr<BCProcessor> bcProcessor; - LBMReal collFactor; - int ghostLayerWidth; - bool compressible; - - //forcing - bool withForcing; - mu::Parser muForcingX1; - mu::Parser muForcingX2; - mu::Parser muForcingX3; - int ix1, ix2, ix3; - LBMReal deltaT; - - //sponge layer - bool withSpongeLayer; - mu::Parser muSpongeLayer; - - std::weak_ptr<Block3D> block; - - int nx1, nx2, nx3; - -private: - friend class boost::serialization::access; - template<class Archive> - void serialize(Archive & ar, const unsigned int version) - { - ar & collFactor; - ar & ghostLayerWidth; - ar & compressible; - ar & withForcing; - //ar & withSpongeLayer; - ar & deltaT; - ar & dataSet; - ar & bcProcessor; - ar & ix1 & ix2 & ix3; - ar & nx1 & nx2 & nx3; - } - - void checkFunction(mu::Parser fct); -}; - -#endif diff --git a/src/VirtualFluids/LBM/LBMKernelTest.cpp b/src/VirtualFluids/LBM/LBMKernelTest.cpp deleted file mode 100644 index 4a5c32dcc..000000000 --- a/src/VirtualFluids/LBM/LBMKernelTest.cpp +++ /dev/null @@ -1,12 +0,0 @@ -#include "gmock/gmock.h" - -#include <memory> - -//#include "LBMKernel.h" -//#include "IncompressibleCumulantLBMKernel.h" - - -TEST(LBMKernelTest, aa) -{ - -} diff --git a/src/VirtualFluids/LBM/LBMSystem.cpp b/src/VirtualFluids/LBM/LBMSystem.cpp deleted file mode 100644 index ce129e2a4..000000000 --- a/src/VirtualFluids/LBM/LBMSystem.cpp +++ /dev/null @@ -1,6 +0,0 @@ -#include "LBMSystem.h" - -namespace LBMSystem -{ - real SMAG_CONST = REAL_CAST(0.18); -} diff --git a/src/VirtualFluids/LBM/LBMSystem.h b/src/VirtualFluids/LBM/LBMSystem.h deleted file mode 100644 index fab9559f1..000000000 --- a/src/VirtualFluids/LBM/LBMSystem.h +++ /dev/null @@ -1,83 +0,0 @@ -#ifndef LBMSYSTEM_H -#define LBMSYSTEM_H - -#include <cmath> -#include <string> -#include <iostream> - -#ifdef RCF_USE_SF_SERIALIZATION -#include <SF/Serializer.hpp> - -#if CAB_RCF <= 903 -#include <SF/SerializeEnum.hpp> -#endif -#endif //RCF_USE_SF_SERIALIZATION - -#include <basics/utilities/UbException.h> -#include <basics/utilities/UbTuple.h> -#include <basics/utilities/UbMath.h> -#include <basics/utilities/UbSystem.h> - -/*=========================================================================*/ -/* LBMSystem */ -/* */ -/** -namespace for global system-functions -<BR><BR> -@author <A HREF="mailto:geller@irmb.tu-bs.de">S. Geller</A> -@version 1.0 - 07.01.11 -*/ - -/* -usage: ... -*/ - -namespace LBMSystem -{ -#ifndef SWIG - using namespace UbMath; -#endif - -//#define SINGLEPRECISION - -#ifdef SINGLEPRECISION - typedef float real; - #define REAL_CAST(x) ( (LBMSystem::real)(x) ) -#else - typedef double real; - #define REAL_CAST(x) ( x ) -#endif - - extern real SMAG_CONST; - - ////////////////////////////////////////////////////////////////////////// - //!get LBM deltaT is equal LBM DeltaX - //!deltaT is dependent from grid level - //!for first grid level is deltaT = 1.0 - //!for next grid level 1/2 etc. - static real getDeltaT(int level) - { - return REAL_CAST(1.0/REAL_CAST(1<<level)); - } - - ////////////////////////////////////////////////////////////////////////// - //!calculate collision factor omega = 1.0/(3.0*viscosity/deltaT+0.5) - //!deltaT is dependent from grid level - //!for first grid level is deltaT = 1.0 - //!for next grid level 1/2 etc. - static real calcCollisionFactor(real viscosity, int level) - { - //return REAL_CAST(1.0/(3.0*viscosity/deltaT+0.5)); - return REAL_CAST(1.0/(3.0*viscosity/(1.0/REAL_CAST(1<<level))+0.5)); - } -} - -//some typedefs for global namespace -typedef LBMSystem::real LBMReal; - -//#define LBMSystem::real LBMReal - - - -#endif - diff --git a/src/VirtualFluids/LBM/LBMSystems.h b/src/VirtualFluids/LBM/LBMSystems.h deleted file mode 100644 index 859d58f24..000000000 --- a/src/VirtualFluids/LBM/LBMSystems.h +++ /dev/null @@ -1,372 +0,0 @@ -#ifndef D3Q27SYSTEM_H -#define D3Q27SYSTEM_H - -#include <cmath> -#include <string> -#include <iostream> - -#include <basics/utilities/UbException.h> -#include <basics/utilities/UbTuple.h> -#include <basics/utilities/UbMath.h> -#include <basics/utilities/UbSystem.h> -#include "Patch3DSystem.h" -#include "LBMSystem.h" - - -class LBMSystems -{ - ////////////////////////////////////////////////////////////////////////// - - - ////////////////////////////////////////////////////////////////////////// - //MACROSCOPIC VALUES - /*=====================================================================*/ - static LBMReal getDensity(const LBMReal* const& f/*[27]*/) - { - return f[ZERO] + f[E] + f[W] + f[N] + f[S] + f[T] + f[B] - + f[NE] + f[SW] + f[SE] + f[NW] + f[TE] + f[BW] + f[BE] - + f[TW] + f[TN] + f[BS] + f[BN] + f[TS] + f[TNE] + f[TSW] - + f[TSE] + f[TNW] + f[BNE] + f[BSW] + f[BSE] + f[BNW]; - } - /*=====================================================================*/ - //ACHTUNG: gilt nicht fuer alle modelle -> praedikat verwenden anstelle static! toDo - static LBMReal getPressure(const LBMReal* const& f/*[27]*/) - { - return REAL_CAST( c1o3 )*getDensity(f); - } - /*=====================================================================*/ - static LBMReal getIncompVelocityX1(const LBMReal* const& f/*[27]*/) - { - return f[E] - f[W] + f[NE] - f[SW] + f[SE] - f[NW] + f[TE] - + f[BE] - f[BW] - f[TW] + f[TNE] - f[TSW] + f[TSE] - f[TNW] + f[BNE] - f[BSW] - + f[BSE] - f[BNW]; - } - /*=====================================================================*/ - static LBMReal getIncompVelocityX2(const LBMReal* const& f/*[27]*/) - { - return f[N] - f[S] + f[NE] - f[SW] - f[SE] + f[NW] + f[TN] - f[BS] + f[BN] - - f[TS] + f[TNE] - f[TSW] - f[TSE] + f[TNW] + f[BNE] - f[BSW] - f[BSE] - + f[BNW]; - } - /*=====================================================================*/ - static LBMReal getIncompVelocityX3(const LBMReal* const& f/*[27]*/) - { - return f[T] - f[B] + f[TE] - f[BW] - f[BE] + f[TW] + f[TN] - f[BS] - f[BN] - + f[TS] + f[TNE] + f[TSW] + f[TSE] + f[TNW] - f[BNE] - f[BSW] - f[BSE] - - f[BNW]; - } - /*=====================================================================*/ - static void calcDensity(const LBMReal* const& f/*[27]*/, LBMReal& rho) - { - rho = f[ZERO] + f[E] + f[W] + f[N] + f[S] + f[T] + f[B] - + f[NE] + f[SW] + f[SE] + f[NW] + f[TE] + f[BW] + f[BE] - + f[TW] + f[TN] + f[BS] + f[BN] + f[TS] + f[TNE] + f[TSW] - + f[TSE] + f[TNW] + f[BNE] + f[BSW] + f[BSE] + f[BNW]; - } - /*=====================================================================*/ - static void calcIncompVelocityX1(const LBMReal* const& f/*[27]*/, LBMReal& vx1) - { - vx1 = f[E] - f[W] + f[NE] - f[SW] + f[SE] - f[NW] + f[TE] - f[BW] - + f[BE] - f[TW] + f[TNE] - f[TSW] + f[TSE] - f[TNW] + f[BNE] - f[BSW] - + f[BSE] - f[BNW]; - } - /*=====================================================================*/ - static void calcIncompVelocityX2(const LBMReal* const& f/*[27]*/, LBMReal& vx2) - { - vx2 = f[N] - f[S] + f[NE] - f[SW] - f[SE] + f[NW] + f[TN] - f[BS] + f[BN] - - f[TS] + f[TNE] - f[TSW] - f[TSE] + f[TNW] + f[BNE] - f[BSW] - f[BSE] - + f[BNW]; - } - /*=====================================================================*/ - static void calcIncompVelocityX3(const LBMReal* const& f/*[27]*/, LBMReal& vx3) - { - vx3 = f[T] - f[B] + f[TE] - f[BW] - f[BE] + f[TW] + f[TN] - f[BS] - f[BN] - + f[TS] + f[TNE] + f[TSW] + f[TSE] + f[TNW] - f[BNE] - f[BSW] - f[BSE] - - f[BNW]; - } - /*=====================================================================*/ - static LBMReal getCompVelocityX1(const LBMReal* const& f/*[27]*/) - { - return (f[E] - f[W] + f[NE] - f[SW] + f[SE] - f[NW] + f[TE] - f[BW] - + f[BE] - f[TW] + f[TNE] - f[TSW] + f[TSE] - f[TNW] + f[BNE] - f[BSW] - + f[BSE] - f[BNW])/getDensity(f); - } - /*=====================================================================*/ - static LBMReal getCompVelocityX2(const LBMReal* const& f/*[27]*/) - { - return (f[N] - f[S] + f[NE] - f[SW] - f[SE] + f[NW] + f[TN] - f[BS] + f[BN] - - f[TS] + f[TNE] - f[TSW] - f[TSE] + f[TNW] + f[BNE] - f[BSW] - f[BSE] - + f[BNW])/getDensity(f); - } - /*=====================================================================*/ - static LBMReal getCompVelocityX3(const LBMReal* const& f/*[27]*/) - { - return (f[T] - f[B] + f[TE] - f[BW] - f[BE] + f[TW] + f[TN] - f[BS] - f[BN] - + f[TS] + f[TNE] + f[TSW] + f[TSE] + f[TNW] - f[BNE] - f[BSW] - f[BSE] - - f[BNW])/getDensity(f); - } - /*=====================================================================*/ - static void calcCompVelocityX1(const LBMReal* const& f/*[27]*/, LBMReal& vx1) - { - vx1 = (f[E] - f[W] + f[NE] - f[SW] + f[SE] - f[NW] + f[TE] - f[BW] - + f[BE] - f[TW] + f[TNE] - f[TSW] + f[TSE] - f[TNW] + f[BNE] - f[BSW] - + f[BSE] - f[BNW])/getDensity(f); - } - /*=====================================================================*/ - static void calcCompVelocityX2(const LBMReal* const& f/*[27]*/, LBMReal& vx2) - { - vx2 = (f[N] - f[S] + f[NE] - f[SW] - f[SE] + f[NW] + f[TN] - f[BS] + f[BN] - - f[TS] + f[TNE] - f[TSW] - f[TSE] + f[TNW] + f[BNE] - f[BSW] - f[BSE] - + f[BNW])/getDensity(f); - } - /*=====================================================================*/ - static void calcCompVelocityX3(const LBMReal* const& f/*[27]*/, LBMReal& vx3) - { - vx3 = (f[T] - f[B] + f[TE] - f[BW] - f[BE] + f[TW] + f[TN] - f[BS] - f[BN] - + f[TS] + f[TNE] + f[TSW] + f[TSE] + f[TNW] - f[BNE] - f[BSW] - f[BSE] - - f[BNW])/getDensity(f); - } - /*=====================================================================*/ - static void calcIncompMacroscopicValues(const LBMReal* const& f/*[27]*/, LBMReal& rho, LBMReal& vx1, LBMReal& vx2, LBMReal& vx3) - { - D3Q27System::calcDensity(f, rho); - D3Q27System::calcIncompVelocityX1(f, vx1); - D3Q27System::calcIncompVelocityX2(f, vx2); - D3Q27System::calcIncompVelocityX3(f, vx3); - } - - /*=====================================================================*/ - static void calcCompMacroscopicValues(const LBMReal* const& f/*[27]*/, LBMReal& rho, LBMReal& vx1, LBMReal& vx2, LBMReal& vx3) - { - D3Q27System::calcDensity(f, rho); - D3Q27System::calcIncompVelocityX1(f, vx1); - D3Q27System::calcIncompVelocityX2(f, vx2); - D3Q27System::calcIncompVelocityX3(f, vx3); - vx1/=rho; - vx2/=rho; - vx3/=rho; - } - ////////////////////////////////////////////////////////////////////////// - static LBMReal getCompFeqForDirection(const int& direction, const LBMReal& rho,const LBMReal& vx1,const LBMReal& vx2,const LBMReal& vx3) - { - LBMReal cu_sq=1.5*(vx1*vx1+vx2*vx2+vx3*vx3); - - switch(direction) - { - case ZERO : return REAL_CAST( c8o27*rho*(1.0-cu_sq)); - case E : return REAL_CAST( c2o27*rho*(1.0+3.0*( vx1 )+c9o2*( vx1 )*( vx1 )-cu_sq)); - case W : return REAL_CAST( c2o27*rho*(1.0+3.0*(-vx1 )+c9o2*(-vx1 )*(-vx1 )-cu_sq)); - case N : return REAL_CAST( c2o27*rho*(1.0+3.0*( vx2)+c9o2*( vx2)*( vx2)-cu_sq)); - case S : return REAL_CAST( c2o27*rho*(1.0+3.0*( -vx2)+c9o2*( -vx2)*( -vx2)-cu_sq)); - case T : return REAL_CAST( c2o27*rho*(1.0+3.0*( vx3 )+c9o2*( vx3)*( vx3)-cu_sq)); - case B : return REAL_CAST( c2o27*rho*(1.0+3.0*( -vx3)+c9o2*( -vx3)*( -vx3)-cu_sq)); - case NE : return REAL_CAST( c1o54*rho*(1.0+3.0*( vx1+vx2)+c9o2*( vx1+vx2)*( vx1+vx2)-cu_sq)); - case SW : return REAL_CAST( c1o54*rho*(1.0+3.0*(-vx1-vx2)+c9o2*(-vx1-vx2)*(-vx1-vx2)-cu_sq)); - case SE : return REAL_CAST( c1o54*rho*(1.0+3.0*( vx1-vx2)+c9o2*( vx1-vx2)*( vx1-vx2)-cu_sq)); - case NW : return REAL_CAST( c1o54*rho*(1.0+3.0*(-vx1+vx2)+c9o2*(-vx1+vx2)*(-vx1+vx2)-cu_sq)); - case TE : return REAL_CAST( c1o54*rho*(1.0+3.0*( vx1+vx3)+c9o2*( vx1+vx3)*( vx1+vx3)-cu_sq)); - case BW : return REAL_CAST( c1o54*rho*(1.0+3.0*(-vx1-vx3)+c9o2*(-vx1-vx3)*(-vx1-vx3)-cu_sq)); - case BE : return REAL_CAST( c1o54*rho*(1.0+3.0*( vx1-vx3)+c9o2*( vx1-vx3)*( vx1-vx3)-cu_sq)); - case TW : return REAL_CAST( c1o54*rho*(1.0+3.0*(-vx1+vx3)+c9o2*(-vx1+vx3)*(-vx1+vx3)-cu_sq)); - case TN : return REAL_CAST( c1o54*rho*(1.0+3.0*( vx2+vx3)+c9o2*( vx2+vx3)*( vx2+vx3)-cu_sq)); - case BS : return REAL_CAST( c1o54*rho*(1.0+3.0*(-vx2-vx3)+c9o2*(-vx2-vx3)*(-vx2-vx3)-cu_sq)); - case BN : return REAL_CAST( c1o54*rho*(1.0+3.0*( vx2-vx3)+c9o2*( vx2-vx3)*( vx2-vx3)-cu_sq)); - case TS : return REAL_CAST( c1o54*rho*(1.0+3.0*(-vx2+vx3)+c9o2*(-vx2+vx3)*(-vx2+vx3)-cu_sq)); - case TNE : return REAL_CAST(c1o216*rho*(1.0+3.0*( vx1+vx2+vx3)+c9o2*( vx1+vx2+vx3)*( vx1+vx2+vx3)-cu_sq)); - case BSW : return REAL_CAST(c1o216*rho*(1.0+3.0*(-vx1-vx2-vx3)+c9o2*(-vx1-vx2-vx3)*(-vx1-vx2-vx3)-cu_sq)); - case BNE : return REAL_CAST(c1o216*rho*(1.0+3.0*( vx1+vx2-vx3)+c9o2*( vx1+vx2-vx3)*( vx1+vx2-vx3)-cu_sq)); - case TSW : return REAL_CAST(c1o216*rho*(1.0+3.0*(-vx1-vx2+vx3)+c9o2*(-vx1-vx2+vx3)*(-vx1-vx2+vx3)-cu_sq)); - case TSE : return REAL_CAST(c1o216*rho*(1.0+3.0*( vx1-vx2+vx3)+c9o2*( vx1-vx2+vx3)*( vx1-vx2+vx3)-cu_sq)); - case BNW : return REAL_CAST(c1o216*rho*(1.0+3.0*(-vx1+vx2-vx3)+c9o2*(-vx1+vx2-vx3)*(-vx1+vx2-vx3)-cu_sq)); - case BSE : return REAL_CAST(c1o216*rho*(1.0+3.0*( vx1-vx2-vx3)+c9o2*( vx1-vx2-vx3)*( vx1-vx2-vx3)-cu_sq)); - case TNW : return REAL_CAST(c1o216*rho*(1.0+3.0*(-vx1+vx2+vx3)+c9o2*(-vx1+vx2+vx3)*(-vx1+vx2+vx3)-cu_sq)); - default: throw UbException(UB_EXARGS,"unknown dir"); - } - } - ////////////////////////////////////////////////////////////////////////// - static void calcCompFeq(LBMReal* const& feq/*[27]*/,const LBMReal& rho,const LBMReal& vx1,const LBMReal& vx2,const LBMReal& vx3) - { - LBMReal cu_sq=1.5*(vx1*vx1+vx2*vx2+vx3*vx3); - - feq[ZERO] = c8o27*rho*(1.0-cu_sq); - feq[E] = c2o27*rho*(1.0+3.0*( vx1 )+c9o2*( vx1 )*( vx1 )-cu_sq); - feq[W] = c2o27*rho*(1.0+3.0*(-vx1 )+c9o2*(-vx1 )*(-vx1 )-cu_sq); - feq[N] = c2o27*rho*(1.0+3.0*( vx2)+c9o2*( vx2)*( vx2)-cu_sq); - feq[S] = c2o27*rho*(1.0+3.0*( -vx2)+c9o2*( -vx2)*( -vx2)-cu_sq); - feq[T] = c2o27*rho*(1.0+3.0*( vx3 )+c9o2*( vx3)*( vx3)-cu_sq); - feq[B] = c2o27*rho*(1.0+3.0*( -vx3)+c9o2*( -vx3)*( -vx3)-cu_sq); - feq[NE] = c1o54*rho*(1.0+3.0*( vx1+vx2)+c9o2*( vx1+vx2)*( vx1+vx2)-cu_sq); - feq[SW] = c1o54*rho*(1.0+3.0*(-vx1-vx2)+c9o2*(-vx1-vx2)*(-vx1-vx2)-cu_sq); - feq[SE] = c1o54*rho*(1.0+3.0*( vx1-vx2)+c9o2*( vx1-vx2)*( vx1-vx2)-cu_sq); - feq[NW] = c1o54*rho*(1.0+3.0*(-vx1+vx2)+c9o2*(-vx1+vx2)*(-vx1+vx2)-cu_sq); - feq[TE] = c1o54*rho*(1.0+3.0*( vx1+vx3)+c9o2*( vx1+vx3)*( vx1+vx3)-cu_sq); - feq[BW] = c1o54*rho*(1.0+3.0*(-vx1-vx3)+c9o2*(-vx1-vx3)*(-vx1-vx3)-cu_sq); - feq[BE] = c1o54*rho*(1.0+3.0*( vx1-vx3)+c9o2*( vx1-vx3)*( vx1-vx3)-cu_sq); - feq[TW] = c1o54*rho*(1.0+3.0*(-vx1+vx3)+c9o2*(-vx1+vx3)*(-vx1+vx3)-cu_sq); - feq[TN] = c1o54*rho*(1.0+3.0*( vx2+vx3)+c9o2*( vx2+vx3)*( vx2+vx3)-cu_sq); - feq[BS] = c1o54*rho*(1.0+3.0*(-vx2-vx3)+c9o2*(-vx2-vx3)*(-vx2-vx3)-cu_sq); - feq[BN] = c1o54*rho*(1.0+3.0*( vx2-vx3)+c9o2*( vx2-vx3)*( vx2-vx3)-cu_sq); - feq[TS] = c1o54*rho*(1.0+3.0*(-vx2+vx3)+c9o2*(-vx2+vx3)*(-vx2+vx3)-cu_sq); - feq[TNE] = c1o216*rho*(1.0+3.0*( vx1+vx2+vx3)+c9o2*( vx1+vx2+vx3)*( vx1+vx2+vx3)-cu_sq); - feq[BSW] = c1o216*rho*(1.0+3.0*(-vx1-vx2-vx3)+c9o2*(-vx1-vx2-vx3)*(-vx1-vx2-vx3)-cu_sq); - feq[BNE] = c1o216*rho*(1.0+3.0*( vx1+vx2-vx3)+c9o2*( vx1+vx2-vx3)*( vx1+vx2-vx3)-cu_sq); - feq[TSW] = c1o216*rho*(1.0+3.0*(-vx1-vx2+vx3)+c9o2*(-vx1-vx2+vx3)*(-vx1-vx2+vx3)-cu_sq); - feq[TSE] = c1o216*rho*(1.0+3.0*( vx1-vx2+vx3)+c9o2*( vx1-vx2+vx3)*( vx1-vx2+vx3)-cu_sq); - feq[BNW] = c1o216*rho*(1.0+3.0*(-vx1+vx2-vx3)+c9o2*(-vx1+vx2-vx3)*(-vx1+vx2-vx3)-cu_sq); - feq[BSE] = c1o216*rho*(1.0+3.0*( vx1-vx2-vx3)+c9o2*( vx1-vx2-vx3)*( vx1-vx2-vx3)-cu_sq); - feq[TNW] = c1o216*rho*(1.0+3.0*(-vx1+vx2+vx3)+c9o2*(-vx1+vx2+vx3)*(-vx1+vx2+vx3)-cu_sq); - } - ////////////////////////////////////////////////////////////////////////// - static LBMReal getIncompFeqForDirection(const int& direction,const LBMReal& drho, const LBMReal& vx1,const LBMReal& vx2,const LBMReal& vx3) - { - LBMReal cu_sq=1.5f*(vx1*vx1+vx2*vx2+vx3*vx3); - - switch(direction) - { - case ZERO : return REAL_CAST( c8o27*(drho-cu_sq)); - case E : return REAL_CAST( c2o27*(drho+3.0*( vx1 )+c9o2*( vx1 )*( vx1 )-cu_sq)); - case W : return REAL_CAST( c2o27*(drho+3.0*(-vx1 )+c9o2*(-vx1 )*(-vx1 )-cu_sq)); - case N : return REAL_CAST( c2o27*(drho+3.0*( vx2)+c9o2*( vx2)*( vx2)-cu_sq)); - case S : return REAL_CAST( c2o27*(drho+3.0*( -vx2)+c9o2*( -vx2)*( -vx2)-cu_sq)); - case T : return REAL_CAST( c2o27*(drho+3.0*( vx3 )+c9o2*( vx3)*( vx3)-cu_sq)); - case B : return REAL_CAST( c2o27*(drho+3.0*( -vx3)+c9o2*( -vx3)*( -vx3)-cu_sq)); - case NE : return REAL_CAST( c1o54*(drho+3.0*( vx1+vx2)+c9o2*( vx1+vx2)*( vx1+vx2)-cu_sq)); - case SW : return REAL_CAST( c1o54*(drho+3.0*(-vx1-vx2)+c9o2*(-vx1-vx2)*(-vx1-vx2)-cu_sq)); - case SE : return REAL_CAST( c1o54*(drho+3.0*( vx1-vx2)+c9o2*( vx1-vx2)*( vx1-vx2)-cu_sq)); - case NW : return REAL_CAST( c1o54*(drho+3.0*(-vx1+vx2)+c9o2*(-vx1+vx2)*(-vx1+vx2)-cu_sq)); - case TE : return REAL_CAST( c1o54*(drho+3.0*( vx1+vx3)+c9o2*( vx1+vx3)*( vx1+vx3)-cu_sq)); - case BW : return REAL_CAST( c1o54*(drho+3.0*(-vx1-vx3)+c9o2*(-vx1-vx3)*(-vx1-vx3)-cu_sq)); - case BE : return REAL_CAST( c1o54*(drho+3.0*( vx1-vx3)+c9o2*( vx1-vx3)*( vx1-vx3)-cu_sq)); - case TW : return REAL_CAST( c1o54*(drho+3.0*(-vx1+vx3)+c9o2*(-vx1+vx3)*(-vx1+vx3)-cu_sq)); - case TN : return REAL_CAST( c1o54*(drho+3.0*( vx2+vx3)+c9o2*( vx2+vx3)*( vx2+vx3)-cu_sq)); - case BS : return REAL_CAST( c1o54*(drho+3.0*(-vx2-vx3)+c9o2*(-vx2-vx3)*(-vx2-vx3)-cu_sq)); - case BN : return REAL_CAST( c1o54*(drho+3.0*( vx2-vx3)+c9o2*( vx2-vx3)*( vx2-vx3)-cu_sq)); - case TS : return REAL_CAST( c1o54*(drho+3.0*(-vx2+vx3)+c9o2*(-vx2+vx3)*(-vx2+vx3)-cu_sq)); - case TNE : return REAL_CAST(c1o216*(drho+3.0*( vx1+vx2+vx3)+c9o2*( vx1+vx2+vx3)*( vx1+vx2+vx3)-cu_sq)); - case BSW : return REAL_CAST(c1o216*(drho+3.0*(-vx1-vx2-vx3)+c9o2*(-vx1-vx2-vx3)*(-vx1-vx2-vx3)-cu_sq)); - case BNE : return REAL_CAST(c1o216*(drho+3.0*( vx1+vx2-vx3)+c9o2*( vx1+vx2-vx3)*( vx1+vx2-vx3)-cu_sq)); - case TSW : return REAL_CAST(c1o216*(drho+3.0*(-vx1-vx2+vx3)+c9o2*(-vx1-vx2+vx3)*(-vx1-vx2+vx3)-cu_sq)); - case TSE : return REAL_CAST(c1o216*(drho+3.0*( vx1-vx2+vx3)+c9o2*( vx1-vx2+vx3)*( vx1-vx2+vx3)-cu_sq)); - case BNW : return REAL_CAST(c1o216*(drho+3.0*(-vx1+vx2-vx3)+c9o2*(-vx1+vx2-vx3)*(-vx1+vx2-vx3)-cu_sq)); - case BSE : return REAL_CAST(c1o216*(drho+3.0*( vx1-vx2-vx3)+c9o2*( vx1-vx2-vx3)*( vx1-vx2-vx3)-cu_sq)); - case TNW : return REAL_CAST(c1o216*(drho+3.0*(-vx1+vx2+vx3)+c9o2*(-vx1+vx2+vx3)*(-vx1+vx2+vx3)-cu_sq)); - default: throw UbException(UB_EXARGS,"unknown dir"); - } - } - ////////////////////////////////////////////////////////////////////////// - static void calcIncompFeq(LBMReal* const& feq/*[27]*/,const LBMReal& drho,const LBMReal& vx1,const LBMReal& vx2,const LBMReal& vx3) - { - LBMReal cu_sq=1.5f*(vx1*vx1+vx2*vx2+vx3*vx3); - - feq[ZERO] = c8o27*(drho-cu_sq); - feq[E] = c2o27*(drho+3.0*( vx1 )+c9o2*( vx1 )*( vx1 )-cu_sq); - feq[W] = c2o27*(drho+3.0*(-vx1 )+c9o2*(-vx1 )*(-vx1 )-cu_sq); - feq[N] = c2o27*(drho+3.0*( vx2)+c9o2*( vx2)*( vx2)-cu_sq); - feq[S] = c2o27*(drho+3.0*( -vx2)+c9o2*( -vx2)*( -vx2)-cu_sq); - feq[T] = c2o27*(drho+3.0*( vx3 )+c9o2*( vx3)*( vx3)-cu_sq); - feq[B] = c2o27*(drho+3.0*( -vx3)+c9o2*( -vx3)*( -vx3)-cu_sq); - feq[NE] = c1o54*(drho+3.0*( vx1+vx2)+c9o2*( vx1+vx2)*( vx1+vx2)-cu_sq); - feq[SW] = c1o54*(drho+3.0*(-vx1-vx2)+c9o2*(-vx1-vx2)*(-vx1-vx2)-cu_sq); - feq[SE] = c1o54*(drho+3.0*( vx1-vx2)+c9o2*( vx1-vx2)*( vx1-vx2)-cu_sq); - feq[NW] = c1o54*(drho+3.0*(-vx1+vx2)+c9o2*(-vx1+vx2)*(-vx1+vx2)-cu_sq); - feq[TE] = c1o54*(drho+3.0*( vx1+vx3)+c9o2*( vx1+vx3)*( vx1+vx3)-cu_sq); - feq[BW] = c1o54*(drho+3.0*(-vx1-vx3)+c9o2*(-vx1-vx3)*(-vx1-vx3)-cu_sq); - feq[BE] = c1o54*(drho+3.0*( vx1-vx3)+c9o2*( vx1-vx3)*( vx1-vx3)-cu_sq); - feq[TW] = c1o54*(drho+3.0*(-vx1+vx3)+c9o2*(-vx1+vx3)*(-vx1+vx3)-cu_sq); - feq[TN] = c1o54*(drho+3.0*( vx2+vx3)+c9o2*( vx2+vx3)*( vx2+vx3)-cu_sq); - feq[BS] = c1o54*(drho+3.0*(-vx2-vx3)+c9o2*(-vx2-vx3)*(-vx2-vx3)-cu_sq); - feq[BN] = c1o54*(drho+3.0*( vx2-vx3)+c9o2*( vx2-vx3)*( vx2-vx3)-cu_sq); - feq[TS] = c1o54*(drho+3.0*(-vx2+vx3)+c9o2*(-vx2+vx3)*(-vx2+vx3)-cu_sq); - feq[TNE] = c1o216*(drho+3.0*( vx1+vx2+vx3)+c9o2*( vx1+vx2+vx3)*( vx1+vx2+vx3)-cu_sq); - feq[BSW] = c1o216*(drho+3.0*(-vx1-vx2-vx3)+c9o2*(-vx1-vx2-vx3)*(-vx1-vx2-vx3)-cu_sq); - feq[BNE] = c1o216*(drho+3.0*( vx1+vx2-vx3)+c9o2*( vx1+vx2-vx3)*( vx1+vx2-vx3)-cu_sq); - feq[TSW] = c1o216*(drho+3.0*(-vx1-vx2+vx3)+c9o2*(-vx1-vx2+vx3)*(-vx1-vx2+vx3)-cu_sq); - feq[TSE] = c1o216*(drho+3.0*( vx1-vx2+vx3)+c9o2*( vx1-vx2+vx3)*( vx1-vx2+vx3)-cu_sq); - feq[BNW] = c1o216*(drho+3.0*(-vx1+vx2-vx3)+c9o2*(-vx1+vx2-vx3)*(-vx1+vx2-vx3)-cu_sq); - feq[BSE] = c1o216*(drho+3.0*( vx1-vx2-vx3)+c9o2*( vx1-vx2-vx3)*( vx1-vx2-vx3)-cu_sq); - feq[TNW] = c1o216*(drho+3.0*(-vx1+vx2+vx3)+c9o2*(-vx1+vx2+vx3)*(-vx1+vx2+vx3)-cu_sq); - } - ////////////////////////////////////////////////////////////////////////// - static inline float getBoundaryVelocityForDirection(const int& direction, const float& bcVelocityX1,const float& bcVelocityX2,const float& bcVelocityX3) - { - switch(direction) - { - case E: return (float)( UbMath::c4o9*(+bcVelocityX1) ); - case W: return (float)( UbMath::c4o9*(-bcVelocityX1) ); - case N: return (float)( UbMath::c4o9*(+bcVelocityX2) ); - case S: return (float)( UbMath::c4o9*(-bcVelocityX2) ); - case T: return (float)( UbMath::c4o9*(+bcVelocityX3) ); - case B: return (float)( UbMath::c4o9*(-bcVelocityX3) ); - case NE: return (float)( UbMath::c1o9*(+bcVelocityX1+bcVelocityX2 ) ); - case SW: return (float)( UbMath::c1o9*(-bcVelocityX1-bcVelocityX2 ) ); - case SE: return (float)( UbMath::c1o9*(+bcVelocityX1-bcVelocityX2 ) ); - case NW: return (float)( UbMath::c1o9*(-bcVelocityX1+bcVelocityX2 ) ); - case TE: return (float)( UbMath::c1o9*(+bcVelocityX1 +bcVelocityX3) ); - case BW: return (float)( UbMath::c1o9*(-bcVelocityX1 -bcVelocityX3) ); - case BE: return (float)( UbMath::c1o9*(+bcVelocityX1 -bcVelocityX3) ); - case TW: return (float)( UbMath::c1o9*(-bcVelocityX1 +bcVelocityX3) ); - case TN: return (float)( UbMath::c1o9*( +bcVelocityX2+bcVelocityX3) ); - case BS: return (float)( UbMath::c1o9*( -bcVelocityX2-bcVelocityX3) ); - case BN: return (float)( UbMath::c1o9*( +bcVelocityX2-bcVelocityX3) ); - case TS: return (float)( UbMath::c1o9*( -bcVelocityX2+bcVelocityX3) ); - case TNE: return (float)( UbMath::c1o36*(+bcVelocityX1+bcVelocityX2+bcVelocityX3) ); - case BSW: return (float)( UbMath::c1o36*(-bcVelocityX1-bcVelocityX2-bcVelocityX3) ); - case BNE: return (float)( UbMath::c1o36*(+bcVelocityX1+bcVelocityX2-bcVelocityX3) ); - case TSW: return (float)( UbMath::c1o36*(-bcVelocityX1-bcVelocityX2+bcVelocityX3) ); - case TSE: return (float)( UbMath::c1o36*(+bcVelocityX1-bcVelocityX2+bcVelocityX3) ); - case BNW: return (float)( UbMath::c1o36*(-bcVelocityX1+bcVelocityX2-bcVelocityX3) ); - case BSE: return (float)( UbMath::c1o36*(+bcVelocityX1-bcVelocityX2-bcVelocityX3) ); - case TNW: return (float)( UbMath::c1o36*(-bcVelocityX1+bcVelocityX2+bcVelocityX3) ); - default: throw UbException(UB_EXARGS,"unknown direction"); - } - } - /*=====================================================================*/ - static const int& getInvertDirection(const int& direction) - { -#ifdef _DEBUG - if(direction<STARTDIR || direction>ENDDIR) - throw UbException(UB_EXARGS,"unknown direction"); -#endif - return INVDIR[direction]; - } - /*=====================================================================*/ - static std::vector<int> getFDirs() - { - std::vector<int> D3Q27_f_Dirs; - D3Q27_f_Dirs.resize(ENDF+1); - for(int dir=STARTF; dir<=ENDF; ++dir) - D3Q27_f_Dirs[dir] = dir; - - return D3Q27_f_Dirs; - } - /*=====================================================================*/ - static std::vector<int> getDirs(const bool& onlyLBdirs) - { - std::vector<int> D3Q27Dirs; - if(onlyLBdirs) /*FSTARTDIR->FENDDIR*/ - { - D3Q27Dirs.resize(FENDDIR+1); - for(int dir=FSTARTDIR; dir<=FENDDIR; ++dir) - D3Q27Dirs[dir] = dir; - } - else /*STARTDIR->ENDDIR*/ - { - D3Q27Dirs.resize(ENDDIR+1); - for(int dir=STARTDIR; dir<=ENDDIR; ++dir) - D3Q27Dirs[dir] = dir; - } - return D3Q27Dirs; - } - ////////////////////////////////////////////////////////////////////////// - static LBMReal calcCollisionFactor(LBMReal viscosity, LBMReal deltaX) - { - return 1.0/(3.0*viscosity/deltaX+0.5); - } - - - - -}; - -#endif - diff --git a/src/VirtualFluids/LBM/LBMUnitConverter.h b/src/VirtualFluids/LBM/LBMUnitConverter.h deleted file mode 100644 index 58f759909..000000000 --- a/src/VirtualFluids/LBM/LBMUnitConverter.h +++ /dev/null @@ -1,215 +0,0 @@ -#ifndef LBMUNITCONVERTER_H -#define LBMUNITCONVERTER_H - -#include <iostream> -#include <iomanip> -#include <string> -#include <sstream> - -#include "LBMUnitConverter.h" - -#include <basics/utilities/UbException.h> -#include <basics/utilities/UbFileInput.h> -#include <basics/utilities/UbFileOutput.h> - -#include <boost/smart_ptr/shared_ptr.hpp> -#include <boost/serialization/serialization.hpp> - -// LBMUnitConverter conv( 100 /*L_World*/, 1484/*cs_water*/ , 1000/*rho_water*/ -// , 1000/*L_LB*/ , 1./srqt(3.)/*cs_Lb*/, 1/*rho_Lb*/ ); -// cout<<conv.toString()<<endl; -// -// cout<<"100m = "<< 100 * conv.getFactorLentghWToLb() << "dx " << std::endl; -// cout<<"1000dx = "<< 1000 * conv.getFactorLentghLbToW() << "m " << std::endl; -// -// cout<<"25m/s = "<< 25 * conv.getFactorVelocityWToLb() << "dx/dt " << std::endl; -// cout<<"0.04 dx/dt = "<< 0.04 * conv.getFactorVelocityLbToW() << "m/s " << std::endl; -// -//alternativ -// LBMUnitConverter conv(, 100 /*L_World*/, LBMUnitConverter::WATER, 1000/*L_LB*/ ); - -class LBMUnitConverter; -typedef std::shared_ptr<LBMUnitConverter> LBMUnitConverterPtr; - -class LBMUnitConverter -{ -public: - - enum WORLD_MATERIAL { WATER = 0, SEAWWATER = 1, AIR_20C = 2, OIL = 3 }; - - LBMUnitConverter() : factorLengthLbToW(1.0), - factorTimeLbToW(1.0), - factorMassLbToW(1.0), - refRhoLb(1.0), - factorVelocityLbToW(1.0), - factorViscosityLbToW(1.0), - factorDensityLbToW(1.0), - factorPressureLbToW(1.0) - { - - } - - LBMUnitConverter( const double& refLengthWorld, const double& csWorld, const double& rhoWorld - , const double& refLengthLb , const double& csLb = 1.0/std::sqrt(3.0) , const double& rhoLb = 1.0 ) - { - this->init( refLengthWorld, csWorld, rhoWorld, csWorld, refLengthLb, rhoLb, csLb ); - - } - - LBMUnitConverter( const double& refLengthWorld, WORLD_MATERIAL worldMaterial - , const double& refLengthLb , const double& csLb = 1.0/std::sqrt(3.0) , const double& rhoLb = 1.0 ) - { - double csWorld; - double rhoWorld; - - if ( worldMaterial == WATER ) { csWorld = 1484/*m/s*/; rhoWorld = 1000/*kg/m^3*/; } - else if( worldMaterial == SEAWWATER) { csWorld = 1500/*m/s*/; rhoWorld = 1025/*kg/m^3*/; } - else if( worldMaterial == AIR_20C ) { csWorld = 343/*m/s*/; rhoWorld = 1.290/*kg/m^3*/; } - else if( worldMaterial == OIL ) { csWorld = 1740/*m/s*/; rhoWorld = 830/*kg/m^3*/; } - else throw UbException(UB_EXARGS,"unknown material"); - - this->init( refLengthWorld, csWorld, rhoWorld, csWorld, refLengthLb, rhoLb, csLb ); - - } - - LBMUnitConverter(int dummy, double uReal, double uLB, double nuReal, double nuLB) - { - factorVelocityLbToW = uReal/uLB; - factorViscosityLbToW = nuReal/nuLB; - factorDensityLbToW = factorViscosityLbToW * factorVelocityLbToW * factorVelocityLbToW; - factorPressureLbToW = factorDensityLbToW; - } - - virtual ~LBMUnitConverter() {} - - double getRefRhoLb() { return refRhoLb; } - - double getFactorLentghLbToW() { return factorLengthLbToW; } - double getFactorLentghWToLb() { return 1.0/this->getFactorLentghLbToW(); } - - double getFactorTimeLbToW() { return factorTimeLbToW; } - double getFactorTimeWToLb() { return 1.0/this->getFactorTimeLbToW(); } - - double getFactorVelocityLbToW() { return factorLengthLbToW/factorTimeLbToW; } - double getFactorVelocityWToLb() { return 1.0/this->getFactorVelocityLbToW(); } - - double getFactorViscosityLbToW() { return factorLengthLbToW*factorLengthLbToW/factorTimeLbToW; } - double getFactorViscosityWToLb() { return 1.0/this->getFactorViscosityLbToW(); } - - double getFactorDensityLbToW() { return this->factorMassLbToW/std::pow(factorLengthLbToW,3.0); } - double getFactorDensityWToLb() { return 1.0/this->getFactorDensityLbToW(); } - - double getFactorPressureLbToW() { return this->factorMassLbToW/(std::pow(factorTimeLbToW,2.0)*factorLengthLbToW); } - double getFactorPressureWToLb() { return 1.0/this->getFactorPressureLbToW(); } - - double getFactorMassLbToW() { return this->factorMassLbToW; } - double getFactorMassWToLb() { return 1.0/this->getFactorMassLbToW(); } - - double getFactorForceLbToW() { return factorMassLbToW*factorLengthLbToW/(factorTimeLbToW*factorTimeLbToW); } - double getFactorForceWToLb() { return 1.0/this->getFactorForceLbToW(); } - - double getFactorAccLbToW() { return factorLengthLbToW/(factorTimeLbToW*factorTimeLbToW); } - double getFactorAccWToLb() { return 1.0/this->getFactorAccLbToW(); } - - double getFactorTimeLbToW(double deltaX) const { return factorTimeWithoutDx * deltaX; } - ////////////////////////////////////////////////////////////////////////// - double getFactorVelocityLbToW2() { return factorVelocityLbToW; } - double getFactorDensityLbToW2() { return factorDensityLbToW; } - double getFactorPressureLbToW2() { return factorPressureLbToW; } - - - - /*==========================================================*/ - friend inline std::ostream& operator << (std::ostream& os, LBMUnitConverter c) - { - os<<c.toString(); - return os; - } - /*==========================================================*/ - std::string toString() - { - std::ostringstream out; - out<<"LB --> WORLD" << std::endl; - out<<" * lentgh 1[dx ] = " << std::setw(12) << this->getFactorLentghLbToW() << " [m ] " << std::endl; - out<<" * time 1[dt ] = " << std::setw(12) << this->getFactorTimeLbToW() << " [s ] " << std::endl; - out<<" * mass 1[mass] = " << std::setw(12) << this->getFactorMassLbToW() << " [kg ] " << std::endl; - out<<std::endl; - out<<"WORLD --> LB" << std::endl; - out<<" * lentgh 1[m ] = " << std::setw(12) << this->getFactorLentghWToLb() << " [dx ] " << std::endl; - out<<" * time 1[s ] = " << std::setw(12) << this->getFactorTimeWToLb() << " [dt ] " << std::endl; - out<<" * mass 1[kg ] = " << std::setw(12) << this->getFactorMassWToLb() << " [mass] " << std::endl; - out<<std::endl; - out<<"LB --> WORLD (combined units)" << std::endl; - out<<" * velocity 1 [dx/dt ] = " << std::setw(12) << this->getFactorVelocityLbToW() << " [m/s ]" << std::endl; - out<<" * density 1 [mass/dx^3] = " << std::setw(12) << this->getFactorDensityLbToW() << " [kg/m^3 ]" << std::endl; - out<<" * pressure 1 [F_lb/dx^2] = " << std::setw(12) << this->getFactorPressureLbToW() << " [N/m^2 ]" << std::endl; - out<<" * viscosity 1 [dx^2/dt ] = " << std::setw(12) << this->getFactorViscosityLbToW() << " [m^2/s ]" << std::endl; - out<<" * force 1 [F_lb ] = " << std::setw(12) << this->getFactorForceLbToW() << " [N ]" << std::endl; - out<<" * acceleration 1 [dx/dt^2 ] = " << std::setw(12) << this->getFactorAccLbToW() << " [m/s^2 ]" << std::endl; - out<<std::endl; - out<<"WORLD --> LB (combined units)" << std::endl; - out<<" * velocity 1 [m/s ] = " << std::setw(12) << this->getFactorVelocityWToLb() << " [dx/dt ]" << std::endl; - out<<" * density 1 [kg/m^3 ] = " << std::setw(12) << this->getFactorDensityWToLb() << " [mass/dx^3]" << std::endl; - out<<" * pressure 1 [N/m^2 ] = " << std::setw(12) << this->getFactorPressureWToLb() << " [F_lb/dx^2]" << std::endl; - out<<" * viscosity 1 [m^2/s ] = " << std::setw(12) << this->getFactorViscosityWToLb() << " [dx^2/dt ]" << std::endl; - out<<" * force 1 [N ] = " << std::setw(12) << this->getFactorForceWToLb() << " [F_lb ]" << std::endl; - out<<" * acceleration 1 [m/s^2 ] = " << std::setw(12) << this->getFactorAccWToLb() << " [dx/dt^2 ]" << std::endl; - - return out.str(); - } - /*==========================================================*/ - virtual void write(UbFileOutput* out) - { - out->writeDouble(factorLengthLbToW); - out->writeDouble(factorTimeLbToW ); - out->writeDouble(factorMassLbToW ); - } - /*==========================================================*/ - virtual void read(UbFileInput* in) - { - factorLengthLbToW = in->readDouble(); - factorTimeLbToW = in->readDouble(); - factorMassLbToW = in->readDouble(); - } - - - - void init( const double& refLengthWorld, const double& csWorld, const double& rhoWorld, const double& vWorld, - const double& refLengthLb, const double& rhoLb, const double& vLb ) - { - factorLengthLbToW = refLengthWorld / refLengthLb; - factorTimeLbToW = vLb / vWorld * factorLengthLbToW; - factorMassLbToW = rhoWorld/rhoLb*factorLengthLbToW*factorLengthLbToW*factorLengthLbToW; - factorTimeWithoutDx=vLb/vWorld; - this->refRhoLb = rhoLb; - } - protected: - double factorLengthLbToW; - double factorTimeLbToW; - double factorMassLbToW; - double refRhoLb; - double factorTimeWithoutDx; - - double factorVelocityLbToW; - double factorViscosityLbToW; - double factorDensityLbToW; - double factorPressureLbToW; - - private: - friend class boost::serialization::access; - template<class Archive> - void serialize(Archive & ar, const unsigned int version) - { - ar & factorLengthLbToW; - ar & factorTimeLbToW; - ar & factorMassLbToW; - ar & refRhoLb; - ar & factorTimeWithoutDx; - ar & factorVelocityLbToW; - ar & factorViscosityLbToW; - ar & factorDensityLbToW; - ar & factorPressureLbToW; - } -}; - -#endif //LBMUNITCONVERTER_H diff --git a/src/VirtualFluids/LBM/VoidLBMKernel.cpp b/src/VirtualFluids/LBM/VoidLBMKernel.cpp deleted file mode 100644 index a9af2e84e..000000000 --- a/src/VirtualFluids/LBM/VoidLBMKernel.cpp +++ /dev/null @@ -1,49 +0,0 @@ -#include "VoidLBMKernel.h" -#include "VoidData3D.h" -#include "BCProcessor.h" -#include "DataSet3D.h" - -VoidLBMKernel::VoidLBMKernel() -{ - -} - -VoidLBMKernel::VoidLBMKernel(int nx1, int nx2, int nx3) : nx1(nx1), nx2(nx2), nx3(nx3) -{ - DistributionArray3DPtr d(new VoidData3D(nx1+2, nx2+2, nx3+2, -999.0)); - dataSet->setFdistributions(d); -} - -VoidLBMKernel::~VoidLBMKernel() -{ - -} - -LBMKernelPtr VoidLBMKernel::clone() -{ - LBMKernelPtr kernel(new VoidLBMKernel(nx1, nx2, nx3)); - kernel->setCollisionFactor(this->collFactor); - kernel->setBCProcessor(bcProcessor->clone(kernel)); - kernel->setWithForcing(withForcing); - kernel->setForcingX1(muForcingX1); - kernel->setForcingX2(muForcingX2); - kernel->setForcingX3(muForcingX3); - kernel->setIndex(ix1, ix2, ix3); - kernel->setDeltaT(deltaT); - return kernel; -} - -void VoidLBMKernel::calculate() -{ - -} - -void VoidLBMKernel::swapDistributions() -{ - -} - -double VoidLBMKernel::getCalculationTime() -{ - return 0.0; -} diff --git a/src/VirtualFluids/LBM/VoidLBMKernel.h b/src/VirtualFluids/LBM/VoidLBMKernel.h deleted file mode 100644 index fbab39c20..000000000 --- a/src/VirtualFluids/LBM/VoidLBMKernel.h +++ /dev/null @@ -1,28 +0,0 @@ -#ifndef VoidLBMKernel_h__ -#define VoidLBMKernel_h__ - -#include "LBMKernel.h" - -class VoidLBMKernel : public LBMKernel -{ -public: - VoidLBMKernel(); - VoidLBMKernel(int nx1, int nx2, int nx3); - ~VoidLBMKernel(); - LBMKernelPtr clone(); - void calculate(); - void swapDistributions(); - double getCalculationTime(); -protected: -private: - int nx1, nx2, nx3; - friend class boost::serialization::access; - template<class Archive> - void serialize(Archive & ar, const unsigned int version) - { - ar & boost::serialization::base_object<LBMKernel>(*this); - ar & nx1 & nx2 & nx3; - } - -}; -#endif // VoidLBMKernel_h__ diff --git a/src/VirtualFluids/LBM/package.include b/src/VirtualFluids/LBM/package.include deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/VirtualFluids/Parallel/BlocksDistributor.cpp b/src/VirtualFluids/Parallel/BlocksDistributor.cpp deleted file mode 100644 index de5613ea6..000000000 --- a/src/VirtualFluids/Parallel/BlocksDistributor.cpp +++ /dev/null @@ -1,7 +0,0 @@ -#include "BlocksDistributor.h" - -BlocksDistributor::BlocksDistributor(Grid3DPtr grid, CommunicatorPtr comm) : grid(grid), comm(comm) -{ - -} - diff --git a/src/VirtualFluids/Parallel/BlocksDistributor.h b/src/VirtualFluids/Parallel/BlocksDistributor.h deleted file mode 100644 index 3fa34948e..000000000 --- a/src/VirtualFluids/Parallel/BlocksDistributor.h +++ /dev/null @@ -1,26 +0,0 @@ -#ifndef BlocksDistributor_H -#define BlocksDistributor_H - -#include "Communicator.h" -#include "Grid3D.h" - -#include <memory> - -class BlocksDistributor; -typedef std::shared_ptr<BlocksDistributor> BlocksDistributorPtr; - -class BlocksDistributor -{ -public: - BlocksDistributor(Grid3DPtr grid, CommunicatorPtr comm); - ~BlocksDistributor(); - -protected: -private: - Grid3DPtr grid; - CommunicatorPtr comm; -}; - -#endif - - diff --git a/src/VirtualFluids/Parallel/CMakePackage.txt b/src/VirtualFluids/Parallel/CMakePackage.txt deleted file mode 100644 index 1b8416f01..000000000 --- a/src/VirtualFluids/Parallel/CMakePackage.txt +++ /dev/null @@ -1,2 +0,0 @@ -GET_FILENAME_COMPONENT( CURRENT_DIR ${CMAKE_CURRENT_LIST_FILE} PATH) -COLLECT_PACKAGE_DATA_WITH_OPTION(${CURRENT_DIR} ALL_SOURCES) diff --git a/src/VirtualFluids/Parallel/Communicator.cpp b/src/VirtualFluids/Parallel/Communicator.cpp deleted file mode 100644 index cdaa2c5ec..000000000 --- a/src/VirtualFluids/Parallel/Communicator.cpp +++ /dev/null @@ -1,12 +0,0 @@ -#include "Communicator.h" -#include <basics/utilities/UbException.h> - -CommunicatorPtr Communicator::instance = CommunicatorPtr(); -////////////////////////////////////////////////////////////////////////// -CommunicatorPtr Communicator::getInstance() -{ - if( !instance ) - UB_THROW(UbException(UB_EXARGS,"Communicator isn't initialized correctly! You can not create a new instance of abstract Communicator class!")); - return instance; -} - diff --git a/src/VirtualFluids/Parallel/Communicator.h b/src/VirtualFluids/Parallel/Communicator.h deleted file mode 100644 index 8d8b04c40..000000000 --- a/src/VirtualFluids/Parallel/Communicator.h +++ /dev/null @@ -1,58 +0,0 @@ -#ifndef COMMUNICATOR_H -#define COMMUNICATOR_H - -#include <vector> -#include <string> -#include <memory> - -#include <VirtualFluidsDefinitions.h> - -class Communicator; -typedef std::shared_ptr<Communicator> CommunicatorPtr; - -class VF_PUBLIC Communicator -{ -public: - virtual ~Communicator(){} - static CommunicatorPtr getInstance(); - virtual int getBundleID() = 0; - virtual int getNumberOfBundles() = 0; - virtual int getProcessID() = 0; - virtual int getProcessID(int bundle, int rank) = 0; - virtual int getNumberOfProcesses() = 0; - virtual bool isRoot() = 0; - virtual void* getNativeCommunicator() = 0; - - virtual void sendSerializedObject(std::stringstream& ss, int target) = 0; - virtual void receiveSerializedObject(std::stringstream& ss, int source) = 0; - - virtual int getRoot() = 0; - virtual int getBundleRoot() = 0; - virtual int getProcessRoot() = 0; - virtual int getNumberOfProcessesInBundle(int bundle) = 0; - virtual void barrier() = 0; - virtual void abort(int errorcode) = 0; - - virtual std::vector<std::string> gather(const std::string& str) = 0; - virtual std::vector<int> gather(std::vector<int>& values) = 0; - virtual std::vector<float> gather(std::vector<float>& values) = 0; - virtual std::vector<double> gather(std::vector<double>& values) = 0; - - virtual void allGather(std::vector<int>& svalues, std::vector<int>& rvalues) = 0; - virtual void allGather(std::vector<float>& svalues, std::vector<float>& rvalues) = 0; - virtual void allGather(std::vector<double>& svalues, std::vector<double>& rvalues) = 0; - - virtual void broadcast(int& value) = 0; - virtual void broadcast(float& value) = 0; - virtual void broadcast(double& value) = 0; - virtual void broadcast(std::vector<int>& values) = 0; - virtual void broadcast(std::vector<float>& values) = 0; - virtual void broadcast(std::vector<double>& values) = 0; -protected: - Communicator(){} - static CommunicatorPtr instance; -private: -}; - -#endif - diff --git a/src/VirtualFluids/Parallel/LoadBalancer.cpp b/src/VirtualFluids/Parallel/LoadBalancer.cpp deleted file mode 100644 index cd04964da..000000000 --- a/src/VirtualFluids/Parallel/LoadBalancer.cpp +++ /dev/null @@ -1,507 +0,0 @@ -#if defined VF_MPI - -#include "LoadBalancer.h" - -#include <boost/archive/text_oarchive.hpp> -#include <boost/archive/text_iarchive.hpp> -#include <boost/algorithm/string.hpp> -#include "MPICommunicator.h" -#include "MathUtil.hpp" - -//#include "BoostSerializationClassExportHelper.h" - -LoadBalancer::LoadBalancer(Grid3DPtr grid, CommunicatorPtr comm, const int& endDir) : -grid(grid), -comm(comm), -endDir(endDir) -{ - mpi_comm = *((MPI_Comm*) comm->getNativeCommunicator()); - processID = comm->getProcessID(); - int size = comm->getNumberOfProcesses(); - converged.resize(size,0); -} -////////////////////////////////////////////////////////////////////////// -LoadBalancer::~LoadBalancer() -{ - -} -////////////////////////////////////////////////////////////////////////// -bool LoadBalancer::balance() -{ - if (!isConverged()) - { - //std::cout << "is not converged" << std::endl; - if(processID == 0) - UBLOG(logINFO,"is not converged"); - collectData(); - collectNeighboursLoad(); - prepareToSendLoad(); - prepareToRecieveLoad(); - sendRecieveLoad(); - saveRecievedLoad(); - //MPI_Barrier(mpi_comm); - //std::cout<< "MPI_Barrier: PID = " << processID <<std::endl; - return false; - } - else - { - //std::cout << "is converged" << std::endl; - if(processID == 0) - UBLOG(logINFO,"is converged"); - return true; - } -} -////////////////////////////////////////////////////////////////////////// -void LoadBalancer::prepareToSendLoad() -{ - sendBuffer.clear(); - removeBlocksSend.resize(0); - int conv = 1; - for(NeighbourProcess neighbProzess : neighbourProcesses) - { - if (this->load != neighbProzess.load) - { - if(neighbProzess.load < this->load) - { - //std::cout<<"rank = " << comm->getProcessID() << " : send Abweichung = " << (this->load/neighbProzess.load - 1.0)*100.0 <<std::endl; - if ((static_cast<double>(this->load)/static_cast<double>(neighbProzess.load) - 1.0)*100.0 > 3.0) - { - //if(processID == 0) - UBLOG(logINFO,"rank = " << comm->getProcessID() << " : send Abweichung = " << (this->load/neighbProzess.load - 1.0)*100.0); - double transLoad = (this->load - neighbProzess.load)/2; - prepareToSendLoad(neighbProzess.processID, transLoad, conv); - } - } - } - } - setConverged(conv); -} -////////////////////////////////////////////////////////////////////////// -void LoadBalancer::prepareToSendLoad(const int& nProcessID, const double& transLoad, int& conv) -{ - if((itnMap = neighboursMap.find(nProcessID)) != neighboursMap.end()) - { - TransferBuffer sbuf; - std::vector<Block3DPtr> sendBlocks; - BBlocks &boundaryBlocks = itnMap->second; - TBlocks tBlocks; - std::stringstream ss_out; - - std::string str_out; - - for(LoadBalancer::BBlocks::value_type b : boundaryBlocks) - { - TransferBlock &tBlock = b.second; - tBlocks.insert(std::make_pair(tBlock.weight, tBlock)); - } - - double lsum = 0; - for(LoadBalancer::TBlocks::value_type t : tBlocks) - { - TransferBlock &tBlock = t.second; - lsum += tBlock.load; - - if(lsum >= transLoad) - break; - - sendBlocks.push_back(tBlock.block); - for(BBlocksMap::value_type &bbm : neighboursMap) - bbm.second.erase(tBlock.block); - - //if(lsum >= transLoad) - // break; - } - if (sendBlocks.size() > 0) - { - boost::archive::text_oarchive oa(ss_out); - oa.register_type<Block3D>(); - - for(Block3DPtr b : sendBlocks) - { - oa << b; - } - - sbuf.sbuffer = ss_out.str(); - sbuf.sbufferSize = static_cast<int> (sbuf.sbuffer.length()); - sbuf.blocksSize = static_cast<int>(sendBlocks.size()); - - sbuf.comFlag = 1; - sendBuffer.insert(std::make_pair(nProcessID, sbuf)); - - for(Block3DPtr b : sendBlocks) - { - b->deleteKernel(); - b->setRank(nProcessID); - b->deleteConnectors(); - //b->deleteInterpolationConnectors(); - - removeBlocksSend.push_back(b->getX1()); - removeBlocksSend.push_back(b->getX2()); - removeBlocksSend.push_back(b->getX3()); - removeBlocksSend.push_back(b->getLevel()); - removeBlocksSend.push_back(b->getRank()); - - //std::cout<< "Send: PID = " << processID << " block: " <<b->toString()<<std::endl; - } - conv *= 0; - } - else - { - sbuf.comFlag = 0; - sendBuffer.insert(std::make_pair(nProcessID, sbuf)); - } - } -} -////////////////////////////////////////////////////////////////////////// -void LoadBalancer::prepareToRecieveLoad() -{ - receiveBuffer.clear(); - int conv = 1; - for(NeighbourProcess neighbProzess : neighbourProcesses) - { - if (this->load != neighbProzess.load) - { - if(neighbProzess.load > this->load) - { - //std::cout<<"rank = " << comm->getProcessID() << " : recieve Abweichung = " << (static_cast<double>(neighbProzess.load)/static_cast<double>(this->load) - 1.0)*100.0 <<std::endl; - if ((static_cast<double>(neighbProzess.load)/static_cast<double>(this->load) - 1.0)*100.0 > 3.0) - { - //if(processID == 0) - UBLOG(logINFO,"rank = " << comm->getProcessID() << " : recieve Abweichung = " << (static_cast<double>(neighbProzess.load)/static_cast<double>(this->load) - 1.0)*100.0); - conv *= 0; - TransferBuffer rbuf; - receiveBuffer.insert(std::make_pair(neighbProzess.processID, rbuf)); - } - } - } - } - setConverged(conv); -} -////////////////////////////////////////////////////////////////////////// -void LoadBalancer::sendRecieveLoad() -{ - std::vector<MPI_Request> request; - request.resize(0); - int rcount = 0; - for(TransferBufferMap::value_type &tb : receiveBuffer) - { - int nProcessID = tb.first; - TransferBuffer &rbuf = tb.second; - request.push_back(0); - MPI_Irecv(&rbuf.comFlag, 1, MPI_INT, nProcessID, 0, mpi_comm, &request[rcount]); - rcount++; - } - for(TransferBufferMap::value_type &tb : sendBuffer) - { - int nProcessID = tb.first; - TransferBuffer &sbuf = tb.second; - request.push_back(0); - MPI_Isend(&sbuf.comFlag, 1, MPI_INT, nProcessID, 0, mpi_comm, &request[rcount]); - rcount++; - } - if(request.size() > 0) - MPI_Waitall(static_cast<int>(request.size()), &request[0], MPI_STATUSES_IGNORE); - - //UBLOG(logINFO,"rank = " << comm->getProcessID() << "sendRecieveLoad comFlag" ); - ////////////////////////////////////////////////////////////////////////// - request.resize(0); - rcount = 0; - for(TransferBufferMap::value_type &tb : receiveBuffer) - { - int nProcessID = tb.first; - TransferBuffer &rbuf = tb.second; - if (rbuf.comFlag == 1) - { - request.push_back(0); - MPI_Irecv(&rbuf.blocksSize, 1, MPI_INT, nProcessID, 0, mpi_comm, &request[rcount]); - rcount++; - } - } - for(TransferBufferMap::value_type &tb : sendBuffer) - { - int nProcessID = tb.first; - TransferBuffer &sbuf = tb.second; - if (sbuf.comFlag == 1) - { - request.push_back(0); - MPI_Isend(&sbuf.blocksSize, 1, MPI_INT, nProcessID, 0, mpi_comm, &request[rcount]); - rcount++; - } - } - if(request.size() > 0) - MPI_Waitall(static_cast<int>(request.size()), &request[0], MPI_STATUSES_IGNORE); - - //UBLOG(logINFO,"rank = " << comm->getProcessID() << "sendRecieveLoad blocksSize" ); - ////////////////////////////////////////////////////////////////////////// - request.resize(0); - rcount = 0; - for(TransferBufferMap::value_type &tb : receiveBuffer) - { - int nProcessID = tb.first; - TransferBuffer &rbuf = tb.second; - if (rbuf.comFlag == 1) - { - request.push_back(0); - MPI_Irecv(&rbuf.sbufferSize, 1, MPI_INT, nProcessID, 0, mpi_comm, &request[rcount]); - rcount++; - } - } - for(TransferBufferMap::value_type &tb : sendBuffer) - { - int nProcessID = tb.first; - TransferBuffer &sbuf = tb.second; - if (sbuf.comFlag == 1) - { - request.push_back(0); - MPI_Isend(&sbuf.sbufferSize,1,MPI_INT,nProcessID,0,mpi_comm,&request[rcount]); - rcount++; - } - } - if(request.size() > 0) - MPI_Waitall(static_cast<int>(request.size()), &request[0], MPI_STATUSES_IGNORE); - - //UBLOG(logINFO,"rank = " << comm->getProcessID() << "sendRecieveLoad sbufferSize" ); - ////////////////////////////////////////////////////////////////////////// - request.resize(0); - rcount = 0; - for(TransferBufferMap::value_type &tb : receiveBuffer) - { - int nProcessID = tb.first; - TransferBuffer &rbuf = tb.second; - if (rbuf.comFlag == 1) - { - request.push_back(0); - rbuf.sbuffer.resize(rbuf.sbufferSize); - MPI_Irecv((char *)rbuf.sbuffer.c_str(),rbuf.sbufferSize,MPI_CHAR,nProcessID,0,mpi_comm,&request[rcount]); - rcount++; - } - } - for(TransferBufferMap::value_type &tb : sendBuffer) - { - int nProcessID = tb.first; - TransferBuffer &sbuf = tb.second; - if (sbuf.comFlag == 1) - { - request.push_back(0); - MPI_Isend((char *)sbuf.sbuffer.c_str(),sbuf.sbufferSize,MPI_CHAR,nProcessID,0,mpi_comm,&request[rcount]); - rcount++; - } - } - if(request.size() > 0) - MPI_Waitall(static_cast<int>(request.size()), &request[0], MPI_STATUSES_IGNORE); - - //UBLOG(logINFO,"rank = " << comm->getProcessID() << "sendRecieveLoad sbuffer" ); -} -////////////////////////////////////////////////////////////////////////// -void LoadBalancer::sendRecieveChanges() -{ - std::vector<int> removeBlocksRecieve; - - ////////////////////////////////////////////////////////////////////////// - //UBLOG(logINFO,"rank = " << comm->getProcessID() << "sendRecieveChanges" ); - - comm->allGather(removeBlocksSend, removeBlocksRecieve); - - ////////////////////////////////////////////////////////////////////////// - //UBLOG(logINFO,"rank = " << comm->getProcessID() << "allGatherInts removeBlocksRecieve" ); - - if(removeBlocksRecieve.size() >= 4) - { - for (int i = 0; i < removeBlocksRecieve.size(); i+=5) - { - Block3DPtr block = grid->getBlock(removeBlocksRecieve[i], removeBlocksRecieve[i+1], removeBlocksRecieve[i+2], removeBlocksRecieve[i+3]); - block->setRank(removeBlocksRecieve[i+4]); - //std::cout<< "RecieveChanges: PID = " << processID << " block: " <<block->toString()<<std::endl; - } - } -} -////////////////////////////////////////////////////////////////////////// -void LoadBalancer::saveRecievedLoad() -{ - for(TransferBufferMap::value_type &tb : receiveBuffer) - { - int nProcessID = tb.first; - TransferBuffer &rbuf = tb.second; - - if (rbuf.comFlag == 1) - { - std::stringstream ss_in; - ss_in.str(rbuf.sbuffer); - - boost::archive::text_iarchive ia(ss_in); - ia.register_type<Block3D>(); - - for(int i = 0; i < rbuf.blocksSize; i++) - { - Block3DPtr block; - ia >> block; - block->setRank(this->processID); - grid->replaceBlock(block); - //std::cout<< "Receive: PID = " << processID << " block: " <<block->toString()<<std::endl; - } - } - } - sendRecieveChanges(); -} -////////////////////////////////////////////////////////////////////////// -bool LoadBalancer::isConverged() -{ - int conv = 1; - for(int c : converged) - conv *= c; - - if(conv) - return true; - else - return false; -} -////////////////////////////////////////////////////////////////////////// -void LoadBalancer::setConverged(int value) -{ - //UBLOG(logINFO,"rank = " << comm->getProcessID() << " setConverged start" ); - converged.resize(comm->getNumberOfProcesses()); - MPI_Allgather( &value, 1, MPI_INT, &converged[0], 1, MPI_INT, mpi_comm); - //UBLOG(logINFO,"rank = " << comm->getProcessID() << " setConverged end" ); -} -////////////////////////////////////////////////////////////////////////// -void LoadBalancer::collectData() -{ - neighboursMap.clear(); - - int weightScaleFactor = 8; - - int blockRank = 0; - this->load = 0; - - int gridRank = grid->getRank(); - - int minInitLevel = this->grid->getCoarsestInitializedLevel(); - int maxInitLevel = this->grid->getFinestInitializedLevel(); - - for(int level = minInitLevel; level<=maxInitLevel;level++) - { - std::vector<Block3DPtr> blockVector; - grid->getBlocks(level, gridRank, true, blockVector); - for(Block3DPtr block : blockVector) - { - if (block) - { - this->load += block->getWorkLoad(); - blockRank = block->getRank(); - - //search for parent block - Block3DPtr parentBlock = grid->getSuperBlock(block); - if(parentBlock) - { - int parentRank = parentBlock->getRank(); - if(parentRank != blockRank && parentBlock->isActive()) - { - block->addWeight(parentRank, weightScaleFactor); - addTransferBlock(block, parentRank); - } - } - - //search for child blocks - std::vector<Block3DPtr> childBlocks; - grid->getSubBlocks(block, 1, childBlocks); - for(Block3DPtr b : childBlocks) - { - int childRank = b->getRank(); - if(childRank != blockRank && b->isActive()) - { - block->addWeight(childRank, weightScaleFactor); - addTransferBlock(block, childRank); - } - } - - //search for neighbor blocks - for( int dir = 0; dir <= endDir; dir++) - { - Block3DPtr neighBlock = (grid->getNeighborBlock(dir, block->getX1(), block->getX2(), block->getX3(), block->getLevel())); - if(neighBlock) - { - int neighBlockRank = neighBlock->getRank(); - if(blockRank != neighBlockRank && neighBlock->isActive()) - { - addTransferBlock(block, neighBlockRank); - } - } - } - } - } - } - -} -////////////////////////////////////////////////////////////////////////// -void LoadBalancer::collectNeighboursLoad() -{ - loadThreshold = 0; - neighbourProcesses.resize(0); - for(BBlocksMap::value_type b : neighboursMap) - { - int neighbourProcessID = b.first; - NeighbourProcess nProc; - nProc.processID = neighbourProcessID; - neighbourProcesses.push_back(nProc); - } - //std::cout<<"rank = " << comm->getProcessID() << " : this->load = " << this->load <<std::endl; - //if(processID == 0) - UBLOG(logINFO, "rank = " << comm->getProcessID() << " : this->load = " << this->load); - - std::vector<MPI_Request> request; - request.resize(0); - int rcount = 0; - - for(NeighbourProcess &np : neighbourProcesses) - { - request.push_back(0); - MPI_Irecv(&np.load, 1, MPI_DOUBLE, np.processID, 0, mpi_comm, &request[rcount]); - rcount++; - //UBLOG(logINFO,"rank = " << comm->getProcessID() << " : MPI_Irecv from " << np.processID); - request.push_back(0); - MPI_Isend(&load, 1, MPI_DOUBLE, np.processID, 0, mpi_comm, &request[rcount]); - rcount++; - //UBLOG(logINFO,"rank = " << comm->getProcessID() << " : MPI_Isend to " << np.processID); - } - - if(request.size() > 0) - MPI_Waitall(static_cast<int>(request.size()), &request[0], MPI_STATUSES_IGNORE); - - for(NeighbourProcess &np : neighbourProcesses) - { - loadThreshold += np.load; - //std::cout<<"rank = " << comm->getProcessID() << " : neighbor process load = " << np.load <<std::endl; - //UBLOG(logINFO,"rank = " << comm->getProcessID() << " : neighbor process load = " << np.load); - } - loadThreshold += this->load; - //int allLoad = loadThreshold; - loadThreshold /= (static_cast<int>(neighbourProcesses.size()) + 1); - //loadThresholdP = MathUtil::cint(static_cast<double>(loadThreshold)*100.0/static_cast<double>(allLoad)); - //loadP = MathUtil::cint(static_cast<double>(load)*100.0/static_cast<double>(allLoad)); - - //std::cout<<"rank = " << comm->getProcessID() << " : this->loadThresholdP = " << this->loadThresholdP <<std::endl; - //std::cout<<"rank = " << comm->getProcessID() << " : this->loadP = " << this->loadP <<std::endl; - //std::cout<<"rank = " << comm->getProcessID() << " : allLoad = " << allLoad <<std::endl; -} -////////////////////////////////////////////////////////////////////////// -void LoadBalancer::addTransferBlock(Block3DPtr block, int neighBlockRank) -{ - TransferBlock tBlock; - tBlock.block = block; - tBlock.load = block->getWorkLoad(); - tBlock.weight = block->getWeight(neighBlockRank); - - if((itnMap = neighboursMap.find(neighBlockRank)) == neighboursMap.end()) - { - BBlocks boundaryBlocks; - boundaryBlocks.insert(std::make_pair(block, tBlock)); - neighboursMap.insert(std::make_pair(neighBlockRank, boundaryBlocks)); - } - else - { - BBlocks &boundaryBlocks = itnMap->second; - boundaryBlocks.insert(std::make_pair(block, tBlock)); - } -} -////////////////////////////////////////////////////////////////////////// -#endif diff --git a/src/VirtualFluids/Parallel/LoadBalancer.h b/src/VirtualFluids/Parallel/LoadBalancer.h deleted file mode 100644 index 6fa455b95..000000000 --- a/src/VirtualFluids/Parallel/LoadBalancer.h +++ /dev/null @@ -1,104 +0,0 @@ -#ifndef LOADBALANCER_H -#define LOADBALANCER_H - -#if defined VF_MPI - -#include <vector> -#include <map> -#include "Block3D.h" -#include "Communicator.h" -#include "MPICommunicator.h" -#include "Grid3D.h" -#include "LBMKernel.h" - -struct NeighbourProcess -{ - int processID; - double load; -}; - -struct ltweight -{ - bool operator()(const int l1, const int l2) const - { - return (l1 > l2); - } -}; - -struct TransferBuffer -{ - int comFlag; //communication on = 1, communication off = 0 - int blocksSize; - int sbufferSize; - std::string sbuffer; -}; - -struct TransferBlock -{ - double load; - int weight; - Block3DPtr block; -}; - - -class LoadBalancer; -typedef std::shared_ptr<LoadBalancer> LoadBalancerPtr; - -class LoadBalancer -{ -public: - // boundary blocks: block, load - //typedef std::map< Block3DPtr, int> BBlocks; - typedef std::map< Block3DPtr, TransferBlock> BBlocks; - //typedef std::set< TransferBlock > BBlocks; - // neighbor, boundary blocks - typedef std::map< int, BBlocks > BBlocksMap; - //transfer blocks: weight, transfer block, sort function - typedef std::multimap< int, TransferBlock, ltweight> TBlocks; - // neighbor,buffer - typedef std::map<int, TransferBuffer> TransferBufferMap; -public: - LoadBalancer(Grid3DPtr grid, CommunicatorPtr comm, const int& endDir); - virtual ~LoadBalancer(); - bool balance(); - -protected: -private: - void callculateLoad(); - void collectData(); - void collectNeighboursLoad(); - void prepareToSendLoad(); - void prepareToSendLoad(const int& nProcessID, const double& transLoad, int& conv); - void prepareToRecieveLoad(); - void sendRecieveLoad(); - void saveRecievedLoad(); - void sendRecieveChanges(); - bool isConverged(); - void setConverged(int value); - void addTransferBlock(Block3DPtr block, int neighBlockRank); - double load; - int processID; - double loadThreshold; - int loadThresholdP; - int loadP; - std::vector<NeighbourProcess> neighbourProcesses; - Grid3DPtr grid; - CommunicatorPtr comm; - BBlocksMap neighboursMap; - BBlocksMap::iterator itnMap; - BBlocks::iterator itbBlocks; - int endDir; - - MPI_Comm mpi_comm; - - TransferBufferMap sendBuffer; - TransferBufferMap receiveBuffer; - - std::vector<int> removeBlocksSend; - - std::vector<int> converged; -}; - -#endif - -#endif diff --git a/src/VirtualFluids/Parallel/MPICommunicator.cpp b/src/VirtualFluids/Parallel/MPICommunicator.cpp deleted file mode 100644 index 25fa1b038..000000000 --- a/src/VirtualFluids/Parallel/MPICommunicator.cpp +++ /dev/null @@ -1,227 +0,0 @@ -#if defined VF_MPI - -#include "MPICommunicator.h" -#include <mpi.h> - -#include <sstream> -using namespace std; -////////////////////////////////////////////////////////////////////////// -MPICommunicator::MPICommunicator() -{ - //proof if MPI is initialized - int mpiInitialized = (int)false; - MPI_Initialized(&mpiInitialized); - if (!mpiInitialized) - { - //MPI_Init(0, 0); - MPI_Init_thread(NULL, NULL, MPI_THREAD_FUNNELED, NULL); - } - MPI_Comm_rank(MPI_COMM_WORLD, &PID); - MPI_Comm_size(MPI_COMM_WORLD, &numprocs); - //numprocs = 1000; - comm = MPI_COMM_WORLD; - root = 0; -} -////////////////////////////////////////////////////////////////////////// -MPICommunicator::~MPICommunicator() -{ - //proof if MPI is finalized - int _mpiFinalized = (int)false; - MPI_Finalized(&_mpiFinalized); - if (!_mpiFinalized) - { - MPI_Finalize(); - //UBLOG(logINFO, "MPI_Finalize()"); - } - } -////////////////////////////////////////////////////////////////////////// -CommunicatorPtr MPICommunicator::getInstance() -{ - if( !Communicator::instance ) - Communicator::instance = CommunicatorPtr(new MPICommunicator()); - return Communicator::instance; -} -////////////////////////////////////////////////////////////////////////// -void MPICommunicator::abort(int errorcode) -{ - MPI_Abort(comm, errorcode); -} -//////////////////////////////////////////////////////////////////////////// -vector<string> MPICommunicator::gather(const string& str) -{ - vector<string> parts; - vector<string> strings; - int scount; - vector<char> rbuf(1); - vector<int> rcounts(1); - MPI_Status status; - - if (PID == root) - { - rcounts.resize(numprocs - 1); - strings.push_back(str); - - for (int i = 1; i < numprocs; i++) - { - MPI_Recv(&rcounts[i-1], 1, MPI_INT, i, 0, comm, &status); - } - for (int i = 1; i < numprocs; i++) - { - rbuf.resize(rcounts[i-1]); - MPI_Recv(&rbuf[0], rcounts[i-1], MPI_CHAR, i, 0, comm, &status); - string s(&rbuf[0], rcounts[i-1]); - if (s != "") strings.push_back(s); - } - } - else - { - scount = (int)str.length(); - MPI_Send(&scount, 1, MPI_INT, root, 0, comm); - MPI_Send((char *)str.c_str(), scount, MPI_CHAR, root, 0, comm); - } - return strings; -} -////////////////////////////////////////////////////////////////////////// -vector<int> MPICommunicator::gather(vector<int>& values) -{ - return gather<int>(values); -} -////////////////////////////////////////////////////////////////////////// -vector<float> MPICommunicator::gather(vector<float>& values) -{ - return gather<float>(values); -} -////////////////////////////////////////////////////////////////////////// -vector<double> MPICommunicator::gather(vector<double>& values) -{ - return gather<double>(values); -} -////////////////////////////////////////////////////////////////////////// -int MPICommunicator::getProcessID() -{ - return PID; -} -////////////////////////////////////////////////////////////////////////// -int MPICommunicator::getProcessID(int bundle, int rank) -{ - return PID; -} -////////////////////////////////////////////////////////////////////////// -int MPICommunicator::getNumberOfProcesses() -{ - return numprocs; -} -////////////////////////////////////////////////////////////////////////// -void* MPICommunicator::getNativeCommunicator() -{ - return &comm; -} -////////////////////////////////////////////////////////////////////////// -int MPICommunicator::getBundleID() -{ - return 0; -} -////////////////////////////////////////////////////////////////////////// -int MPICommunicator::getNumberOfBundles() -{ - return 1; -} -////////////////////////////////////////////////////////////////////////// -int MPICommunicator::getRoot() -{ - return root; -} -////////////////////////////////////////////////////////////////////////// -int MPICommunicator::getBundleRoot() -{ - return 0; -} -////////////////////////////////////////////////////////////////////////// -int MPICommunicator::getProcessRoot() -{ - return 0; -} -////////////////////////////////////////////////////////////////////////// -int MPICommunicator::getNumberOfProcessesInBundle(int bundle) -{ - return numprocs; -} -////////////////////////////////////////////////////////////////////////// -bool MPICommunicator::isRoot() -{ - return PID == root; -} -////////////////////////////////////////////////////////////////////////// -void MPICommunicator::sendSerializedObject( std::stringstream& ss, int target) -{ - string str = ss.str(); - int scount = static_cast<int> (str.length()); - MPI_Send(&scount,1,MPI_INT,target,0,comm); - MPI_Send((char *)str.c_str(),scount,MPI_CHAR,target,0,comm); -} -////////////////////////////////////////////////////////////////////////// -void MPICommunicator::receiveSerializedObject( std::stringstream& ss, int source ) -{ - vector<char> rbuf; - int rcount; - MPI_Status status; - MPI_Recv(&rcount,1,MPI_INT,source,0,comm,&status); - rbuf.resize(rcount); - MPI_Recv(&rbuf[0],rcount,MPI_CHAR,source,0,comm,&status); - ss.rdbuf()->pubsetbuf(&rbuf[0],rcount); - string str (&rbuf[0]); - ss.str(str); -} -////////////////////////////////////////////////////////////////////////// -void MPICommunicator::barrier() -{ - MPI_Barrier(comm); -} -////////////////////////////////////////////////////////////////////////// -void MPICommunicator::allGather(std::vector<int>& svalues, std::vector<int>& rvalues) -{ - allGather<int>(svalues, rvalues); -} -////////////////////////////////////////////////////////////////////////// -void MPICommunicator::allGather(std::vector<float>& svalues, std::vector<float>& rvalues) -{ - allGather<float>(svalues, rvalues); -} -////////////////////////////////////////////////////////////////////////// -void MPICommunicator::allGather(std::vector<double>& svalues, std::vector<double>& rvalues) -{ - allGather<double>(svalues, rvalues); -} -////////////////////////////////////////////////////////////////////////// -void MPICommunicator::broadcast(std::vector<int>& values) -{ - broadcast<int>(values); -} -////////////////////////////////////////////////////////////////////////// -void MPICommunicator::broadcast(std::vector<float>& values) -{ - broadcast<float>(values); -} -////////////////////////////////////////////////////////////////////////// -void MPICommunicator::broadcast(std::vector<double>& values) -{ - broadcast<double>(values); -} -////////////////////////////////////////////////////////////////////////// -void MPICommunicator::broadcast(int& value) -{ - broadcast<int>(value); -} -////////////////////////////////////////////////////////////////////////// -void MPICommunicator::broadcast(float& value) -{ - broadcast<float>(value); -} -////////////////////////////////////////////////////////////////////////// -void MPICommunicator::broadcast(double& value) -{ - broadcast<double>(value); -} -////////////////////////////////////////////////////////////////////////// - -#endif diff --git a/src/VirtualFluids/Parallel/MPICommunicator.h b/src/VirtualFluids/Parallel/MPICommunicator.h deleted file mode 100644 index 6a4e63511..000000000 --- a/src/VirtualFluids/Parallel/MPICommunicator.h +++ /dev/null @@ -1,183 +0,0 @@ -#if defined VF_MPI - -#ifndef MPICOMMUNICATOR_H -#define MPICOMMUNICATOR_H - -#include <mpi.h> -#include <vector> -#include <string> -#include <memory> -#include <basics/utilities/UbException.h> -#include <basics/utilities/UbLogger.h> -#include "Communicator.h" - -class MPICommunicator; -typedef std::shared_ptr<MPICommunicator> MPICommunicatorPtr; - -//! \brief A class uses MPI library to communication. -//! \details Support MPI communication. Implements singleton pattern. -//! \author K. Kutscher - -class MPICommunicator : public Communicator -{ -private: - MPICommunicator(); -public: - ~MPICommunicator(); - static CommunicatorPtr getInstance(); - int getBundleID(); - int getNumberOfBundles(); - int getProcessID(); - int getProcessID(int bundle, int rank); - int getNumberOfProcesses(); - void* getNativeCommunicator(); - int getRoot(); - int getBundleRoot(); - int getProcessRoot(); - int getNumberOfProcessesInBundle(int bundle); - bool isRoot(); - void abort(int errorcode); - - void sendSerializedObject(std::stringstream& ss, int target); - void receiveSerializedObject(std::stringstream& ss, int source); - - void barrier(); - - std::vector<std::string> gather(const std::string& str); - std::vector<int> gather(std::vector<int>& values); - std::vector<float> gather(std::vector<float>& values); - std::vector<double> gather(std::vector<double>& values); - - void allGather(std::vector<int>& svalues, std::vector<int>& rvalues); - void allGather(std::vector<float>& svalues, std::vector<float>& rvalues); - void allGather(std::vector<double>& svalues, std::vector<double>& rvalues); - - void broadcast(int& value); - void broadcast(float& value); - void broadcast(double& value); - void broadcast(std::vector<int>& values); - void broadcast(std::vector<float>& values); - void broadcast(std::vector<double>& values); - - template <class T> - std::vector<T> gather(std::vector<T>& values); - - template <class T> - void allGather(std::vector<T>& svalues, std::vector<T>& rvalues); - - template <class T> - void broadcast(std::vector<T>& values); - - template <class T> - void broadcast(T& value); - -private: - int numprocs, PID; - MPI_Comm comm; - int root; -}; - -////////////////////////////////////////////////////////////////////////// -template <class T> -std::vector<T> MPICommunicator::gather(std::vector<T>& values) -{ - MPI_Datatype mpiDataType; - if ((std::string)typeid(T).name()==(std::string)typeid(double).name()) mpiDataType = MPI_DOUBLE; - else if ((std::string)typeid(T).name()==(std::string)typeid(float).name()) mpiDataType = MPI_FLOAT; - else if ((std::string)typeid(T).name()==(std::string)typeid(int).name()) mpiDataType = MPI_INT; - else throw UbException(UB_EXARGS, "no MpiDataType for T"+(std::string)typeid(T).name()); - - int count = static_cast<int> (values.size()); - std::vector<T> rvalues(1); - - if (PID == root) - { - rvalues.resize(numprocs*count); - } - - MPI_Gather(&values[0], count, mpiDataType, &rvalues[0], count, mpiDataType, root, comm); - - return rvalues; -} -////////////////////////////////////////////////////////////////////////// -template <class T> -void MPICommunicator::allGather(std::vector<T>& svalues, std::vector<T>& rvalues) -{ - MPI_Datatype mpiDataType; - if ((std::string)typeid(T).name()==(std::string)typeid(double).name()) mpiDataType = MPI_DOUBLE; - else if ((std::string)typeid(T).name()==(std::string)typeid(float).name()) mpiDataType = MPI_FLOAT; - else if ((std::string)typeid(T).name()==(std::string)typeid(int).name()) mpiDataType = MPI_INT; - else throw UbException(UB_EXARGS, "no MpiDataType for T"+(std::string)typeid(T).name()); - - int scount; - std::vector<int> displs, rcounts; - - scount = (int)(svalues.size()); - - rcounts.resize(numprocs); - MPI_Allgather(&scount, 1, MPI_INT, &rcounts[0], 1, MPI_INT, comm); - displs.resize(numprocs); - - displs[0] = 0; - for (int i=1; i<numprocs; ++i) - { - displs[i] = displs[i-1]+rcounts[i-1]; - } - - rvalues.resize(displs[numprocs-1]+rcounts[numprocs-1]); - - if (rvalues.size() == 0) - { - rvalues.resize(1); - rvalues[0] = -999; - } - if (scount == 0) - { - svalues.resize(1); - svalues[0] = -999; - } - - MPI_Allgatherv(&svalues[0], scount, mpiDataType, &rvalues[0], &rcounts[0], &displs[0], mpiDataType, comm); -} -////////////////////////////////////////////////////////////////////////// -template <class T> -void MPICommunicator::broadcast(std::vector<T>& values) -{ - MPI_Datatype mpiDataType; - if ((std::string)typeid(T).name()==(std::string)typeid(double).name()) mpiDataType = MPI_DOUBLE; - else if ((std::string)typeid(T).name()==(std::string)typeid(float).name()) mpiDataType = MPI_FLOAT; - else if ((std::string)typeid(T).name()==(std::string)typeid(int).name()) mpiDataType = MPI_INT; - else throw UbException(UB_EXARGS, "no MpiDataType for T"+(std::string)typeid(T).name()); - - int rcount; - if (this->PID == this->root) - { - rcount = (int)values.size(); - } - - MPI_Bcast(&rcount, 1, MPI_INT, this->root, comm); - - if (this->PID != this->root) - { - values.resize(rcount); - } - - MPI_Bcast(&values[0], (int)values.size(), mpiDataType, this->root, comm); -} -////////////////////////////////////////////////////////////////////////// -template <class T> -void MPICommunicator::broadcast(T& value) -{ - MPI_Datatype mpiDataType; - if ((std::string)typeid(T).name() == (std::string)typeid(double).name()) mpiDataType = MPI_DOUBLE; - else if ((std::string)typeid(T).name() == (std::string)typeid(float).name()) mpiDataType = MPI_FLOAT; - else if ((std::string)typeid(T).name() == (std::string)typeid(int).name()) mpiDataType = MPI_INT; - else throw UbException(UB_EXARGS, "no MpiDataType for T" + (std::string)typeid(T).name()); - - MPI_Bcast(&value, 1, mpiDataType, this->root, comm); -} -////////////////////////////////////////////////////////////////////////// - -#endif - -#endif diff --git a/src/VirtualFluids/Parallel/MetisPartitioner.cpp b/src/VirtualFluids/Parallel/MetisPartitioner.cpp deleted file mode 100644 index bc5681fc2..000000000 --- a/src/VirtualFluids/Parallel/MetisPartitioner.cpp +++ /dev/null @@ -1,71 +0,0 @@ -#if defined VF_METIS - -#include "MetisPartitioner.h" - - -MetisPartitioner::MetisPartitioner() -{ - METIS_SetDefaultOptions(options); - options[METIS_OPTION_NUMBERING] = 0; - vsize = NULL; - tpwgts = NULL; - ubvec = NULL; -} -////////////////////////////////////////////////////////////////////////// -MetisPartitioner::~MetisPartitioner() -{ - -} -////////////////////////////////////////////////////////////////////////// -idx_t* MetisPartitioner::getMetisOptions() -{ - return options; -} -////////////////////////////////////////////////////////////////////////// -int MetisPartitioner::partition(int nofParts, MetisPartitioner::PartType ptype) -{ - int rc; - idx_t nvtxs = (idx_t)xadj.size()-1; // number of nodes - idx_t ncon = (idx_t)vwgt.size()/nvtxs; // number Of node constraints; - - part.resize(nvtxs); - int edgecutCount = 0; - - switch (ptype) - { - case MetisPartitioner::RECURSIVE: - if ( nofParts < 1 ) UB_THROW( UbException(UB_EXARGS,"invalid nofParts<1") ); - else if (nofParts == 1) { part.resize(nvtxs, 0); return 0; } - //else if( nofParts > 8 ) UBLOG(logWARNING, "MetisPartitioner::Recursive: !!!Warning!!! best for nofParts<=8 --> Kway is maybe a better option"); - - rc = METIS_PartGraphRecursive(&nvtxs, &ncon, &xadj[0], &adjncy[0], - &vwgt[0], vsize, &adjwgt[0], &nofParts, - tpwgts, ubvec, options, &edgecutCount, &part[0]); - break; - case MetisPartitioner::KWAY: - if ( nofParts < 1 ) UB_THROW( UbException(UB_EXARGS,"invalid nofParts<1") ); - else if (nofParts == 1) { part.resize(nvtxs, 0); return 0; } - //else if( nofParts < 9 ) UBLOG(logWARNING, "MetisPartitioner::Kway: !!!Warning!!! best for nofParts>8 --> Recursive is maybe a better option"); - - rc = METIS_PartGraphKway(&nvtxs, &ncon, &xadj[0], &adjncy[0], - &vwgt[0], vsize, &adjwgt[0], &nofParts, - tpwgts, ubvec, options, &edgecutCount, &part[0]); - break; - } - - switch (rc) - { - case METIS_ERROR_INPUT: - throw UbException(UB_EXARGS,"METIS: input error"); - break; - case METIS_ERROR_MEMORY: - throw UbException(UB_EXARGS,"METIS: it could not allocate the required memory"); - break; - case METIS_ERROR: - throw UbException(UB_EXARGS,"METIS: error"); - break; - } - - return edgecutCount; -} -#endif diff --git a/src/VirtualFluids/Parallel/MetisPartitioner.h b/src/VirtualFluids/Parallel/MetisPartitioner.h deleted file mode 100644 index 98b497992..000000000 --- a/src/VirtualFluids/Parallel/MetisPartitioner.h +++ /dev/null @@ -1,61 +0,0 @@ -/** -* @file MetisPartitioner.h -* @brief Class use METIS library for graph-based partitioning. -* @author Kostyantyn Kucher -* @date 22.09.2011 -*/ - -#ifndef METISPARTITIONER_H -#define METISPARTITIONER_H - -#if defined VF_METIS - -#include "metis.h" -#include <vector> -#include <string> -#include <memory> -#include "basics/utilities/UbLogger.h" -#include "basics/utilities/UbSystem.h" - -class MetisPartitioner; -typedef std::shared_ptr<MetisPartitioner> MetisPartitionerPtr; - -class MetisPartitioner -{ -public: - enum PartType { RECURSIVE, KWAY }; -public: - MetisPartitioner(); - virtual ~MetisPartitioner(); - idx_t* getMetisOptions(); - int partition(int nofParts, PartType ptype); -public: - std::vector<idx_t> xadj; // adjncy offset of nodes - //(size = n+1, n=nofNodes) - std::vector<idx_t> adjncy; // array that stores the adjacency lists of nodes - //(size = m*2, m= nofEdged, factor 2 because edge A->B AND B->A has to be stored) - std::vector<idx_t> vwgt; // vertex weights (size=n*ncon, ncon=nofNodeWeightsPerNode) - std::vector<idx_t> adjwgt; // array that stores the weights of the adjacency lists - // (size=2*m) - idx_t * vsize; // array that stores the computation weights per node - // (size=n) - - real_t * tpwgts; // holds the wished fratcion of segment i, e.g. tpwgts={0.2, 0.2, 0.6} - // -> patisions 0 and one will get 20% of the weight each and part 3 60%! - // (size=nofPartitions) sum of tpwgts must be 1.0 - - real_t * ubvec; //This is an array of size ncon that specifies the allowed load imbalance tolerance for each constraint. - //For the ith partition and jth constraint the allowed weight is the ubvec[j]*tpwgts[i*ncon+j] fraction - //of the jth’s constraint total weight. The load imbalances must be greater than 1.0. - //A NULL value can be passed indicating that the load imbalance tolerance for each constraint should - //be 1.001 (for ncon=1) or 1.01 (for ncon¿1). - - std::vector<idx_t> part; // This is a vector of size n that upon successful completion stores the partition vector of the graph. - // The numbering of this vector starts from 0 -private: - idx_t options[METIS_NOPTIONS]; -}; - -#endif - -#endif diff --git a/src/VirtualFluids/Parallel/NullCommunicator.cpp b/src/VirtualFluids/Parallel/NullCommunicator.cpp deleted file mode 100644 index 9c1316f9e..000000000 --- a/src/VirtualFluids/Parallel/NullCommunicator.cpp +++ /dev/null @@ -1,74 +0,0 @@ -#include "NullCommunicator.h" - -NullCommunicator::NullCommunicator() -{ -} -////////////////////////////////////////////////////////////////////////// -NullCommunicator::~NullCommunicator() -{ -} -////////////////////////////////////////////////////////////////////////// -int NullCommunicator::getBundleID() -{ - return 0; -} -////////////////////////////////////////////////////////////////////////// -int NullCommunicator::getNumberOfBundles() -{ - return 0; -} -////////////////////////////////////////////////////////////////////////// -int NullCommunicator::getProcessID() -{ - return 0; -} -////////////////////////////////////////////////////////////////////////// -int NullCommunicator::getNumberOfProcesses() -{ - return 0; -} -////////////////////////////////////////////////////////////////////////// -void* NullCommunicator::getNativeCommunicator() -{ - return NULL; -} -////////////////////////////////////////////////////////////////////////// -int NullCommunicator::getRoot() -{ - return 0; -} -////////////////////////////////////////////////////////////////////////// -int NullCommunicator::getBundleRoot() -{ - return 0; -} -////////////////////////////////////////////////////////////////////////// -int NullCommunicator::getProcessRoot() -{ - return 0; -} -////////////////////////////////////////////////////////////////////////// -std::vector<std::string> NullCommunicator::gather(const std::string& str) -{ - return std::vector<std::string>(); -} -////////////////////////////////////////////////////////////////////////// -std::vector<double> NullCommunicator::gatherDoubles(std::vector<double>& values) -{ - return std::vector<double>(); -} -////////////////////////////////////////////////////////////////////////// -void NullCommunicator::allGatherInts(std::vector<int>& svalues, std::vector<int>& rvalues) -{ - -} -////////////////////////////////////////////////////////////////////////// -void NullCommunicator::sendSerializedObject(std::stringstream& ss, int target) -{ - -} -////////////////////////////////////////////////////////////////////////// -void NullCommunicator::receiveSerializedObject(std::stringstream& ss, int source) -{ - -} diff --git a/src/VirtualFluids/Parallel/NullCommunicator.h b/src/VirtualFluids/Parallel/NullCommunicator.h deleted file mode 100644 index e2953983b..000000000 --- a/src/VirtualFluids/Parallel/NullCommunicator.h +++ /dev/null @@ -1,33 +0,0 @@ -#ifndef NullCommunicator_H -#define NullCommunicator_H - -#include "Communicator.h" - -#include <memory> - -class NullCommunicator; -typedef std::shared_ptr<NullCommunicator> NullCommunicatorPtr; - -class NullCommunicator : public Communicator -{ -public: - NullCommunicator(); - ~NullCommunicator(); - int getBundleID(); - int getNumberOfBundles(); - int getProcessID(); - int getNumberOfProcesses(); - void* getNativeCommunicator(); - int getRoot(); - int getBundleRoot(); - int getProcessRoot(); - std::vector<std::string> gather(const std::string& str); - std::vector<double> gatherDoubles(std::vector<double>& values); - void allGatherInts(std::vector<int>& svalues, std::vector<int>& rvalues); - void sendSerializedObject(std::stringstream& ss, int target); - void receiveSerializedObject(std::stringstream& ss, int source); -protected: -private: -}; - -#endif diff --git a/src/VirtualFluids/Parallel/PriorityQueueDecompositor.cpp b/src/VirtualFluids/Parallel/PriorityQueueDecompositor.cpp deleted file mode 100644 index 4d3ad4201..000000000 --- a/src/VirtualFluids/Parallel/PriorityQueueDecompositor.cpp +++ /dev/null @@ -1,2 +0,0 @@ -#include "PriorityQueueDecompositor.h" - diff --git a/src/VirtualFluids/Parallel/PriorityQueueDecompositor.h b/src/VirtualFluids/Parallel/PriorityQueueDecompositor.h deleted file mode 100644 index 67f1e52d4..000000000 --- a/src/VirtualFluids/Parallel/PriorityQueueDecompositor.h +++ /dev/null @@ -1,68 +0,0 @@ -/** -* @file PriorityQueueDecompositor.h -* @brief Priority Queue for threads decomposition. -* @author Kostyantyn Kucher -* @date 06/06/2011 -*/ -#ifndef PRIORITYQUEUEDECOMPOSITOR_H -#define PRIORITYQUEUEDECOMPOSITOR_H - -#include <algorithm> -#include <vector> -#include <map> - -struct sortMinMax { - bool operator() (int i,int j) const { return (i<j);} -}; - -struct sortMaxMin { - bool operator() (int i,int j) const { return (i>j);} -}; - -template <class T> -class PriorityQueueDecompositor -{ -public: - PriorityQueueDecompositor(const std::vector<T>& objcts, const std::vector<int>& weights, const int& numberOfParts) - { - for (int i = 0; i < (int)objcts.size(); i++) - { - objects.insert(std::pair<int, T>(weights[i], objcts[i])); - } - for (int i = 0; i < numberOfParts; i++) - { - std::vector<T> part; - parts.insert(std::pair<int,std::vector<T> >(0, part)); - } - } - virtual ~PriorityQueueDecompositor() - { - - } - void getDecomposition(std::vector< std::vector<T> >& prts) - { - for( itOb=objects.begin() ; itOb != objects.end(); itOb++) - { - itP = parts.begin(); - int weight = (*itP).first; - std::vector<T> obj = (*itP).second; - parts.erase(itP); - weight += (*itOb).first; - obj.push_back((*itOb).second); - parts.insert(std::pair<int,std::vector<T> >(weight, obj)); - } - - for( itP=parts.begin() ; itP != parts.end(); itP++) - { - prts.push_back((*itP).second); - } - } -protected: -private: - std::multimap<int, T, sortMaxMin> objects; - typename std::multimap<int, T, sortMaxMin>::iterator itOb; - std::multimap<int, std::vector<T>, sortMinMax> parts; - typename std::multimap<int, std::vector<T>, sortMinMax>::iterator itP; -}; - -#endif diff --git a/src/VirtualFluids/Parallel/SimpleGeometricPartitioner.h b/src/VirtualFluids/Parallel/SimpleGeometricPartitioner.h deleted file mode 100644 index 36f6029a1..000000000 --- a/src/VirtualFluids/Parallel/SimpleGeometricPartitioner.h +++ /dev/null @@ -1,97 +0,0 @@ -/** -* @file SimpleGeometricPartitioner.h -* @author Kostyantyn Kucher -* @date 06/06/2011 -* -* @section DESCRIPTION -* -* This class make simple geometric partitioning. -*/ - -#ifndef SIMPLEGEOMETRICPARTITIONER_H -#define SIMPLEGEOMETRICPARTITIONER_H - -#include "basics/utilities/UbTuple.h" -#include "basics/utilities/UbException.h" -#include "MathUtil.hpp" - -class SimpleGeometricPartitioner -{ -public: - static UbTupleInt3 createDimensions(const int& x, const int& y, const int& z, const int& numberOfProcess) - { - int xyz = x*y*z; - - int p = numberOfProcess; - - if (p == 1) - return UbTupleInt3(1, 1, 1); - - double a = pow(p*pow(x,3.0)/xyz,1.0/3.0); - double b = pow(p*pow(y,3.0)/xyz,1.0/3.0); - double c = pow(p*pow(z,3.0)/xyz,1.0/3.0); - - MaxDim maxDim; - - if(c >= a && c >= b) - maxDim = cDim; - if(b >= a && b >= c) - maxDim = bDim; - if(a >= b && a >= c) - maxDim = aDim; - - int dim1, dim2, dim3; - dim1 = (int)Utilities::cint(a); - dim2 = (int)Utilities::cint(b); - dim3 = (int)Utilities::cint(c); - if(dim1 <= 0) dim1 = 1; - if(dim2 <= 0) dim2 = 1; - if(dim3 <= 0) dim3 = 1; - - switch (maxDim) - { - case aDim: - dim1 = p/(dim2*dim3); - if (dim1*dim2*dim3 != p) - { - dim2 = 1; - dim3 = 1; - dim1 = p; - } - break; - case bDim: - dim2 = p/(dim1*dim3); - if (dim1*dim2*dim3 != p) - { - dim1 = 1; - dim3 = 1; - dim2 = p; - } - break; - case cDim: - dim3 = p/(dim1*dim2); - if (dim1*dim2*dim3 != p) - { - dim1 = 1; - dim2 = 1; - dim3 = p; - } - break; - } - - if (dim1>x || dim2>y || dim3>z) - { - UB_THROW( UbException(UB_EXARGS,"Patch3DSegmentationHelper::createDimensions: Segmentation fault - bad number of prozess") ); - } - - UbTupleInt3 dims(dim1, dim2, dim3); - - return dims; - } - -protected: -private: - enum MaxDim {aDim,bDim,cDim}; -}; - -#endif diff --git a/src/VirtualFluids/Parallel/Synchronizer.h b/src/VirtualFluids/Parallel/Synchronizer.h deleted file mode 100644 index 15e33bd9a..000000000 --- a/src/VirtualFluids/Parallel/Synchronizer.h +++ /dev/null @@ -1,67 +0,0 @@ -#ifndef SYNCHRONIZER_H -#define SYNCHRONIZER_H - -#include <memory> -#include <boost/thread/thread.hpp> -#include <boost/thread/mutex.hpp> -#include <boost/thread/condition.hpp> - - -class Synchronizer; -typedef std::shared_ptr<Synchronizer> SynchronizerPtr; - -class Synchronizer -{ -public: - Synchronizer() - : threshold(0), count(0), generation(0) - {} - - Synchronizer(int count) - : threshold(count), count(count), generation(0) - {} - - ~Synchronizer() {} - - void incNumberOfThreads() - { - threshold++; - count++; - } - - void setNumberOfThreads(int count) - { - this->threshold = count; - this->count = count; - } - - bool wait() - { - boost::mutex::scoped_lock lock(mutex); - unsigned int gen = generation; - - if (--count == 0) - { - generation++; - count = threshold; - cond.notify_all(); - return true; - } - - while (gen == generation) - cond.wait(lock); - return false; - } - - boost::mutex gmtx; -private: - boost::mutex mutex; - boost::condition_variable cond; - - unsigned int threshold; - unsigned int count; - unsigned int generation; -}; - - -#endif diff --git a/src/VirtualFluids/Parallel/ZoltanPartitioner.cpp b/src/VirtualFluids/Parallel/ZoltanPartitioner.cpp deleted file mode 100644 index fd38c7157..000000000 --- a/src/VirtualFluids/Parallel/ZoltanPartitioner.cpp +++ /dev/null @@ -1,203 +0,0 @@ -#if defined VF_ZOLTAN && defined VF_MPI - -#include "ZoltanPartitioner.h" -#include "StringUtil.hpp" -#include <iostream> -#include <stdlib.h> - -using namespace std; - -////////////////////////////////////////////////////////////////////////// -ZoltanPartitioner::ZoltanPartitioner(MPI_Comm comm, int rank, int numberOfLocalParts): - comm(comm), rank(rank), numberOfLocalParts(numberOfLocalParts),lb_approach("PARTITION") -{ - int rc; - float ver; - - rc = Zoltan_Initialize(0, NULL, &ver); - - if (rc != ZOLTAN_OK){ - cout<<"Sorry, Zoltan can't be initialized\n"<<endl; - MPI_Finalize(); - exit(0); - } - /****************************************************************** - ** Create a Zoltan library structure for this instance of load - ** balancing. Set the parameters and query functions that will - ** govern the library's calculation. See the Zoltan User's - ** Guide for the definition of these and many other parameters. - ******************************************************************/ - - zz = Zoltan_Create(comm); -} -////////////////////////////////////////////////////////////////////////// -ZoltanPartitioner::~ZoltanPartitioner() -{ - Zoltan_Destroy(&zz); -} -////////////////////////////////////////////////////////////////////////// -void ZoltanPartitioner::partition() -{ - //General parameters - Zoltan_Set_Param(zz, "DEBUG_LEVEL", "0"); - Zoltan_Set_Param(zz, "LB_METHOD", "GRAPH"); - Zoltan_Set_Param(zz, "LB_APPROACH", lb_approach.c_str()); - Zoltan_Set_Param(zz, "NUM_GID_ENTRIES", "1"); - Zoltan_Set_Param(zz, "NUM_LID_ENTRIES", "1"); - Zoltan_Set_Param(zz, "RETURN_LISTS", "ALL"); - string nparts(StringUtil::toString<int>(numberOfLocalParts)); - Zoltan_Set_Param(zz, "NUM_LOCAL_PARTS", nparts.c_str()); - - /* Query functions - defined in simpleQueries.h */ - - Zoltan_Set_Num_Obj_Fn(zz, get_number_of_vertices, &graph); - Zoltan_Set_Obj_List_Fn(zz, get_vertex_list, &graph); - Zoltan_Set_Num_Edges_Multi_Fn(zz, get_num_edges_list, &graph); - Zoltan_Set_Edge_List_Multi_Fn(zz, get_edge_list, &graph); - - /****************************************************************** - ** Zoltan can now partition the graph. - ** In this case, we assume the number of partitions is - ** equal to the number of processes. Process rank 0 will own - ** partition 0, process rank 1 will own partition 1, and so on. - ******************************************************************/ - - int rc = Zoltan_LB_Partition(zz, /* input (all remaining fields are output) */ - &changes, /* 1 if partitioning was changed, 0 otherwise */ - &numGidEntries, /* Number of integers used for a global ID */ - &numLidEntries, /* Number of integers used for a local ID */ - &numImport, /* Number of vertices to be sent to me */ - &importGlobalGids, /* Global IDs of vertices to be sent to me */ - &importLocalGids, /* Local IDs of vertices to be sent to me */ - &importProcs, /* Process rank for source of each incoming vertex */ - &importToPart, /* New partition for each incoming vertex */ - &numExport, /* Number of vertices I must send to other processes*/ - &exportGlobalGids, /* Global IDs of the vertices I must send */ - &exportLocalGids, /* Local IDs of the vertices I must send */ - &exportProcs, /* Process to which I send each of the vertices */ - &exportToPart); /* Partition to which each vertex will belong */ - - - - if (rc != ZOLTAN_OK){ - cout << "Partitioning failed on process " << rank <<"\n" << endl; - MPI_Finalize(); - Zoltan_Destroy(&zz); - exit(0); - } -} -////////////////////////////////////////////////////////////////////////// -void ZoltanPartitioner::setLB_APPROACH(std::string lb_approach) -{ - this->lb_approach = lb_approach; -} -////////////////////////////////////////////////////////////////////////// -void ZoltanPartitioner::setNumberOfLocalParts(int numberOfLocalParts) -{ - this->numberOfLocalParts = numberOfLocalParts; -} -////////////////////////////////////////////////////////////////////////// -// Application defined query functions // -////////////////////////////////////////////////////////////////////////// -int ZoltanPartitioner::get_number_of_vertices(void *data, int *ierr) -{ - ZoltanGraph *graph = (ZoltanGraph *)data; - *ierr = ZOLTAN_OK; - return graph->numLocalVertices; -} -////////////////////////////////////////////////////////////////////////// -void ZoltanPartitioner::get_vertex_list(void *data, int sizeGID, int sizeLID, - ZOLTAN_ID_PTR globalID, ZOLTAN_ID_PTR localID, - int wgt_dim, float *obj_wgts, int *ierr) -{ - ZoltanGraph *graph = (ZoltanGraph *)data; - *ierr = ZOLTAN_OK; - - /* In this case, return the IDs of our vertices, but no weights. - * Zoltan will assume equally weighted vertices. - */ - - for (int i=0; i<graph->numLocalVertices; i++){ - globalID[i] = graph->vvertexGID[i]; - localID[i] = i; - } -} -////////////////////////////////////////////////////////////////////////// -void ZoltanPartitioner::get_num_edges_list(void *data, int sizeGID, int sizeLID, - int num_obj, - ZOLTAN_ID_PTR globalID, ZOLTAN_ID_PTR localID, - int *numEdges, int *ierr) -{ - ZoltanGraph *graph = (ZoltanGraph *)data; - - if ( (sizeGID != 1) || (sizeLID != 1) || (num_obj != graph->numLocalVertices)){ - *ierr = ZOLTAN_FATAL; - return; - } - - for (int i=0; i < num_obj ; i++){ - numEdges[i] = graph->vnumEdges[i]; - } - - *ierr = ZOLTAN_OK; - return; -} -////////////////////////////////////////////////////////////////////////// -void ZoltanPartitioner::get_edge_list(void *data, int sizeGID, int sizeLID, - int num_obj, ZOLTAN_ID_PTR globalID, ZOLTAN_ID_PTR localID, - int *num_edges, - ZOLTAN_ID_PTR nborGID, int *nborProc, - int wgt_dim, float *ewgts, int *ierr) -{ - int *nextNbor, *nextProc; - - ZoltanGraph *graph = (ZoltanGraph *)data; - *ierr = ZOLTAN_OK; - - if ( (sizeGID != 1) || (sizeLID != 1) || - (num_obj != graph->numLocalVertices)|| - (wgt_dim != 0)){ - *ierr = ZOLTAN_FATAL; - return; - } - - nextNbor = (int *)nborGID; - nextProc = nborProc; - - int n=0; - for (int i=0; i < num_obj; i++){ - - /* - * In this case, we are not setting edge weights. Zoltan will - * set each edge to weight 1.0. - */ - - for (int j=0; j < num_edges[i]; j++){ - nborGID[n] = graph->vnborGID[n]; - nborProc[n] = graph->vnborProc[n]; - n++; - } - } - return; -} -////////////////////////////////////////////////////////////////////////// -ZoltanGraph* ZoltanPartitioner::getGraphData() -{ - return &graph; -} -////////////////////////////////////////////////////////////////////////// -void ZoltanPartitioner::getExportData(vector<int>& exportGlobalGids, vector<int>& exportToPart, vector<int>& exportProcs) -{ - for (int i = 0; i < this->numExport; i++) - { - exportGlobalGids.push_back(static_cast<int> (this->exportGlobalGids[i])); - exportToPart.push_back(this->exportToPart[i]); - exportProcs.push_back(this->exportProcs[i]); - } -} -////////////////////////////////////////////////////////////////////////// - bool ZoltanPartitioner::areChanges() - { - return static_cast<bool>(this->changes); - } -#endif diff --git a/src/VirtualFluids/Parallel/ZoltanPartitioner.h b/src/VirtualFluids/Parallel/ZoltanPartitioner.h deleted file mode 100644 index 2bfea8877..000000000 --- a/src/VirtualFluids/Parallel/ZoltanPartitioner.h +++ /dev/null @@ -1,74 +0,0 @@ -/** -* @file ZoltanPartitioner.h -* @brief Class use Zoltan library for graph-based partitioning. -* @author Kostyantyn Kucher -* @date 10.06.2011 -*/ - -#ifndef ZOLTANPARTITIONER_H -#define ZOLTANPARTITIONER_H - -#if defined VF_ZOLTAN && defined VF_MPI - -#include "zoltan.h" -#include <vector> -#include <string> - -/* Structure to hold graph data */ - -struct ZoltanGraph{ - int numLocalVertices; // total vertices in in this partition - std::vector<int> vvertexGID; // global ID of each of my vertices - std::vector<int> vnumEdges; // number of Edges - std::vector<int> vnborGID; // global ID of neighbors - std::vector<int> vnborProc; // process owning each nbor in nborGID -}; - -struct Zoltan_Output{ - ZOLTAN_ID_PTR importGlobalGids, importLocalGids, exportGlobalGids, exportLocalGids; - int *importProcs, *importToPart, *exportProcs, *exportToPart; - int changes, numGidEntries, numLidEntries, numImport, numExport; -}; - -class ZoltanPartitioner -{ -public: - ZoltanPartitioner(MPI_Comm comm , int rank, int numberOfLocalParts); - virtual ~ZoltanPartitioner(); - void partition(); - ZoltanGraph* getGraphData(); - void setLB_APPROACH(std::string lb_approach); - void setNumberOfLocalParts(int numberOfLocalParts); - void getExportData(std::vector<int>& exportGlobalGids, std::vector<int>& exportToPart, std::vector<int>& exportProcs); - bool areChanges(); - -protected: - static int get_number_of_vertices(void *data, int *ierr); - static void get_vertex_list(void *data, int sizeGID, int sizeLID, - ZOLTAN_ID_PTR globalID, ZOLTAN_ID_PTR localID, - int wgt_dim, float *obj_wgts, int *ierr); - static void get_num_edges_list(void *data, int sizeGID, int sizeLID, - int num_obj, - ZOLTAN_ID_PTR globalID, ZOLTAN_ID_PTR localID, - int *numEdges, int *ierr); - static void get_edge_list(void *data, int sizeGID, int sizeLID, - int num_obj, ZOLTAN_ID_PTR globalID, ZOLTAN_ID_PTR localID, - int *num_edges, - ZOLTAN_ID_PTR nborGID, int *nborProc, - int wgt_dim, float *ewgts, int *ierr); - -private: - MPI_Comm comm; - int rank; - int numberOfLocalParts; - struct Zoltan_Struct *zz; - std::string lb_approach; - ZOLTAN_ID_PTR importGlobalGids, importLocalGids, exportGlobalGids, exportLocalGids; - int *importProcs, *importToPart, *exportProcs, *exportToPart; - int changes, numGidEntries, numLidEntries, numImport, numExport; - ZoltanGraph graph; -}; - -#endif - -#endif diff --git a/src/VirtualFluids/Parallel/package.include b/src/VirtualFluids/Parallel/package.include deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/VirtualFluids/Utilities/CMakePackage.txt b/src/VirtualFluids/Utilities/CMakePackage.txt deleted file mode 100644 index 1b8416f01..000000000 --- a/src/VirtualFluids/Utilities/CMakePackage.txt +++ /dev/null @@ -1,2 +0,0 @@ -GET_FILENAME_COMPONENT( CURRENT_DIR ${CMAKE_CURRENT_LIST_FILE} PATH) -COLLECT_PACKAGE_DATA_WITH_OPTION(${CURRENT_DIR} ALL_SOURCES) diff --git a/src/VirtualFluids/Utilities/ChangeRandomQs.hpp b/src/VirtualFluids/Utilities/ChangeRandomQs.hpp deleted file mode 100644 index bc3bf480e..000000000 --- a/src/VirtualFluids/Utilities/ChangeRandomQs.hpp +++ /dev/null @@ -1,51 +0,0 @@ -#ifndef ChangeRandomQs_h__ -#define ChangeRandomQs_h__ - -#include "LBMKernel.h" -#include "IntegrateValuesHelper.h" -#include "BoundaryConditions.h" -#include "BCArray3D.h" -#include "BCProcessor.h" - -namespace Utilities -{ - void ChangeRandomQs(IntegrateValuesHelperPtr integrateValues) - { - std::vector<IntegrateValuesHelper::CalcNodes> cnodes = integrateValues->getCNodes(); - - for(IntegrateValuesHelper::CalcNodes cn : cnodes) - { - ILBMKernelPtr kernel = cn.block->getKernel(); - BCArray3DPtr bcArray = kernel->getBCProcessor()->getBCArray(); - for(UbTupleInt3 node : cn.nodes) - { - BoundaryConditionsPtr bc = bcArray->getBC(val<1>(node), val<2>(node), val<3>(node)); - if (bc) - { - for (int fdir=D3Q27System::FSTARTDIR; fdir<=D3Q27System::FENDDIR; fdir++) - { - if (bc->hasNoSlipBoundaryFlag(fdir)) - { - const int invDir = D3Q27System::INVDIR[fdir]; - float q = bc->getQ(invDir); - //double r = (double)UbRandom::rand(-50, 50); - float r = (float)UbRandom::rand(-10, 10); - float q_temp = q + q/r; - if (q_temp < 0.0) - { - q_temp = 0.0001f; - } - else if (q_temp > 1.0) - { - q_temp = 0.9999f; - } - bc->setQ(q_temp, fdir); - } - } - } - } - } - } - -} -#endif // ChangeRandomQs_h__ diff --git a/src/VirtualFluids/Utilities/ConfigFileReader.cpp b/src/VirtualFluids/Utilities/ConfigFileReader.cpp deleted file mode 100644 index 3e03645ed..000000000 --- a/src/VirtualFluids/Utilities/ConfigFileReader.cpp +++ /dev/null @@ -1,195 +0,0 @@ -#include "ConfigFileReader.h" -#include "StringUtil.hpp" -#include <errno.h> -#include <algorithm> -#include <sstream> -#include <iostream> -#include <string> - - -ConfigFileReader::ConfigFileReader( const char *strConfigFile ) -{ - if ( strConfigFile ) - m_sConfigFile = strConfigFile; -} -ConfigFileReader::~ConfigFileReader() -{ -} -bool ConfigFileReader::read() -{ - m_in.open(m_sConfigFile.c_str(),std::ios::in); - if (m_in.fail()) - { - return false; - } - while (!m_in.eof()) - { - //-------------------------------------------------------- - // Get a token and value. - // This gives values to member vars: m_token and m_value. - //---------------------------------------------------------- - get_token_and_value(); - if ( m_token.length() ) - m_ConfigEntries.insert( String_Pair(m_token, m_value) ); - } - m_in.close(); - return true; -} -void ConfigFileReader::get_token_and_value(void) -{ - char token[1024]; - char ch; - bool found_equal=false; - int i=0; - eat_white_and_comments(); - while(!(m_in.get(ch)).fail()) - { - if ((ch != '\t')) - { - if ( (ch == '=') || (ch == ' ') || (ch == '\n') || (ch == '\r') || - (ch == '\t')) - { - if (ch == '=')found_equal=true; - break; - } - token[i++]=ch; - } - } - if (i==0) - { - // It didn’t find a token, in this case. - m_token=""; - m_value=""; - return; - } - // Null-terminate the token that was found. - token[i++]='\0'; - m_token = token; - makeLower(m_token); - // Advance to the equal sign, if need be. - if (!found_equal) - { - if (!advance_to_equal_sign_on_line()) - { - // The token had no value. - m_token=""; - m_value=""; - return; - } - } - // Get the token’s value. - i=0; - char c = eat_white_and_comments(false); - if ( c != '\n' ) - { - i=0; - while(!(m_in.get(ch)).fail()) - { - if ((ch == '\t') || (ch == '\r') || (ch == '\n') || (ch == '#') ) - { - while (ch!='\n') - { - if (m_in.get(ch).fail()) break; - } - break; - } - else - { - token[i++]=ch; - } - } - } - if (i==0) - { - // This token had no value. - m_value=""; - } - else - { - token[i++]='\0'; - m_value=token; - // Remove leading/trailing spaces. - m_value = StringUtil::trim(m_value); - // Strip leading and trailing quotes, if there are any. - if ( m_value[0] == '"' ) - m_value = m_value.substr( 1 ); - if ( m_value[ m_value.length() -1 ] == '"' ) - m_value = m_value.substr( 0, m_value.length()-1 ); - } -} -bool ConfigFileReader::advance_to_equal_sign_on_line() -{ - char ch; - bool found_equal=false; - while ( !(m_in.get(ch)).fail() ) - { - if ((ch=='\r')||(ch=='\n')) break; - if (ch == '=') - { - found_equal=true; - break; - } - } - return found_equal; -} -char ConfigFileReader::eat_white_and_comments(bool traverse_newlines) -{ - char ch; - bool in_comment; - in_comment = false; - while (!(m_in.get(ch)).fail()) - if (ch == '#') - in_comment = true; - else if (ch == '\n') - { - in_comment = false; - if (!traverse_newlines) - { - return(ch); // Stop eating. - } - } - else if ((!in_comment) && (ch != ' ') && - (ch != '\t') && (ch != '\r')) - { - m_in.putback(ch); - return 0; - } - return 0; -} -void ConfigFileReader::makeLower(std::string &instring) -{ - for(unsigned i=0; i < instring.size(); - i++) - { - instring[i] = tolower(instring[i]); - } -} -bool ConfigFileReader::hasValue( const char *key ) -{ - bool bRet = false; - std::string sKey = key; - makeLower( sKey ); - if ( m_ConfigEntries.find( sKey.c_str() ) != m_ConfigEntries.end() ) - { - bRet = true; - } - return bRet; -} -std::string ConfigFileReader::getValue( const char *key ) -{ - std::string sKey = key; - makeLower( sKey ); - if ( m_ConfigEntries.find( sKey.c_str() ) != m_ConfigEntries.end() ) - { - std::map<std::string, std::string>::iterator iter; - iter = m_ConfigEntries.find(sKey.c_str()); - return (*iter).second; - } - return ""; -} -void ConfigFileReader::setValue( const char *key, const char *value ) -{ - std::string sKey = key; - makeLower( sKey ); - m_ConfigEntries[sKey] = value; -} diff --git a/src/VirtualFluids/Utilities/ConfigFileReader.h b/src/VirtualFluids/Utilities/ConfigFileReader.h deleted file mode 100644 index 1ac562af4..000000000 --- a/src/VirtualFluids/Utilities/ConfigFileReader.h +++ /dev/null @@ -1,31 +0,0 @@ -#ifndef CONFIGFILE_H -#define CONFIGFILE_H -#include <string> -#include <vector> -#include <fstream> -#include <map> -#include <list> - -class ConfigFileReader -{ -public: - ConfigFileReader(const char *strFileName); - virtual ~ConfigFileReader(void); - bool read(void); - bool hasValue( const char *key ); - std::string getValue( const char *key ); - void setValue( const char *key, const char *value ); -protected: - virtual void get_token_and_value(); - virtual char eat_white_and_comments(bool traverse_newlines=true); - virtual bool advance_to_equal_sign_on_line(); - virtual void makeLower(std::string &instring); -protected: - std::fstream m_in; - std::string m_token; - std::string m_value; - std::string m_sConfigFile; - typedef std::pair <std::string, std::string> String_Pair; - std::map<std::string, std::string> m_ConfigEntries; -}; -#endif diff --git a/src/VirtualFluids/Utilities/ConfigurationFile.hpp b/src/VirtualFluids/Utilities/ConfigurationFile.hpp deleted file mode 100644 index 64c25f5a5..000000000 --- a/src/VirtualFluids/Utilities/ConfigurationFile.hpp +++ /dev/null @@ -1,258 +0,0 @@ -#ifndef Configuration_h__ -#define Configuration_h__ - -#include <map> -#include <string> -#include <fstream> -#include <iostream> -#include <stdlib.h> - -//! \brief Simple configuration file -//! \details The Configuration class presented here can read and keep values of any configuration file written in a format like this: -//!# -//!# Simulation parameters -//!# -//! -//!nbDimensions = 2 -//!temperature = 25.001 -//!epsilon = 1.013e-14 -//!writeLogFile = false # NOTE: Set to "true" in debug mode only. -//! # Logging slows down the program. -//!errorMessage = the simulation failed -//!origin = 0.0 0.0 0.0 # x, y, z of origin -//! -//!Example how to use it: -//! -//!Configuration config; -//!config.load(configname); -//! -//!int nbDimensions = config.getInt("nbDimensions"); -//!float temperature = config.getFloat("temperature"); -//!double epsilon = config.getDouble("epsilon"); -//!bool writeLogFile = config.getBool("writeLogFile"); -//!string errorMessage = config.getString("pathname"); -//!vector<double> origin = config.getVector<double>("origin"); -//! -//! \author Konstantin Kutscher - -class ConfigurationFile -{ -public: - // clear all values - void clear(); - - // load a configuration file - bool load(const std::string& File); - - // check if value associated with given key exists - bool contains(const std::string& key) const; - - // get value associated with given key - - int getInt(const std::string& key) const; - long getLong(const std::string& key) const; - float getFloat(const std::string& key) const; - double getDouble(const std::string& key) const; - bool getBool(const std::string& key) const; - std::string getString(const std::string& key) const; - template<class T> - std::vector<T> getVector(const std::string& key) const; - - template<class T> - T getValue(const std::string& key) const; - -private: - // the container - std::map<std::string, std::string> data; - - // remove leading and trailing tabs and spaces - static std::string trim(const std::string& str); - - template<class T> - T fromString(const std::string& str) const; -}; - - -// ---------------------------------- -// method implementations -// ---------------------------------- - -void ConfigurationFile::clear() -{ - data.clear(); -} -////////////////////////////////////////////////////////////////////////// -bool ConfigurationFile::load(const std::string& file) -{ - std::ifstream inFile(file.c_str()); - - if (!inFile.good()) - { - UB_THROW(UbException(UB_EXARGS, "Cannot read configuration file "+file+"!")); - } - - while (inFile.good() && ! inFile.eof()) - { - std::string line; - getline(inFile, line); - - // filter out comments - if (!line.empty()) - { - size_t pos = line.find('#'); - - if (pos != std::string::npos) - { - line = line.substr(0, pos); - } - } - - // split line into key and value - if (!line.empty()) - { - size_t pos = line.find('='); - - if (pos != std::string::npos) - { - std::string key = trim(line.substr(0, pos)); - std::string value = trim(line.substr(pos + 1)); - - if (!key.empty() && !value.empty()) - { - data[key] = value; - } - } - } - } - - return true; -} -////////////////////////////////////////////////////////////////////////// -bool ConfigurationFile::contains(const std::string& key) const -{ - return data.find(key) != data.end(); -} -////////////////////////////////////////////////////////////////////////// -std::string ConfigurationFile::getString(const std::string& key) const -{ - std::map<std::string, std::string>::const_iterator iter = data.find(key); - - if (iter != data.end()) - { - std::string value = iter->second; - return value; - } - else - { - UB_THROW(UbException(UB_EXARGS, "The parameter \"" + key + "\" is missing!")); - } -} -////////////////////////////////////////////////////////////////////////// -int ConfigurationFile::getInt(const std::string& key) const -{ - std::string str = getString(key); - int value = std::atoi(str.c_str()); - return value; -} -////////////////////////////////////////////////////////////////////////// -long ConfigurationFile::getLong(const std::string& key) const -{ - std::string str = getString(key); - long value = std::atol(str.c_str()); - return value; -} -////////////////////////////////////////////////////////////////////////// -float ConfigurationFile::getFloat(const std::string& key) const -{ - std::string str = getString(key); - float value = (float)std::atof(str.c_str()); - return value; -} -////////////////////////////////////////////////////////////////////////// -double ConfigurationFile::getDouble(const std::string& key) const -{ - std::string str = getString(key); - double value = std::atof(str.c_str()); - return value; -} -////////////////////////////////////////////////////////////////////////// -bool ConfigurationFile::getBool(const std::string& key) const -{ - std::string str = getString(key); - bool value = (str == "true"); - return value; -} -////////////////////////////////////////////////////////////////////////// -std::string ConfigurationFile::trim(const std::string& str) -{ - size_t first = str.find_first_not_of(" \t\n\r"); - - if (first != std::string::npos) - { - size_t last = str.find_last_not_of(" \t\n\r"); - - return str.substr(first, last - first + 1); - } - else - { - return ""; - } -} -////////////////////////////////////////////////////////////////////////// -template<class T> -std::vector<T> ConfigurationFile::getVector(const std::string& key) const -{ - std::string str = getString(key); - std::vector<T> v; - std::vector<std::string> strings; - boost::algorithm::split(strings, str, boost::algorithm::is_any_of("\t\n\r;, ")); - for(std::string s : strings) - { - if (s != "") - { - v.push_back(fromString<T>(s)); - } - } - return v; -} -////////////////////////////////////////////////////////////////////////// -template<class T> -T ConfigurationFile::fromString(const std::string& str) const -{ - //boolean hack - if (str == "true") - return true; - else if (str == "false") - return false; - ////////////// - std::istringstream stream(str); - T t; - stream >> t; - return t; -} -////////////////////////////////////////////////////////////////////////// -template<class T> -T ConfigurationFile::getValue(const std::string& key) const -{ - std::string str = getString(key); - bool bFlag = false; - if ((std::string)typeid(T).name() == (std::string)typeid(bool).name()) - { - bFlag = true; - } - - std::istringstream iss(str); - T x; - iss >> x; - if (!iss && !bFlag) - UB_THROW(UbException(UB_EXARGS, " cannot convert \"" + str + "\" to type <" + static_cast<std::string>(typeid(x).name()) + ">")); - - if (bFlag) - { - bool value = (str == "true"); - x = value; - } - - return x; -} -#endif // Configuration_h__ diff --git a/src/VirtualFluids/Utilities/MathUtil.hpp b/src/VirtualFluids/Utilities/MathUtil.hpp deleted file mode 100644 index 56d9a9299..000000000 --- a/src/VirtualFluids/Utilities/MathUtil.hpp +++ /dev/null @@ -1,97 +0,0 @@ -#ifndef MATHUTIL_H -#define MATHUTIL_H - -#include <math.h> -#include "MuParser/include/muParser.h" - -namespace Utilities -{ - static bool isEven( int integer ) - { - if ( integer % 2 == 0 ) - return true; - else - return false; - } - - static bool isOdd( int integer ) - { - if ( integer % 2 != 0 ) - return true; - else - return false; - } - - //convert from double to int - static int cint(double x) - { - double intpart; - if (modf(x,&intpart)>=.5) - return static_cast<int> (floor(x)+1); - else - return static_cast<int> (floor(x)); - } - - //create new mu parser for duct parabolic profile - //inflow in X - static mu::Parser getDuctParaboloidX(double Cy, double Hy, double Cz, double Hz, double V) - { - mu::Parser fct; - fct.SetExpr("V*(((-(x2-Cy)^2.0+(Hy/2.0)^2.0)/(Hy/2.0)^2.0)*((-(x3-Cz)^2.0+(Hz/2.0)^2.0)/(Hz/2.0)^2.0))" ); - fct.DefineConst("Cy", Cy); - fct.DefineConst("Hy", Hy); - fct.DefineConst("Cz", Cz); - fct.DefineConst("Hz", Hz); - fct.DefineConst("V" , V ); - return fct; - } - //inflow in Y - static mu::Parser getDuctParaboloidY(double Cx, double Hx, double Cz, double Hz, double V) - { - mu::Parser fct; - fct.SetExpr("V*(((-(x1-Cx)^2.0+(Hx/2.0)^2.0)/(Hx/2.0)^2.0)*((-(x3-Cz)^2.0+(Hz/2.0)^2.0)/(Hz/2.0)^2.0))" ); - fct.DefineConst("Cx", Cx); - fct.DefineConst("Hx", Hx); - fct.DefineConst("Cz", Cz); - fct.DefineConst("Hz", Hz); - fct.DefineConst("V" , V ); - return fct; - } - //inflow in Z - static mu::Parser getDuctParaboloidZ(double Cx, double Hx, double Cy, double Hy, double V) - { - mu::Parser fct; - fct.SetExpr("V*(((-(x1-Cx)^2.0+(Hx/2.0)^2.0)/(Hx/2.0)^2.0)*((-(x2-Cy)^2.0+(Hy/2.0)^2.0)/(Hy/2.0)^2.0))" ); - fct.DefineConst("Cx", Cx); - fct.DefineConst("Hx", Hx); - fct.DefineConst("Cy", Cy); - fct.DefineConst("Hy", Hy); - fct.DefineConst("V" , V ); - return fct; - } - //hash function - static unsigned int RSHash(const std::string& str) - { - unsigned int b = 378551; - unsigned int a = 63689; - unsigned int hash = 0; - - for(std::size_t i = 0; i < str.length(); i++) - { - hash = hash * a + str[i]; - a = a * b; - } - - return hash; - } - //linear interpolation - static double linear_interpolation1D(double x0, double y0, double x1, double y1, double x) - { - double a = (y1 - y0) / (x1 - x0); - double b = -a*x0 + y0; - double y = a * x + b; - return y; - } -}; - -#endif diff --git a/src/VirtualFluids/Utilities/MemoryUtil.h b/src/VirtualFluids/Utilities/MemoryUtil.h deleted file mode 100644 index f94757aa7..000000000 --- a/src/VirtualFluids/Utilities/MemoryUtil.h +++ /dev/null @@ -1,121 +0,0 @@ -#ifndef _MEMORYUTIL_H_ -#define _MEMORYUTIL_H_ - -#if defined(_WIN32) || defined(_WIN64) - #define MEMORYUTIL_WINDOWS - #include "windows.h" - #include "psapi.h" - #pragma comment(lib, "psapi.lib") -#elif defined __APPLE__ -#define MEMORYUTIL_APPLE - #include "sys/types.h" - #include "sys/sysctl.h" - #include "stdlib.h" - #include "stdio.h" - #include "string.h" -#elif (defined(__amd64) || defined(__amd64__) || defined(__unix__) || defined(__CYGWIN__)) && !defined(__AIX__) - #define MEMORYUTIL_LINUX - #include "sys/types.h" - #include "sys/sysinfo.h" - #include "stdlib.h" - #include "stdio.h" - #include "string.h" -#else - #error "MemoryUtil::UnknownMachine" -#endif -////////////////////////////////////////////////////////////////////////// -//MemoryUtil -////////////////////////////////////////////////////////////////////////// -namespace Utilities -{ -////////////////////////////////////////////////////////////////////////// - static long long getTotalPhysMem() - { - #if defined MEMORYUTIL_WINDOWS - MEMORYSTATUSEX memInfo; - memInfo.dwLength = sizeof(MEMORYSTATUSEX); - GlobalMemoryStatusEx(&memInfo); - DWORDLONG totalPhysMem = memInfo.ullTotalPhys; - #elif defined(MEMORYUTIL_LINUX) - struct sysinfo memInfo; - sysinfo (&memInfo); - long long totalPhysMem = memInfo.totalram; - //Multiply in next statement to avoid int overflow on right hand side... - totalPhysMem *= memInfo.mem_unit; - #elif defined(MEMORYUTIL_APPLE) - long long totalPhysMem = 0; - #else - #error "MemoryUtil::getTotalPhysMem - UnknownMachine" - #endif - - return (long long)totalPhysMem; - } -////////////////////////////////////////////////////////////////////////// - static long long getPhysMemUsed() - { - #if defined MEMORYUTIL_WINDOWS - MEMORYSTATUSEX memInfo; - memInfo.dwLength = sizeof(MEMORYSTATUSEX); - GlobalMemoryStatusEx(&memInfo); - DWORDLONG physMemUsed = memInfo.ullTotalPhys - memInfo.ullAvailPhys; - #elif defined(MEMORYUTIL_LINUX) - struct sysinfo memInfo; - sysinfo (&memInfo); - long long physMemUsed = memInfo.totalram - memInfo.freeram; - //Multiply in next statement to avoid int overflow on right hand side... - physMemUsed *= memInfo.mem_unit; - #elif defined(MEMORYUTIL_APPLE) - long long physMemUsed = 0; - #else - #error "MemoryUtil::getPhysMemUsed - UnknownMachine" - #endif - - return (long long)physMemUsed; - } -////////////////////////////////////////////////////////////////////////// -#if defined(MEMORYUTIL_LINUX) || defined(MEMORYUTIL_APPLE) - static int parseLine(char* line){ - int i = strlen(line); - while (*line < '0' || *line > '9') line++; - line[i-3] = '\0'; - i = atoi(line); - return i; - } - - static int getValue(){ //Note: this value is in KB! - FILE* file = fopen("/proc/self/status", "r"); - int result = -1; - char line[128]; - - - while (fgets(line, 128, file) != NULL){ - if (strncmp(line, "VmRSS:", 6) == 0){ - result = parseLine(line); - break; - } - } - fclose(file); - return result; - } -#endif -////////////////////////////////////////////////////////////////////////// - static long long getPhysMemUsedByMe() - { - #if defined MEMORYUTIL_WINDOWS - PROCESS_MEMORY_COUNTERS pmc; - GetProcessMemoryInfo(GetCurrentProcess(), &pmc, sizeof(pmc)); - SIZE_T physMemUsedByMe = pmc.WorkingSetSize; - #elif defined(MEMORYUTIL_LINUX) || defined(MEMORYUTIL_APPLE) - long long physMemUsedByMe = (long long)getValue() * (long long)1024; - #else - #error "MemoryUtil::getPhysMemUsedByMe - UnknownMachine" - #endif - - return (long long)physMemUsedByMe; - } -////////////////////////////////////////////////////////////////////////// - -} - -#endif - diff --git a/src/VirtualFluids/Utilities/StringUtil.hpp b/src/VirtualFluids/Utilities/StringUtil.hpp deleted file mode 100644 index 08be63554..000000000 --- a/src/VirtualFluids/Utilities/StringUtil.hpp +++ /dev/null @@ -1,305 +0,0 @@ -#ifndef STRINGUTIL_H -#define STRINGUTIL_H -#include <errno.h> -#include <algorithm> -#include <sstream> -#include <iostream> -#include <string> - -#include <boost/algorithm/string.hpp> - -template <class T> -bool from_string(T &t, const std::string &s, std::ios_base &(*f)(std::ios_base&)) -{ - std::istringstream iss(s); - return !(iss>>f>>t).fail(); -} -class StringUtil -{ -public: - StringUtil() {} - ~StringUtil() {} - // Find the given string in the source string and replace it with the - // "replace" string, everywhere instances of that string exist. - static void findandreplace( std::string& source, const std::string& find, const std::string& replace ) - { - size_t j; - for (;(j = source.find( find )) - != std::string::npos;) - { - source.replace( j, - find.length(), replace ); - } - } - // The following function returns a string with all-uppercase characters. - static std::string makeUpper( const std::string& instring) - { - std::string temp=instring; - transform( temp.begin(), temp.end(), temp.begin(), ::toupper ); - return temp; - } - // The following function returns a string with all-lowercase characters. - static std::string makeLower( const std::string& instring) - { - std::string temp; - transform( temp.begin(), temp.end(), temp.begin(), ::tolower ); - return temp; - } - static bool contains( const std::string& source, const char *find ) - { - return ( 0!=strstr(source.c_str(),find) ); - } - static std::string pad( const std::string& instring, char padchar, int length ) - { - std::string outstring = instring; - for ( int i=(int)outstring.length(); i<length; ++i ) - outstring += padchar; - return outstring; - } - // Trim the given characters from the beginning and end of a string. - // the default is to trim whitespace. If the string is empty or contains - // only the trim characters, an empty string is returned. - static std::string trim( const std::string &instring, const std::string &trimstring=std::string(" \t\n")) - { - if (trimstring.size()==0) - return instring; - std::string temp=""; - std::string::size_type begpos=instring.find_first_not_of (trimstring); - if (begpos==std::string::npos) - { - return temp; - } - else - { - std::string::size_type endpos=instring.find_last_not_of (trimstring); - temp=instring.substr(begpos, endpos-begpos+1); - } - return temp; - } - // Convert the string to an int. Note that a string exception is thrown if - // it is invalid. - static int toInt(const std::string & myInString) - { - int i=0; - std::string inString = trim(myInString); - if( !from_string<int>(i, inString, std::dec) ) - { - std::string exceptionText = "StringUtil::toInt() - Not an integer: " + inString; - throw exceptionText; - } - // Time to run some more checks. - for (unsigned int j=0; j < inString.length(); j++) - { - if ( !isNumeric(inString[j]) ) - { - if (j==0 && inString[j] =='-') - { - continue; - } - else - { - std::string exceptionText = "StringUtil::toInt() - Not an integer: " + inString; - throw exceptionText; - } - } - } - return (i); - } - // Convert the string to a float. Note: A string exception is thrown if - // it is invalid. - static float toFloat(const std::string & myInString) - { - float f=0; - std::string inString = trim(myInString); - if( !from_string<float>(f, inString, std::dec) ) - { - std::string exceptionText = "StringUtil::toFloat() - Not a float: " + inString; - throw exceptionText; - } - // Now it runs some more checks. - int dec_count=0; - int e_count=0; - for (unsigned int j=0; j < inString.length(); j++) - { - if ( !isNumeric(inString[j]) ) - { - if ((j==0 || inString[j-1] == 'e' || inString[j-1] == 'E') && inString[j] =='-') - { - continue; - } - else if (inString[j]=='.') - { - dec_count++; - if (dec_count > 1) - { - std::string exceptionText = "StringUtil::toFloat() - Not a float: " + inString; - throw exceptionText; - } - continue; - } - else if (inString[j] == 'e' || inString[j] == 'E') - { - e_count++; - if (e_count > 1) - { - std::string exceptionText = "StringUtil::toFloat() - Not a float: " + inString; - throw exceptionText; - } - continue; - } - else - { - std::string exceptionText = "StringUtil::toFloat() - Not a float: " + inString; - throw exceptionText; - } - } - } - return (f); - } - // Convert the string to a double. Note: A string exception is thrown if - // it is invalid. - static double toDouble(const std::string & myInString) - { - double d=0; - std::string inString = trim(myInString); - if( !from_string<double>(d, inString, std::dec) ) - { - std::string exceptionText = "StringUtil::toDouble() - Not a double: " + inString; - throw exceptionText; - } - // Now it runs some more checks. - int dec_count=0; - int e_count=0; - for (unsigned int j=0; j < inString.length(); j++) - { - if ( !isNumeric(inString[j]) ) - { - if ((j==0 || inString[j-1] == 'e' || inString[j-1] == 'E') && inString[j] =='-') - { - continue; - } - else if (inString[j]=='.') - { - dec_count++; - if (dec_count > 1) - { - std::string exceptionText = "StringUtil::toDouble() - Not a double: " + inString; - throw exceptionText; - } - continue; - } - else if (inString[j] == 'e' || inString[j] == 'E') - { - e_count++; - if (e_count > 1) - { - std::string exceptionText = "StringUtil::toDouble() - Not a double: " + inString; - throw exceptionText; - } - continue; - } - else - { - std::string exceptionText = "StringUtil::toDouble() - Not a double: " + inString; - throw exceptionText; - } - } - } - return (d); - } - // Convert the string to a boolean. Note: A string exception is thrown if - // it is invalid. - static bool toBool(const std::string & myInString) - { - bool b=0; - std::string inString = trim(myInString); - if( !from_string<bool>(b, inString, std::boolalpha) ) - { - std::string exceptionText = "StringUtil::toBool() - Not a bool: " + inString; - throw exceptionText; - } - return (b); - } - // Returns true if the character is numeric. - static bool isNumeric(char c) - { - return ('0' <= c && c <= '9'); - } - // Replace environment variables in the string with their values. - // Note: environment variables must be of the form ${ENVVAR}. - //static std::string substituteEnvVar( const std::string &myInString ) - //{ - // std::string outString=""; - // char variable[512]; - // const char *s = myInString.c_str(); - // while(*s!=0) - // { - // if (*s=='$' && *(s+1)=='{') - // { - // // When you've found beginning of variable, find the end. - // //strcpy(variable,s+2); - // strcpy_s(variable, s+2); - // char *end = strchr (variable,'}'); - // if (end) - // { - // *end='\0'; - // //char *cp = (char *)getenv(variable); - // char *cp; - // size_t len; - // _dupenv_s(&cp, &len, variable ); - // if (cp) - // //outString += (char *) getenv(variable); - // outString += (char *) cp; - // s = strchr(s,'}'); - // } - // else - // { - // outString += *s; - // } - // } - // else - // { - // outString += *s; - // } - // s++; - // } - // return outString; - //} - template<class T> - static std::vector<T> toVector(const std::string& s) - { - std::vector<T> v; - std::vector<std::string> strings; - boost::algorithm::split(strings, s, boost::algorithm::is_any_of("\t\n ")); - for(std::string s : strings){ - if (s != "") - { - v.push_back(fromString<T>(s)); - } - } - return v; - } - template<class T> - static std::string toString(const T& t) - { - std::ostringstream stream; - stream << t; - return stream.str(); - } - template<class T> - static T fromString(const std::string& s) - { - //boolean hack - if(s == "true") - return true; - else if(s == "false") - return false; - ////////////// - std::istringstream stream (s); - T t; - stream >> t; - return t; - } -}; -#endif //STRINGUTIL_H - diff --git a/src/VirtualFluids/Utilities/VoxelMatrixUtil.hpp b/src/VirtualFluids/Utilities/VoxelMatrixUtil.hpp deleted file mode 100644 index 9fc472c5d..000000000 --- a/src/VirtualFluids/Utilities/VoxelMatrixUtil.hpp +++ /dev/null @@ -1,50 +0,0 @@ -#ifndef VoxelMatrixUtil_h__ -#define VoxelMatrixUtil_h__ - -#include "GbCuboid3D.h" -#include "NoSlipBCAdapter.h" -#include "D3Q27Interactor.h" -#include "SetSolidBlockVisitor.h" -#include "Block3D.h" -#include "Grid3D.h" - - -namespace Utilities -{ - void voxelMatrixDiscretisation(GbVoxelMatrix3DPtr matrix, std::string& pathname, int myid, int fileCounter, Grid3DPtr grid, int bounceBackOption, bool vmFile) - { - BCAdapterPtr noSlipPM(new NoSlipBCAdapter(bounceBackOption)); - D3Q27InteractorPtr vmInt = D3Q27InteractorPtr(new D3Q27Interactor(matrix, grid, noSlipPM, Interactor3D::SOLID)); - - if (vmFile) - { - if (myid == 0) matrix->writeToVTKImageDataASCII(pathname + "/geo/vmatrix" + UbSystem::toString(fileCounter)); - } - - GbCuboid3DPtr vmBox(new GbCuboid3D(matrix->getX1Minimum(), matrix->getX2Minimum(), matrix->getX3Minimum(), matrix->getX1Maximum(), matrix->getX2Maximum(), matrix->getX3Maximum())); - if (myid == 0) GbSystem3D::writeGeoObject(vmBox.get(), pathname + "/geo/vmbox" + UbSystem::toString(fileCounter), WbWriterVtkXmlASCII::getInstance()); - D3Q27InteractorPtr vmBoxInt = D3Q27InteractorPtr(new D3Q27Interactor(vmBox, grid, noSlipPM, Interactor3D::SOLID)); - SetSolidBlockVisitor v1(vmBoxInt, BlockType::SOLID); - grid->accept(v1); - SetSolidBlockVisitor v2(vmBoxInt, BlockType::BC); - grid->accept(v2); - - std::vector<Block3DPtr> blocks; - std::vector<Block3DPtr>& sb = vmBoxInt->getSolidBlockSet(); - if (myid == 0) UBLOG(logINFO, "number of solid blocks = " << sb.size()); - blocks.insert(blocks.end(), sb.begin(), sb.end()); - std::vector<Block3DPtr>& tb = vmBoxInt->getBcBlocks(); - if (myid == 0) UBLOG(logINFO, "number of trans blocks = " << tb.size()); - blocks.insert(blocks.end(), tb.begin(), tb.end()); - - if (myid == 0) UBLOG(logINFO, "number of blocks = " << blocks.size()); - - for(Block3DPtr block : blocks) - { - block->setActive(true); - vmInt->setDifferencesToGbObject3D(block); - } - } -} -#endif // VoxelMatrixUtil_h__ - diff --git a/src/VirtualFluids/Utilities/package.include b/src/VirtualFluids/Utilities/package.include deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/VirtualFluids/VirtualFluids.h b/src/VirtualFluids/VirtualFluids.h deleted file mode 100644 index 98a88c50f..000000000 --- a/src/VirtualFluids/VirtualFluids.h +++ /dev/null @@ -1,310 +0,0 @@ -//VirtualFluids header files - -#if defined VF_FETOL -#define WIN32_LEAN_AND_MEAN -#include <JM.h> -#endif - - -//#include <MuParser/include/muParser.h> -//#include <MuParser/include/muParserBase.h> -//#include <MuParser/include/muParserBytecode.h> -//#include <MuParser/include/muParserCallback.h> -//#include <MuParser/include/muParserDef.h> -//#include <MuParser/include/muParserDLL.h> -//#include <MuParser/include/muParserError.h> -//#include <MuParser/include/muParserFixes.h> -//#include <MuParser/include/muParserInt.h> -//#include <MuParser/include/muParserStack.h> -//#include <MuParser/include/muParserTemplateMagic.h> -//#include <MuParser/include/muParserTest.h> -//#include <MuParser/include/muParserToken.h> -//#include <MuParser/include/muParserTokenReader.h> -#include <basics/container/CbArray2D.h> -#include <basics/container/CbArray3D.h> -#include <basics/container/CbArray4D.h> -#include <basics/container/CbVector.h> -#include <basics/container/CbVectorPool.h> -#include <basics/memory/MbMemPool.h> -#include <basics/memory/MbSharedPointerDefines.h> -#include <basics/memory/MbSmartPtr.h> -#include <basics/memory/MbSmartPtrBase.h> -#include <basics/objects/ObCreator.h> -#include <basics/objects/ObFactory.h> -#include <basics/objects/ObObject.h> -#include <basics/objects/ObObjectCreator.h> -#include <basics/objects/ObObjectFactory.h> -#include <basics/objects/ObObjectManager.h> -#include <basics/transmitter/TbTransmitter.h> -#include <basics/transmitter/TbTransmitterLocal.h> -#include <basics/transmitter/TbTransmitterMpiPool.h> -#include <basics/utilities/UbAutoRun.hpp> -#include <basics/utilities/UbComparators.h> -#include <basics/utilities/UbConverter.h> -#include <basics/utilities/UbEqual.h> -#include <basics/utilities/UbException.h> -#include <basics/utilities/UbFileInput.h> -#include <basics/utilities/UbFileInputASCII.h> -#include <basics/utilities/UbFileInputBinary.h> -#include <basics/utilities/UbFileOutput.h> -#include <basics/utilities/UbFileOutputASCII.h> -#include <basics/utilities/UbFileOutputBinary.h> -#include <basics/utilities/UbInfinity.h> -#include <basics/utilities/UbKeys.h> -#include <basics/utilities/UbLimits.h> -#include <basics/utilities/UbLogger.h> -#include <basics/utilities/UbMath.h> -#include <basics/utilities/UbNupsTimer.h> -#include <basics/utilities/UbObservable.h> -#include <basics/utilities/UbObserver.h> -#include <basics/utilities/UbPointerWrapper.h> -#include <basics/utilities/UbRandom.h> -#include <basics/utilities/UbScheduler.h> -#include <basics/utilities/UbStaticPathMap.h> -#include <basics/utilities/UbString.h> -#include <basics/utilities/UbStringInputASCII.h> -#include <basics/utilities/UbSystem.h> -#include <basics/utilities/UbTableModel.h> -#include <basics/utilities/UbTiming.h> -#include <basics/utilities/UbTuple.h> -#include <basics/writer/WbWriter.h> -#include <basics/writer/WbWriterAvsASCII.h> -#include <basics/writer/WbWriterAvsBinary.h> -#include <basics/writer/WbWriterBOBJ.h> -#include <basics/writer/WbWriterSunflow.h> -#include <basics/writer/WbWriterTecPlotASCII.h> -#include <basics/writer/WbWriterVtkASCII.h> -#include <basics/writer/WbWriterVtkBinary.h> -#include <basics/writer/WbWriterVtkXmlASCII.h> -#include <basics/writer/WbWriterVtkXmlBinary.h> -#include <basics/writer/WbWriterX3D.h> -// #include <BoundaryCondition/BCArray.h> -#include <BoundaryConditions/BCArray3D.h> -#include <BoundaryConditions/BCProcessor.h> -#include <BoundaryConditions/BCAlgorithm.h> -#include <BoundaryConditions/BCFunction.h> -#include <BoundaryConditions/BoundaryConditions.h> -#include <BoundaryConditions/BCAdapter.h> -#include <BoundaryConditions/DensityBCAdapter.h> -#include <BoundaryConditions/BCProcessor.h> -#include <BoundaryConditions/ThinWallBCProcessor.h> -#include <BoundaryConditions/NoSlipBCAdapter.h> -#include <BoundaryConditions/SlipBCAdapter.h> -#include <BoundaryConditions/VelocityBCAdapter.h> - -//#include <BoundaryCondition/BoundaryConditionProcessor.h> -#include <BoundaryConditions/BCAlgorithm.h> -#include <BoundaryConditions/VelocityBCAlgorithm.h> -#include <BoundaryConditions/NonEqDensityBCAlgorithm.h> -#include <BoundaryConditions/EqDensityBCAlgorithm.h> -#include <BoundaryConditions/NoSlipBCAlgorithm.h> -#include <BoundaryConditions/ThinWallNoSlipBCAlgorithm.h> -#include <BoundaryConditions/HighViscosityNoSlipBCAlgorithm.h> -#include <BoundaryConditions/SlipBCAlgorithm.h> -#include <BoundaryConditions/NonReflectingOutflowBCAlgorithm.h> -#include <BoundaryConditions/VelocityWithDensityBCAlgorithm.h> -//#include <BoundaryConditions/NonReflectingSlipBCAlgorithm.h> - -#include <Connectors/Block3DConnector.h> -#include <Connectors/D3Q27ETCFOffVectorConnector.h> -#include <Connectors/D3Q27ETFCOffVectorConnector.h> -#include <Connectors/D3Q27ETFullDirectConnector.h> -#include <Connectors/D3Q27ETFullVectorConnector.h> -#include <Connectors/LocalBlock3DConnector.h> -#include <Connectors/RemoteBlock3DConnector.h> -#include <Connectors/CoarseToFineBlock3DConnector.h> -#include <Connectors/CoarseToFineNodeSetBlock3DConnector.h> -#include <Connectors/FineToCoarseBlock3DConnector.h> -#include <Connectors/FineToCoarseNodeSetBlock3DConnector.h> -#include <Connectors/ConnectorFactory.h> -#include <Connectors/Block3DConnectorFactory.h> -#include <Data/D3Q27EsoTwist3DSplittedVector.h> -#include <Data/D3Q27EsoTwist3DSplittedVectorEx.h> -#include <Data/DataSet3D.h> -#include <Data/DistributionArray3D.h> -#include <Data/EsoTwist3D.h> -#include <Data/EsoTwistD3Q27System.h> -#include <Data/EsoTwistD3Q27SparseData.h> -#include <Data/VoidData3D.h> -#include <Grid/Block3D.h> -//#include <Grid/BoostSerializationClassExportHelper.h> -#include <Grid/CalculationManager.h> -#include <Grid/Calculator.h> -//#include <Grid/Calculator2.h> -#include <Grid/Grid3D.h> -#include <Grid/Grid3DSystem.h> -#include <Interactors/D3Q27Interactor.h> -#include <Interactors/D3Q27TriFaceMeshInteractor.h> -#include <Interactors/Interactor3D.h> -#include <Interactors/InteractorsHelper.h> -#include <CoProcessors/WriteBlocksCoProcessor.h> -#include <CoProcessors/AdjustForcingCoProcessor.h> -#include <CoProcessors/CalculateForcesCoProcessor.h> -#include <CoProcessors/WriteMacroscopicQuantitiesCoProcessor.h> -#include <CoProcessors/WriteBoundaryConditionsCoProcessor.h> -//#include <CoProcessors/PathLineCoProcessor.h> -//#include <CoProcessors/PathLineCoProcessorMcpart.h> -#include <CoProcessors/PressureDifferenceCoProcessor.h> -#include <CoProcessors/EmergencyExitCoProcessor.h> -#include <CoProcessors/NUPSCounterCoProcessor.h> -//#include <CoProcessors/Particles.h> -#include <CoProcessors/CoProcessor.h> -#include <CoProcessors/RestartCoProcessor.h> -#include <CoProcessors/TurbulenceIntensityCoProcessor.h> -#include <CoProcessors/AverageValuesCoProcessor.h> -#include <CoProcessors/DecreaseViscosityCoProcessor.h> -#include <CoProcessors/TimeseriesCoProcessor.h> -#include <CoProcessors/ShearStressCoProcessor.h> -#include <CoProcessors/QCriterionCoProcessor.h> -#include <CoProcessors/InSituVTKCoProcessor.h> -//#include <CoProcessors/MeanValuesCoProcessor.h> -#include <CoProcessors/TimeAveragedValuesCoProcessor.h> -#include <CoProcessors/InSituCatalystCoProcessor.h> -#include <CoProcessors/MPIIORestart2CoProcessor.h> -#include <CoProcessors/PressureCoefficientCoProcessor.h> -#include <LineTimeSeriesCoProcessor.h> -#include <IntegrateValuesHelper.h> -//#include <LBM/D3Q27CompactInterpolationProcessor.h> -#include <LBM/IncompressibleOffsetInterpolationProcessor.h> -#include <LBM/CompressibleOffsetInterpolationProcessor.h> -#include <LBM/CompressibleOffsetMomentsInterpolationProcessor.h> -#include <LBM/InterpolationHelper.h> -#include <LBM/InterpolationProcessor.h> -//#include <LBM/D3Q27OffsetInterpolationProcessor.h> -#include <LBM/D3Q27System.h> -#include <LBM/ICell.h> -#include <LBM/InterpolationProcessor.h> -#include <LBM/LBMKernel.h> -#include <IncompressibleCumulantWithSpongeLayerLBMKernel.h> -#include <LBM/LBMKernel.h> -#include <LBM/IncompressibleCumulantLBMKernel.h> -#include <LBM/CompressibleCumulantLBMKernel.h> -#include <LBM/InitDensityLBMKernel.h> -#include <LBM/VoidLBMKernel.h> -#include <LBM/LBMSystem.h> -#include <LBM/LBMSystems.h> -#include <LBM/LBMUnitConverter.h> -#include <numerics/geometry3d/CoordinateTransformation3D.h> -#include <numerics/geometry3d/GbCuboid3D.h> -#include <numerics/geometry3d/GbCylinder3D.h> -#include <numerics/geometry3d/GbHalfSpace3D.h> -#include <numerics/geometry3d/GbHalfSpaceKrischan3D.h> -#include <numerics/geometry3d/GbLine3D.h> -#include <numerics/geometry3d/GbMeshTools3D.h> -#include <numerics/geometry3d/GbObject3D.h> -#include <numerics/geometry3d/GbObject3DManager.h> -#include <numerics/geometry3d/GbObjectGroup3D.h> -#include <numerics/geometry3d/GbPoint3D.h> -#include <numerics/geometry3d/GbPolygon3D.h> -#include <numerics/geometry3d/GbQuadFaceMesh3D.h> -#include <numerics/geometry3d/GbSphere3D.h> -#include <numerics/geometry3d/GbSystem3D.h> -#include <numerics/geometry3d/GbTriangle3D.h> -#include <numerics/geometry3d/GbTriangularMesh3D.h> -#include <numerics/geometry3d/GbTriFaceMesh3D.h> -#include <numerics/geometry3d/GbVector3D.h> -#include <numerics/geometry3d/GbVoxelMatrix3D.h> -#include <numerics/geometry3d/creator/GbCuboid3DCreator.h> -#include <numerics/geometry3d/creator/GbCylinder3DCreator.h> -#include <numerics/geometry3d/creator/GbLine3DCreator.h> -#include <numerics/geometry3d/creator/GbObject3DCreator.h> -#include <numerics/geometry3d/creator/GbObject3DFactory.h> -#include <numerics/geometry3d/creator/GbPoint3DCreator.h> -#include <numerics/geometry3d/creator/GbPolygon3DCreator.h> -#include <numerics/geometry3d/creator/GbQuadFaceMesh3DCreator.h> -#include <numerics/geometry3d/creator/GbSphere3DCreator.h> -#include <numerics/geometry3d/creator/GbTriangle3DCreator.h> -#include <numerics/geometry3d/creator/GbTriangularMesh3DCreator.h> -#include <numerics/geometry3d/creator/GbTriFaceMesh3DCreator.h> -#include <numerics/geometry3d/creator/GbVoxelMatrix3DCreator.h> -// #include <numerics/geometry3d/examples/stl2inp/QDefineUniformMesh.h> -// #include <numerics/geometry3d/examples/stl2inp/stl2inp.h> -// #include <numerics/geometry3d/fem/FeAdhocTriFaceMesh3D.h> -// #include <numerics/geometry3d/fem/FeHalfDisc3D.h> -// #include <numerics/geometry3d/fem/FePlateTriangularMesh3D.h> -// #include <numerics/geometry3d/fem/FePoint3D.h> -// #include <numerics/geometry3d/fem/FeRing3D.h> -// #include <numerics/geometry3d/fem/FeTriFaceMesh3D.h> -// #include <numerics/geometry3d/fem/creator/FeTriFaceMesh3DCreator.h> -#include <numerics/geometry3d/KdTree/KdNode.h> -#include <numerics/geometry3d/KdTree/KdRay.h> -#include <numerics/geometry3d/KdTree/KdSplitCandidate.h> -#include <numerics/geometry3d/KdTree/KdSplitCandidateManager.h> -#include <numerics/geometry3d/KdTree/KdTree.h> -#include <numerics/geometry3d/KdTree/KdUtilities.h> -#include <numerics/geometry3d/KdTree/intersectionhandler/KdCountLineIntersectionHandler.h> -#include <numerics/geometry3d/KdTree/intersectionhandler/KdCountRayIntersectionHandler.h> -#include <numerics/geometry3d/KdTree/intersectionhandler/KdLineIntersectionHandler.h> -#include <numerics/geometry3d/KdTree/intersectionhandler/KdRayIntersectionHandler.h> -#include <numerics/geometry3d/KdTree/splitalgorithms/KdSAHSplit.h> -#include <numerics/geometry3d/KdTree/splitalgorithms/KdSpatiallMedianSplit.h> -#include <numerics/geometry3d/KdTree/splitalgorithms/KdSplitAlgorithm.h> -// #include <numerics/geometry3d/presentation/QGbCuboid3DInstrument.h> -// #include <numerics/geometry3d/presentation/QGbCylinder3DInstrument.h> -// #include <numerics/geometry3d/presentation/QGbObject3DInstrument.h> -// #include <numerics/geometry3d/presentation/QGbSphere3DInstrument.h> -// #include <numerics/geometry3d/presentation/QVTKGbObject3DViewer.h> -// #include <numerics/geometry3d/presentation/vtkGbCuboid3D.h> -// #include <numerics/geometry3d/presentation/vtkGbCylinder3D.h> -// #include <numerics/geometry3d/presentation/vtkGbSphere3D.h> -// #include <numerics/geometry3d/presentation/vtkGbTriangularMesh3D.h> - -#include <Parallel/Communicator.h> -#include <Parallel/LoadBalancer.h> -#include <Parallel/MetisPartitioner.h> -#include <Parallel/MPICommunicator.h> -#include <Parallel/NullCommunicator.h> -#include <Parallel/PriorityQueueDecompositor.h> -#include <Parallel/SimpleGeometricPartitioner.h> -#include <Parallel/Synchronizer.h> -#include <Parallel/ZoltanPartitioner.h> -#include <Parallel/BlocksDistributor.h> -#include <ZoltanPartitioningGridVisitor.h> -#include <Utilities/MathUtil.hpp> -#include <Utilities/MemoryUtil.h> -#include <Utilities/StringUtil.hpp> -#include <Utilities/ConfigurationFile.hpp> -#include <Utilities/VoxelMatrixUtil.hpp> -#include <Utilities/ChangeRandomQs.hpp> -#include <Utilities/ConfigFileReader.h> -#include <Visitors/Block3DVisitor.h> -#include <Visitors/CreateTransmittersHelper.h> -#include <Visitors/InitDistributionsBlockVisitor.h> -#include <Visitors/SetConnectorsBlockVisitor.h> -#include <Visitors/SetUndefinedNodesBlockVisitor.h> -#include <Visitors/GenBlocksGridVisitor.h> -#include <Visitors/Grid3DVisitor.h> -#include <Visitors/MetisPartitioningGridVisitor.h> -#include <Visitors/OverlapBlockVisitor.h> -#include <Visitors/PQueuePartitioningGridVisitor.h> -#include <Visitors/RatioBlockVisitor.h> -#include <Visitors/RatioSmoothBlockVisitor.h> -#include <Visitors/RefineCrossAndInsideGbObjectBlockVisitor.h> -#include <Visitors/RefineInterGbObjectsVisitor.h> -#include <Visitors/CoarsenCrossAndInsideGbObjectBlockVisitor.h> -#include <Visitors/SetInterpolationDirsBlockVisitor.h> -#include <Visitors/SetKernelBlockVisitor.h> -#include <Visitors/SetForcingBlockVisitor.h> -#include <Visitors/SetSpongeLayerBlockVisitor.h> -#include <Visitors/SetSolidBlockVisitor.h> -#include <Visitors/RenumberBlockVisitor.h> -#include <Visitors/ConnectorBlockVisitor.h> -#include <Visitors/ViscosityBlockVisitor.h> -#include <Visitors/BoundaryConditionsBlockVisitor.h> -#include <Visitors/BoundaryConditionsBlockVisitor.h> -#include <Visitors/ChangeBoundaryDensityBlockVisitor.h> -#include <InitDistributionsFromFileBlockVisitor.h> -#include <InitDistributionsWithInterpolationGridVisitor.h> -#include <CheckRatioBlockVisitor.h> -#include <SpongeLayerBlockVisitor.h> - -#include <Visitors/RefineCrossAndInsideGbObjectHelper.h> -#include <RefineAroundGbObjectHelper.h> - -#if defined VF_FETOL - #include <FETOL/FETOLCalculator.h> - #include <FETOL/FETOLCommunicator.h> - #include <FETOL/FETOLSetConnectorsBlockVisitor.h> - #include <FETOL/FETOLTransmitterBondPool.h> -#endif - diff --git a/src/VirtualFluids/Visitors/Block3DVisitor.h b/src/VirtualFluids/Visitors/Block3DVisitor.h deleted file mode 100644 index 94a3c1b29..000000000 --- a/src/VirtualFluids/Visitors/Block3DVisitor.h +++ /dev/null @@ -1,59 +0,0 @@ -#ifndef Block3DVisitor_h -#define Block3DVisitor_h - -#include <memory> - -class Block3DVisitor; -typedef std::shared_ptr<Block3DVisitor> Block3DVisitorPtr; - -class Block3D; -class Grid3D; - -class Block3DVisitor -{ -public: - Block3DVisitor() : startLevel(-1), stopLevel(-1) - { - } - - Block3DVisitor(int startLevel, int stopLevel) : startLevel(startLevel), stopLevel(stopLevel) - { - } - - virtual ~Block3DVisitor() - { - } - - virtual void visit(std::shared_ptr<Grid3D> grid, std::shared_ptr<Block3D> block) = 0; - - int getStartLevel() const; - int getStopLevel() const; - void setStartLevel(int level); - void setStopLevel(int level); - -private: - int startLevel; - int stopLevel; -}; -////////////////////////////////////////////////////////////////////////// -inline int Block3DVisitor::getStartLevel() const -{ - return this->startLevel; -} -////////////////////////////////////////////////////////////////////////// -inline int Block3DVisitor::getStopLevel() const -{ - return this->stopLevel; -} -////////////////////////////////////////////////////////////////////////// -inline void Block3DVisitor::setStartLevel(int level) -{ - this->startLevel = level; -} -////////////////////////////////////////////////////////////////////////// -inline void Block3DVisitor::setStopLevel(int level) -{ - this->stopLevel = level; -} - -#endif diff --git a/src/VirtualFluids/Visitors/BoundaryConditionsBlockVisitor.cpp b/src/VirtualFluids/Visitors/BoundaryConditionsBlockVisitor.cpp deleted file mode 100644 index 82e09a37d..000000000 --- a/src/VirtualFluids/Visitors/BoundaryConditionsBlockVisitor.cpp +++ /dev/null @@ -1,98 +0,0 @@ -#include "BoundaryConditionsBlockVisitor.h" -#include "LBMKernel.h" -#include "BCProcessor.h" -#include "Grid3DSystem.h" -#include "D3Q27EsoTwist3DSplittedVector.h" -#include "ThinWallNoSlipBCAlgorithm.h" -#include "DataSet3D.h" -#include "Grid3D.h" -#include "BCAdapter.h" -#include "Block3D.h" -#include "BCArray3D.h" - -BoundaryConditionsBlockVisitor::BoundaryConditionsBlockVisitor() : -Block3DVisitor(0, Grid3DSystem::MAXLEVEL) -{ - -} -////////////////////////////////////////////////////////////////////////// -BoundaryConditionsBlockVisitor::~BoundaryConditionsBlockVisitor() -{ - -} -////////////////////////////////////////////////////////////////////////// -void BoundaryConditionsBlockVisitor::visit(Grid3DPtr grid, Block3DPtr block) -{ - if (block->getRank() == grid->getRank()) - { - ILBMKernelPtr kernel = block->getKernel(); - - if (!kernel) - { - throw UbException(UB_EXARGS, "LBMKernel in " + block->toString() + "is not exist!"); - } - - BCProcessorPtr bcProcessor = kernel->getBCProcessor(); - - if (!bcProcessor) - { - throw UbException(UB_EXARGS,"Boundary Conditions Processor is not exist!" ); - } - - BCArray3DPtr bcArray = bcProcessor->getBCArray(); - - bool compressible = kernel->getCompressible(); - double collFactor = kernel->getCollisionFactor(); - int level = block->getLevel(); - - int minX1 = 0; - int minX2 = 0; - int minX3 = 0; - int maxX1 = (int)bcArray->getNX1(); - int maxX2 = (int)bcArray->getNX2(); - int maxX3 = (int)bcArray->getNX3(); - BoundaryConditionsPtr bcPtr; - - bcProcessor->clearBC(); - - DistributionArray3DPtr distributions = kernel->getDataSet()->getFdistributions(); - - for (int x3 = minX3; x3 < maxX3; x3++) - { - for (int x2 = minX2; x2 < maxX2; x2++) - { - for (int x1 = minX1; x1 < maxX1; x1++) - { - if (!bcArray->isSolid(x1, x2, x3) && !bcArray->isUndefined(x1, x2, x3)) - { - if ((bcPtr = bcArray->getBC(x1, x2, x3)) != NULL) - { - char alg = bcPtr->getBcAlgorithmType(); - BCAlgorithmPtr bca = bcMap[alg]; - - if (bca) - { - bca = bca->clone(); - bca->setNodeIndex(x1, x2, x3); - bca->setBcPointer(bcPtr); - bca->addDistributions(distributions); - bca->setCollFactor(collFactor); - bca->setCompressible(compressible); - bca->setBcArray(bcArray); - bcProcessor->addBC(bca); - } - } - } - } - } - } - } -} -////////////////////////////////////////////////////////////////////////// -void BoundaryConditionsBlockVisitor::addBC(BCAdapterPtr bc) -{ - bcMap.insert(std::make_pair(bc->getBcAlgorithmType(), bc->getAlgorithm())); -} - - - diff --git a/src/VirtualFluids/Visitors/BoundaryConditionsBlockVisitor.h b/src/VirtualFluids/Visitors/BoundaryConditionsBlockVisitor.h deleted file mode 100644 index e3b55866a..000000000 --- a/src/VirtualFluids/Visitors/BoundaryConditionsBlockVisitor.h +++ /dev/null @@ -1,27 +0,0 @@ -#ifndef BoundaryConditionBlockVisitor_h__ -#define BoundaryConditionBlockVisitor_h__ - -#include <map> -#include <memory> - -#include "Block3DVisitor.h" - - -class Grid3D; -class Block3D; -class BCAlgorithm; -class BCAdapter; - -class BoundaryConditionsBlockVisitor : public Block3DVisitor -{ -public: - BoundaryConditionsBlockVisitor(); - virtual ~BoundaryConditionsBlockVisitor(); - - void visit(std::shared_ptr<Grid3D> grid, std::shared_ptr<Block3D> block) override; - void addBC(std::shared_ptr<BCAdapter> bc); -protected: -private: - std::map<char, std::shared_ptr<BCAlgorithm> > bcMap; -}; -#endif // BoundaryConditionBlockVisitor_h__ diff --git a/src/VirtualFluids/Visitors/CMakePackage.txt b/src/VirtualFluids/Visitors/CMakePackage.txt deleted file mode 100644 index 1b8416f01..000000000 --- a/src/VirtualFluids/Visitors/CMakePackage.txt +++ /dev/null @@ -1,2 +0,0 @@ -GET_FILENAME_COMPONENT( CURRENT_DIR ${CMAKE_CURRENT_LIST_FILE} PATH) -COLLECT_PACKAGE_DATA_WITH_OPTION(${CURRENT_DIR} ALL_SOURCES) diff --git a/src/VirtualFluids/Visitors/ChangeBoundaryDensityBlockVisitor.cpp b/src/VirtualFluids/Visitors/ChangeBoundaryDensityBlockVisitor.cpp deleted file mode 100644 index 770364d98..000000000 --- a/src/VirtualFluids/Visitors/ChangeBoundaryDensityBlockVisitor.cpp +++ /dev/null @@ -1,62 +0,0 @@ -#include "ChangeBoundaryDensityBlockVisitor.h" -#include "LBMKernel.h" -#include "Grid3DSystem.h" -#include "BoundaryConditions.h" -#include "BCProcessor.h" -#include "Grid3D.h" -#include "Block3D.h" -#include "BCArray3D.h" - -ChangeBoundaryDensityBlockVisitor::ChangeBoundaryDensityBlockVisitor(float oldBoundaryDensity, float newBoundaryDensity) : -Block3DVisitor(0, Grid3DSystem::MAXLEVEL), -oldBoundaryDensity(oldBoundaryDensity), -newBoundaryDensity(newBoundaryDensity) -{ - -} -////////////////////////////////////////////////////////////////////////// -ChangeBoundaryDensityBlockVisitor::~ChangeBoundaryDensityBlockVisitor() -{ - -} -////////////////////////////////////////////////////////////////////////// -void ChangeBoundaryDensityBlockVisitor::visit(Grid3DPtr grid, Block3DPtr block) -{ - if (block->getRank() == grid->getRank()) - { - ILBMKernelPtr kernel = block->getKernel(); - BCArray3DPtr bcArray = kernel->getBCProcessor()->getBCArray(); - - int minX1 = 0; - int minX2 = 0; - int minX3 = 0; - int maxX1 = (int)bcArray->getNX1(); - int maxX2 = (int)bcArray->getNX2(); - int maxX3 = (int)bcArray->getNX3(); - - for (int x3 = minX3; x3 < maxX3; x3++) - { - for (int x2 = minX2; x2 < maxX2; x2++) - { - for (int x1 = minX1; x1 < maxX1; x1++) - { - if (!bcArray->isSolid(x1, x2, x3) && !bcArray->isUndefined(x1, x2, x3)) - { - bcPtr = bcArray->getBC(x1, x2, x3); - if (bcPtr) - { - if (bcPtr->hasDensityBoundary()) - { - float bcDensity = bcPtr->getBoundaryDensity(); - if (bcDensity == oldBoundaryDensity) - { - bcPtr->setBoundaryDensity(newBoundaryDensity); - } - } - } - } - } - } - } - } -} diff --git a/src/VirtualFluids/Visitors/ChangeBoundaryDensityBlockVisitor.h b/src/VirtualFluids/Visitors/ChangeBoundaryDensityBlockVisitor.h deleted file mode 100644 index 5b0bc5fb1..000000000 --- a/src/VirtualFluids/Visitors/ChangeBoundaryDensityBlockVisitor.h +++ /dev/null @@ -1,24 +0,0 @@ -#ifndef ChangeBoundaryDensityBlockVisitor_h__ -#define ChangeBoundaryDensityBlockVisitor_h__ - -#include <memory> - -#include "Block3DVisitor.h" - -class Block3D; -class Grid3D; -class BoundaryConditions; - -class ChangeBoundaryDensityBlockVisitor : public Block3DVisitor -{ -public: - ChangeBoundaryDensityBlockVisitor(float oldBoundaryDensity, float newBoundaryDensity); - virtual ~ChangeBoundaryDensityBlockVisitor(); - - void visit(std::shared_ptr<Grid3D> grid, std::shared_ptr<Block3D> block) override; -private: - float oldBoundaryDensity; - float newBoundaryDensity; - std::shared_ptr<BoundaryConditions> bcPtr; -}; -#endif // ChangeBoundaryDensityBlockVisitor_h__ diff --git a/src/VirtualFluids/Visitors/CheckRatioBlockVisitor.cpp b/src/VirtualFluids/Visitors/CheckRatioBlockVisitor.cpp deleted file mode 100644 index bcc028022..000000000 --- a/src/VirtualFluids/Visitors/CheckRatioBlockVisitor.cpp +++ /dev/null @@ -1,75 +0,0 @@ -#include "CheckRatioBlockVisitor.h" -#include "Grid3DSystem.h" -#include "Block3D.h" -#include "Grid3D.h" - -CheckRatioBlockVisitor::CheckRatioBlockVisitor(int levelDepth/*shut be maxGridLevel*/, bool includeNotActiveBlocks) - : Block3DVisitor(0, Grid3DSystem::MAXLEVEL) - , levelDepth(levelDepth) - , includeNotActiveBlocks(includeNotActiveBlocks) - , state(true) -{ -} -////////////////////////////////////////////////////////////////////////// -void CheckRatioBlockVisitor::visit(Grid3DPtr grid, Block3DPtr block) -{ - int ix1, ix2, ix3, level; - ix1 = block->getX1(); - ix2 = block->getX2(); - ix3 = block->getX3(); - level = block->getLevel(); - - int nix1, nix2, nix3, nlev; - int neighix1, neighix2, neighix3, neighlev; - std::vector<Block3DPtr> neighbors; - grid->getAllNeighbors(ix1, ix2, ix3, level, this->levelDepth, neighbors); - bool hasAdded = false; - for (size_t i = 0; i<neighbors.size(); i++) - { - if ((neighbors[i]->isActive()||includeNotActiveBlocks) - &&neighbors[i]->getLevel()>level) - { - neighix1 = neighbors[i]->getX1(); - neighix2 = neighbors[i]->getX2(); - neighix3 = neighbors[i]->getX3(); - neighlev = neighbors[i]->getLevel(); - nix1 = neighix1>>1; - nix2 = neighix2>>1; - nix3 = neighix3>>1; - nlev = neighlev-1; - - if (nlev!=level) - { - //throw UbException(UB_EXARGS, "OverlapBlockVisitor::adaptBlock - leveldifferenz passt nicht, block: "+block->toString()); - //grid->expandBlock(ix1, ix2, ix3, level); - state = state&&false; - falseBlock = block; - - } - else - { - state = state&&true; - } - - //UBLOG(logINFO, "OverlapBlockVisitor::state= "<<state); - - - } - } -} -////////////////////////////////////////////////////////////////////////// -bool CheckRatioBlockVisitor::getState() -{ - return state; -} -////////////////////////////////////////////////////////////////////////// -void CheckRatioBlockVisitor::resetState() -{ - state = true; -} -////////////////////////////////////////////////////////////////////////// -std::string CheckRatioBlockVisitor::getStateString() -{ - return falseBlock->toString(); -} -////////////////////////////////////////////////////////////////////////// diff --git a/src/VirtualFluids/Visitors/CheckRatioBlockVisitor.h b/src/VirtualFluids/Visitors/CheckRatioBlockVisitor.h deleted file mode 100644 index 2113a80f4..000000000 --- a/src/VirtualFluids/Visitors/CheckRatioBlockVisitor.h +++ /dev/null @@ -1,33 +0,0 @@ -#ifndef CheckRatioBlockVisitor_H -#define CheckRatioBlockVisitor_H - -#include <string> -#include <memory> - -#include "Block3DVisitor.h" - -class Grid3D; -class Block3D; - -class CheckRatioBlockVisitor : public Block3DVisitor -{ -public: - CheckRatioBlockVisitor(int levelDepth, bool includeNotActiveBlocks = true); - - virtual ~CheckRatioBlockVisitor() {} - - bool getState(); - void resetState(); - std::string getStateString(); - - void visit(std::shared_ptr<Grid3D> grid, std::shared_ptr<Block3D> block) override; - -private: - int levelDepth; - bool includeNotActiveBlocks; - bool state; - std::shared_ptr<Block3D> falseBlock; -}; - -#endif //OverlapBlockVisitor_H - diff --git a/src/VirtualFluids/Visitors/CoarsenCrossAndInsideGbObjectBlockVisitor.cpp b/src/VirtualFluids/Visitors/CoarsenCrossAndInsideGbObjectBlockVisitor.cpp deleted file mode 100644 index 01306cedb..000000000 --- a/src/VirtualFluids/Visitors/CoarsenCrossAndInsideGbObjectBlockVisitor.cpp +++ /dev/null @@ -1,41 +0,0 @@ -#include "CoarsenCrossAndInsideGbObjectBlockVisitor.h" -#include "Block3D.h" -#include "Grid3D.h" -#include <numerics/geometry3d/GbObject3D.h> - -CoarsenCrossAndInsideGbObjectBlockVisitor::CoarsenCrossAndInsideGbObjectBlockVisitor() - : Block3DVisitor(), notActive(true) -{ -} -////////////////////////////////////////////////////////////////////////// -CoarsenCrossAndInsideGbObjectBlockVisitor::CoarsenCrossAndInsideGbObjectBlockVisitor(GbObject3DPtr geoObject, int fineLevel, int coarseLevel) - : Block3DVisitor(fineLevel, fineLevel), geoObject(geoObject), notActive(true), coarseLevel(coarseLevel) -{ - -} -////////////////////////////////////////////////////////////////////////// -CoarsenCrossAndInsideGbObjectBlockVisitor::~CoarsenCrossAndInsideGbObjectBlockVisitor() -{ -} -////////////////////////////////////////////////////////////////////////// -void CoarsenCrossAndInsideGbObjectBlockVisitor::visit(const Grid3DPtr grid, Block3DPtr block) -{ - int fineLevel = block->getLevel(); - if (notActive && block->isNotActive()) return; - if (fineLevel>this->getStopLevel()) return; - - UbTupleDouble3 coords = grid->getBlockWorldCoordinates(block); - UbTupleDouble3 deltas = grid->getBlockLengths(block); - if (geoObject->isCellInsideOrCuttingGbObject3D(val<1>(coords) - , val<2>(coords) - , val<3>(coords) - , val<1>(coords)+val<1>(deltas) - , val<2>(coords)+val<2>(deltas) - , val<3>(coords)+val<3>(deltas))) - { - grid->collapseBlock(block->getX1(), block->getX2(), block->getX3(), fineLevel, coarseLevel); - } - - return; -} -////////////////////////////////////////////////////////////////////////// diff --git a/src/VirtualFluids/Visitors/CoarsenCrossAndInsideGbObjectBlockVisitor.h b/src/VirtualFluids/Visitors/CoarsenCrossAndInsideGbObjectBlockVisitor.h deleted file mode 100644 index 5909fa020..000000000 --- a/src/VirtualFluids/Visitors/CoarsenCrossAndInsideGbObjectBlockVisitor.h +++ /dev/null @@ -1,33 +0,0 @@ -#ifndef CoarsenCrossAndInsideGbObjectBlockVisitor_H -#define CoarsenCrossAndInsideGbObjectBlockVisitor_H - -#include <memory> - -#include "Block3DVisitor.h" - -class GbObject3D; -class Block3D; -class Grid3D; - -//! \brief Refine blocks on base of bounding box which is defined with <i>geoObject</i> -//! \details The class uses a geometry object for define a bounding box. Inside and across this bounding box will be grid on block basis refinement. -//! \author K. Kutscher -class CoarsenCrossAndInsideGbObjectBlockVisitor : public Block3DVisitor -{ -public: - //! A default constructor - CoarsenCrossAndInsideGbObjectBlockVisitor(); - //! A constructor - //! \param geoObject a smart pointer to bounding box - //! \param refineLevel an integer for refine on this level - CoarsenCrossAndInsideGbObjectBlockVisitor(std::shared_ptr<GbObject3D> geoObject, int fineLevel, int coarseLevel); - virtual ~CoarsenCrossAndInsideGbObjectBlockVisitor(); - void visit(std::shared_ptr<Grid3D> grid, std::shared_ptr<Block3D> block) override; - ////////////////////////////////////////////////////////////////////////// -protected: - std::shared_ptr<GbObject3D> geoObject; - bool notActive; - int coarseLevel; -}; - -#endif diff --git a/src/VirtualFluids/Visitors/ConnectorBlockVisitor.cpp b/src/VirtualFluids/Visitors/ConnectorBlockVisitor.cpp deleted file mode 100644 index 3d7199eca..000000000 --- a/src/VirtualFluids/Visitors/ConnectorBlockVisitor.cpp +++ /dev/null @@ -1,472 +0,0 @@ -#include "ConnectorBlockVisitor.h" -#include "Grid3DSystem.h" -#include "ConnectorFactory.h" -#include "InterpolationProcessor.h" -#include "Communicator.h" -#include "Grid3D.h" - -ConnectorBlockVisitor::ConnectorBlockVisitor(CommunicatorPtr comm, LBMReal nu, InterpolationProcessorPtr iProcessor, ConnectorFactoryPtr cFactory) : - Block3DVisitor(0, Grid3DSystem::MAXLEVEL), - comm(comm), - nu(nu), - iProcessor(iProcessor), - cFactory(cFactory) -{ -} -////////////////////////////////////////////////////////////////////////// -ConnectorBlockVisitor::~ConnectorBlockVisitor(void) -{ -} -////////////////////////////////////////////////////////////////////////// -void ConnectorBlockVisitor::visit(Grid3DPtr grid, Block3DPtr block) -{ - if (!block) return; - - UBLOG(logDEBUG5, "ConnectorBlockVisitor::visit() - start"); - UBLOG(logDEBUG5, block->toString()); - - gridRank = comm->getProcessID(); - grid->setRank(gridRank); - - setSameLevelConnectors(grid, block); - - if (grid->getFinestInitializedLevel() > grid->getCoarsestInitializedLevel()) - setInterpolationConnectors(grid, block); - - if (block->getGlobalID()==2234) - { - UBLOG(logINFO, block->toString()); - } - - UBLOG(logDEBUG5, "ConnectorBlockVisitor::visit() - end"); -} -////////////////////////////////////////////////////////////////////////// -void ConnectorBlockVisitor::setSameLevelConnectors(Grid3DPtr grid, Block3DPtr block) -{ - if (block->getGlobalID()==2234) - { - UBLOG(logINFO, block->toString()); - } - UBLOG(logDEBUG5, "ConnectorBlockVisitor::setSameLevelConnectors() - start"); - int blockRank = block->getRank(); - if (gridRank == blockRank && block->isActive()) - { - block->clearWeight(); - std::vector<Block3DPtr> 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++) - { - Block3DPtr neighBlock = grid->getNeighborBlock(dir, ix1, ix2, ix3, level); - - if (neighBlock) - { - int neighBlockRank = neighBlock->getRank(); - if (blockRank == neighBlockRank && neighBlock->isActive()) - { - Block3DConnectorPtr connector; - connector = cFactory->createSameLevelDirectConnector(block, neighBlock, dir); - block->setConnector(connector); - } - else if (blockRank != neighBlockRank && neighBlock->isActive()) - { - setRemoteConnectors(block, neighBlock, dir); - } - } - } - } - UBLOG(logDEBUG5, "ConnectorBlockVisitor::setSameLevelConnectors() - end"); - if (block->getGlobalID()==2234) - { - UBLOG(logINFO, block->toString()); - } -} -////////////////////////////////////////////////////////////////////////// -void ConnectorBlockVisitor::setRemoteConnectors(Block3DPtr sblock, Block3DPtr tblock, int dir) -{ - UBLOG(logDEBUG5, "ConnectorBlockVisitor::setRemoteConnectors() - start"); - CreateTransmittersHelper helper; - CreateTransmittersHelper::TransmitterPtr sender, receiver; - helper.createTransmitters(sblock, tblock, dir, CreateTransmittersHelper::NONE, sender, receiver, comm, CreateTransmittersHelper::MPI); - - - Block3DConnectorPtr connector; - connector = cFactory->createSameLevelVectorConnector(sblock, sender, receiver, dir); - sblock->setConnector(connector); - UBLOG(logDEBUG5, "ConnectorBlockVisitor::setRemoteConnectors() - end"); -} -////////////////////////////////////////////////////////////////////////// -void ConnectorBlockVisitor::setInterpolationConnectors(Grid3DPtr grid, Block3DPtr block) -{ - if (block->getGlobalID()==2234) - { - UBLOG(logINFO, block->toString()); - } - UBLOG(logDEBUG5, "ConnectorBlockVisitor::setInterpolationConnectors() - start"); - int blockRank = block->getRank(); - - //search for all blocks with different ranks - if (block->hasInterpolationFlagCF() && block->isActive()) - { - int fbx1 = block->getX1() << 1; - int fbx2 = block->getX2() << 1; - int fbx3 = block->getX3() << 1; - int level = block->getLevel() + 1; - - if (block->hasInterpolationFlagCF(D3Q27System::E)) - { - Block3DPtr fblock00 = grid->getBlock(fbx1+1, fbx2, fbx3, level); - Block3DPtr fblock10 = grid->getBlock(fbx1+1, fbx2+1, fbx3, level); - Block3DPtr fblock01 = grid->getBlock(fbx1+1, fbx2, fbx3+1, level); - Block3DPtr fblock11 = grid->getBlock(fbx1+1, fbx2+1, fbx3+1, level); - - setInterpolationConnectors(fblock00, fblock10, fblock01, fblock11, block, D3Q27System::E); - } - if (block->hasInterpolationFlagCF(D3Q27System::W)) - { - Block3DPtr fblock00 = grid->getBlock(fbx1, fbx2, fbx3, level); - Block3DPtr fblock10 = grid->getBlock(fbx1, fbx2+1, fbx3, level); - Block3DPtr fblock01 = grid->getBlock(fbx1, fbx2, fbx3+1, level); - Block3DPtr fblock11 = grid->getBlock(fbx1, fbx2+1, fbx3+1, level); - - setInterpolationConnectors(fblock00, fblock10, fblock01, fblock11, block, D3Q27System::W); - } - if (block->hasInterpolationFlagCF(D3Q27System::N)) - { - Block3DPtr fblock00 = grid->getBlock(fbx1, fbx2+1, fbx3, level); - Block3DPtr fblock10 = grid->getBlock(fbx1+1, fbx2+1, fbx3, level); - Block3DPtr fblock01 = grid->getBlock(fbx1, fbx2+1, fbx3+1, level); - Block3DPtr fblock11 = grid->getBlock(fbx1+1, fbx2+1, fbx3+1, level); - - setInterpolationConnectors(fblock00, fblock10, fblock01, fblock11, block, D3Q27System::N); - } - if (block->hasInterpolationFlagCF(D3Q27System::S)) - { - Block3DPtr fblock00 = grid->getBlock(fbx1, fbx2, fbx3, level); - Block3DPtr fblock10 = grid->getBlock(fbx1+1, fbx2, fbx3, level); - Block3DPtr fblock01 = grid->getBlock(fbx1, fbx2, fbx3+1, level); - Block3DPtr fblock11 = grid->getBlock(fbx1+1, fbx2, fbx3+1, level); - - setInterpolationConnectors(fblock00, fblock10, fblock01, fblock11, block, D3Q27System::S); - } - if (block->hasInterpolationFlagCF(D3Q27System::T)) - { - Block3DPtr fblock00 = grid->getBlock(fbx1, fbx2, fbx3+1, level); - Block3DPtr fblock10 = grid->getBlock(fbx1+1, fbx2, fbx3+1, level); - Block3DPtr fblock01 = grid->getBlock(fbx1, fbx2+1, fbx3+1, level); - Block3DPtr fblock11 = grid->getBlock(fbx1+1, fbx2+1, fbx3+1, level); - - setInterpolationConnectors(fblock00, fblock10, fblock01, fblock11, block, D3Q27System::T); - } - if (block->hasInterpolationFlagCF(D3Q27System::B)) - { - Block3DPtr fblock00 = grid->getBlock(fbx1, fbx2, fbx3, level); - Block3DPtr fblock10 = grid->getBlock(fbx1+1, fbx2, fbx3, level); - Block3DPtr fblock01 = grid->getBlock(fbx1, fbx2+1, fbx3, level); - Block3DPtr fblock11 = grid->getBlock(fbx1+1, fbx2+1, fbx3, level); - - setInterpolationConnectors(fblock00, fblock10, fblock01, fblock11, block, D3Q27System::B); - } - - //////NE-NW-SE-SW - if (block->hasInterpolationFlagCF(D3Q27System::NE)&&!block->hasInterpolationFlagCF(D3Q27System::N) && !block->hasInterpolationFlagCF(D3Q27System::E)) - { - Block3DPtr fblock00 = grid->getBlock(fbx1+1, fbx2+1, fbx3+0, level); - Block3DPtr fblock10 = grid->getBlock(fbx1+1, fbx2+1, fbx3+1, level); - Block3DPtr fblock01; - Block3DPtr fblock11; - - setInterpolationConnectors(fblock00, fblock10, fblock01, fblock11, block, D3Q27System::NE); - } - if (block->hasInterpolationFlagCF(D3Q27System::SW)&& !block->hasInterpolationFlagCF(D3Q27System::W) && !block->hasInterpolationFlagCF(D3Q27System::S)) - { - Block3DPtr fblock00 = grid->getBlock(fbx1, fbx2, fbx3, level); - Block3DPtr fblock10 = grid->getBlock(fbx1, fbx2, fbx3+1, level); - Block3DPtr fblock01; - Block3DPtr fblock11; - - setInterpolationConnectors(fblock00, fblock10, fblock01, fblock11, block, D3Q27System::SW); - } - if (block->hasInterpolationFlagCF(D3Q27System::SE)&& !block->hasInterpolationFlagCF(D3Q27System::E) && !block->hasInterpolationFlagCF(D3Q27System::S)) - { - Block3DPtr fblock00 = grid->getBlock(fbx1+1, fbx2, fbx3+0, level); - Block3DPtr fblock10 = grid->getBlock(fbx1+1, fbx2, fbx3+1, level); - Block3DPtr fblock01; - Block3DPtr fblock11; - - setInterpolationConnectors(fblock00, fblock10, fblock01, fblock11, block, D3Q27System::SE); - } - if (block->hasInterpolationFlagCF(D3Q27System::NW)&& !block->hasInterpolationFlagCF(D3Q27System::N) && !block->hasInterpolationFlagCF(D3Q27System::W)) - { - Block3DPtr fblock00 = grid->getBlock(fbx1, fbx2+1, fbx3, level); - Block3DPtr fblock10 = grid->getBlock(fbx1, fbx2+1, fbx3+1, level); - Block3DPtr fblock01; - Block3DPtr fblock11; - - setInterpolationConnectors(fblock00, fblock10, fblock01, fblock11, block, D3Q27System::NW); - } - - /////////TE-BW-BE-TW 1-0 - if (block->hasInterpolationFlagCF(D3Q27System::TE)&& !block->hasInterpolationFlagCF(D3Q27System::E) && !block->hasInterpolationFlagCF(D3Q27System::T)) - { - Block3DPtr fblock00 = grid->getBlock(fbx1+1, fbx2+0, fbx3+1, level); - Block3DPtr fblock10 = grid->getBlock(fbx1+1, fbx2+1, fbx3+1, level); - Block3DPtr fblock01; - Block3DPtr fblock11; - - setInterpolationConnectors(fblock00, fblock10, fblock01, fblock11, block, D3Q27System::TE); - } - if (block->hasInterpolationFlagCF(D3Q27System::BW)&& !block->hasInterpolationFlagCF(D3Q27System::W) && !block->hasInterpolationFlagCF(D3Q27System::B)) - { - - Block3DPtr fblock00 = grid->getBlock(fbx1, fbx2+0, fbx3, level); - Block3DPtr fblock10 = grid->getBlock(fbx1, fbx2+1, fbx3, level); - Block3DPtr fblock01; - Block3DPtr fblock11; - - setInterpolationConnectors(fblock00, fblock10, fblock01, fblock11, block, D3Q27System::BW); - } - if (block->hasInterpolationFlagCF(D3Q27System::BE)&& !block->hasInterpolationFlagCF(D3Q27System::E) && !block->hasInterpolationFlagCF(D3Q27System::B)) - { - Block3DPtr fblock00 = grid->getBlock(fbx1+1, fbx2+0, fbx3, level); - Block3DPtr fblock10 = grid->getBlock(fbx1+1, fbx2+1, fbx3, level); - Block3DPtr fblock01; - Block3DPtr fblock11; - - setInterpolationConnectors(fblock00, fblock10, fblock01, fblock11, block, D3Q27System::BE); - } - if (block->hasInterpolationFlagCF(D3Q27System::TW)&& !block->hasInterpolationFlagCF(D3Q27System::W) && !block->hasInterpolationFlagCF(D3Q27System::T)) - { - Block3DPtr fblock00 = grid->getBlock(fbx1, fbx2+0, fbx3+1, level); - Block3DPtr fblock10 = grid->getBlock(fbx1, fbx2+1, fbx3+1, level); - Block3DPtr fblock01; - Block3DPtr fblock11; - - setInterpolationConnectors(fblock00, fblock10, fblock01, fblock11, block, D3Q27System::TW); - } - - //////TN-BS-BN-TS - if (block->hasInterpolationFlagCF(D3Q27System::TN)&& !block->hasInterpolationFlagCF(D3Q27System::N) && !block->hasInterpolationFlagCF(D3Q27System::T)) - { - Block3DPtr fblock00 = grid->getBlock(fbx1+0, fbx2+1, fbx3+1, level); - Block3DPtr fblock10 = grid->getBlock(fbx1+1, fbx2+1, fbx3+1, level); - Block3DPtr fblock01; - Block3DPtr fblock11; - - setInterpolationConnectors(fblock00, fblock10, fblock01, fblock11, block, D3Q27System::TN); - } - if (block->hasInterpolationFlagCF(D3Q27System::BS)&& !block->hasInterpolationFlagCF(D3Q27System::S) && !block->hasInterpolationFlagCF(D3Q27System::B)) - { - Block3DPtr fblock00 = grid->getBlock(fbx1+0, fbx2, fbx3, level); - Block3DPtr fblock10 = grid->getBlock(fbx1+1, fbx2, fbx3, level); - Block3DPtr fblock01; - Block3DPtr fblock11; - - setInterpolationConnectors(fblock00, fblock10, fblock01, fblock11, block, D3Q27System::BS); - } - if (block->hasInterpolationFlagCF(D3Q27System::BN)&& !block->hasInterpolationFlagCF(D3Q27System::N) && !block->hasInterpolationFlagCF(D3Q27System::B)) - { - Block3DPtr fblock00 = grid->getBlock(fbx1+0, fbx2+1, fbx3, level); - Block3DPtr fblock10 = grid->getBlock(fbx1+1, fbx2+1, fbx3, level); - Block3DPtr fblock01; - Block3DPtr fblock11; - - setInterpolationConnectors(fblock00, fblock10, fblock01, fblock11, block, D3Q27System::BN); - } - if (block->hasInterpolationFlagCF(D3Q27System::TS)&& !block->hasInterpolationFlagCF(D3Q27System::S) && !block->hasInterpolationFlagCF(D3Q27System::T)) - { - Block3DPtr fblock00 = grid->getBlock(fbx1+0, fbx2, fbx3+1, level); - Block3DPtr fblock10 = grid->getBlock(fbx1+1, fbx2, fbx3+1, level); - Block3DPtr fblock01; - Block3DPtr fblock11; - - setInterpolationConnectors(fblock00, fblock10, fblock01, fblock11, block, D3Q27System::TS); - } - - - - - //////corners - if (block->hasInterpolationFlagCF(D3Q27System::TNE)&&!block->hasInterpolationFlagCF(D3Q27System::TE)&&!block->hasInterpolationFlagCF(D3Q27System::TN)&&!block->hasInterpolationFlagCF(D3Q27System::NE)&&!block->hasInterpolationFlagCF(D3Q27System::T)&&!block->hasInterpolationFlagCF(D3Q27System::N) && !block->hasInterpolationFlagCF(D3Q27System::E)) - { - Block3DPtr fblock00 = grid->getBlock(fbx1+1, fbx2+1, fbx3+1, level); - Block3DPtr fblock10;// = grid->getBlock(fbx1+1, fbx2+1, fbx3+0, level); - Block3DPtr fblock01;// = grid->getBlock(fbx1+1, fbx2+1, fbx3+1, level); - Block3DPtr fblock11;// = grid->getBlock(fbx1+1, fbx2+1, fbx3+1, level); - - setInterpolationConnectors(fblock00, fblock10, fblock01, fblock11, block, D3Q27System::TNE); - } - if (block->hasInterpolationFlagCF(D3Q27System::TSW)&&!block->hasInterpolationFlagCF(D3Q27System::TW)&&!block->hasInterpolationFlagCF(D3Q27System::TS)&& !block->hasInterpolationFlagCF(D3Q27System::SW)&& !block->hasInterpolationFlagCF(D3Q27System::T)&& !block->hasInterpolationFlagCF(D3Q27System::W) && !block->hasInterpolationFlagCF(D3Q27System::S)) - { - Block3DPtr fblock00 = grid->getBlock(fbx1, fbx2, fbx3+1, level); - Block3DPtr fblock10;// = grid->getBlock(fbx1, fbx2, fbx3, level); - Block3DPtr fblock01;// = grid->getBlock(fbx1, fbx2, fbx3+1, level); - Block3DPtr fblock11;// = grid->getBlock(fbx1, fbx2, fbx3+1, level); - - setInterpolationConnectors(fblock00, fblock10, fblock01, fblock11, block, D3Q27System::TSW); - } - if (block->hasInterpolationFlagCF(D3Q27System::TSE)&&!block->hasInterpolationFlagCF(D3Q27System::TE)&&!block->hasInterpolationFlagCF(D3Q27System::TS)&& !block->hasInterpolationFlagCF(D3Q27System::SE)&& !block->hasInterpolationFlagCF(D3Q27System::T)&& !block->hasInterpolationFlagCF(D3Q27System::E) && !block->hasInterpolationFlagCF(D3Q27System::S)) - { - Block3DPtr fblock00 = grid->getBlock(fbx1+1, fbx2, fbx3+1, level); - Block3DPtr fblock10;// = grid->getBlock(fbx1+1, fbx2, fbx3+0, level); - Block3DPtr fblock01;// = grid->getBlock(fbx1+1, fbx2, fbx3+1, level); - Block3DPtr fblock11;// = grid->getBlock(fbx1+1, fbx2, fbx3+1, level); - - setInterpolationConnectors(fblock00, fblock10, fblock01, fblock11, block, D3Q27System::TSE); - } - if (block->hasInterpolationFlagCF(D3Q27System::TNW)&&!block->hasInterpolationFlagCF(D3Q27System::TW)&&!block->hasInterpolationFlagCF(D3Q27System::TN)&& !block->hasInterpolationFlagCF(D3Q27System::NW)&& !block->hasInterpolationFlagCF(D3Q27System::T)&& !block->hasInterpolationFlagCF(D3Q27System::N) && !block->hasInterpolationFlagCF(D3Q27System::W)) - { - Block3DPtr fblock00 = grid->getBlock(fbx1, fbx2+1, fbx3+1, level); - Block3DPtr fblock10;// = grid->getBlock(fbx1, fbx2+1, fbx3, level); - Block3DPtr fblock01;// = grid->getBlock(fbx1, fbx2+1, fbx3+1, level); - Block3DPtr fblock11;// = grid->getBlock(fbx1, fbx2+1, fbx3+1, level); - - setInterpolationConnectors(fblock00, fblock10, fblock01, fblock11, block, D3Q27System::TNW); - } - if (block->hasInterpolationFlagCF(D3Q27System::BNE)&&!block->hasInterpolationFlagCF(D3Q27System::BE)&&!block->hasInterpolationFlagCF(D3Q27System::BN)&& !block->hasInterpolationFlagCF(D3Q27System::NE)&&!block->hasInterpolationFlagCF(D3Q27System::B)&&!block->hasInterpolationFlagCF(D3Q27System::N) && !block->hasInterpolationFlagCF(D3Q27System::E)) - { - Block3DPtr fblock00 = grid->getBlock(fbx1+1, fbx2+1, fbx3+0, level); - Block3DPtr fblock10;// = grid->getBlock(fbx1+1, fbx2+1, fbx3+0, level); - Block3DPtr fblock01;// = grid->getBlock(fbx1+1, fbx2+1, fbx3+1, level); - Block3DPtr fblock11;// = grid->getBlock(fbx1+1, fbx2+1, fbx3+1, level); - - setInterpolationConnectors(fblock00, fblock10, fblock01, fblock11, block, D3Q27System::BNE); - } - if (block->hasInterpolationFlagCF(D3Q27System::BSW)&& !block->hasInterpolationFlagCF(D3Q27System::BS)&& !block->hasInterpolationFlagCF(D3Q27System::BW)&& !block->hasInterpolationFlagCF(D3Q27System::SW)&& !block->hasInterpolationFlagCF(D3Q27System::B)&& !block->hasInterpolationFlagCF(D3Q27System::W) && !block->hasInterpolationFlagCF(D3Q27System::S)) - { - Block3DPtr fblock00 = grid->getBlock(fbx1, fbx2, fbx3+0, level); - Block3DPtr fblock10;// = grid->getBlock(fbx1, fbx2, fbx3, level); - Block3DPtr fblock01;// = grid->getBlock(fbx1, fbx2, fbx3+1, level); - Block3DPtr fblock11;// = grid->getBlock(fbx1, fbx2, fbx3+1, level); - - setInterpolationConnectors(fblock00, fblock10, fblock01, fblock11, block, D3Q27System::BSW); - } - if (block->hasInterpolationFlagCF(D3Q27System::BSE)&& !block->hasInterpolationFlagCF(D3Q27System::BS)&& !block->hasInterpolationFlagCF(D3Q27System::BE)&& !block->hasInterpolationFlagCF(D3Q27System::SE)&& !block->hasInterpolationFlagCF(D3Q27System::B)&& !block->hasInterpolationFlagCF(D3Q27System::E) && !block->hasInterpolationFlagCF(D3Q27System::S)) - { - Block3DPtr fblock00 = grid->getBlock(fbx1+1, fbx2, fbx3, level); - Block3DPtr fblock10;// = grid->getBlock(fbx1+1, fbx2, fbx3+0, level); - Block3DPtr fblock01;// = grid->getBlock(fbx1+1, fbx2, fbx3+1, level); - Block3DPtr fblock11;// = grid->getBlock(fbx1+1, fbx2, fbx3+1, level); - - setInterpolationConnectors(fblock00, fblock10, fblock01, fblock11, block, D3Q27System::BSE); - } - if (block->hasInterpolationFlagCF(D3Q27System::BNW)&& !block->hasInterpolationFlagCF(D3Q27System::BN)&& !block->hasInterpolationFlagCF(D3Q27System::BW)&& !block->hasInterpolationFlagCF(D3Q27System::NW)&& !block->hasInterpolationFlagCF(D3Q27System::B)&& !block->hasInterpolationFlagCF(D3Q27System::N) && !block->hasInterpolationFlagCF(D3Q27System::W)) - { - Block3DPtr fblock00 = grid->getBlock(fbx1, fbx2+1, fbx3+0, level); - Block3DPtr fblock10;// = grid->getBlock(fbx1, fbx2+1, fbx3, level); - Block3DPtr fblock01;// = grid->getBlock(fbx1, fbx2+1, fbx3+1, level); - Block3DPtr fblock11;// = grid->getBlock(fbx1, fbx2+1, fbx3+1, level); - - setInterpolationConnectors(fblock00, fblock10, fblock01, fblock11, block, D3Q27System::BNW); - } - - } - UBLOG(logDEBUG5, "ConnectorBlockVisitor::setInterpolationConnectors() - end"); -} -////////////////////////////////////////////////////////////////////////// - -void ConnectorBlockVisitor::setInterpolationConnectors(Block3DPtr fblock00, Block3DPtr fblock10, Block3DPtr fblock01, Block3DPtr fblock11, Block3DPtr cBlock, int dir) -{ - UBLOG(logDEBUG5, "ConnectorBlockVisitor::setInterpolationConnectors(...) - start"); - int fblock00Rank = -999, fblock10Rank = -999, fblock01Rank = -999, fblock11Rank = -999; - if (fblock00) fblock00Rank = fblock00->getRank(); - if (fblock01) fblock01Rank = fblock01->getRank(); - if (fblock10) fblock10Rank = fblock10->getRank(); - if (fblock11) fblock11Rank = fblock11->getRank(); - int cBlockRank = cBlock->getRank(); - - LBMReal omegaF; - if (fblock00) omegaF = LBMSystem::calcCollisionFactor(nu, fblock00->getLevel()); - if (fblock01) omegaF = LBMSystem::calcCollisionFactor(nu, fblock01->getLevel()); - if (fblock10) omegaF = LBMSystem::calcCollisionFactor(nu, fblock10->getLevel()); - if (fblock11) omegaF = LBMSystem::calcCollisionFactor(nu, fblock11->getLevel()); - LBMReal omegaC = LBMSystem::calcCollisionFactor(nu, cBlock->getLevel()); - iProcessor->setOmegas(omegaC, omegaF); - - InterpolationProcessorPtr cIProcessor(iProcessor->clone()); - InterpolationProcessorPtr fIProcessor00(iProcessor->clone()); - InterpolationProcessorPtr fIProcessor10(iProcessor->clone()); - InterpolationProcessorPtr fIProcessor01(iProcessor->clone()); - InterpolationProcessorPtr fIProcessor11(iProcessor->clone()); - - CreateTransmittersHelper::TransmitterPtr senderCF00, receiverCF00, - senderCF01, receiverCF01, - senderCF10, receiverCF10, - senderCF11, receiverCF11, - senderFC00, receiverFC00, - senderFC01, receiverFC01, - senderFC10, receiverFC10, - senderFC11, receiverFC11; - - if (fblock00) createTransmitters(cBlock, fblock00, dir, CreateTransmittersHelper::SW, senderCF00, receiverCF00, senderFC00, receiverFC00); - if (fblock01) createTransmitters(cBlock, fblock01, dir, CreateTransmittersHelper::NW, senderCF01, receiverCF01, senderFC01, receiverFC01); - if (fblock10) createTransmitters(cBlock, fblock10, dir, CreateTransmittersHelper::SE, senderCF10, receiverCF10, senderFC10, receiverFC10); - if (fblock11) createTransmitters(cBlock, fblock11, dir, CreateTransmittersHelper::NE, senderCF11, receiverCF11, senderFC11, receiverFC11); - - if (cBlockRank == gridRank) - { - Block3DConnectorPtr connector = cFactory->createCoarseToFineConnector(cBlock, - senderCF00, receiverCF00, senderCF01, receiverCF01, - senderCF10, receiverCF10, senderCF11, receiverCF11, - dir, cIProcessor); - cBlock->setConnector(connector); - } - if (fblock00 && fblock00Rank == gridRank) - { - Block3DConnectorPtr connector = cFactory->createFineToCoarseConnector(fblock00, - senderFC00, receiverFC00, dir, fIProcessor00, FineToCoarseBlock3DConnector::Type00); - fblock00->setConnector(connector); - } - if (fblock01 && fblock01Rank == gridRank) - { - Block3DConnectorPtr connector = cFactory->createFineToCoarseConnector(fblock01, - senderFC01, receiverFC01, dir, fIProcessor01, FineToCoarseBlock3DConnector::Type01); - fblock01->setConnector(connector); - } - if (fblock10 && fblock10Rank == gridRank) - { - Block3DConnectorPtr connector = cFactory->createFineToCoarseConnector(fblock10, - senderFC10, receiverFC10, dir, fIProcessor10, FineToCoarseBlock3DConnector::Type10); - fblock10->setConnector(connector); - } - if (fblock11 && fblock11Rank == gridRank) - { - Block3DConnectorPtr connector = cFactory->createFineToCoarseConnector(fblock11, - senderFC11, receiverFC11, dir, fIProcessor11, FineToCoarseBlock3DConnector::Type11); - fblock11->setConnector(connector); - } - UBLOG(logDEBUG5, "ConnectorBlockVisitor::setInterpolationConnectors(...) - end"); -} -////////////////////////////////////////////////////////////////////////// -void ConnectorBlockVisitor::createTransmitters(Block3DPtr cBlock, Block3DPtr fBlock, int dir, - CreateTransmittersHelper::IBlock ib, - CreateTransmittersHelper::TransmitterPtr& senderCF, - CreateTransmittersHelper::TransmitterPtr& receiverCF, - CreateTransmittersHelper::TransmitterPtr& senderFC, - CreateTransmittersHelper::TransmitterPtr& receiverFC) -{ - UBLOG(logDEBUG5, "ConnectorBlockVisitor::createTransmitters(...) - start"); - CreateTransmittersHelper helper; - bool MPIpool = true; - bool orthogonal = false; - int fBlockRank = fBlock->getRank(); - int cBlockRank = cBlock->getRank(); - if (fBlockRank == cBlockRank && fBlockRank == gridRank) - { - senderCF = receiverFC = CreateTransmittersHelper::TransmitterPtr(new TbLocalTransmitter< CbVector< LBMReal > >()); - senderFC = receiverCF = CreateTransmittersHelper::TransmitterPtr(new TbLocalTransmitter< CbVector< LBMReal > >()); - } - else if (cBlockRank == gridRank) - { - helper.createTransmitters(cBlock, fBlock, dir, ib, senderCF, receiverCF, comm, CreateTransmittersHelper::MPI); - } - else if (fBlockRank == gridRank) - { - helper.createTransmitters(fBlock, cBlock, dir, ib, senderFC, receiverFC, comm, CreateTransmittersHelper::MPI); - } - UBLOG(logDEBUG5, "ConnectorBlockVisitor::createTransmitters(...) - end"); -} - diff --git a/src/VirtualFluids/Visitors/ConnectorBlockVisitor.h b/src/VirtualFluids/Visitors/ConnectorBlockVisitor.h deleted file mode 100644 index 6eaecf1eb..000000000 --- a/src/VirtualFluids/Visitors/ConnectorBlockVisitor.h +++ /dev/null @@ -1,41 +0,0 @@ -#ifndef ConnectorBlockVisitor_H -#define ConnectorBlockVisitor_H - -#include <memory> - -#include "Block3DVisitor.h" -#include "D3Q27System.h" -#include "CreateTransmittersHelper.h" - -class Grid3D; -class Block3D; -class InterpolationProcessor; -class ConnectorFactory; - -class ConnectorBlockVisitor : public Block3DVisitor -{ -public: - ConnectorBlockVisitor(CommunicatorPtr comm, LBMReal nu, std::shared_ptr<InterpolationProcessor> iProcessor, std::shared_ptr<ConnectorFactory> cFactory); - virtual ~ConnectorBlockVisitor(); - void visit(std::shared_ptr<Grid3D> grid, std::shared_ptr<Block3D> block) override; - ////////////////////////////////////////////////////////////////////////// -protected: - void setSameLevelConnectors(std::shared_ptr<Grid3D> grid, std::shared_ptr<Block3D> block); - void setRemoteConnectors(std::shared_ptr<Block3D> sblock, std::shared_ptr<Block3D> tblock, int dir); - void setInterpolationConnectors(std::shared_ptr<Grid3D> grid, std::shared_ptr<Block3D> block); - void setInterpolationConnectors(std::shared_ptr<Block3D> fBlockSW, std::shared_ptr<Block3D> fBlockSE, std::shared_ptr<Block3D> fBlockNW, std::shared_ptr<Block3D> fBlockNE, std::shared_ptr<Block3D> cBlock, int dir); - void createTransmitters(std::shared_ptr<Block3D> cBlock, std::shared_ptr<Block3D> fBlock, int dir, - CreateTransmittersHelper::IBlock ib, - CreateTransmittersHelper::TransmitterPtr& senderCF, - CreateTransmittersHelper::TransmitterPtr& receiverCF, - CreateTransmittersHelper::TransmitterPtr& senderFC, - CreateTransmittersHelper::TransmitterPtr& receiverFC); - CommunicatorPtr comm; - int gridRank; - LBMReal nu; - std::shared_ptr<InterpolationProcessor> iProcessor; - std::shared_ptr<ConnectorFactory> cFactory; -}; - -#endif //ConnectorBlockVisitor_H - diff --git a/src/VirtualFluids/Visitors/CreateTransmittersHelper.cpp b/src/VirtualFluids/Visitors/CreateTransmittersHelper.cpp deleted file mode 100644 index 878ca2ede..000000000 --- a/src/VirtualFluids/Visitors/CreateTransmittersHelper.cpp +++ /dev/null @@ -1,161 +0,0 @@ -#include "CreateTransmittersHelper.h" -#include <D3Q27System.h> -#include <Communicator.h> -#include <StringUtil.hpp> -#include <string> - -#ifdef VF_FETOL - #include <FETOLTransmitterBondPool.h> -#endif -#include <MathUtil.hpp> - -unsigned CreateTransmittersHelper::vKey = 0; - -using namespace std; - -////////////////////////////////////////////////////////////////////////// -CreateTransmittersHelper::CreateTransmittersHelper() -{ - -} -////////////////////////////////////////////////////////////////////////// -void CreateTransmittersHelper::createTransmitters(Block3DPtr sblock, Block3DPtr tblock, int dir, IBlock ib, - TransmitterPtr& sender, TransmitterPtr& receiver, CommunicatorPtr comm, TransmitterType tType) -{ - //SourceBlock - int srcLevel = sblock->getLevel(); - int srcID = sblock->getGlobalID(); - - //TargetBlock - int tgtLevel = tblock->getLevel(); - int tgtID = tblock->getGlobalID(); - - int invDir = D3Q27System::INVDIR[dir]; - - if( srcLevel != tgtLevel ) invDir = dir; - - int srcRank = 0; - int tgtRank = 0; - - if (tType == MPI) - { - srcRank = sblock->getRank(); - tgtRank = tblock->getRank(); - } -#ifdef VF_FETOL - else if (tType == MPI2BOND) - { - srcRank = sblock->getLocalRank(); - tgtRank = tblock->getLocalRank(); - } -#endif - - if (tType == MPI -#ifdef VF_FETOL - || tType == MPI2BOND -#endif - ) - { - string sendPoolKey = generatePoolKey(srcRank, srcLevel, tgtRank, tgtLevel); - string receivePoolKey = generatePoolKey(tgtRank, tgtLevel, srcRank, srcLevel); - - TbCbVectorMpiPool <LBMReal>::MpiPoolPtr sendPool = TbCbVectorMpiPool <LBMReal>::getTbCbVectorMpiPool(sendPoolKey ); - TbCbVectorMpiPool <LBMReal>::MpiPoolPtr recvPool = TbCbVectorMpiPool <LBMReal>::getTbCbVectorMpiPool(receivePoolKey); - - MPI_Comm mpi_comm = *((MPI_Comm*) comm->getNativeCommunicator()); - - if( !sendPool ) sendPool = TbCbVectorMpiPool <LBMReal>::createTbCbVectorMpiPool(sendPoolKey ,tgtRank, generateMPITag(srcLevel, tgtLevel), mpi_comm); - if( !recvPool ) recvPool = TbCbVectorMpiPool <LBMReal>::createTbCbVectorMpiPool(receivePoolKey,tgtRank, generateMPITag(tgtLevel, srcLevel), mpi_comm); - - TbCbVectorMpiPool <LBMReal>::CbVectorKey keyOfSendCbVectorKey = generateVectorKey(sblock->getX1(), sblock->getX2(), sblock->getX3()/*tgtID*/, dir, ib); - TbCbVectorMpiPool <LBMReal>::CbVectorKey keyOfRecvCbVectorKey = generateVectorKey(tblock->getX1(), tblock->getX2(), tblock->getX3()/*srcID*/, invDir, ib); - - //////////////////////////////////////////////////////// - //DEBUG - //int myid = comm->getProcessID(); - //FILE * file; - ////char * name = "d:/temp/sendPoolKey.csv"; - //std::string name = "d:/temp/VectorKey" + UbSystem::toString(myid) + ".csv"; - //file = fopen(name.c_str(), "a"); - //fprintf(file, "%d;%d%;%d;%d;%d;%u;%d;%d%;%d;%d;%d;%u\n", sblock->getX1(), sblock->getX2(), sblock->getX3()/*tgtID*/, dir, ib, keyOfSendCbVectorKey, tblock->getX1(), tblock->getX2(), tblock->getX3()/*srcID*/, invDir, ib, keyOfRecvCbVectorKey); - //fclose(file); - //////////////////////////////////////////////////////// - - //create sender-/receiver - sender = TransmitterPtr( new TbCbVectorSenderMpiPool< LBMReal >(keyOfSendCbVectorKey,sendPool.get()) ); - receiver = TransmitterPtr( new TbCbVectorReceiverMpiPool< LBMReal >(keyOfRecvCbVectorKey,recvPool.get()) ); - } -#ifdef VF_FETOL - if (tType == BOND) - { - int srcBondRank = sblock->getRank(); - int tgtBondRank = tblock->getRank(); - - int sendBondPoolKey = generatePoolKey(srcBondRank,srcLevel,tgtBondRank,tgtLevel); - int receiveBondPoolKey = generatePoolKey(tgtBondRank,tgtLevel,srcBondRank,srcLevel); - - TbCbVectorBondPool <LBMReal>::BondPoolPtr sendPool = TbCbVectorBondPool <LBMReal>::getTbCbVectorBondPool(sendBondPoolKey ); - TbCbVectorBondPool <LBMReal>::BondPoolPtr recvPool = TbCbVectorBondPool <LBMReal>::getTbCbVectorBondPool(receiveBondPoolKey); - - if( !sendPool ) sendPool = TbCbVectorBondPool <LBMReal>::createTbCbVectorBondPool(sendBondPoolKey ,tgtBondRank, generateMPITag(srcLevel, tgtLevel)); - if( !recvPool ) recvPool = TbCbVectorBondPool <LBMReal>::createTbCbVectorBondPool(receiveBondPoolKey,tgtBondRank, generateMPITag(tgtLevel, srcLevel)); - - TbCbVectorBondPool <LBMReal>::CbVectorKey keyOfSendCbVectorKey = generateVectorKey(tgtID, dir, ib); - TbCbVectorBondPool <LBMReal>::CbVectorKey keyOfRecvCbVectorKey = generateVectorKey(srcID, invDir, ib); - - //create sender-/receiver - sender = TransmitterPtr( new TbCbVectorSenderBondPool< LBMReal >(keyOfSendCbVectorKey,sendPool.get()) ); - receiver = TransmitterPtr( new TbCbVectorReceiverBondPool< LBMReal >(keyOfRecvCbVectorKey,recvPool.get()) ); - } -#endif -} -////////////////////////////////////////////////////////////////////////// -int CreateTransmittersHelper::generateMPITag(int srcLevel, int tgtLevel) -{ - //The MPI standard guarantees that integers 0-32767 can be used as tags - if (srcLevel == tgtLevel) - { - return srcLevel; - } - else - { - srcLevel++; - tgtLevel++; - std::string str = UbSystem::toString<int>(srcLevel) + UbSystem::toString<int>(tgtLevel); - int r = UbSystem::stringTo<int>(str); - return r; - } -} -////////////////////////////////////////////////////////////////////////// -string CreateTransmittersHelper::generatePoolKey(int srcRank, int srcLevel, int tgtRank, int tgtLevel) -{ - std::string str; - str = StringUtil::toString<int>(srcLevel); - str += "#"; - str += StringUtil::toString<int>(tgtLevel); - str += "#"; - str += StringUtil::toString<int>(srcRank); - str += "#"; - str += StringUtil::toString<int>(tgtRank); - - return str; -} -////////////////////////////////////////////////////////////////////////// -string CreateTransmittersHelper::generateVectorKey(int x1, int x2, int x3, int dir, IBlock ib) -{ - std::string str; - - str += StringUtil::toString<int>(x1); - str += "#"; - str += StringUtil::toString<int>(x2); - str += "#"; - str += StringUtil::toString<int>(x3); - str += "#"; - str += StringUtil::toString<int>(dir); - str += "#"; - str += StringUtil::toString<int>(ib); - - return str; -} - - diff --git a/src/VirtualFluids/Visitors/CreateTransmittersHelper.h b/src/VirtualFluids/Visitors/CreateTransmittersHelper.h deleted file mode 100644 index f4a27fe8b..000000000 --- a/src/VirtualFluids/Visitors/CreateTransmittersHelper.h +++ /dev/null @@ -1,38 +0,0 @@ -#ifndef CREATETRANSMITTERSHELPER_H -#define CREATETRANSMITTERSHELPER_H - -#include "Block3D.h" -#include "Communicator.h" - -#include "LBMSystem.h" - -#include <basics/transmitter/TbTransmitter.h> -#include <basics/transmitter/TbTransmitterMpiPool.h> -#include <basics/container/CbVector.h> - -//! \brief The class helps to create Transmitters. -//! \details It is created two types of Transmitters: MPI and BOND -//! \author K. Kucher -class CreateTransmittersHelper -{ -public: - //! Switch between same level and interpolation Connectors. NONE - for same level Connectors; SW, NW, NE, SE - source/target fine blocks in grid interface - enum IBlock {NONE, SW, NW, NE, SE}; - //! Switch between MPI and BOND Transmitters - enum TransmitterType {MPI, BOND, MPI2BOND}; -public: - typedef CbVector <LBMReal> DataType; - typedef std::shared_ptr< TbTransmitter< DataType > > TransmitterPtr; -public: - CreateTransmittersHelper(); - void createTransmitters(const Block3DPtr sblock, const Block3DPtr tblock, int dir, IBlock ib, - TransmitterPtr& sender, TransmitterPtr& receiver, CommunicatorPtr comm, TransmitterType tType); -protected: -private: - std::string generatePoolKey(int srcRank, int srcLevel, int tgtRank, int tgtLevel); - std::string generateVectorKey(int x1, int x2, int x3,/*int id,*/ int dir, IBlock ib); - int generateMPITag(int srcLevel, int tgtLevel); - static unsigned int vKey; -}; - -#endif diff --git a/src/VirtualFluids/Visitors/GenBlocksGridVisitor.cpp b/src/VirtualFluids/Visitors/GenBlocksGridVisitor.cpp deleted file mode 100644 index ecbb8462c..000000000 --- a/src/VirtualFluids/Visitors/GenBlocksGridVisitor.cpp +++ /dev/null @@ -1,70 +0,0 @@ -#include "GenBlocksGridVisitor.h" -#include "Grid3DSystem.h" -#include "CoordinateTransformation3D.h" -#include "Block3D.h" -#include "Grid3D.h" - -#include <numerics/geometry3d/GbObject3D.h> - -GenBlocksGridVisitor::GenBlocksGridVisitor(GbObject3DPtr boundingBox) : - boundingBox(boundingBox) -{ - -} -////////////////////////////////////////////////////////////////////////// -void GenBlocksGridVisitor::visit(const Grid3DPtr grid) -{ - double orgX1 = boundingBox->getX1Minimum(); - double orgX2 = boundingBox->getX2Minimum(); - double orgX3 = boundingBox->getX3Minimum(); - - double dx = grid->getDeltaX(0); - - UbTupleInt3 blockNX = grid->getBlockNX(); - - double blockLentghX1 = (double)val<1>(blockNX)*dx; - double blockLentghX2 = (double)val<2>(blockNX)*dx; - double blockLentghX3 = (double)val<3>(blockNX)*dx; - - CoordinateTransformation3DPtr trafo(new CoordinateTransformation3D(orgX1, orgX2, orgX3, blockLentghX1, blockLentghX2, blockLentghX3)); - grid->setCoordinateTransformator(trafo); - - genBlocks(grid); -} -////////////////////////////////////////////////////////////////////////// -void GenBlocksGridVisitor::fillExtentWithBlocks( Grid3DPtr grid ) -{ - for(int x3 = val<3>(minInd); x3 < val<3>(maxInd); x3++) - { - for(int x2 = val<2>(minInd); x2 < val<2>(maxInd); x2++) - { - for(int x1 = val<1>(minInd); x1 < val<1>(maxInd); x1++) - { - Block3DPtr block( new Block3D(x1,x2,x3,0) ); - grid->addBlock(block); - } - } - } -} -////////////////////////////////////////////////////////////////////////// -void GenBlocksGridVisitor::genBlocks(Grid3DPtr grid) -{ - minInd = grid->getBlockIndexes(boundingBox->getX1Minimum(), boundingBox->getX2Minimum(), boundingBox->getX3Minimum()); - double geoMaxX1 = boundingBox->getX1Maximum(); - double geoMaxX2 = boundingBox->getX2Maximum(); - double geoMaxX3 = boundingBox->getX3Maximum(); - maxInd = grid->getBlockIndexes(geoMaxX1, geoMaxX2, geoMaxX3); - UbTupleDouble3 blockCoord = grid->getBlockWorldCoordinates(static_cast<int>(val<1>(maxInd)), static_cast<int>(val<2>(maxInd)), static_cast<int>(val<3>(maxInd)), 0); - if (geoMaxX1 > val<1>(blockCoord)) - val<1>(maxInd) += 1; - if (geoMaxX2 > val<2>(blockCoord)) - val<2>(maxInd) += 1; - if (geoMaxX3 > val<3>(blockCoord)) - val<3>(maxInd) += 1; - - this->fillExtentWithBlocks(grid); - - grid->setNX1(val<1>(maxInd)); - grid->setNX2(val<2>(maxInd)); - grid->setNX3(val<3>(maxInd)); -} diff --git a/src/VirtualFluids/Visitors/GenBlocksGridVisitor.h b/src/VirtualFluids/Visitors/GenBlocksGridVisitor.h deleted file mode 100644 index 2179c470f..000000000 --- a/src/VirtualFluids/Visitors/GenBlocksGridVisitor.h +++ /dev/null @@ -1,28 +0,0 @@ -#ifndef GenBlocksGridVisitor_h -#define GenBlocksGridVisitor_h - -#include <memory> - -#include <VirtualFluidsBasics/basics/utilities/UbTuple.h> - -#include "Grid3DVisitor.h" - -class GbObject3D; -class Grid3D; - -class GenBlocksGridVisitor : public Grid3DVisitor -{ -public: - GenBlocksGridVisitor(std::shared_ptr<GbObject3D> boundingBox); - virtual ~GenBlocksGridVisitor(){} - - void visit(std::shared_ptr<Grid3D> grid); - -private: - UbTupleInt3 minInd, maxInd; - std::shared_ptr<GbObject3D> boundingBox; - void fillExtentWithBlocks(std::shared_ptr<Grid3D> grid); - void genBlocks(std::shared_ptr<Grid3D> grid); -}; - -#endif diff --git a/src/VirtualFluids/Visitors/Grid3DVisitor.h b/src/VirtualFluids/Visitors/Grid3DVisitor.h deleted file mode 100644 index 5b1fba2a5..000000000 --- a/src/VirtualFluids/Visitors/Grid3DVisitor.h +++ /dev/null @@ -1,20 +0,0 @@ -#ifndef Grid3DVisitor_h -#define Grid3DVisitor_h - -#include <memory> - -class Grid3DVisitor; -typedef std::shared_ptr<Grid3DVisitor> Grid3DVisitorPtr; - -class Grid3D; - -class Grid3DVisitor -{ -public: - Grid3DVisitor() {} - virtual ~Grid3DVisitor() {} - - virtual void visit(std::shared_ptr<Grid3D> grid) = 0; -}; - -#endif diff --git a/src/VirtualFluids/Visitors/InitDistributionsBlockVisitor.cpp b/src/VirtualFluids/Visitors/InitDistributionsBlockVisitor.cpp deleted file mode 100644 index 98fbd21c2..000000000 --- a/src/VirtualFluids/Visitors/InitDistributionsBlockVisitor.cpp +++ /dev/null @@ -1,316 +0,0 @@ -#include "InitDistributionsBlockVisitor.h" -#include "LBMKernel.h" -#include "BCProcessor.h" -#include "Grid3DSystem.h" -#include "DataSet3D.h" -#include "EsoTwist3D.h" -#include "Grid3D.h" -#include "Block3D.h" -#include "BCArray3D.h" - -InitDistributionsBlockVisitor::InitDistributionsBlockVisitor() - : Block3DVisitor(0, Grid3DSystem::MAXLEVEL) -{ - this->setVx1(0.0); - this->setVx2(0.0); - this->setVx3(0.0); - 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); -//} -////////////////////////////////////////////////////////////////////////// -InitDistributionsBlockVisitor::InitDistributionsBlockVisitor( LBMReal nu, LBMReal rho, LBMReal vx1, LBMReal vx2, LBMReal vx3) - : Block3DVisitor(0, Grid3DSystem::MAXLEVEL) -{ - this->setVx1(vx1); - this->setVx2(vx2); - this->setVx3(vx3); - this->setRho(rho); - this->setNu(nu); -} -////////////////////////////////////////////////////////////////////////// -void InitDistributionsBlockVisitor::setVx1( const mu::Parser& parser) -{ - this->checkFunction(parser); - this->muVx1 = parser; -} -////////////////////////////////////////////////////////////////////////// -void InitDistributionsBlockVisitor::setVx2( const mu::Parser& parser) -{ - this->checkFunction(parser); - this->muVx2 = parser; -} -////////////////////////////////////////////////////////////////////////// -void InitDistributionsBlockVisitor::setVx3( const mu::Parser& parser) -{ - this->checkFunction(parser); - this->muVx3 = parser; -} -////////////////////////////////////////////////////////////////////////// -void InitDistributionsBlockVisitor::setRho( const mu::Parser& parser) -{ - this->checkFunction(parser); - this->muRho = parser; -} -////////////////////////////////////////////////////////////////////////// -void InitDistributionsBlockVisitor::setVx1( const std::string& muParserString) -{ - this->muVx1.SetExpr(muParserString); - this->checkFunction(muVx1); -} -////////////////////////////////////////////////////////////////////////// -void InitDistributionsBlockVisitor::setVx2( const std::string& muParserString) -{ - this->muVx2.SetExpr(muParserString); - this->checkFunction(muVx2); -} -////////////////////////////////////////////////////////////////////////// -void InitDistributionsBlockVisitor::setVx3( const std::string& muParserString) -{ - this->muVx3.SetExpr(muParserString); - this->checkFunction(muVx3); -} -////////////////////////////////////////////////////////////////////////// -void InitDistributionsBlockVisitor::setRho( const std::string& muParserString) -{ - this->muRho.SetExpr(muParserString); - this->checkFunction(muRho); -} -////////////////////////////////////////////////////////////////////////// -void InitDistributionsBlockVisitor::setVx1( LBMReal vx1 ) -{ - this->muVx1.SetExpr( UbSystem::toString(vx1,D3Q27RealLim::digits10) ); - this->checkFunction(muVx1); -} -////////////////////////////////////////////////////////////////////////// -void InitDistributionsBlockVisitor::setVx2( LBMReal vx2 ) -{ - this->muVx2.SetExpr( UbSystem::toString(vx2,D3Q27RealLim::digits10) ); - this->checkFunction(muVx2); -} -////////////////////////////////////////////////////////////////////////// -void InitDistributionsBlockVisitor::setVx3( LBMReal vx3 ) -{ - this->muVx3.SetExpr( UbSystem::toString(vx3,D3Q27RealLim::digits10) ); - this->checkFunction(muVx3); -} -////////////////////////////////////////////////////////////////////////// -void InitDistributionsBlockVisitor::setRho( LBMReal rho ) -{ - this->muRho.SetExpr( UbSystem::toString(rho,D3Q27RealLim::digits10) ); - this->checkFunction(muRho); -} -////////////////////////////////////////////////////////////////////////// -void InitDistributionsBlockVisitor::visit(const Grid3DPtr grid, Block3DPtr 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); - this->muVx2.DefineVar("x1",&x1); this->muVx2.DefineVar("x2",&x2); this->muVx2.DefineVar("x3",&x3); - this->muVx3.DefineVar("x1",&x1); this->muVx3.DefineVar("x2",&x2); this->muVx3.DefineVar("x3",&x3); - this->muRho.DefineVar("x1",&x1); this->muRho.DefineVar("x2",&x2); this->muRho.DefineVar("x3",&x3); - - //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; - - int gridRank = grid->getRank(); - int blockRank = block->getRank(); - - if (blockRank == gridRank && block->isActive()) - { - ILBMKernelPtr kernel = block->getKernel(); - 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); - - BCArray3DPtr bcArray = kernel->getBCProcessor()->getBCArray(); - EsoTwist3DPtr distributions = std::dynamic_pointer_cast<EsoTwist3D>(kernel->getDataSet()->getFdistributions()); - - LBMReal f[D3Q27System::ENDF+1]; - - size_t nx1 = distributions->getNX1(); - size_t nx2 = distributions->getNX2(); - size_t nx3 = distributions->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++) - { - Vector3D coords = grid->getNodeCoordinates(block, ix1, ix2, ix3); - x1 = coords[0]; - x2 = coords[1]; - x3 = coords[2]; - - vx1 = muVx1.Eval(); - vx2 = muVx2.Eval(); - vx3 = muVx3.Eval(); - rho = muRho.Eval(); - - //x-derivative - double deltaX=dx*0.5; - x1 = coords[0]+deltaX; - double vx1Plusx1 = muVx1.Eval(); - double vx2Plusx1 = muVx2.Eval(); - double vx3Plusx1 = muVx3.Eval(); - - x1 = coords[0]-deltaX; - double vx1Minusx1 = muVx1.Eval(); - double vx2Minusx1 = muVx2.Eval(); - double vx3Minusx1 = muVx3.Eval(); - - //y-derivative - x1 = coords[0]; - x2 = coords[1]+deltaX; - double vx1Plusx2 = muVx1.Eval(); - double vx2Plusx2 = muVx2.Eval(); - double vx3Plusx2 = muVx3.Eval(); - - x2 = coords[1]-deltaX; - double vx1Minusx2 = muVx1.Eval(); - double vx2Minusx2 = muVx2.Eval(); - double vx3Minusx2 = muVx3.Eval(); - - //z-derivative - x2 = coords[1]; - x3 = coords[2]+deltaX; - double vx1Plusx3 = muVx1.Eval(); - double vx2Plusx3 = muVx2.Eval(); - double vx3Plusx3 = muVx3.Eval(); - - x3 = coords[2]-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]; - - calcFeqsFct(feq,rho,vx1,vx2,vx3); - - 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[ZERO] = f_ZERO + feq[ZERO]; - - //calcFeqsFct(f,rho,vx1,vx2,vx3); - distributions->setDistribution(f, ix1, ix2, ix3); - distributions->setDistributionInv(f, ix1, ix2, ix3); - - //distributions->swap(); - //distributions->setDistribution(f, ix1, ix2, ix3); - //distributions->setDistributionInv(f, ix1, ix2, ix3); - //distributions->swap(); - - } - } - - //variablen der functions loeschen, da die verwiesenen Objecte nach dem verlassen des scopes ungueltig sind! - this->muVx1.ClearVar(); - this->muVx2.ClearVar(); - this->muVx3.ClearVar(); - this->muRho.ClearVar(); - -} -////////////////////////////////////////////////////////////////////////// -void InitDistributionsBlockVisitor::checkFunction(mu::Parser fct) -{ - double x1=1.0,x2=1.0,x3=1.0; - fct.DefineVar("x1",&x1); - fct.DefineVar("x2",&x2); - fct.DefineVar("x3",&x3); - - try - { - fct.Eval(); - fct.ClearVar(); - } - catch(mu::ParserError& e) - { - throw UbException(UB_EXARGS,"function: "+e.GetExpr() + (std::string)"error: "+e.GetMsg() - +(std::string)", only x1,x2,x3 are allowed as variables" ); - } -} -////////////////////////////////////////////////////////////////////////// -void InitDistributionsBlockVisitor::setNu( LBMReal nu ) -{ - this->nu = nu; -} - diff --git a/src/VirtualFluids/Visitors/InitDistributionsBlockVisitor.h b/src/VirtualFluids/Visitors/InitDistributionsBlockVisitor.h deleted file mode 100644 index c8960a6d2..000000000 --- a/src/VirtualFluids/Visitors/InitDistributionsBlockVisitor.h +++ /dev/null @@ -1,86 +0,0 @@ -#ifndef InitDistributionsBlockVisitor_H -#define InitDistributionsBlockVisitor_H - -#include <memory> - -#include "Block3DVisitor.h" -#include "D3Q27System.h" - -#include <MuParser/include/muParser.h> - -/*================================================================================*/ -/* D3Q27ETInitDistributionsBlockVisitor */ -/* */ -/** -more flexible way to initialize flow area -you can define functions to calculate macroscopic values for feq -!!! x1,x2,x3 are automatically defined via this adapter and are the real world -vertex coordinates !!! - -if function is invalid an UbException with detailed information is thrown - -<BR><BR> -@author <A HREF="mailto:muffmolch@gmx.de">S. Freudiger</A> -@version 1.0 - 19.04.08 -*/ - -//! \details example:<BR> -//! D3Q27InitDistributionsBlockVisitor init(1.0,0.0,0.0,0.0);<BR> -//! Bem.: rho=0.0 bei inkompressibel<BR> -//! init.setVx1("0.01*x2");<BR> -//! init.setVx1("0.01*x2^2");<BR> -//! patch.adaptByPatchCriterion(init); - -class Grid3D; -class Block3D; - - -class InitDistributionsBlockVisitor : public Block3DVisitor -{ -public: - typedef std::numeric_limits<LBMReal> D3Q27RealLim; - -public: - InitDistributionsBlockVisitor(); - //D3Q27ETInitDistributionsBlockVisitor(LBMReal rho, LBMReal vx1=0.0, LBMReal vx2=0.0, LBMReal vx3=0.0); - //! Constructor - //! \param nu - viscosity - //! \param rho - density - //! \param vx1 - velocity in x - //! \param vx2 - velocity in y - //! \param vx3 - velocity in z - InitDistributionsBlockVisitor( LBMReal nu, LBMReal rho, LBMReal vx1=0.0, LBMReal vx2=0.0, LBMReal vx3=0.0); - ////////////////////////////////////////////////////////////////////////// - //automatic vars are: x1,x2, x3 - //ussage example: setVx1("x1*0.01+x2*0.003") - ////////////////////////////////////////////////////////////////////////// - void setVx1( const mu::Parser& parser); - void setVx2( const mu::Parser& parser); - void setVx3( const mu::Parser& parser); - void setRho( const mu::Parser& parser); - - void setVx1( const std::string& muParserString); - void setVx2( const std::string& muParserString); - void setVx3( const std::string& muParserString); - void setRho( const std::string& muParserString); - ////////////////////////////////////////////////////////////////////////// - void setVx1( LBMReal vx1 ); - void setVx2( LBMReal vx2 ); - void setVx3( LBMReal vx3 ); - void setRho( LBMReal rho ); - void setNu( LBMReal nu ); - - void visit(std::shared_ptr<Grid3D> grid, std::shared_ptr<Block3D> block) override; - -protected: - void checkFunction(mu::Parser fct); - -private: - mu::Parser muVx1; - mu::Parser muVx2; - mu::Parser muVx3; - mu::Parser muRho; - LBMReal nu; -}; - -#endif //D3Q27INITDISTRIBUTIONSPATCHVISITOR_H diff --git a/src/VirtualFluids/Visitors/InitDistributionsFromFileBlockVisitor.cpp b/src/VirtualFluids/Visitors/InitDistributionsFromFileBlockVisitor.cpp deleted file mode 100644 index 82836988e..000000000 --- a/src/VirtualFluids/Visitors/InitDistributionsFromFileBlockVisitor.cpp +++ /dev/null @@ -1,258 +0,0 @@ -#include "InitDistributionsFromFileBlockVisitor.h" -#include <basics/utilities/UbFileInputASCII.h> -#include "LBMKernel.h" -#include "BCProcessor.h" -#include "Grid3DSystem.h" -#include "InitDensityLBMKernel.h" -#include "DataSet3D.h" -#include "EsoTwist3D.h" -#include "Grid3D.h" -#include "Block3D.h" -#include "BCArray3D.h" - - -InitDistributionsFromFileBlockVisitor::InitDistributionsFromFileBlockVisitor(LBMReal nu, LBMReal rho, std::string filename) - : Block3DVisitor(0, Grid3DSystem::MAXLEVEL), nu(nu), rho(rho) -{ - UbFileInputASCII in(filename); - if (!in) - { - throw UbException(UB_EXARGS, "could not open file "+filename); - } - - int nodesX1 = in.readInteger(); - int nodesX2 = in.readInteger(); - int nodesX3 = in.readInteger(); - - matrix = CbArray4D<LBMReal, IndexerX4X3X2X1>(3, nodesX1, nodesX2, nodesX3, 0); - - for (int x3 = 0; x3<nodesX3; x3++) - for (int x2 = 0; x2<nodesX2; x2++) - for (int x1 = 0; x1<nodesX1; x1++) - { - //for (int x1 = 0; x1<nodesX1; x1++) - // for (int x2 = 0; x2<nodesX2; x2++) - // for (int x3 = 0; x3<nodesX3; x3++) - // { - matrix(Vx1, x1, x2, x3) = in.readDouble(); - matrix(Vx2, x1, x2, x3) = in.readDouble(); - matrix(Vx3, x1, x2, x3) = in.readDouble(); - } -} -////////////////////////////////////////////////////////////////////////// -InitDistributionsFromFileBlockVisitor::~InitDistributionsFromFileBlockVisitor() -{ -} -////////////////////////////////////////////////////////////////////////// -void InitDistributionsFromFileBlockVisitor::visit(const Grid3DPtr grid, Block3DPtr 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()); - - - //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; - - int gridRank = grid->getRank(); - int blockRank = block->getRank(); - - if (blockRank==gridRank && block->isActive()) - { - ILBMKernelPtr kernel = block->getKernel(); - 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); - - BCArray3DPtr bcArray = kernel->getBCProcessor()->getBCArray(); - EsoTwist3DPtr distributions = std::dynamic_pointer_cast<EsoTwist3D>(kernel->getDataSet()->getFdistributions()); - - LBMReal f[D3Q27System::ENDF+1]; - - size_t nx1 = distributions->getNX1(); - size_t nx2 = distributions->getNX2(); - size_t nx3 = distributions->getNX3(); - - int minX1 = 0; - int minX2 = 0; - int minX3 = 0; - - int maxX1 = (int)bcArray->getNX1(); - int maxX2 = (int)bcArray->getNX2(); - int maxX3 = (int)bcArray->getNX3(); - - int maxMX1 = (int)matrix.getNX2(); - int maxMX2 = (int)matrix.getNX3(); - int maxMX3 = (int)matrix.getNX4(); - - int blockix1 = block->getX1(); - int blockix2 = block->getX2(); - int blockix3 = block->getX3(); - - UbTupleInt3 blockNx = grid->getBlockNX(); - - for (int ix3 = minX1; ix3<maxX3; ix3++) - for (int ix2 = minX2; ix2<maxX2; ix2++) - for (int ix1 = minX1; ix1<maxX1; ix1++) - { - int x1 = blockix1*val<1>(blockNx)+ix1-1; - int x2 = blockix2*val<2>(blockNx)+ix2-1; - int x3 = blockix3*val<3>(blockNx)+ix3-1; - - if (x1==-1) - { - x1 = maxMX1-1; - } - if (x2==-1) - { - x2 = maxMX2-1; - } - if (x3==-1) - { - x3 = maxMX3-1; - } - - if (x1==maxMX1) - { - x1 = 1; - } - if (x2==maxMX2) - { - x2 = 1; - } - if (x3==maxMX3) - { - x3 = 1; - } - - vx1 = matrix(Vx1, x1, x2, x3); - vx2 = matrix(Vx2, x1, x2, x3); - vx3 = matrix(Vx3, x1, x2, x3); - - //int x1p, x2p, x3p; - - ////x-derivative - //if (x1+1 >= maxMX1) x1p = x1; - //else x1p = x1+1; - //double vx1Plusx1 = matrix(Vx1, x1p, x2, x3); - //double vx2Plusx1 = matrix(Vx2, x1p, x2, x3); - //double vx3Plusx1 = matrix(Vx3, x1p, x2, x3); - - //if (x1-1 < minX1) x1p = x1; - //else x1p = x1-1; - //double vx1Minusx1 = matrix(Vx1, x1p, x2, x3); - //double vx2Minusx1 = matrix(Vx2, x1p, x2, x3); - //double vx3Minusx1 = matrix(Vx3, x1p, x2, x3); - - ////y-derivative - //if (x2+1 >= maxMX2) x2p = x2; - //else x2p = x2+1; - //double vx1Plusx2 = matrix(Vx1, x1, x2p, x3); - //double vx2Plusx2 = matrix(Vx2, x1, x2p, x3); - //double vx3Plusx2 = matrix(Vx3, x1, x2p, x3); - - //if (x2-1 < minX2) x2p = x2; - //else x2p = x2-1; - //double vx1Minusx2 = matrix(Vx1, x1, x2p, x3); - //double vx2Minusx2 = matrix(Vx2, x1, x2p, x3); - //double vx3Minusx2 = matrix(Vx3, x1, x2p, x3); - - ////z-derivative - //if (x3+1 >= maxMX3) x3p = x3; - //else x3p = x3+1; - //double vx1Plusx3 = matrix(Vx1, x1, x2, x3p); - //double vx2Plusx3 = matrix(Vx2, x1, x2, x3p); - //double vx3Plusx3 = matrix(Vx3, x1, x2, x3p); - - //if (x3-1 < minX3) x3p = x3; - //else x3p = x3-1; - //double vx1Minusx3 = matrix(Vx1, x1, x2, x3); - //double vx2Minusx3 = matrix(Vx2, x1, x2, x3); - //double vx3Minusx3 = matrix(Vx3, x1, x2, x3); - - //double ax = (vx1Plusx1 - vx1Minusx1) / (2.0); - //double bx = (vx2Plusx1 - vx2Minusx1) / (2.0); - //double cx = (vx3Plusx1 - vx3Minusx1) / (2.0); - - //double ay = (vx1Plusx2 - vx1Minusx2) / (2.0); - //double by = (vx2Plusx2 - vx2Minusx2) / (2.0); - //double cy = (vx3Plusx2 - vx3Minusx2) / (2.0); - - //double az = (vx1Plusx3 - vx1Minusx3) / (2.0); - //double bz = (vx2Plusx3 - vx2Minusx3) / (2.0); - //double cz = (vx3Plusx3 - vx3Minusx3) / (2.0); - //double eps_new = 1.0; - //LBMReal op = 1.; - - //LBMReal feq[27]; - - //calcFeqsFct(feq, rho, vx1, vx2, vx3); - - //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[ZERO] = f_ZERO + feq[ZERO]; - - calcFeqsFct(f, rho, vx1, vx2, vx3); - - distributions->setDistribution(f, ix1, ix2, ix3); - distributions->setDistributionInv(f, ix1, ix2, ix3); - std::dynamic_pointer_cast<InitDensityLBMKernel>(kernel)->setVelocity(ix1, ix2, ix3, vx1, vx2, vx3); - } - - } -} -////////////////////////////////////////////////////////////////////////// diff --git a/src/VirtualFluids/Visitors/InitDistributionsFromFileBlockVisitor.h b/src/VirtualFluids/Visitors/InitDistributionsFromFileBlockVisitor.h deleted file mode 100644 index d01da2e16..000000000 --- a/src/VirtualFluids/Visitors/InitDistributionsFromFileBlockVisitor.h +++ /dev/null @@ -1,28 +0,0 @@ -#ifndef InitDistributionsFromFileBlockVisitor_h__ -#define InitDistributionsFromFileBlockVisitor_h__ - -#include "Block3DVisitor.h" -#include "LBMSystem.h" - -#include "CbArray4D.h" - -class Grid3D; -class Block3D; - -class InitDistributionsFromFileBlockVisitor : public Block3DVisitor -{ -public: - InitDistributionsFromFileBlockVisitor(LBMReal nu, LBMReal rho, std::string file); - ~InitDistributionsFromFileBlockVisitor(); - - void visit(std::shared_ptr<Grid3D> grid, std::shared_ptr<Block3D> block) override; - -private: - CbArray4D<LBMReal, IndexerX4X3X2X1> matrix; - enum Velocity { Vx1, Vx2, Vx3 }; - LBMReal nu; - LBMReal rho; -}; -#endif // InitDistributionsFromFileBlockVisitor_h__ - - diff --git a/src/VirtualFluids/Visitors/InitDistributionsWithInterpolationGridVisitor.cpp b/src/VirtualFluids/Visitors/InitDistributionsWithInterpolationGridVisitor.cpp deleted file mode 100644 index cec02e5f0..000000000 --- a/src/VirtualFluids/Visitors/InitDistributionsWithInterpolationGridVisitor.cpp +++ /dev/null @@ -1,610 +0,0 @@ -#include "InitDistributionsWithInterpolationGridVisitor.h" - -#include "mpi.h" - -#include <basics/utilities/UbFileInputASCII.h> -#include "LBMKernel.h" -#include "BCProcessor.h" -#include "Grid3DSystem.h" -#include <CbArray2D.h> -#include "D3Q27EsoTwist3DSplittedVector.h" -#include "InterpolationProcessor.h" -#include "DataSet3D.h" -#include "Grid3D.h" -#include "Block3D.h" - -using namespace std; - -InitDistributionsWithInterpolationGridVisitor::InitDistributionsWithInterpolationGridVisitor(Grid3DPtr oldGrid, InterpolationProcessorPtr iProcessor, LBMReal nu) - : oldGrid(oldGrid), iProcessor(iProcessor), nu(nu) -{ - -} -////////////////////////////////////////////////////////////////////////// -InitDistributionsWithInterpolationGridVisitor::~InitDistributionsWithInterpolationGridVisitor() -{ -} -////////////////////////////////////////////////////////////////////////// -void InitDistributionsWithInterpolationGridVisitor::visit(Grid3DPtr grid) -{ - newGrid = grid; - int minInitLevel = newGrid->getCoarsestInitializedLevel(); - int maxInitLevel = newGrid->getFinestInitializedLevel(); - int newGridRank = newGrid->getRank(); - - for (int l = minInitLevel; l<=maxInitLevel; l++) - { - int n = 0; - vector<Block3DPtr> blockVector; - newGrid->getBlocks(l, blockVector); - vector<Block3DPtr> tBlockID; - - for(Block3DPtr newBlock : blockVector) - { - if (!newBlock) - UB_THROW(UbException(UB_EXARGS, "block is not exist")); - - int newBlockRank = newBlock->getRank(); - int newBlockLevel = newBlock->getLevel(); - - Block3DPtr oldBlock = oldGrid->getBlock(newBlock->getX1(), newBlock->getX2(), newBlock->getX3(), newBlock->getLevel()); - if (oldBlock) - { - int oldBlockRank = oldBlock->getRank(); - if (oldBlockRank == newBlockRank && oldBlock->isActive() && newBlockRank == newGridRank && newBlock->isActive()) - { - copyLocalBlock(oldBlock, newBlock); - } - else - { - copyRemoteBlock(oldBlock, newBlock); - } - } - else - { - int newlevel = newBlock->getLevel(); - Vector3D coords = newGrid->getNodeCoordinates(newBlock, 1, 1, 1); - - UbTupleInt3 oldGridBlockIndexes = oldGrid->getBlockIndexes(coords[0], coords[1], coords[2], newlevel-1); - Block3DPtr oldBlock = oldGrid->getBlock(val<1>(oldGridBlockIndexes), val<2>(oldGridBlockIndexes), val<3>(oldGridBlockIndexes), newlevel-1); - - if (oldBlock) - { - int oldBlockRank = oldBlock->getRank(); - int oldBlockLevel = oldBlock->getLevel(); - - if (oldBlockRank == newBlockRank && oldBlock->isActive() && newBlockRank == newGridRank && newBlock->isActive()) - { - interpolateLocalBlockCoarseToFine(oldBlock, newBlock); - } - else - { - interpolateRemoteBlockCoarseToFine(oldBlock, newBlock); - } - } - else - { - UbTupleInt3 oldGridBlockIndexes = oldGrid->getBlockIndexes(coords[0], coords[1], coords[2], newlevel+1); - Block3DPtr oldBlock = oldGrid->getBlock(val<1>(oldGridBlockIndexes), val<2>(oldGridBlockIndexes), val<3>(oldGridBlockIndexes), newlevel+1); - if (oldBlock) - { - int oldBlockRank = oldBlock->getRank(); - int oldBlockLevel = oldBlock->getLevel(); - - if (oldBlockRank == newBlockRank && oldBlock->isActive() && newBlockRank == newGridRank && newBlock->isActive()) - { - interpolateLocalBlockFineToCoarse(oldBlock, newBlock); - } - else - { - interpolateRemoteBlockFineToCoarse(oldBlock, newBlock); - } - } - } - } - } - } -} -////////////////////////////////////////////////////////////////////////// -void InitDistributionsWithInterpolationGridVisitor::copyLocalBlock(Block3DPtr oldBlock, Block3DPtr newBlock) -{ - ILBMKernelPtr oldKernel = oldBlock->getKernel(); - if (!oldKernel) - throw UbException(UB_EXARGS, "The LBM kernel isn't exist in block: "+oldBlock->toString()); - EsoTwist3DPtr oldDistributions = std::dynamic_pointer_cast<EsoTwist3D>(oldKernel->getDataSet()->getFdistributions()); - - ILBMKernelPtr kernel = newBlock->getKernel(); - if (!kernel) - throw UbException(UB_EXARGS, "The LBM kernel isn't exist in new block: "+newBlock->toString()); - kernel->getDataSet()->setFdistributions(oldDistributions); -} -////////////////////////////////////////////////////////////////////////// -void InitDistributionsWithInterpolationGridVisitor::copyRemoteBlock(Block3DPtr oldBlock, Block3DPtr newBlock) -{ - int newGridRank = newGrid->getRank(); - int oldBlockRank = oldBlock->getRank(); - int newBlockRank = newBlock->getRank(); - - if (oldBlockRank == newGridRank && oldBlock->isActive()) - { - ILBMKernelPtr oldKernel = oldBlock->getKernel(); - if (!oldKernel) - throw UbException(UB_EXARGS, "The LBM kernel isn't exist in block: "+oldBlock->toString()); - EsoTwist3DPtr oldDistributions = std::dynamic_pointer_cast<EsoTwist3D>(oldKernel->getDataSet()->getFdistributions()); - - CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr localDistributions = std::dynamic_pointer_cast<D3Q27EsoTwist3DSplittedVector>(oldDistributions)->getLocalDistributions(); - CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr nonLocalDistributions = std::dynamic_pointer_cast<D3Q27EsoTwist3DSplittedVector>(oldDistributions)->getNonLocalDistributions(); - CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr zeroDistributions = std::dynamic_pointer_cast<D3Q27EsoTwist3DSplittedVector>(oldDistributions)->getZeroDistributions(); - - MPI_Send(localDistributions->getStartAdressOfSortedArray(0, 0, 0, 0), (int)localDistributions->getDataVector().size(), MPI_DOUBLE, newBlockRank, 0, MPI_COMM_WORLD); - MPI_Send(nonLocalDistributions->getStartAdressOfSortedArray(0, 0, 0, 0), (int)nonLocalDistributions->getDataVector().size(), MPI_DOUBLE, newBlockRank, 0, MPI_COMM_WORLD); - MPI_Send(zeroDistributions->getStartAdressOfSortedArray(0, 0, 0), (int)zeroDistributions->getDataVector().size(), MPI_DOUBLE, newBlockRank, 0, MPI_COMM_WORLD); - } - else if (newBlockRank == newGridRank && newBlock->isActive()) - { - ILBMKernelPtr newKernel = newBlock->getKernel(); - if (!newKernel) - throw UbException(UB_EXARGS, "The LBM kernel isn't exist in new block: "+newBlock->toString()+UbSystem::toString(newGridRank)); - - EsoTwist3DPtr newDistributions = std::dynamic_pointer_cast<EsoTwist3D>(newKernel->getDataSet()->getFdistributions()); - - CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr localDistributions = std::dynamic_pointer_cast<D3Q27EsoTwist3DSplittedVector>(newDistributions)->getLocalDistributions(); - CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr nonLocalDistributions = std::dynamic_pointer_cast<D3Q27EsoTwist3DSplittedVector>(newDistributions)->getNonLocalDistributions(); - CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr zeroDistributions = std::dynamic_pointer_cast<D3Q27EsoTwist3DSplittedVector>(newDistributions)->getZeroDistributions(); - - MPI_Recv(localDistributions->getStartAdressOfSortedArray(0, 0, 0, 0), (int)localDistributions->getDataVector().size(), MPI_DOUBLE, oldBlockRank, 0, MPI_COMM_WORLD, MPI_STATUS_IGNORE); - MPI_Recv(nonLocalDistributions->getStartAdressOfSortedArray(0, 0, 0, 0), (int)nonLocalDistributions->getDataVector().size(), MPI_DOUBLE, oldBlockRank, 0, MPI_COMM_WORLD, MPI_STATUS_IGNORE); - MPI_Recv(zeroDistributions->getStartAdressOfSortedArray(0, 0, 0), (int)zeroDistributions->getDataVector().size(), MPI_DOUBLE, oldBlockRank, 0, MPI_COMM_WORLD, MPI_STATUS_IGNORE); - } -} -////////////////////////////////////////////////////////////////////////// -void InitDistributionsWithInterpolationGridVisitor::interpolateLocalBlockCoarseToFine(Block3DPtr oldBlock, Block3DPtr newBlock) -{ - D3Q27ICell icellC; - D3Q27ICell icellF; - LBMReal xoff, yoff, zoff; - - LBMReal omegaC = LBMSystem::calcCollisionFactor(nu, oldBlock->getLevel()); - LBMReal omegaF =LBMSystem::calcCollisionFactor(nu, newBlock->getLevel()); - - iProcessor->setOmegas(omegaC, omegaF); - - ILBMKernelPtr oldKernel = oldBlock->getKernel(); - if (!oldKernel) - throw UbException(UB_EXARGS, "The LBM kernel isn't exist in old block: "+oldBlock->toString()); - - EsoTwist3DPtr oldDistributions = std::dynamic_pointer_cast<EsoTwist3D>(oldKernel->getDataSet()->getFdistributions()); - - BCArray3DPtr bcArrayOldBlock = oldBlock->getKernel()->getBCProcessor()->getBCArray(); - - ILBMKernelPtr newKernel = newBlock->getKernel(); - if (!newKernel) - throw UbException(UB_EXARGS, "The LBM kernel isn't exist in new block: "+newBlock->toString()); - - EsoTwist3DPtr newDistributions = std::dynamic_pointer_cast<EsoTwist3D>(newKernel->getDataSet()->getFdistributions()); - - int minX1 = 0; - int minX2 = 0; - int minX3 = 0; - - int maxX1 = (int)newDistributions->getNX1()-1; - int maxX2 = (int)newDistributions->getNX2()-1; - int maxX3 = (int)newDistributions->getNX3()-1; - - int bMaxX1 = (int)newDistributions->getNX1(); - int bMaxX2 = (int)newDistributions->getNX2(); - int bMaxX3 = (int)newDistributions->getNX3(); - - for (int ix3 = minX3; ix3 < maxX3; ix3+=2) - for (int ix2 = minX2; ix2 < maxX2; ix2+=2) - for (int ix1 = minX1; ix1 < maxX1; ix1+=2) - { - Vector3D coords = newGrid->getNodeCoordinates(newBlock, ix1, ix2, ix3); - UbTupleInt3 oldGridIndexMin = oldGrid->getNodeIndexes(oldBlock, coords[0], coords[1], coords[2]); - int howManySolids= iProcessor->iCellHowManySolids(bcArrayOldBlock, val<1>(oldGridIndexMin), val<2>(oldGridIndexMin), val<3>(oldGridIndexMin)); - - if (howManySolids == 0 || howManySolids == 8) - { - iProcessor->readICell(oldDistributions, icellC, val<1>(oldGridIndexMin), val<2>(oldGridIndexMin), val<3>(oldGridIndexMin)); - iProcessor->interpolateCoarseToFine(icellC, icellF); - } - else - { - if (iProcessor->findNeighborICell(bcArrayOldBlock, oldDistributions, icellC, bMaxX1, bMaxX2, bMaxX3, - val<1>(oldGridIndexMin), val<2>(oldGridIndexMin), val<3>(oldGridIndexMin), xoff, yoff, zoff)) - { - //std::string err = "For "+oldBlock->toString()+ - // " x1="+UbSystem::toString(val<1>(oldGridIndexMin))+ - // ", x2=" + UbSystem::toString(val<2>(oldGridIndexMin))+ - // ", x3=" + UbSystem::toString(val<3>(oldGridIndexMin))+ - // " interpolation is not implemented for other direction"+ - // " by using in: "+(std::string)typeid(*this).name()+ - // " or maybe you have a solid on the block boundary"; - //UB_THROW(UbException(UB_EXARGS, err)); - iProcessor->interpolateCoarseToFine(icellC, icellF, xoff, yoff, zoff); - } - else - { - for (int i=0; i<27; i++) - { - icellF.BSW[i]=0.0; - icellF.BSE[i]=0.0; - icellF.BNW[i]=0.0; - icellF.BNE[i]=0.0; - icellF.TSW[i]=0.0; - icellF.TSE[i]=0.0; - icellF.TNW[i]=0.0; - icellF.TNE[i]=0.0; - } - // std::string err = "For "+oldBlock->toString()+ - // " x1="+UbSystem::toString(val<1>(oldGridIndexMin))+ - // ", x2=" + UbSystem::toString(val<2>(oldGridIndexMin))+ - // ", x3=" + UbSystem::toString(val<3>(oldGridIndexMin))+ - // " interpolation is not implemented for other direction"+ - // " by using in: "+(std::string)typeid(*this).name()+ - // " or maybe you have a solid on the block boundary"; - ////UB_THROW(UbException(UB_EXARGS, err)); - // UBLOG(logINFO, err); - } - } - - iProcessor->writeICell(newDistributions, icellF, ix1, ix2, ix3); - iProcessor->writeICellInv(newDistributions, icellF, ix1, ix2, ix3); - } -} -////////////////////////////////////////////////////////////////////////// -void InitDistributionsWithInterpolationGridVisitor::interpolateRemoteBlockCoarseToFine(Block3DPtr oldBlock, Block3DPtr newBlock) -{ - int newGridRank = newGrid->getRank(); - int oldBlockRank = oldBlock->getRank(); - int newBlockRank = newBlock->getRank(); - - if (oldBlockRank == newGridRank) - { - ILBMKernelPtr oldKernel = oldBlock->getKernel(); - if (!oldKernel) - throw UbException(UB_EXARGS, "The LBM kernel isn't exist in block: "+oldBlock->toString()); - EsoTwist3DPtr oldDistributions = std::dynamic_pointer_cast<EsoTwist3D>(oldKernel->getDataSet()->getFdistributions()); - - CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr localDistributions = std::dynamic_pointer_cast<D3Q27EsoTwist3DSplittedVector>(oldDistributions)->getLocalDistributions(); - CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr nonLocalDistributions = std::dynamic_pointer_cast<D3Q27EsoTwist3DSplittedVector>(oldDistributions)->getNonLocalDistributions(); - CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr zeroDistributions = std::dynamic_pointer_cast<D3Q27EsoTwist3DSplittedVector>(oldDistributions)->getZeroDistributions(); - - MPI_Send(localDistributions->getStartAdressOfSortedArray(0, 0, 0, 0), (int)localDistributions->getDataVector().size(), MPI_DOUBLE, newBlockRank, 0, MPI_COMM_WORLD); - MPI_Send(nonLocalDistributions->getStartAdressOfSortedArray(0, 0, 0, 0), (int)nonLocalDistributions->getDataVector().size(), MPI_DOUBLE, newBlockRank, 0, MPI_COMM_WORLD); - MPI_Send(zeroDistributions->getStartAdressOfSortedArray(0, 0, 0), (int)zeroDistributions->getDataVector().size(), MPI_DOUBLE, newBlockRank, 0, MPI_COMM_WORLD); - - BCArray3DPtr bcArrayOldBlock = oldBlock->getKernel()->getBCProcessor()->getBCArray(); - std::vector< int >& bcDataVector = bcArrayOldBlock->getBcindexmatrixDataVector(); - MPI_Send(&bcDataVector[0], (int)bcDataVector.size(), MPI_INT, newBlockRank, 0, MPI_COMM_WORLD); - } - else if (newBlockRank == newGridRank && newBlock->isActive()) - { - D3Q27ICell icellC; - D3Q27ICell icellF; - LBMReal xoff, yoff, zoff; - - LBMReal omegaC = LBMSystem::calcCollisionFactor(nu, oldBlock->getLevel()); - LBMReal omegaF =LBMSystem::calcCollisionFactor(nu, newBlock->getLevel()); - - iProcessor->setOmegas(omegaC, omegaF); - - ILBMKernelPtr newKernel = newBlock->getKernel(); - if (!newKernel) - throw UbException(UB_EXARGS, "The LBM kernel isn't exist in new block: "+newBlock->toString()); - - EsoTwist3DPtr newDistributions = std::dynamic_pointer_cast<EsoTwist3D>(newKernel->getDataSet()->getFdistributions()); - - int minX1 = 0; - int minX2 = 0; - int minX3 = 0; - - int maxX1 = (int)newDistributions->getNX1()-1; - int maxX2 = (int)newDistributions->getNX2()-1; - int maxX3 = (int)newDistributions->getNX3()-1; - - int bMaxX1 = (int)newDistributions->getNX1(); - int bMaxX2 = (int)newDistributions->getNX2(); - int bMaxX3 = (int)newDistributions->getNX3(); - - EsoTwist3DPtr oldDistributions(new D3Q27EsoTwist3DSplittedVector(bMaxX1, bMaxX2, bMaxX3, 0)); - - CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr localDistributions = std::dynamic_pointer_cast<D3Q27EsoTwist3DSplittedVector>(oldDistributions)->getLocalDistributions(); - CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr nonLocalDistributions = std::dynamic_pointer_cast<D3Q27EsoTwist3DSplittedVector>(oldDistributions)->getNonLocalDistributions(); - CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr zeroDistributions = std::dynamic_pointer_cast<D3Q27EsoTwist3DSplittedVector>(oldDistributions)->getZeroDistributions(); - - MPI_Recv(localDistributions->getStartAdressOfSortedArray(0, 0, 0, 0), (int)localDistributions->getDataVector().size(), MPI_DOUBLE, oldBlockRank, 0, MPI_COMM_WORLD, MPI_STATUS_IGNORE); - MPI_Recv(nonLocalDistributions->getStartAdressOfSortedArray(0, 0, 0, 0), (int)nonLocalDistributions->getDataVector().size(), MPI_DOUBLE, oldBlockRank, 0, MPI_COMM_WORLD, MPI_STATUS_IGNORE); - MPI_Recv(zeroDistributions->getStartAdressOfSortedArray(0, 0, 0), (int)zeroDistributions->getDataVector().size(), MPI_DOUBLE, oldBlockRank, 0, MPI_COMM_WORLD, MPI_STATUS_IGNORE); - - BCArray3DPtr bcArrayOldBlock(new BCArray3D(bMaxX1, bMaxX2, bMaxX3, BCArray3D::FLUID)); - std::vector< int >& bcDataVector = bcArrayOldBlock->getBcindexmatrixDataVector(); - MPI_Recv(&bcDataVector[0], (int)bcDataVector.size(), MPI_INT, oldBlockRank, 0, MPI_COMM_WORLD, MPI_STATUS_IGNORE); - - for (int ix3 = minX3; ix3 < maxX3; ix3+=2) - for (int ix2 = minX2; ix2 < maxX2; ix2+=2) - for (int ix1 = minX1; ix1 < maxX1; ix1+=2) - { - Vector3D coords = newGrid->getNodeCoordinates(newBlock, ix1, ix2, ix3); - UbTupleInt3 oldGridIndexMin = oldGrid->getNodeIndexes(oldBlock, coords[0], coords[1], coords[2]); - - int howManySolids= iProcessor->iCellHowManySolids(bcArrayOldBlock, val<1>(oldGridIndexMin), val<2>(oldGridIndexMin), val<3>(oldGridIndexMin)); - - if (howManySolids == 0 || howManySolids == 8) - { - iProcessor->readICell(oldDistributions, icellC, val<1>(oldGridIndexMin), val<2>(oldGridIndexMin), val<3>(oldGridIndexMin)); - iProcessor->interpolateCoarseToFine(icellC, icellF); - } - else - { - if (iProcessor->findNeighborICell(bcArrayOldBlock, oldDistributions, icellC, bMaxX1, bMaxX2, bMaxX3, - val<1>(oldGridIndexMin), val<2>(oldGridIndexMin), val<3>(oldGridIndexMin), xoff, yoff, zoff)) - { - //std::string err = "For "+oldBlock->toString()+ - // " x1="+UbSystem::toString(val<1>(oldGridIndexMin))+ - // ", x2=" + UbSystem::toString(val<2>(oldGridIndexMin))+ - // ", x3=" + UbSystem::toString(val<3>(oldGridIndexMin))+ - // " interpolation is not implemented for other direction"+ - // " by using in: "+(std::string)typeid(*this).name()+ - // " or maybe you have a solid on the block boundary"; - //UB_THROW(UbException(UB_EXARGS, err)); - iProcessor->interpolateCoarseToFine(icellC, icellF, xoff, yoff, zoff); - } - else - { - for (int i=0; i<27; i++) - { - icellF.BSW[i]=0.0; - icellF.BSE[i]=0.0; - icellF.BNW[i]=0.0; - icellF.BNE[i]=0.0; - icellF.TSW[i]=0.0; - icellF.TSE[i]=0.0; - icellF.TNW[i]=0.0; - icellF.TNE[i]=0.0; - } - // std::string err = "For "+oldBlock->toString()+ - // " x1="+UbSystem::toString(val<1>(oldGridIndexMin))+ - // ", x2=" + UbSystem::toString(val<2>(oldGridIndexMin))+ - // ", x3=" + UbSystem::toString(val<3>(oldGridIndexMin))+ - // " interpolation is not implemented for other direction"+ - // " by using in: "+(std::string)typeid(*this).name()+ - // " or maybe you have a solid on the block boundary"; - ////UB_THROW(UbException(UB_EXARGS, err)); - // UBLOG(logINFO, err); - } - } - - - - iProcessor->writeICell(newDistributions, icellF, ix1, ix2, ix3); - iProcessor->writeICellInv(newDistributions, icellF, ix1, ix2, ix3); - } - } -} -////////////////////////////////////////////////////////////////////////// -void InitDistributionsWithInterpolationGridVisitor::interpolateLocalBlockFineToCoarse(Block3DPtr oldBlock, Block3DPtr newBlock) -{ - LBMReal icellC[27]; - D3Q27ICell icellF; - LBMReal xoff, yoff, zoff; - - LBMReal omegaF = LBMSystem::calcCollisionFactor(nu, oldBlock->getLevel()); - LBMReal omegaC =LBMSystem::calcCollisionFactor(nu, newBlock->getLevel()); - - iProcessor->setOmegas(omegaC, omegaF); - - ILBMKernelPtr oldKernel = oldBlock->getKernel(); - if (!oldKernel) - throw UbException(UB_EXARGS, "The LBM kernel isn't exist in old block: "+oldBlock->toString()); - - EsoTwist3DPtr oldDistributions = std::dynamic_pointer_cast<EsoTwist3D>(oldKernel->getDataSet()->getFdistributions()); - - BCArray3DPtr bcArrayOldBlock = oldBlock->getKernel()->getBCProcessor()->getBCArray(); - - ILBMKernelPtr newKernel = newBlock->getKernel(); - if (!newKernel) - throw UbException(UB_EXARGS, "The LBM kernel isn't exist in new block: "+newBlock->toString()); - - EsoTwist3DPtr newDistributions = std::dynamic_pointer_cast<EsoTwist3D>(newKernel->getDataSet()->getFdistributions()); - - int minX1 = 0; - int minX2 = 0; - int minX3 = 0; - - int maxX1 = (int)newDistributions->getNX1()-1; - int maxX2 = (int)newDistributions->getNX2()-1; - int maxX3 = (int)newDistributions->getNX3()-1; - - int bMaxX1 = (int)newDistributions->getNX1(); - int bMaxX2 = (int)newDistributions->getNX2(); - int bMaxX3 = (int)newDistributions->getNX3(); - - for (int ix3 = minX3; ix3 < maxX3; ix3+=2) - for (int ix2 = minX2; ix2 < maxX2; ix2+=2) - for (int ix1 = minX1; ix1 < maxX1; ix1+=2) - { - Vector3D coords = newGrid->getNodeCoordinates(newBlock, ix1, ix2, ix3); - UbTupleInt3 oldGridIndexMin = oldGrid->getNodeIndexes(oldBlock, coords[0], coords[1], coords[2]); - - int howManySolids= iProcessor->iCellHowManySolids(bcArrayOldBlock, val<1>(oldGridIndexMin), val<2>(oldGridIndexMin), val<3>(oldGridIndexMin)); - - if (howManySolids == 0 || howManySolids == 8) - { - iProcessor->readICell(oldDistributions, icellF, val<1>(oldGridIndexMin), val<2>(oldGridIndexMin), val<3>(oldGridIndexMin)); - iProcessor->interpolateFineToCoarse(icellF, icellC); - } - else - { - if (iProcessor->findNeighborICell(bcArrayOldBlock, oldDistributions, icellF, bMaxX1, bMaxX2, bMaxX3, - val<1>(oldGridIndexMin), val<2>(oldGridIndexMin), val<3>(oldGridIndexMin), xoff, yoff, zoff)) - { - //std::string err = "For "+oldBlock->toString()+ - // " x1="+UbSystem::toString(val<1>(oldGridIndexMin))+ - // ", x2=" + UbSystem::toString(val<2>(oldGridIndexMin))+ - // ", x3=" + UbSystem::toString(val<3>(oldGridIndexMin))+ - // " interpolation is not implemented for other direction"+ - // " by using in: "+(std::string)typeid(*this).name()+ - // " or maybe you have a solid on the block boundary"; - //UB_THROW(UbException(UB_EXARGS, err)); - iProcessor->interpolateFineToCoarse(icellF, icellC, xoff, yoff, zoff); - } - else - { - for (int i=0; i<27; i++) - { - icellF.BSW[i]=0.0; - icellF.BSE[i]=0.0; - icellF.BNW[i]=0.0; - icellF.BNE[i]=0.0; - icellF.TSW[i]=0.0; - icellF.TSE[i]=0.0; - icellF.TNW[i]=0.0; - icellF.TNE[i]=0.0; - } - // std::string err = "For "+oldBlock->toString()+ - // " x1="+UbSystem::toString(val<1>(oldGridIndexMin))+ - // ", x2=" + UbSystem::toString(val<2>(oldGridIndexMin))+ - // ", x3=" + UbSystem::toString(val<3>(oldGridIndexMin))+ - // " interpolation is not implemented for other direction"+ - // " by using in: "+(std::string)typeid(*this).name()+ - // " or maybe you have a solid on the block boundary"; - ////UB_THROW(UbException(UB_EXARGS, err)); - // UBLOG(logINFO, err); - } - } - - iProcessor->writeINode(newDistributions, icellC, ix1, ix2, ix3); - //iProcessor->writeINodeInv(newDistributions, icellC, ix1, ix2, ix3); - } -} -////////////////////////////////////////////////////////////////////////// -void InitDistributionsWithInterpolationGridVisitor::interpolateRemoteBlockFineToCoarse(Block3DPtr oldBlock, Block3DPtr newBlock) -{ - int newGridRank = newGrid->getRank(); - int oldBlockRank = oldBlock->getRank(); - int newBlockRank = newBlock->getRank(); - - if (oldBlockRank == newGridRank) - { - ILBMKernelPtr oldKernel = oldBlock->getKernel(); - if (!oldKernel) - throw UbException(UB_EXARGS, "The LBM kernel isn't exist in block: "+oldBlock->toString()); - EsoTwist3DPtr oldDistributions = std::dynamic_pointer_cast<EsoTwist3D>(oldKernel->getDataSet()->getFdistributions()); - - CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr localDistributions = std::dynamic_pointer_cast<D3Q27EsoTwist3DSplittedVector>(oldDistributions)->getLocalDistributions(); - CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr nonLocalDistributions = std::dynamic_pointer_cast<D3Q27EsoTwist3DSplittedVector>(oldDistributions)->getNonLocalDistributions(); - CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr zeroDistributions = std::dynamic_pointer_cast<D3Q27EsoTwist3DSplittedVector>(oldDistributions)->getZeroDistributions(); - - MPI_Send(localDistributions->getStartAdressOfSortedArray(0, 0, 0, 0), (int)localDistributions->getDataVector().size(), MPI_DOUBLE, newBlockRank, 0, MPI_COMM_WORLD); - MPI_Send(nonLocalDistributions->getStartAdressOfSortedArray(0, 0, 0, 0), (int)nonLocalDistributions->getDataVector().size(), MPI_DOUBLE, newBlockRank, 0, MPI_COMM_WORLD); - MPI_Send(zeroDistributions->getStartAdressOfSortedArray(0, 0, 0), (int)zeroDistributions->getDataVector().size(), MPI_DOUBLE, newBlockRank, 0, MPI_COMM_WORLD); - - BCArray3DPtr bcArrayOldBlock = oldBlock->getKernel()->getBCProcessor()->getBCArray(); - std::vector< int >& bcDataVector = bcArrayOldBlock->getBcindexmatrixDataVector(); - MPI_Send(&bcDataVector[0], (int)bcDataVector.size(), MPI_INT, newBlockRank, 0, MPI_COMM_WORLD); - } - else if (newBlockRank == newGridRank && newBlock->isActive()) - { - LBMReal icellC[27]; - D3Q27ICell icellF; - LBMReal xoff, yoff, zoff; - - LBMReal omegaF = LBMSystem::calcCollisionFactor(nu, oldBlock->getLevel()); - LBMReal omegaC =LBMSystem::calcCollisionFactor(nu, newBlock->getLevel()); - - iProcessor->setOmegas(omegaC, omegaF); - - ILBMKernelPtr newKernel = newBlock->getKernel(); - if (!newKernel) - throw UbException(UB_EXARGS, "The LBM kernel isn't exist in new block: "+newBlock->toString()); - - EsoTwist3DPtr newDistributions = std::dynamic_pointer_cast<EsoTwist3D>(newKernel->getDataSet()->getFdistributions()); - - int minX1 = 0; - int minX2 = 0; - int minX3 = 0; - - int maxX1 = (int)newDistributions->getNX1()-1; - int maxX2 = (int)newDistributions->getNX2()-1; - int maxX3 = (int)newDistributions->getNX3()-1; - - int bMaxX1 = (int)newDistributions->getNX1(); - int bMaxX2 = (int)newDistributions->getNX2(); - int bMaxX3 = (int)newDistributions->getNX3(); - - EsoTwist3DPtr oldDistributions(new D3Q27EsoTwist3DSplittedVector(bMaxX1, bMaxX2, bMaxX3, 0)); - - CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr localDistributions = std::dynamic_pointer_cast<D3Q27EsoTwist3DSplittedVector>(oldDistributions)->getLocalDistributions(); - CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr nonLocalDistributions = std::dynamic_pointer_cast<D3Q27EsoTwist3DSplittedVector>(oldDistributions)->getNonLocalDistributions(); - CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr zeroDistributions = std::dynamic_pointer_cast<D3Q27EsoTwist3DSplittedVector>(oldDistributions)->getZeroDistributions(); - - MPI_Recv(localDistributions->getStartAdressOfSortedArray(0, 0, 0, 0), (int)localDistributions->getDataVector().size(), MPI_DOUBLE, oldBlockRank, 0, MPI_COMM_WORLD, MPI_STATUS_IGNORE); - MPI_Recv(nonLocalDistributions->getStartAdressOfSortedArray(0, 0, 0, 0), (int)nonLocalDistributions->getDataVector().size(), MPI_DOUBLE, oldBlockRank, 0, MPI_COMM_WORLD, MPI_STATUS_IGNORE); - MPI_Recv(zeroDistributions->getStartAdressOfSortedArray(0, 0, 0), (int)zeroDistributions->getDataVector().size(), MPI_DOUBLE, oldBlockRank, 0, MPI_COMM_WORLD, MPI_STATUS_IGNORE); - - BCArray3DPtr bcArrayOldBlock(new BCArray3D(bMaxX1, bMaxX2, bMaxX3, BCArray3D::FLUID)); - std::vector< int >& bcDataVector = bcArrayOldBlock->getBcindexmatrixDataVector(); - MPI_Recv(&bcDataVector[0], (int)bcDataVector.size(), MPI_INT, oldBlockRank, 0, MPI_COMM_WORLD, MPI_STATUS_IGNORE); - - for (int ix3 = minX3; ix3 < maxX3; ix3+=2) - for (int ix2 = minX2; ix2 < maxX2; ix2+=2) - for (int ix1 = minX1; ix1 < maxX1; ix1+=2) - { - Vector3D coords = newGrid->getNodeCoordinates(newBlock, ix1, ix2, ix3); - UbTupleInt3 oldGridIndexMin = oldGrid->getNodeIndexes(oldBlock, coords[0], coords[1], coords[2]); - - int howManySolids= iProcessor->iCellHowManySolids(bcArrayOldBlock, val<1>(oldGridIndexMin), val<2>(oldGridIndexMin), val<3>(oldGridIndexMin)); - - if (howManySolids == 0 || howManySolids == 8) - { - iProcessor->readICell(oldDistributions, icellF, val<1>(oldGridIndexMin), val<2>(oldGridIndexMin), val<3>(oldGridIndexMin)); - iProcessor->interpolateFineToCoarse(icellF, icellC); - } - else - { - if (iProcessor->findNeighborICell(bcArrayOldBlock, oldDistributions, icellF, bMaxX1, bMaxX2, bMaxX3, - val<1>(oldGridIndexMin), val<2>(oldGridIndexMin), val<3>(oldGridIndexMin), xoff, yoff, zoff)) - { - //std::string err = "For "+oldBlock->toString()+ - // " x1="+UbSystem::toString(val<1>(oldGridIndexMin))+ - // ", x2=" + UbSystem::toString(val<2>(oldGridIndexMin))+ - // ", x3=" + UbSystem::toString(val<3>(oldGridIndexMin))+ - // " interpolation is not implemented for other direction"+ - // " by using in: "+(std::string)typeid(*this).name()+ - // " or maybe you have a solid on the block boundary"; - //UB_THROW(UbException(UB_EXARGS, err)); - iProcessor->interpolateFineToCoarse(icellF, icellC, xoff, yoff, zoff); - } - else - { - for (int i=0; i<27; i++) - { - icellF.BSW[i]=0.0; - icellF.BSE[i]=0.0; - icellF.BNW[i]=0.0; - icellF.BNE[i]=0.0; - icellF.TSW[i]=0.0; - icellF.TSE[i]=0.0; - icellF.TNW[i]=0.0; - icellF.TNE[i]=0.0; - } - // std::string err = "For "+oldBlock->toString()+ - // " x1="+UbSystem::toString(val<1>(oldGridIndexMin))+ - // ", x2=" + UbSystem::toString(val<2>(oldGridIndexMin))+ - // ", x3=" + UbSystem::toString(val<3>(oldGridIndexMin))+ - // " interpolation is not implemented for other direction"+ - // " by using in: "+(std::string)typeid(*this).name()+ - // " or maybe you have a solid on the block boundary"; - ////UB_THROW(UbException(UB_EXARGS, err)); - // UBLOG(logINFO, err); - } - } - - iProcessor->writeINode(newDistributions, icellC, ix1, ix2, ix3); - //iProcessor->writeINodeInv(newDistributions, icellC, ix1, ix2, ix3); - } - } -} - -////////////////////////////////////////////////////////////////////////// diff --git a/src/VirtualFluids/Visitors/InitDistributionsWithInterpolationGridVisitor.h b/src/VirtualFluids/Visitors/InitDistributionsWithInterpolationGridVisitor.h deleted file mode 100644 index 3ff500e11..000000000 --- a/src/VirtualFluids/Visitors/InitDistributionsWithInterpolationGridVisitor.h +++ /dev/null @@ -1,34 +0,0 @@ -#ifndef InitDistributionsWithCoarseGridBlockVisitor_h__ -#define InitDistributionsWithCoarseGridBlockVisitor_h__ - -#include <memory> - -#include "Block3DVisitor.h" -#include "LBMSystem.h" - -class Grid3D; -class Block3D; -class InterpolationProcessor; - -class InitDistributionsWithInterpolationGridVisitor : public Block3DVisitor -{ -public: - InitDistributionsWithInterpolationGridVisitor(std::shared_ptr<Grid3D> oldGrid, std::shared_ptr<InterpolationProcessor> iProcessor, LBMReal nu); - ~InitDistributionsWithInterpolationGridVisitor(); - void visit(std::shared_ptr<Grid3D> grid); -private: - void copyLocalBlock(std::shared_ptr<Block3D> oldBlock, std::shared_ptr<Block3D> newBlock); - void copyRemoteBlock(std::shared_ptr<Block3D> oldBlock, std::shared_ptr<Block3D> newBlock); - void interpolateLocalBlockCoarseToFine(std::shared_ptr<Block3D> oldBlock, std::shared_ptr<Block3D> newBlock); - void interpolateRemoteBlockCoarseToFine(std::shared_ptr<Block3D> oldBlock, std::shared_ptr<Block3D> newBlock); - void interpolateLocalBlockFineToCoarse(std::shared_ptr<Block3D> oldBlock, std::shared_ptr<Block3D> newBlock); - void interpolateRemoteBlockFineToCoarse(std::shared_ptr<Block3D> oldBlock, std::shared_ptr<Block3D> newBlock); - - std::shared_ptr<Grid3D> newGrid; - std::shared_ptr<Grid3D> oldGrid; - LBMReal nu; - - std::shared_ptr<InterpolationProcessor> iProcessor; -}; - -#endif // InitDistributionsWithVelocityProfileBlockVisitor_h__ diff --git a/src/VirtualFluids/Visitors/MetisPartitioningGridVisitor.cpp b/src/VirtualFluids/Visitors/MetisPartitioningGridVisitor.cpp deleted file mode 100644 index c0c0a140d..000000000 --- a/src/VirtualFluids/Visitors/MetisPartitioningGridVisitor.cpp +++ /dev/null @@ -1,305 +0,0 @@ -#if defined VF_METIS && defined VF_MPI - -#include "MetisPartitioningGridVisitor.h" -#include <math.h> -#include "Block3D.h" -#include "Grid3D.h" -#include "Communicator.h" - -using namespace std; - -MetisPartitioningGridVisitor::MetisPartitioningGridVisitor(CommunicatorPtr comm, GraphType graphType, int numOfDirs, MetisPartitioner::PartType partType, bool threads, int numberOfThreads) - : Grid3DVisitor(), - numberOfThreads(numberOfThreads), - numOfDirs(numOfDirs), - comm(comm), - threads(threads), - graphType(graphType), - partType(partType) -{ - numberOfProcesses = comm->getNumberOfProcesses(); -} -////////////////////////////////////////////////////////////////////////// -MetisPartitioningGridVisitor::~MetisPartitioningGridVisitor() -{ - -} -////////////////////////////////////////////////////////////////////////// -void MetisPartitioningGridVisitor::visit(Grid3DPtr grid) -{ - UBLOG(logDEBUG1, "MetisPartitioningGridVisitor::visit() - start"); - - this->clear(); - - bundleRoot = comm->getBundleRoot(); - bundleID = comm->getBundleID(); - numberOfBundles = comm->getNumberOfBundles(); - if (numberOfBundles > 1) - { - if (bundleRoot == bundleID && processRoot == processID) - collectData(grid, numberOfBundles, BUNDLE); - comm->broadcast(blockID); - comm->broadcast(parts); - distributePartitionData(grid, BUNDLE); - this->clear(); - } - - processRoot = comm->getProcessRoot(); - processID = comm->getProcessID(); - /*int numberOfProcesses = comm->getNumberOfProcesses();*/ - if (numberOfProcesses > 1) - { - int temp = bundleID; - for (int i = 0; i < numberOfBundles; i++) - { - if (bundleRoot == bundleID && processRoot == processID) - { - bundleID = i; - //numberOfProcesses = comm->getNumberOfProcessesInBundle(i); - collectData(grid, numberOfProcesses, PROCESS); - bundleID = temp; - } - comm->broadcast(blockID); - //UBLOG(logINFO, "blockID="<<blockID.size()); - comm->broadcast(parts); - //UBLOG(logINFO, "parts="<<parts.size()); - distributePartitionData(grid, PROCESS); - } - } - - if (threads) - { - if (numberOfThreads > 1) - { - collectData(grid, numberOfThreads, THREAD); - distributePartitionData(grid, THREAD); - } - } - UBLOG(logDEBUG1, "MetisPartitioningGridVisitor::visit() - end"); -} -////////////////////////////////////////////////////////////////////////// -void MetisPartitioningGridVisitor::collectData(Grid3DPtr grid, int nofSegments, PartLevel level) -{ - clear(); - - switch (graphType) - { - case LevelIntersected: - buildMetisGraphLevelIntersected(grid, nofSegments, level); - break; - case LevelBased: - buildMetisGraphLevelBased(grid, nofSegments, level); - break; - } -} -////////////////////////////////////////////////////////////////////////// -void MetisPartitioningGridVisitor::distributePartitionData(Grid3DPtr grid, PartLevel level) -{ - Block3DPtr block; - - for(size_t p=0; p<parts.size(); p++) - { - block = grid->getBlock(blockID[p]); - if (block) - { - switch (level) - { - case BUNDLE: - block->setBundle(parts[p]); - break; - case PROCESS: - if (numberOfBundles == 1) - { - block->setRank(parts[p]); - } - else - { - block->setLocalRank(parts[p]); - block->setRank(comm->getProcessID(block->getBundle(),parts[p])); - } - break; - case THREAD: - block->setPart(parts[p]); - break; - } - } - } -} -////////////////////////////////////////////////////////////////////////// -void MetisPartitioningGridVisitor::buildMetisGraphLevelIntersected(Grid3DPtr grid, int nofSegments, PartLevel level) -{ - int edges = 0; - const int edgeWeight= 1; - const int edgeWeightChildFactor = 8; - int n = 0; - - for(Grid3D::BlockIDMap::value_type b : grid->getBlockIDs()) - { - Block3DPtr block = b.second; - if (this->getPartitionCondition(block, level)) - { - block->setLocalID(n); - blockID.push_back(block->getGlobalID()); - n++; - } - } - - MetisPartitioner metis; - - for(Grid3D::BlockIDMap::value_type b : grid->getBlockIDs()) - { - const Block3DPtr block = b.second; - if (this->getPartitionCondition(block, level)) - { - metis.xadj.push_back(edges); - //the weights of the vertices are 2^level of grid (1, 2, 4, 8 .....) 1<<level - metis.vwgt.push_back((idx_t)(1<<block->getLevel())); - - for( int dir = 0; dir <= numOfDirs; dir++) - { - Block3DPtr neighBlock = grid->getNeighborBlock(dir, block); - if(neighBlock) - { - if (this->getPartitionCondition(neighBlock, level)) - { - edges++; - metis.adjwgt.push_back(edgeWeight); - metis.adjncy.push_back(neighBlock->getLocalID()); - } - } - } - vector<Block3DPtr> subBlocks; - grid->getSubBlocks(block, 1, subBlocks); - for(Block3DPtr subBlock : subBlocks) - { - if (subBlock) - { - if (this->getPartitionCondition(subBlock, level)) - { - edges++; - metis.adjwgt.push_back(edgeWeight*edgeWeightChildFactor); - metis.adjncy.push_back(subBlock->getLocalID()); - } - } - } - } - } - - metis.xadj.push_back(static_cast<idx_t>(metis.adjncy.size())); - if ((metis.adjncy.size()%2)!=0) - throw UbException(UB_EXARGS,"number of edges is odd - probable adjncy-vector doesn't contain all pairs (A->B) and (B->A)!!!" ); - - - metis.partition(nofSegments, partType); - parts = metis.part; -} -////////////////////////////////////////////////////////////////////////// -void MetisPartitioningGridVisitor::buildMetisGraphLevelBased(Grid3DPtr grid, int nofSegments, PartLevel level) -{ - int minInitLevel = grid->getCoarsestInitializedLevel(); - int maxInitLevel = grid->getFinestInitializedLevel(); - - for(int l = minInitLevel; l<=maxInitLevel;l++) - { - int n = 0; - vector<Block3DPtr> blockVector; - grid->getBlocks(l, blockVector); - vector<Block3DPtr> tBlockID; - - for(Block3DPtr block : blockVector) - { - if (this->getPartitionCondition(block, level)) - { - block->setLocalID(n); - blockID.push_back(block->getGlobalID()); - tBlockID.push_back(block); - n++; - } - } - - if (tBlockID.size() == 0) - { - UB_THROW(UbException(UB_EXARGS,"Blocks for decomposition don't exist!")); - } - - MetisPartitioner metis; - - const int vertexWeight = 1; - int edges = 0; - const int edgeWeight= 1; - - for(Block3DPtr block : tBlockID) - { - metis.xadj.push_back(edges); - metis.vwgt.push_back(vertexWeight); - - for( int dir = 0; dir <= numOfDirs; dir++) - { - Block3DPtr neighBlock = grid->getNeighborBlock(dir, block); - if(neighBlock) - { - if (this->getPartitionCondition(neighBlock, level)) - { - edges++; - metis.adjwgt.push_back(edgeWeight); - metis.adjncy.push_back(neighBlock->getLocalID()); - } - } - } - } - metis.xadj.push_back(static_cast<idx_t>(metis.adjncy.size())); - if ((metis.adjncy.size()%2)!=0) - throw UbException(UB_EXARGS,"number of edges is odd - probable adjncy-vector doesn't contain all pairs (A->B) and (B->A)!!!" ); - - int nofBlocks = grid->getNumberOfBlocks(l); - int tnofSegments = nofSegments; - if (nofBlocks < nofSegments) - { - tnofSegments = nofBlocks; - } - metis.partition(tnofSegments, partType); - - for(idx_t p : metis.part) - { - parts.push_back(p); - } - } -} -////////////////////////////////////////////////////////////////////////// -bool MetisPartitioningGridVisitor::getPartitionCondition(Block3DPtr block, PartLevel level) -{ - if (level == BUNDLE) - { - return true; - } - else if(level == PROCESS) - { - if (block->getBundle() == bundleID) - { - return true; - } - } - else if(level == THREAD) - { - if (block->getBundle() == bundleID && block->getRank() == processID) - { - return true; - } - } - - return false; -} -////////////////////////////////////////////////////////////////////////// -void MetisPartitioningGridVisitor::clear() -{ - blockID.clear(); - parts.clear(); -} -////////////////////////////////////////////////////////////////////////// -void MetisPartitioningGridVisitor::setNumberOfProcesses(int np) -{ - numberOfProcesses = np; -} - - -#endif //VF_METIS diff --git a/src/VirtualFluids/Visitors/MetisPartitioningGridVisitor.h b/src/VirtualFluids/Visitors/MetisPartitioningGridVisitor.h deleted file mode 100644 index 0649c4296..000000000 --- a/src/VirtualFluids/Visitors/MetisPartitioningGridVisitor.h +++ /dev/null @@ -1,70 +0,0 @@ -#ifndef MetisPartitioningGridVisitor_h -#define MetisPartitioningGridVisitor_h - -#if defined VF_METIS && defined VF_MPI - -#include <vector> -#include <memory> - -#include "Grid3DVisitor.h" -#include "MetisPartitioner.h" - - -class Communicator; - -class MetisPartitioningGridVisitor; -typedef std::shared_ptr<MetisPartitioningGridVisitor> PartitionMetisGridVisitorPtr; - -//////////////////////////////////////////////////////////////////////// -//! \brief The class implements domain decomposition with METIS library -//! \author Kostyantyn Kucher -////////////////////////////////////////////////////////////////////////// - -class Grid3D; -class Block3D; - -class MetisPartitioningGridVisitor : public Grid3DVisitor -{ -public: - //! This describe different types of decomposition - enum GraphType{LevelIntersected, LevelBased}; - -public: - //! Constructor - //! \param comm - communicator - //! \param graphType - type of decomposition - //! \param numOfDirs - maximum number of neighbors for each process - //! \param threads - on/off decomposition for threads - //! \param numberOfThreads - number of threads - MetisPartitioningGridVisitor(std::shared_ptr<Communicator> comm, GraphType graphType, int numOfDirs, MetisPartitioner::PartType partType = MetisPartitioner::KWAY, bool threads = false, int numberOfThreads = 0); - virtual ~MetisPartitioningGridVisitor(); - void visit(std::shared_ptr<Grid3D> grid) override; - void setNumberOfProcesses(int np); - -protected: - enum PartLevel {BUNDLE, PROCESS, THREAD}; - void collectData(std::shared_ptr<Grid3D> grid, int nofSegments, PartLevel level); - void buildMetisGraphLevelIntersected(std::shared_ptr<Grid3D> grid, int nofSegments, PartLevel level); - void buildMetisGraphLevelBased(std::shared_ptr<Grid3D> grid, int nofSegments, PartLevel level); - bool getPartitionCondition(std::shared_ptr<Block3D> block, PartLevel level); - void distributePartitionData(std::shared_ptr<Grid3D> grid, PartLevel level); - void clear(); - int nofSegments; - int numOfDirs; - std::vector<int> blockID; - std::vector<idx_t> parts; - std::shared_ptr<Communicator> comm; - int bundleRoot; - int processRoot; - int bundleID; - int processID; - int numberOfBundles; - int numberOfThreads; - bool threads; - GraphType graphType; - MetisPartitioner::PartType partType; - int numberOfProcesses; -}; - -#endif //VF_MPI -#endif diff --git a/src/VirtualFluids/Visitors/OverlapBlockVisitor.cpp b/src/VirtualFluids/Visitors/OverlapBlockVisitor.cpp deleted file mode 100644 index b1b8f34a1..000000000 --- a/src/VirtualFluids/Visitors/OverlapBlockVisitor.cpp +++ /dev/null @@ -1,60 +0,0 @@ -#include "OverlapBlockVisitor.h" -#include "Grid3DSystem.h" -#include "Block3D.h" -#include "Grid3D.h" - -OverlapBlockVisitor::OverlapBlockVisitor(int levelDepth/*shut be maxGridLevel*/, bool includeNotActiveBlocks) - : Block3DVisitor(0, Grid3DSystem::MAXLEVEL) - , levelDepth(levelDepth) - , includeNotActiveBlocks(includeNotActiveBlocks) -{ -} -////////////////////////////////////////////////////////////////////////// -void OverlapBlockVisitor::visit(Grid3DPtr grid, Block3DPtr block) -{ - int ix1, ix2, ix3, level; - ix1 = block->getX1(); - ix2 = block->getX2(); - ix3 = block->getX3(); - level = block->getLevel(); - - int nix1, nix2,nix3, nlev; - int neighix1, neighix2, neighix3, neighlev; - std::vector<Block3DPtr> neighbors; - grid->getAllNeighbors(ix1, ix2, ix3, level, this->levelDepth, neighbors); - bool hasAdded = false; - for(size_t i=0; i<neighbors.size(); i++) - { - if( ( neighbors[i]->isActive() || includeNotActiveBlocks ) - && neighbors[i]->getLevel() > level) - { - neighix1 = neighbors[i]->getX1(); - neighix2 = neighbors[i]->getX2(); - neighix3 = neighbors[i]->getX3(); - neighlev = neighbors[i]->getLevel(); - nix1 = neighix1>>1; - nix2 = neighix2>>1; - nix3 = neighix3>>1; - nlev = neighlev-1; - - if(nlev != level) - { - throw UbException(UB_EXARGS, "OverlapBlockVisitor::adaptBlock - leveldifferenz passt nicht, block: " + block->toString()); - } - - Block3DPtr newBlock = grid->getBlock(nix1,nix2,nix3,nlev); - if(!newBlock) - { - newBlock = Block3DPtr(new Block3D(nix1,nix2,nix3,nlev)); - grid->addBlock(newBlock); - hasAdded=true; - } - } - } -} -////////////////////////////////////////////////////////////////////////// -std::string OverlapBlockVisitor::getSpecificDescription() -{ - std::string str("Overlap:"); - return str; -} diff --git a/src/VirtualFluids/Visitors/OverlapBlockVisitor.h b/src/VirtualFluids/Visitors/OverlapBlockVisitor.h deleted file mode 100644 index ca875bdd7..000000000 --- a/src/VirtualFluids/Visitors/OverlapBlockVisitor.h +++ /dev/null @@ -1,31 +0,0 @@ -#ifndef OverlapBlockVisitor_H -#define OverlapBlockVisitor_H - -#include <string> -#include <memory> - -#include "Block3DVisitor.h" - -class Grid3D; -class Block3D; - -class OverlapBlockVisitor : public Block3DVisitor -{ -public: - OverlapBlockVisitor(int levelDepth, bool includeNotActiveBlocks = true); - - virtual ~OverlapBlockVisitor(){} - - bool isIterative() { return false; } - - std::string getSpecificDescription(); - - void visit(std::shared_ptr<Grid3D> grid, std::shared_ptr<Block3D> block) override; - - -private: - int levelDepth; - bool includeNotActiveBlocks; -}; - -#endif //OverlapBlockVisitor_H diff --git a/src/VirtualFluids/Visitors/PQueuePartitioningGridVisitor.cpp b/src/VirtualFluids/Visitors/PQueuePartitioningGridVisitor.cpp deleted file mode 100644 index 9321ceeee..000000000 --- a/src/VirtualFluids/Visitors/PQueuePartitioningGridVisitor.cpp +++ /dev/null @@ -1,54 +0,0 @@ -#include "PQueuePartitioningGridVisitor.h" - -#include <vector> - -#include "PriorityQueueDecompositor.h" -#include "Grid3D.h" -#include "Block3D.h" -#include "UbLogger.h" - - -PQueuePartitioningGridVisitor::PQueuePartitioningGridVisitor(int numOfParts) : numOfParts(numOfParts) -{ - -} -////////////////////////////////////////////////////////////////////////// -void PQueuePartitioningGridVisitor::visit(Grid3DPtr grid) -{ - UBLOG(logDEBUG5, "PQueuePartitioningGridVisitor::visit() - start"); - std::vector<Block3DPtr> blocks; - std::vector<int> weights; - std::vector< std::vector <Block3DPtr> > parts; - int gridRank = grid->getRank(); - - int minInitLevel = grid->getCoarsestInitializedLevel(); - int maxInitLevel = grid->getFinestInitializedLevel(); - - for(int level = minInitLevel; level<=maxInitLevel; level++) - { - std::vector<Block3DPtr> blockVector; - grid->getBlocks(level, gridRank, true, blockVector); - for(Block3DPtr block : blockVector) - { - if (block) - { - blocks.push_back(block); - weights.push_back(block->getNumberOfLocalConnectors()*(1<<block->getLevel())); - } - } - } - PriorityQueueDecompositor <Block3DPtr> dec = PriorityQueueDecompositor <Block3DPtr> (blocks, weights, numOfParts); - dec.getDecomposition(parts); - - int i = 0; - for(std::vector<Block3DPtr> p : parts) - { - for(Block3DPtr block : p) - { - block->setPart(i); - } - i++; - - } - UBLOG(logDEBUG5, "PQueuePartitioningGridVisitor::visit() - end"); -} diff --git a/src/VirtualFluids/Visitors/PQueuePartitioningGridVisitor.h b/src/VirtualFluids/Visitors/PQueuePartitioningGridVisitor.h deleted file mode 100644 index 131671e28..000000000 --- a/src/VirtualFluids/Visitors/PQueuePartitioningGridVisitor.h +++ /dev/null @@ -1,27 +0,0 @@ -/** -* @file PQueuePartitioningPatchVisitor.h -* @brief Visitor class which apply Priority Queue for threads decomposition. -* @author Kostyantyn Kucher -* @date 06.06.2011 -*/ -#ifndef PQUEUEPARTITIONINGPATCHVISITOR_H -#define PQUEUEPARTITIONINGPATCHVISITOR_H - -#include <memory> - -#include "Grid3DVisitor.h" - -class Grid3D; - -class PQueuePartitioningGridVisitor : public Grid3DVisitor -{ -public: - PQueuePartitioningGridVisitor(int numOfParts); - - void visit(std::shared_ptr<Grid3D> grid) override; - -private: - int numOfParts; -}; - -#endif diff --git a/src/VirtualFluids/Visitors/RatioBlockVisitor.cpp b/src/VirtualFluids/Visitors/RatioBlockVisitor.cpp deleted file mode 100644 index e5d58af41..000000000 --- a/src/VirtualFluids/Visitors/RatioBlockVisitor.cpp +++ /dev/null @@ -1,129 +0,0 @@ -#include "RatioBlockVisitor.h" -#include "Grid3DSystem.h" -#include "Grid3D.h" -#include "Block3D.h" - -RatioBlockVisitor::RatioBlockVisitor(int levelDepth, bool includeNotActiveBlocks) - : Block3DVisitor(0, Grid3DSystem::MAXLEVEL) - , maxLevelRatio(1) - , expandBlocks(true) - , levelDepth(levelDepth) - , includeNotActiveBlocks(includeNotActiveBlocks) -{ - -} -////////////////////////////////////////////////////////////////////////// -void RatioBlockVisitor::visit(Grid3DPtr grid, Block3DPtr block) -{ - int ix1, ix2, ix3, level; - ix1 = block->getX1(); - ix2 = block->getX2(); - ix3 = block->getX3(); - level = block->getLevel(); - - if( block->isActive() || includeNotActiveBlocks ) - { - if(this->expandBlocks) - { - if(this->lookForExpand(grid,ix1, ix2, ix3, level)) - { - grid->expandBlock(ix1, ix2, ix3, level); - } - } - else - { - if(this->lookForCollapse(grid,ix1, ix2, ix3, level)) - { - grid->collapseBlock(ix1, ix2, ix3, level, levelDepth); - } - } - } -} -////////////////////////////////////////////////////////////////////////// -bool RatioBlockVisitor::lookForExpand(Grid3DPtr grid, const int& ix1, const int& ix2, const int& ix3, const int& level) -{ - std::vector<Block3DPtr> neighbors; - grid->getAllNeighbors(ix1, ix2, ix3, level, this->levelDepth, neighbors); - for(size_t i=0; i<neighbors.size(); i++) - { - if( ( neighbors[i]->isActive() || includeNotActiveBlocks ) - && neighbors[i]->getLevel() > level+this->maxLevelRatio) - { - return true; - } - } - - return false; -} -////////////////////////////////////////////////////////////////////////// -bool RatioBlockVisitor::lookForCollapse(Grid3DPtr grid, const int& ix1, const int& ix2, const int& ix3, const int& level) -{ - std::vector<Block3DPtr> neighbors; - grid->getAllNeighbors(ix1, ix2,ix3, level, this->levelDepth, neighbors); - for(size_t i=0; i<neighbors.size(); i++) - { - if( ( neighbors[i]->isActive() || includeNotActiveBlocks ) - && neighbors[i]->getLevel() < level-this->maxLevelRatio) - { - return true; - } - } - - return false; -} -////////////////////////////////////////////////////////////////////////// -void RatioBlockVisitor::setExpandByAdaptation(bool expandBlocks) -{ - if(this->expandBlocks != expandBlocks) - { - this->expandBlocks = expandBlocks; - - int l1 = Block3DVisitor::getStartLevel(); - int l2 = Block3DVisitor::getStopLevel(); - - if(expandBlocks) { if(l1 < l2) { Block3DVisitor::setStartLevel(l2); Block3DVisitor::setStopLevel(l1); } } - else { if(l2 < l1) { Block3DVisitor::setStartLevel(l2); Block3DVisitor::setStopLevel(l1); } } - } -} -////////////////////////////////////////////////////////////////////////// -void RatioBlockVisitor::setLevelRatio(int ratio) -{ - if(ratio < 1) throw UbException(UB_EXARGS,"illegal ratio specified"); - this->maxLevelRatio = ratio; -} -////////////////////////////////////////////////////////////////////////// -std::string RatioBlockVisitor::getSpecificDescription() -{ - std::string str("Ratio:"); - return str; -} -////////////////////////////////////////////////////////////////////////// -int RatioBlockVisitor::getStartLevel() -{ - int l1 = Block3DVisitor::getStartLevel(); - int l2 = Block3DVisitor::getStopLevel(); - - if(this->expandBlocks) { if(l2 < l1) return(l1); else return(l2); } - else { if(l2 < l1) return(l2); else return(l1); } -} -////////////////////////////////////////////////////////////////////////// -int RatioBlockVisitor::getStopLevel() -{ - int l1 = Block3DVisitor::getStartLevel(); - int l2 = Block3DVisitor::getStopLevel(); - - if(this->expandBlocks) { if(l2 < l1) return(l2); else return(l1); } - else { if(l2 < l1) return(l1); else return(l2); } -} -////////////////////////////////////////////////////////////////////////// -void RatioBlockVisitor::setStartLevel(int level) -{ - if(this->expandBlocks) { if(level >= Block3DVisitor::getStopLevel()) Block3DVisitor::setStartLevel(level); } - else { if(level <= Block3DVisitor::getStopLevel()) Block3DVisitor::setStartLevel(level); } -} -////////////////////////////////////////////////////////////////////////// -void RatioBlockVisitor::setStopLevel(int level) -{ - if(this->expandBlocks) { if(level <= Block3DVisitor::getStartLevel()) Block3DVisitor::setStopLevel(level); } - else { if(level >= Block3DVisitor::getStartLevel()) Block3DVisitor::setStopLevel(level); } -} diff --git a/src/VirtualFluids/Visitors/RatioBlockVisitor.h b/src/VirtualFluids/Visitors/RatioBlockVisitor.h deleted file mode 100644 index ccf0ffd8f..000000000 --- a/src/VirtualFluids/Visitors/RatioBlockVisitor.h +++ /dev/null @@ -1,49 +0,0 @@ -#ifndef RatioBlockVisitor_H -#define RatioBlockVisitor_H - -#include <string> -#include <memory> - -#include "Block3DVisitor.h" - -class Grid3D; -class Block3D; - -class RatioBlockVisitor : public Block3DVisitor -{ -public: - RatioBlockVisitor(int levelDepth, bool includeNotActiveBlocks = false); - - virtual ~RatioBlockVisitor() {} - - bool expandsByAdaptation() { return this->expandBlocks; } - - void setExpandByAdaptation(bool expandBlocks); - - int getLevelRatio() { return this->maxLevelRatio; } - bool isIterative() { return true; } - - void setLevelRatio(int ratio); - - int getStartLevel(); - int getStopLevel(); - - void setStartLevel(int level); - void setStopLevel(int level); - - std::string getSpecificDescription(); - - void visit(std::shared_ptr<Grid3D> grid, std::shared_ptr<Block3D> block) override; - -protected: - bool lookForExpand(std::shared_ptr<Grid3D> grid, const int& ix1, const int& ix2, const int& ix3, const int& level); - bool lookForCollapse(std::shared_ptr<Grid3D> grid, const int& ix1, const int& ix2, const int& ix3, const int& level); - -private: - int maxLevelRatio; - bool expandBlocks; - int levelDepth; - bool includeNotActiveBlocks; -}; - -#endif diff --git a/src/VirtualFluids/Visitors/RatioSmoothBlockVisitor.cpp b/src/VirtualFluids/Visitors/RatioSmoothBlockVisitor.cpp deleted file mode 100644 index 621fe1dc2..000000000 --- a/src/VirtualFluids/Visitors/RatioSmoothBlockVisitor.cpp +++ /dev/null @@ -1,145 +0,0 @@ -#include "RatioSmoothBlockVisitor.h" -#include "Grid3DSystem.h" -#include "Block3D.h" -#include "Grid3D.h" - -RatioSmoothBlockVisitor::RatioSmoothBlockVisitor(int levelDepth, bool includeNotActiveBlocks) - : Block3DVisitor(Grid3DSystem::MAXLEVEL, 0) - , maxLevelRatio(1) - , expandBlocks(true) - , levelDepth(levelDepth) - , includeNotActiveBlocks(includeNotActiveBlocks) -{ -} -////////////////////////////////////////////////////////////////////////// -void RatioSmoothBlockVisitor::visit(Grid3DPtr grid, Block3DPtr block) -{ - int ix1, ix2, ix3, level; - ix1 = block->getX1(); - ix2 = block->getX2(); - ix3 = block->getX3(); - level = block->getLevel(); - - if( block->isActive() || includeNotActiveBlocks ) - { - if(this->expandBlocks) - { - if(this->lookForExpand(grid,ix1, ix2, ix3, level)) - { - grid->expandBlock(ix1, ix2, ix3, level); - } - } - else - { - if(this->lookForCollapse(grid,ix1, ix2, ix3, level)) - { - grid->collapseBlock(ix1, ix2, ix3, level, levelDepth); - } - } - } -} - -////////////////////////////////////////////////////////////////////////// -bool RatioSmoothBlockVisitor::lookForExpand(Grid3DPtr grid, const int& ix1, const int& ix2, const int& ix3, const int& level) -{ - std::vector<Block3DPtr> neighbors; - grid->getAllNeighbors(ix1, ix2, ix3, level, this->levelDepth, neighbors); - int nix1, nix2,nix3, nlev; - for(size_t i=0; i<neighbors.size(); i++) - { - if( ( neighbors[i]->isActive() || includeNotActiveBlocks ) - && neighbors[i]->getLevel() > level) - { - nix1 = (neighbors)[i]->getX1(); - nix2 = (neighbors)[i]->getX2(); - nix3 = (neighbors)[i]->getX3(); - nlev = (neighbors)[i]->getLevel(); - - std::vector<Block3DPtr> neighbors1; - grid->getAllNeighbors(nix1, nix2, nix3, nlev, nlev+1, neighbors1); - for(size_t j=0; j<neighbors1.size(); j++) - { - if( ( neighbors1[j]->isActive() || includeNotActiveBlocks ) - && neighbors1[j]->getLevel() > level+this->maxLevelRatio) - { - return true; - } - } - } - } - return false; -} -////////////////////////////////////////////////////////////////////////// -bool RatioSmoothBlockVisitor::lookForCollapse(Grid3DPtr grid, const int& ix1, const int& ix2, const int& ix3, const int& level) -{ - std::vector<Block3DPtr> neighbors; - grid->getAllNeighbors(ix1, ix2,ix3, level, this->levelDepth, neighbors); - for(size_t i=0; i<neighbors.size(); i++) - { - if( ( neighbors[i]->isActive() || includeNotActiveBlocks ) - && neighbors[i]->getLevel() < level-this->maxLevelRatio) - { - throw UbException(UB_EXARGS," not implemented till now"); - return true; - } - } - - return false; -} -////////////////////////////////////////////////////////////////////////// -void RatioSmoothBlockVisitor::setExpandByAdaptation(bool expandBlocks) -{ - if(this->expandBlocks != expandBlocks) - { - this->expandBlocks = expandBlocks; - - int l1 = Block3DVisitor::getStartLevel(); - int l2 = Block3DVisitor::getStopLevel(); - - if(expandBlocks) { if(l1 < l2) { Block3DVisitor::setStartLevel(l2); Block3DVisitor::setStopLevel(l1); } } - else { if(l2 < l1) { Block3DVisitor::setStartLevel(l2); Block3DVisitor::setStopLevel(l1); } } - } -} -////////////////////////////////////////////////////////////////////////// -void RatioSmoothBlockVisitor::setLevelRatio(int ratio) -{ - if(ratio < 1) throw UbException(UB_EXARGS,"illegal ratio specified"); - this->maxLevelRatio = ratio; -} -////////////////////////////////////////////////////////////////////////// -std::string RatioSmoothBlockVisitor::getSpecificDescription() -{ - std::string str("Ratio:"); - return str; -} -////////////////////////////////////////////////////////////////////////// -int RatioSmoothBlockVisitor::getStartLevel() -{ - int l1 = Block3DVisitor::getStartLevel(); - int l2 = Block3DVisitor::getStopLevel(); - - if(this->expandBlocks) { if(l2 < l1) return(l1); else return(l2); } - else { if(l2 < l1) return(l2); else return(l1); } -} -////////////////////////////////////////////////////////////////////////// -int RatioSmoothBlockVisitor::getStopLevel() -{ - int l1 = Block3DVisitor::getStartLevel(); - int l2 = Block3DVisitor::getStopLevel(); - - if(this->expandBlocks) { if(l2 < l1) return(l2); else return(l1); } - else { if(l2 < l1) return(l1); else return(l2); } -} -////////////////////////////////////////////////////////////////////////// -void RatioSmoothBlockVisitor::setStartLevel(int level) -{ - if(this->expandBlocks) { if(level >= Block3DVisitor::getStopLevel()) Block3DVisitor::setStartLevel(level); } - else { if(level <= Block3DVisitor::getStopLevel()) Block3DVisitor::setStartLevel(level); } -} -////////////////////////////////////////////////////////////////////////// -void RatioSmoothBlockVisitor::setStopLevel(int level) -{ - if(this->expandBlocks) { if(level <= Block3DVisitor::getStartLevel()) Block3DVisitor::setStopLevel(level); } - else { if(level >= Block3DVisitor::getStartLevel()) Block3DVisitor::setStopLevel(level); } -} - diff --git a/src/VirtualFluids/Visitors/RatioSmoothBlockVisitor.h b/src/VirtualFluids/Visitors/RatioSmoothBlockVisitor.h deleted file mode 100644 index 34b0eba6e..000000000 --- a/src/VirtualFluids/Visitors/RatioSmoothBlockVisitor.h +++ /dev/null @@ -1,49 +0,0 @@ -#ifndef RatioSmoothBlockVisitor_H -#define RatioSmoothBlockVisitor_H - -#include <string> - -#include "Block3DVisitor.h" - -class Grid3D; -class Block3D; - -class RatioSmoothBlockVisitor : public Block3DVisitor -{ -public: - RatioSmoothBlockVisitor(int levelDepth, bool includeNotActiveBlocks = false); - - virtual ~RatioSmoothBlockVisitor() {} - - bool expandsByAdaptation() { return this->expandBlocks; } - - void setExpandByAdaptation(bool expandBlocks); - - int getLevelRatio() { return this->maxLevelRatio; } - bool isIterative() { return true; } - - void setLevelRatio(int ratio); - - int getStartLevel(); - int getStopLevel(); - - void setStartLevel(int level); - void setStopLevel(int level); - - std::string getSpecificDescription(); - - void visit(std::shared_ptr<Grid3D> grid, std::shared_ptr<Block3D> block) override; - -protected: - bool lookForExpand(std::shared_ptr<Grid3D> grid, const int& ix1, const int& ix2, const int& ix3, const int& level); - bool lookForCollapse(std::shared_ptr<Grid3D> grid, const int& ix1, const int& ix2, const int& ix3, const int& level); - -private: - int maxLevelRatio; - bool expandBlocks; - int levelDepth; - bool includeNotActiveBlocks; - -}; - -#endif //RatioSmoothBlockVisitor_H diff --git a/src/VirtualFluids/Visitors/RefineAroundGbObjectHelper.cpp b/src/VirtualFluids/Visitors/RefineAroundGbObjectHelper.cpp deleted file mode 100644 index cb9a2cecf..000000000 --- a/src/VirtualFluids/Visitors/RefineAroundGbObjectHelper.cpp +++ /dev/null @@ -1,55 +0,0 @@ -#include "RefineAroundGbObjectHelper.h" -#include "RatioBlockVisitor.h" -#include "RatioSmoothBlockVisitor.h" -#include "OverlapBlockVisitor.h" -#include "SetInterpolationDirsBlockVisitor.h" -#include <D3Q27System.h> -#include <Grid3D.h> -#include <D3Q27TriFaceMeshInteractor.h> -#include "Communicator.h" - -RefineAroundGbObjectHelper::RefineAroundGbObjectHelper(Grid3DPtr grid, int refineLevel, D3Q27TriFaceMeshInteractorPtr objectIter, double startDistance, double stopDistance, CommunicatorPtr comm) : - grid(grid), - refineLevel(refineLevel), - objectIter(objectIter), - startDistance(startDistance), - stopDistance(stopDistance), - comm(comm) -{ -} -////////////////////////////////////////////////////////////////////////// -RefineAroundGbObjectHelper::~RefineAroundGbObjectHelper(void) -{ -} -////////////////////////////////////////////////////////////////////////// -void RefineAroundGbObjectHelper::refine() -{ - UBLOG(logDEBUG5,"RefineCrossAndInsideGbObjectHelper: refine - start"); - - int rank = grid->getRank(); - grid->setRank(0); - - objectIter->refineBlockGridToLevel(refineLevel, startDistance, stopDistance); - - RatioBlockVisitor ratioVisitor(refineLevel); - grid->accept(ratioVisitor); - - RatioSmoothBlockVisitor ratioSmoothVisitor(refineLevel); - grid->accept(ratioSmoothVisitor); - - OverlapBlockVisitor overlapVisitor(refineLevel, false); - grid->accept(overlapVisitor); - - std::vector<int> dirs; - for (int i=D3Q27System::E; i<=D3Q27System::TS; i++) - { - dirs.push_back(i); - } - SetInterpolationDirsBlockVisitor interDirsVisitor(dirs); - grid->accept(interDirsVisitor); - - grid->setRank(rank); - - UBLOG(logDEBUG5,"RefineCrossAndInsideGbObjectHelper: refine - end"); -} - diff --git a/src/VirtualFluids/Visitors/RefineAroundGbObjectHelper.h b/src/VirtualFluids/Visitors/RefineAroundGbObjectHelper.h deleted file mode 100644 index 0e8439a96..000000000 --- a/src/VirtualFluids/Visitors/RefineAroundGbObjectHelper.h +++ /dev/null @@ -1,34 +0,0 @@ -#ifndef RefineAroundGbObjectHelper_H -#define RefineAroundGbObjectHelper_H - -#include <memory> - -class Grid3D; -class Communicator; -class D3Q27TriFaceMeshInteractor; - -//! \brief Refine blocks on base of bounding boxes. -//! \details You need to use <i>addGbObject()</i> to add corresponding bounding boxes. Then call <i>refine()</i>. -//! \author K. Kucher -class RefineAroundGbObjectHelper -{ -public: - //! Constructor - //! \param grid a smart pointer to the grid object - //! \param maxRefineLevel an integer for maximal refinement level - //! \param objectIter a D3Q27TriFaceMeshInteractor object - represent geometry which should be refinement - //! \param startDistance start distance from geometry for refinement - //! \param stopDistance stop distance from geometry for refinement - RefineAroundGbObjectHelper(std::shared_ptr<Grid3D> grid, int maxRefineLevel, std::shared_ptr<D3Q27TriFaceMeshInteractor> objectIter, double startDistance, double stopDistance, std::shared_ptr<Communicator> comm); - virtual ~RefineAroundGbObjectHelper(void); - //! start refinement - void refine(); -private: - std::shared_ptr<Grid3D> grid; - std::shared_ptr<D3Q27TriFaceMeshInteractor> objectIter; - int refineLevel; - double startDistance, stopDistance; - std::shared_ptr<Communicator> comm; -}; - -#endif diff --git a/src/VirtualFluids/Visitors/RefineCrossAndInsideGbObjectBlockVisitor.cpp b/src/VirtualFluids/Visitors/RefineCrossAndInsideGbObjectBlockVisitor.cpp deleted file mode 100644 index 0b34938b2..000000000 --- a/src/VirtualFluids/Visitors/RefineCrossAndInsideGbObjectBlockVisitor.cpp +++ /dev/null @@ -1,43 +0,0 @@ -#include "RefineCrossAndInsideGbObjectBlockVisitor.h" - -#include <numerics/geometry3d/GbObject3D.h> -#include "Grid3D.h" -#include "Block3D.h" - - -RefineCrossAndInsideGbObjectBlockVisitor::RefineCrossAndInsideGbObjectBlockVisitor() -: Block3DVisitor() , notActive(true) -{ -} -////////////////////////////////////////////////////////////////////////// -RefineCrossAndInsideGbObjectBlockVisitor::RefineCrossAndInsideGbObjectBlockVisitor(GbObject3DPtr geoObject, int refineLevel) - : Block3DVisitor(0,refineLevel-1), geoObject(geoObject), notActive(true) -{ - -} -////////////////////////////////////////////////////////////////////////// -RefineCrossAndInsideGbObjectBlockVisitor::~RefineCrossAndInsideGbObjectBlockVisitor() -{ -} -////////////////////////////////////////////////////////////////////////// -void RefineCrossAndInsideGbObjectBlockVisitor::visit(const Grid3DPtr grid, Block3DPtr block) -{ - int level = block->getLevel(); - if( notActive && block->isNotActive() ) return; - if( level > this->getStopLevel() ) return; - - UbTupleDouble3 coords = grid->getBlockWorldCoordinates(block); - UbTupleDouble3 deltas = grid->getBlockLengths(block); - if(geoObject->isCellInsideOrCuttingGbObject3D( val<1>(coords) - , val<2>(coords) - , val<3>(coords) - , val<1>(coords)+val<1>(deltas) - , val<2>(coords)+val<2>(deltas) - , val<3>(coords)+val<3>(deltas)) ) - { - grid->expandBlock(block->getX1(),block->getX2(),block->getX3(),level); - } - - return; -} -////////////////////////////////////////////////////////////////////////// diff --git a/src/VirtualFluids/Visitors/RefineCrossAndInsideGbObjectBlockVisitor.h b/src/VirtualFluids/Visitors/RefineCrossAndInsideGbObjectBlockVisitor.h deleted file mode 100644 index dabec6336..000000000 --- a/src/VirtualFluids/Visitors/RefineCrossAndInsideGbObjectBlockVisitor.h +++ /dev/null @@ -1,33 +0,0 @@ -#ifndef RefineCrossAndInsideGbObjectBlockVisitor_H -#define RefineCrossAndInsideGbObjectBlockVisitor_H - -#include <vector> -#include <memory> - -#include "Block3DVisitor.h" - -class Grid3D; -class Block3D; -class GbObject3D; - -//! \brief Refine blocks on base of bounding box which is defined with <i>geoObject</i> -//! \details The class uses a geometry object for define a bounding box. Inside and across this bounding box will be grid on block basis refinement. -//! \author K. Kucher -class RefineCrossAndInsideGbObjectBlockVisitor : public Block3DVisitor -{ -public: - //! A default constructor - RefineCrossAndInsideGbObjectBlockVisitor(); - //! A constructor - //! \param geoObject a smart pointer to bounding box - //! \param refineLevel an integer for refine on this level - RefineCrossAndInsideGbObjectBlockVisitor(std::shared_ptr<GbObject3D> geoObject, int refineLevel); - virtual ~RefineCrossAndInsideGbObjectBlockVisitor(); - - void visit(std::shared_ptr<Grid3D> grid, std::shared_ptr<Block3D> block) override; -protected: - std::shared_ptr<GbObject3D> geoObject; - bool notActive; -}; - -#endif diff --git a/src/VirtualFluids/Visitors/RefineCrossAndInsideGbObjectHelper.cpp b/src/VirtualFluids/Visitors/RefineCrossAndInsideGbObjectHelper.cpp deleted file mode 100644 index d788bebeb..000000000 --- a/src/VirtualFluids/Visitors/RefineCrossAndInsideGbObjectHelper.cpp +++ /dev/null @@ -1,78 +0,0 @@ -#include "RefineCrossAndInsideGbObjectHelper.h" -#include "RefineCrossAndInsideGbObjectBlockVisitor.h" -#include "RatioBlockVisitor.h" -#include "RatioSmoothBlockVisitor.h" -#include "CheckRatioBlockVisitor.h" -#include "OverlapBlockVisitor.h" -#include "SetInterpolationDirsBlockVisitor.h" -#include <D3Q27System.h> -#include "Communicator.h" -#include <Grid3D.h> -#include <GbObject3D.h> - - -RefineCrossAndInsideGbObjectHelper::RefineCrossAndInsideGbObjectHelper(Grid3DPtr grid, int maxRefineLevel, CommunicatorPtr comm) : - grid(grid), - maxRefineLevel(maxRefineLevel), - comm(comm) -{ -} -////////////////////////////////////////////////////////////////////////// -RefineCrossAndInsideGbObjectHelper::~RefineCrossAndInsideGbObjectHelper(void) -{ -} -////////////////////////////////////////////////////////////////////////// -void RefineCrossAndInsideGbObjectHelper::refine() -{ - UBLOG(logDEBUG5,"RefineCrossAndInsideGbObjectHelper: refine - start"); - - if (comm->isRoot()) - { - int size = (int)objects.size(); - - for (int i = 0; i<size; i++) - { - RefineCrossAndInsideGbObjectBlockVisitor refVisitor(objects[i], levels[i]); - grid->accept(refVisitor); - } - - //RatioBlockVisitor ratioVisitor(maxRefineLevel); - //grid->accept(ratioVisitor); - - //RatioSmoothBlockVisitor ratioSmoothVisitor(maxRefineLevel); - //grid->accept(ratioSmoothVisitor); - - RatioBlockVisitor ratioVisitor(maxRefineLevel); - CheckRatioBlockVisitor checkRatio(maxRefineLevel); - int count = 0; - - do { - grid->accept(ratioVisitor); - checkRatio.resetState(); - grid->accept(checkRatio); - UBLOG(logINFO, "count = "<<count++<<" state = "<<checkRatio.getState()); - } while (!checkRatio.getState()); - - - OverlapBlockVisitor overlapVisitor(maxRefineLevel, false); - grid->accept(overlapVisitor); - } - - grid->updateDistributedBlocks(comm); - - std::vector<int> dirs; - - for (int i=D3Q27System::E; i<D3Q27System::ENDDIR; i++) - { - dirs.push_back(i); - } - SetInterpolationDirsBlockVisitor interDirsVisitor(dirs); - grid->accept(interDirsVisitor); - UBLOG(logDEBUG5,"RefineCrossAndInsideGbObjectHelper: refine - end"); -} -////////////////////////////////////////////////////////////////////////// -void RefineCrossAndInsideGbObjectHelper::addGbObject( GbObject3DPtr object, int refineLevel ) -{ - objects.push_back(object); - levels.push_back(refineLevel); -} diff --git a/src/VirtualFluids/Visitors/RefineCrossAndInsideGbObjectHelper.h b/src/VirtualFluids/Visitors/RefineCrossAndInsideGbObjectHelper.h deleted file mode 100644 index 4c2151da2..000000000 --- a/src/VirtualFluids/Visitors/RefineCrossAndInsideGbObjectHelper.h +++ /dev/null @@ -1,36 +0,0 @@ -#ifndef RefineCrossAndInsideGbObjectHelper_H -#define RefineCrossAndInsideGbObjectHelper_H - -#include <vector> -#include <memory> - -class Communicator; -class Grid3D; -class GbObject3D; - -//! \brief Refine blocks on base of bounding boxes. -//! \details You need to use <i>addGbObject()</i> to add corresponding bounding boxes. Then call <i>refine()</i>. -//! \author K. Kucher -class RefineCrossAndInsideGbObjectHelper -{ -public: - //! Constructor - //! \param grid a smart pointer to the grid object - //! \param maxRefineLevel an integer for maximal refinement level - RefineCrossAndInsideGbObjectHelper(std::shared_ptr<Grid3D> grid, int maxRefineLevel, std::shared_ptr<Communicator> comm); - virtual ~RefineCrossAndInsideGbObjectHelper(); - //! add geometric object - //! \param object a smart pointer to bounding box - //! \param refineLevel a value of refinement level for corresponding bounding box - void addGbObject(std::shared_ptr<GbObject3D> object, int refineLevel); - //! start refinement - void refine(); -private: - std::shared_ptr<Grid3D> grid; - std::vector<std::shared_ptr<GbObject3D> > objects; - std::vector<int> levels; - int maxRefineLevel; - std::shared_ptr<Communicator> comm; -}; - -#endif diff --git a/src/VirtualFluids/Visitors/RefineInterGbObjectsVisitor.cpp b/src/VirtualFluids/Visitors/RefineInterGbObjectsVisitor.cpp deleted file mode 100644 index 97da6e558..000000000 --- a/src/VirtualFluids/Visitors/RefineInterGbObjectsVisitor.cpp +++ /dev/null @@ -1,68 +0,0 @@ -#include "RefineInterGbObjectsVisitor.h" - -#include <numerics/geometry3d/GbObject3D.h> -#include "Grid3D.h" -#include "Block3D.h" - - -RefineInterGbObjectsBlockVisitor::RefineInterGbObjectsBlockVisitor() - : Block3DVisitor(-1, -1) -{ -} -////////////////////////////////////////////////////////////////////////// -RefineInterGbObjectsBlockVisitor::RefineInterGbObjectsBlockVisitor(GbObject3DPtr includeGbObject3D, GbObject3DPtr excludeGbObject3D, int startlevel, int stoplevel) - : Block3DVisitor(startlevel, stoplevel) -{ - this->includeGbObjects3D.push_back(includeGbObject3D); - this->excludeGbObjects3D.push_back(excludeGbObject3D); -} -////////////////////////////////////////////////////////////////////////// -RefineInterGbObjectsBlockVisitor::RefineInterGbObjectsBlockVisitor(std::vector<GbObject3DPtr> includeGbObjects3D, std::vector<GbObject3DPtr> excludeGbObjects3D, int startlevel, int stoplevel) - : Block3DVisitor(startlevel, stoplevel) -{ - this->includeGbObjects3D = includeGbObjects3D; - this->excludeGbObjects3D = excludeGbObjects3D; -} -////////////////////////////////////////////////////////////////////////// -void RefineInterGbObjectsBlockVisitor::visit(Grid3DPtr grid, Block3DPtr block) -{ - UbTupleDouble3 coords = grid->getBlockWorldCoordinates(block); - UbTupleDouble3 delta = grid->getBlockLengths(block); - - double cellMinX1 = val<1>(coords); - double cellMinX2 = val<2>(coords); - double cellMinX3 = val<3>(coords); - double cellMaxX1 = val<1>(coords)+val<1>(delta); - double cellMaxX2 = val<2>(coords)+val<2>(delta); - double cellMaxX3 = val<3>(coords)+val<3>(delta); - - bool insideInclude = false; - for(size_t i=0; i<includeGbObjects3D.size(); i++) - { - if( includeGbObjects3D[i]->isCellInsideOrCuttingGbObject3D(cellMinX1,cellMinX2,cellMinX3,cellMaxX1,cellMaxX2,cellMaxX3) ) - { - insideInclude = true; - break; - } - } - - bool insideExclude = false; - for(size_t e=0; e<excludeGbObjects3D.size(); e++) - { - if(excludeGbObjects3D[e]->isCellInsideGbObject3D(cellMinX1, cellMinX2, cellMinX3, cellMaxX1, cellMaxX2, cellMaxX3)) - { - insideExclude = true; - break; - } - } - - if(insideInclude && !insideExclude) - { - int ix1, ix2, ix3, level; - ix1 = block->getX1(); - ix2 = block->getX2(); - ix3 = block->getX3(); - level = block->getLevel(); - grid->expandBlock(ix1,ix2,ix3,level); - } -} diff --git a/src/VirtualFluids/Visitors/RefineInterGbObjectsVisitor.h b/src/VirtualFluids/Visitors/RefineInterGbObjectsVisitor.h deleted file mode 100644 index 341d35fd9..000000000 --- a/src/VirtualFluids/Visitors/RefineInterGbObjectsVisitor.h +++ /dev/null @@ -1,27 +0,0 @@ -#ifndef RefineInterGbObjectsVisirtor_H -#define RefineInterGbObjectsVisirtor_H - -#include <vector> -#include <memory> - -#include "Block3DVisitor.h" - -class Grid3D; -class Block3D; -class GbObject3D; - -////////////////////////////////////////////////////////////////////////// -class RefineInterGbObjectsBlockVisitor : public Block3DVisitor -{ -public: - RefineInterGbObjectsBlockVisitor(); - RefineInterGbObjectsBlockVisitor(std::shared_ptr<GbObject3D> includeGbObject3D, std::shared_ptr<GbObject3D> excludeGbObject3D, int startlevel, int stoplevel); - RefineInterGbObjectsBlockVisitor(std::vector<std::shared_ptr<GbObject3D> > includeGbObjects3D, std::vector<std::shared_ptr<GbObject3D> > excludeGbObjects3D, int startlevel, int stoplevel); - void visit(std::shared_ptr<Grid3D> grid, std::shared_ptr<Block3D> block) override; - -private: - std::vector<std::shared_ptr<GbObject3D> > includeGbObjects3D; - std::vector<std::shared_ptr<GbObject3D> > excludeGbObjects3D; -}; - -#endif //RefineInterGbObjectsVisirtor_H diff --git a/src/VirtualFluids/Visitors/RenumberBlockVisitor.cpp b/src/VirtualFluids/Visitors/RenumberBlockVisitor.cpp deleted file mode 100644 index 1996d3809..000000000 --- a/src/VirtualFluids/Visitors/RenumberBlockVisitor.cpp +++ /dev/null @@ -1,22 +0,0 @@ -#include "RenumberBlockVisitor.h" -#include "Grid3DSystem.h" -#include "LBMSystem.h" -#include "Grid3D.h" -#include "Block3D.h" - -int RenumberBlockVisitor::counter = 0; - -RenumberBlockVisitor::RenumberBlockVisitor() : -Block3DVisitor(0, Grid3DSystem::MAXLEVEL) -{ - -} -////////////////////////////////////////////////////////////////////////// -void RenumberBlockVisitor::visit(Grid3DPtr grid, Block3DPtr block) -{ - block->setGlobalID(counter); - Grid3D::BlockIDMap blockIdMap = grid->getBlockIDs(); - blockIdMap.insert(std::make_pair(counter, block)); - counter++; -} - diff --git a/src/VirtualFluids/Visitors/RenumberBlockVisitor.h b/src/VirtualFluids/Visitors/RenumberBlockVisitor.h deleted file mode 100644 index d1fedd3b8..000000000 --- a/src/VirtualFluids/Visitors/RenumberBlockVisitor.h +++ /dev/null @@ -1,32 +0,0 @@ -/** -* @file RenumberBlockVisitor.h -* @brief Visitor class which renumber blocks. -* @author Konstantin Kutscher -* @date 06.06.2011 -*/ - -#ifndef RenumberBlockVisitor_h -#define RenumberBlockVisitor_h - -#include "Block3DVisitor.h" - -class Grid3D; -class Block3D; - -//! \brief Visitor class which renumber blocks. -//! \details Visitor class which renumber blocks. -//! \author Konstantin Kutscher -class RenumberBlockVisitor : public Block3DVisitor -{ -public: - RenumberBlockVisitor(); - - virtual ~RenumberBlockVisitor() {} - - void visit(std::shared_ptr<Grid3D> grid, std::shared_ptr<Block3D> block) override; - -private: - static int counter; -}; - -#endif diff --git a/src/VirtualFluids/Visitors/SetConnectorsBlockVisitor.cpp b/src/VirtualFluids/Visitors/SetConnectorsBlockVisitor.cpp deleted file mode 100644 index 381648ab0..000000000 --- a/src/VirtualFluids/Visitors/SetConnectorsBlockVisitor.cpp +++ /dev/null @@ -1,486 +0,0 @@ -#include "SetConnectorsBlockVisitor.h" -#include "D3Q27ETFullDirectConnector.h" -#include "D3Q27ETFullVectorConnector.h" -#include "D3Q27ETCFOffVectorConnector.h" -#include "D3Q27ETFCOffVectorConnector.h" -#include "Grid3DSystem.h" -#include <basics/transmitter/TbTransmitterLocal.h> - -#include "Communicator.h" -#include "InterpolationProcessor.h" - -SetConnectorsBlockVisitor::SetConnectorsBlockVisitor(CommunicatorPtr 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(Grid3DPtr grid, Block3DPtr 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(Grid3DPtr grid, Block3DPtr block) -{ - UBLOG(logDEBUG5, "D3Q27SetConnectorsBlockVisitor::setSameLevelConnectors() - start"); - int blockRank = block->getRank(); - if (gridRank == blockRank && block->isActive()) - { - block->clearWeight(); - std::vector<Block3DPtr> neighbors; - int ix1 = block->getX1(); - int ix2 = block->getX2(); - int ix3 = block->getX3(); - int level = block->getLevel(); - //grid->getAllNeighbors(ix1, ix2, ix3, level, level, neighbors); - - //if (block->getGlobalID()==2512) - //{ - // int test = 0; - //} - - for( int dir = 0; dir < dirs; dir++) - { - Block3DPtr neighBlock = grid->getNeighborBlock(dir, ix1, ix2, ix3, level); - - if(neighBlock) - { - int neighBlockRank = neighBlock->getRank(); - if(blockRank == neighBlockRank && neighBlock->isActive()) - { - Block3DConnectorPtr connector; - connector = Block3DConnectorPtr(new D3Q27ETFullDirectConnector( 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); - } - } - } - } - - //if (block->getGlobalID()==2794) - //{ - // UBLOG(logINFO, block->toString()); - //} - - int weight = block->getNumberOfLocalConnectorsForSurfaces(); - weight = 6 - weight; - block->addWeightForAll(weight); - } - UBLOG(logDEBUG5, "D3Q27SetConnectorsBlockVisitor::setSameLevelConnectors() - end"); -} -////////////////////////////////////////////////////////////////////////// -void SetConnectorsBlockVisitor::setRemoteConnectors(Block3DPtr sblock, Block3DPtr 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); - - - Block3DConnectorPtr connector; - connector = Block3DConnectorPtr(new D3Q27ETFullVectorConnector(sblock, sender, receiver, dir)); - sblock->setConnector(connector); - UBLOG(logDEBUG5, "D3Q27SetConnectorsBlockVisitor::setRemoteConnectors() - end"); -} -////////////////////////////////////////////////////////////////////////// -void SetConnectorsBlockVisitor::setInterpolationConnectors(Grid3DPtr grid, Block3DPtr block) -{ - UBLOG(logDEBUG5, "D3Q27SetConnectorsBlockVisitor::setInterpolationConnectors() - start"); - int blockRank = block->getRank(); - if (block->getGlobalID()==394) - { - int test=0; - } - - //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)) - { - Block3DPtr fblockSW = grid->getBlock(fbx1+1,fbx2,fbx3,level); - Block3DPtr fblockSE = grid->getBlock(fbx1+1,fbx2+1,fbx3,level); - Block3DPtr fblockNW = grid->getBlock(fbx1+1,fbx2,fbx3+1,level); - Block3DPtr fblockNE = grid->getBlock(fbx1+1,fbx2+1,fbx3+1,level); - - setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::E); - } - if( block->hasInterpolationFlagCF(D3Q27System::W)) - { - Block3DPtr fblockSW = grid->getBlock(fbx1,fbx2,fbx3,level); - Block3DPtr fblockSE = grid->getBlock(fbx1,fbx2+1,fbx3,level); - Block3DPtr fblockNW = grid->getBlock(fbx1,fbx2,fbx3+1,level); - Block3DPtr fblockNE = grid->getBlock(fbx1,fbx2+1,fbx3+1,level); - - setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::W); - } - if( block->hasInterpolationFlagCF(D3Q27System::N)) - { - Block3DPtr fblockSW = grid->getBlock(fbx1,fbx2+1,fbx3,level); - Block3DPtr fblockSE = grid->getBlock(fbx1+1,fbx2+1,fbx3,level); - Block3DPtr fblockNW = grid->getBlock(fbx1,fbx2+1,fbx3+1,level); - Block3DPtr fblockNE = grid->getBlock(fbx1+1,fbx2+1,fbx3+1,level); - - setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::N); - } - if( block->hasInterpolationFlagCF(D3Q27System::S)) - { - Block3DPtr fblockSW = grid->getBlock(fbx1,fbx2,fbx3,level); - Block3DPtr fblockSE = grid->getBlock(fbx1+1,fbx2,fbx3,level); - Block3DPtr fblockNW = grid->getBlock(fbx1,fbx2,fbx3+1,level); - Block3DPtr fblockNE = grid->getBlock(fbx1+1,fbx2,fbx3+1,level); - - setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::S); - } - if( block->hasInterpolationFlagCF(D3Q27System::T)) - { - Block3DPtr fblockSW = grid->getBlock(fbx1,fbx2,fbx3+1,level); - Block3DPtr fblockSE = grid->getBlock(fbx1+1,fbx2,fbx3+1,level); - Block3DPtr fblockNW = grid->getBlock(fbx1,fbx2+1,fbx3+1,level); - Block3DPtr fblockNE = grid->getBlock(fbx1+1,fbx2+1,fbx3+1,level); - - setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::T); - } - if( block->hasInterpolationFlagCF(D3Q27System::B)) - { - Block3DPtr fblockSW = grid->getBlock(fbx1,fbx2,fbx3,level); - Block3DPtr fblockSE = grid->getBlock(fbx1+1,fbx2,fbx3,level); - Block3DPtr fblockNW = grid->getBlock(fbx1,fbx2+1,fbx3,level); - Block3DPtr 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)) - { - Block3DPtr fblockSW = grid->getBlock(fbx1+1,fbx2+1,fbx3+0,level); - Block3DPtr fblockSE = grid->getBlock(fbx1+1,fbx2+1,fbx3+1,level); - Block3DPtr fblockNW;// = grid->getBlock(fbx1+1, fbx2+1, fbx3+1, level); - Block3DPtr 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)) - { - Block3DPtr fblockSW = grid->getBlock(fbx1,fbx2,fbx3,level); - Block3DPtr fblockSE = grid->getBlock(fbx1,fbx2,fbx3+1,level); - Block3DPtr fblockNW;// = grid->getBlock(fbx1, fbx2, fbx3+1, level); - Block3DPtr 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)) - { - Block3DPtr fblockSW = grid->getBlock(fbx1+1,fbx2,fbx3+0,level); - Block3DPtr fblockSE = grid->getBlock(fbx1+1,fbx2,fbx3+1,level); - Block3DPtr fblockNW;// = grid->getBlock(fbx1+1, fbx2, fbx3+1, level); - Block3DPtr 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)) - { - Block3DPtr fblockSW = grid->getBlock(fbx1,fbx2+1,fbx3,level); - Block3DPtr fblockSE = grid->getBlock(fbx1,fbx2+1,fbx3+1,level); - Block3DPtr fblockNW;// = grid->getBlock(fbx1, fbx2+1, fbx3+1, level); - Block3DPtr 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)) - { - Block3DPtr fblockSW = grid->getBlock(fbx1+1,fbx2+0,fbx3+1,level); - Block3DPtr fblockSE = grid->getBlock(fbx1+1,fbx2+1,fbx3+1,level); - Block3DPtr fblockNW;// = grid->getBlock(fbx1+1, fbx2+0, fbx3+1, level); - Block3DPtr 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)) - { - - Block3DPtr fblockSW = grid->getBlock(fbx1,fbx2+0,fbx3,level); - Block3DPtr fblockSE = grid->getBlock(fbx1,fbx2+1,fbx3,level); - Block3DPtr fblockNW;// = grid->getBlock(fbx1, fbx2+0, fbx3, level); - Block3DPtr 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)) - { - Block3DPtr fblockSW = grid->getBlock(fbx1+1,fbx2+0,fbx3,level); - Block3DPtr fblockSE = grid->getBlock(fbx1+1,fbx2+1,fbx3,level); - Block3DPtr fblockNW;// = grid->getBlock(fbx1+1, fbx2+0, fbx3, level); - Block3DPtr 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)) - { - Block3DPtr fblockSW = grid->getBlock(fbx1,fbx2+0,fbx3+1,level); - Block3DPtr fblockSE = grid->getBlock(fbx1,fbx2+1,fbx3+1,level); - Block3DPtr fblockNW;// = grid->getBlock(fbx1, fbx2+0, fbx3+1, level); - Block3DPtr 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)) - { - Block3DPtr fblockSW = grid->getBlock(fbx1+0,fbx2+1,fbx3+1,level); - Block3DPtr fblockSE = grid->getBlock(fbx1+1,fbx2+1,fbx3+1,level); - Block3DPtr fblockNW;// = grid->getBlock(fbx1+0, fbx2+1, fbx3+1, level); - Block3DPtr 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)) - { - Block3DPtr fblockSW = grid->getBlock(fbx1+0,fbx2,fbx3,level); - Block3DPtr fblockSE = grid->getBlock(fbx1+1,fbx2,fbx3,level); - Block3DPtr fblockNW;// = grid->getBlock(fbx1+0, fbx2, fbx3, level); - Block3DPtr 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)) - { - Block3DPtr fblockSW = grid->getBlock(fbx1+0,fbx2+1,fbx3,level); - Block3DPtr fblockSE = grid->getBlock(fbx1+1,fbx2+1,fbx3,level); - Block3DPtr fblockNW;// = grid->getBlock(fbx1+0, fbx2+1, fbx3, level); - Block3DPtr 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)) - { - Block3DPtr fblockSW = grid->getBlock(fbx1+0,fbx2,fbx3+1,level); - Block3DPtr fblockSE = grid->getBlock(fbx1+1,fbx2,fbx3+1,level); - Block3DPtr fblockNW;// = grid->getBlock(fbx1+0, fbx2, fbx3+1, level); - Block3DPtr 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)) - { - Block3DPtr fblockSW = grid->getBlock(fbx1+1, fbx2+1, fbx3+1, level); - Block3DPtr fblockSE;// = grid->getBlock(fbx1+1, fbx2+1, fbx3+0, level); - Block3DPtr fblockNW;// = grid->getBlock(fbx1+1, fbx2+1, fbx3+1, level); - Block3DPtr 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)) - { - Block3DPtr fblockSW = grid->getBlock(fbx1, fbx2, fbx3+1, level); - Block3DPtr fblockSE;// = grid->getBlock(fbx1, fbx2, fbx3, level); - Block3DPtr fblockNW;// = grid->getBlock(fbx1, fbx2, fbx3+1, level); - Block3DPtr 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)) - { - Block3DPtr fblockSW = grid->getBlock(fbx1+1, fbx2, fbx3+1, level); - Block3DPtr fblockSE;// = grid->getBlock(fbx1+1, fbx2, fbx3+0, level); - Block3DPtr fblockNW;// = grid->getBlock(fbx1+1, fbx2, fbx3+1, level); - Block3DPtr 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)) - { - Block3DPtr fblockSW = grid->getBlock(fbx1, fbx2+1, fbx3+1, level); - Block3DPtr fblockSE;// = grid->getBlock(fbx1, fbx2+1, fbx3, level); - Block3DPtr fblockNW;// = grid->getBlock(fbx1, fbx2+1, fbx3+1, level); - Block3DPtr 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)) - { - Block3DPtr fblockSW = grid->getBlock(fbx1+1, fbx2+1, fbx3+0, level); - Block3DPtr fblockSE;// = grid->getBlock(fbx1+1, fbx2+1, fbx3+0, level); - Block3DPtr fblockNW;// = grid->getBlock(fbx1+1, fbx2+1, fbx3+1, level); - Block3DPtr 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)) - { - Block3DPtr fblockSW = grid->getBlock(fbx1, fbx2, fbx3+0, level); - Block3DPtr fblockSE;// = grid->getBlock(fbx1, fbx2, fbx3, level); - Block3DPtr fblockNW;// = grid->getBlock(fbx1, fbx2, fbx3+1, level); - Block3DPtr 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)) - { - Block3DPtr fblockSW = grid->getBlock(fbx1+1, fbx2, fbx3, level); - Block3DPtr fblockSE;// = grid->getBlock(fbx1+1, fbx2, fbx3+0, level); - Block3DPtr fblockNW;// = grid->getBlock(fbx1+1, fbx2, fbx3+1, level); - Block3DPtr 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)) - { - Block3DPtr fblockSW = grid->getBlock(fbx1, fbx2+1, fbx3+0, level); - Block3DPtr fblockSE;// = grid->getBlock(fbx1, fbx2+1, fbx3, level); - Block3DPtr fblockNW;// = grid->getBlock(fbx1, fbx2+1, fbx3+1, level); - Block3DPtr 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(Block3DPtr fBlockSW, Block3DPtr fBlockSE, Block3DPtr fBlockNW, Block3DPtr fBlockNE, Block3DPtr 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) - { - Block3DConnectorPtr connector(new D3Q27ETCFOffVectorConnector< TbTransmitter< CbVector< LBMReal > > >(cBlock, - senderCFevenEvenSW, receiverCFevenEvenSW, senderCFevenOddNW, receiverCFevenOddNW, - senderCFoddEvenSE, receiverCFoddEvenSE, senderCFoddOddNE, receiverCFoddOddNE, - dir, cIProcessor) ); - cBlock->setConnector(connector); - } - if(fBlockSW && fBlockSWRank == gridRank) - { - Block3DConnectorPtr connector( new D3Q27ETFCOffVectorConnector< TbTransmitter< CbVector< LBMReal > > >(fBlockSW, - senderFCevenEvenSW, receiverFCevenEvenSW, dir, fIProcessorSW, EvenEvenSW) ); - fBlockSW->setConnector(connector); - } - if(fBlockNW && fBlockNWRank == gridRank) - { - Block3DConnectorPtr connector( new D3Q27ETFCOffVectorConnector< TbTransmitter< CbVector< LBMReal > > >(fBlockNW, - senderFCevenOddNW, receiverFCevenOddNW, dir, fIProcessorNW, EvenOddNW) ); - fBlockNW->setConnector(connector); - } - if(fBlockSE && fBlockSERank == gridRank) - { - Block3DConnectorPtr connector( new D3Q27ETFCOffVectorConnector< TbTransmitter< CbVector< LBMReal > > >(fBlockSE, - senderFCoddEvenSE, receiverFCoddEvenSE, dir, fIProcessorSE, OddEvenSE) ); - fBlockSE->setConnector(connector); - } - if(fBlockNE && fBlockNERank == gridRank) - { - Block3DConnectorPtr connector( new D3Q27ETFCOffVectorConnector< TbTransmitter< CbVector< LBMReal > > >(fBlockNE, - senderFCoddOddNE, receiverFCoddOddNE, dir, fIProcessorNE, OddOddNE) ); - fBlockNE->setConnector(connector); - } - UBLOG(logDEBUG5, "D3Q27SetConnectorsBlockVisitor::setInterpolationConnectors(...) - end"); -} -////////////////////////////////////////////////////////////////////////// -void SetConnectorsBlockVisitor::createTransmitters(Block3DPtr cBlock, Block3DPtr 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; - bool MPIpool = true; - bool orthogonal = false; - int fBlockRank = fBlock->getRank(); - int cBlockRank = cBlock->getRank(); - if(fBlockRank == cBlockRank && fBlockRank == gridRank) - { - senderCF = receiverFC = CreateTransmittersHelper::TransmitterPtr( new TbLocalTransmitter< CbVector< LBMReal > >()); - senderFC = receiverCF = CreateTransmittersHelper::TransmitterPtr( new TbLocalTransmitter< CbVector< LBMReal > >()); - } - else if(cBlockRank == gridRank) - { - helper.createTransmitters(cBlock, fBlock, dir, ib, senderCF, receiverCF, comm, CreateTransmittersHelper::MPI); - } - else if(fBlockRank == gridRank) - { - helper.createTransmitters(fBlock, cBlock, dir, ib, senderFC, receiverFC, comm, CreateTransmittersHelper::MPI); - } - UBLOG(logDEBUG5, "D3Q27SetConnectorsBlockVisitor::createTransmitters(...) - end"); -} - diff --git a/src/VirtualFluids/Visitors/SetConnectorsBlockVisitor.h b/src/VirtualFluids/Visitors/SetConnectorsBlockVisitor.h deleted file mode 100644 index f58b8250f..000000000 --- a/src/VirtualFluids/Visitors/SetConnectorsBlockVisitor.h +++ /dev/null @@ -1,42 +0,0 @@ -#ifndef SETCONNECTORSBLOCKVISITOR_H -#define SETCONNECTORSBLOCKVISITOR_H - -#include <memory> - -#include "Block3DVisitor.h" -#include "D3Q27System.h" - -#include "CreateTransmittersHelper.h" - -class Grid3D; -class Block3D; -class Communicator; -class InterpolationProcessor; - -class SetConnectorsBlockVisitor : public Block3DVisitor -{ -public: - SetConnectorsBlockVisitor(std::shared_ptr<Communicator> comm, bool fullConnector, int dirs, LBMReal nue, std::shared_ptr<InterpolationProcessor> iProcessor); - virtual ~SetConnectorsBlockVisitor(); - void visit(std::shared_ptr<Grid3D> grid, std::shared_ptr<Block3D> block) override; - ////////////////////////////////////////////////////////////////////////// -protected: - void setSameLevelConnectors(std::shared_ptr<Grid3D> grid, Block3DPtr block); - void setRemoteConnectors(Block3DPtr sblock, Block3DPtr tblock, int dir, bool fullConnector); - void setInterpolationConnectors(std::shared_ptr<Grid3D> grid, Block3DPtr block); - void setInterpolationConnectors(Block3DPtr fBlockSW, Block3DPtr fBlockSE, Block3DPtr fBlockNW, Block3DPtr fBlockNE, Block3DPtr cBlock, int dir); - void createTransmitters(Block3DPtr cBlock, Block3DPtr fBlock, int dir, - CreateTransmittersHelper::IBlock ib, - CreateTransmittersHelper::TransmitterPtr& senderCF, - CreateTransmittersHelper::TransmitterPtr& receiverCF, - CreateTransmittersHelper::TransmitterPtr& senderFC, - CreateTransmittersHelper::TransmitterPtr& receiverFC); - std::shared_ptr<Communicator> comm; - bool fullConnector; - int dirs; - int gridRank; - LBMReal nue; - std::shared_ptr<InterpolationProcessor> iProcessor; -}; - -#endif //D3Q27SETCONNECTORSVISITOR_H diff --git a/src/VirtualFluids/Visitors/SetForcingBlockVisitor.cpp b/src/VirtualFluids/Visitors/SetForcingBlockVisitor.cpp deleted file mode 100644 index 936c9bb2e..000000000 --- a/src/VirtualFluids/Visitors/SetForcingBlockVisitor.cpp +++ /dev/null @@ -1,70 +0,0 @@ -#include "SetForcingBlockVisitor.h" -#include "Grid3DSystem.h" -#include "LBMSystem.h" -#include "Grid3D.h" -#include "Block3D.h" - -SetForcingBlockVisitor::SetForcingBlockVisitor(LBMReal forcingX1, LBMReal forcingX2, LBMReal forcingX3) : - Block3DVisitor(0, Grid3DSystem::MAXLEVEL), forcingX1(forcingX1), - forcingX2(forcingX2), - forcingX3(forcingX3) -{ - ftype = 0; -} -////////////////////////////////////////////////////////////////////////// -SetForcingBlockVisitor::SetForcingBlockVisitor(const mu::Parser& muForcingX1, const mu::Parser& muForcingX2, const mu::Parser& muForcingX3) : - Block3DVisitor(0, Grid3DSystem::MAXLEVEL), muForcingX1(muForcingX1), - muForcingX2(muForcingX2), - muForcingX3(muForcingX3) - -{ - ftype = 1; -} -////////////////////////////////////////////////////////////////////////// -SetForcingBlockVisitor::SetForcingBlockVisitor(const std::string& sForcingX1, const std::string& sForcingX2, const std::string& sForcingX3) : - Block3DVisitor(0, Grid3DSystem::MAXLEVEL), sForcingX1(sForcingX1), - sForcingX2(sForcingX2), - sForcingX3(sForcingX3) - -{ - ftype = 2; -} -////////////////////////////////////////////////////////////////////////// -void SetForcingBlockVisitor::visit(Grid3DPtr grid, Block3DPtr block) -{ - LBMKernelPtr kernel = std::dynamic_pointer_cast<LBMKernel>(block->getKernel()); - if (!kernel) - throw std::runtime_error("SetForcingBlockVisitor: Kernel is not a LBMKernel"); - - if(block->getRank() == grid->getRank()) - { - switch (ftype) - { - case 0: - kernel->setForcingX1(forcingX1); - kernel->setForcingX2(forcingX2); - kernel->setForcingX3(forcingX3); - kernel->setWithForcing(true); - break; - case 1: - kernel->setForcingX1(muForcingX1); - kernel->setForcingX2(muForcingX2); - kernel->setForcingX3(muForcingX3); - kernel->setWithForcing(true); - break; - case 2: - kernel->setForcingX1(sForcingX1); - kernel->setForcingX2(sForcingX2); - kernel->setForcingX3(sForcingX3); - kernel->setWithForcing(true); - break; - default: - kernel->setForcingX1(0.0); - kernel->setForcingX2(0.0); - kernel->setForcingX3(0.0); - kernel->setWithForcing(false); - break; - } - } -} - diff --git a/src/VirtualFluids/Visitors/SetForcingBlockVisitor.h b/src/VirtualFluids/Visitors/SetForcingBlockVisitor.h deleted file mode 100644 index 96b4fa9f8..000000000 --- a/src/VirtualFluids/Visitors/SetForcingBlockVisitor.h +++ /dev/null @@ -1,39 +0,0 @@ -#ifndef SetForcingBlockVisitor_h -#define SetForcingBlockVisitor_h - -#include "Block3DVisitor.h" -#include "LBMKernel.h" - -class Block3D; -class Grid3D; - -//! \brief Set forcing for all kernels of grid -//! \details This visitor is useful if you need to set or reset forcing in kernels (e.g. after restart because forcing is not serializable). -//! \author K. Kucher -class SetForcingBlockVisitor : public Block3DVisitor -{ -public: - SetForcingBlockVisitor(LBMReal forcingX1, LBMReal forcingX2, LBMReal forcingX3); - - SetForcingBlockVisitor(const mu::Parser& muForcingX1, const mu::Parser& muForcingX2, const mu::Parser& muForcingX3); - - SetForcingBlockVisitor(const std::string& sForcingX1, const std::string& sForcingX2, const std::string& sForcingX3); - - virtual ~SetForcingBlockVisitor() {} - - virtual void visit(std::shared_ptr<Grid3D> grid, std::shared_ptr<Block3D> block) override; - -private: - int ftype; - LBMReal forcingX1; - LBMReal forcingX2; - LBMReal forcingX3; - mu::Parser muForcingX1; - mu::Parser muForcingX2; - mu::Parser muForcingX3; - std::string sForcingX1; - std::string sForcingX2; - std::string sForcingX3; -}; - -#endif diff --git a/src/VirtualFluids/Visitors/SetInterpolationDirsBlockVisitor.cpp b/src/VirtualFluids/Visitors/SetInterpolationDirsBlockVisitor.cpp deleted file mode 100644 index e3513a553..000000000 --- a/src/VirtualFluids/Visitors/SetInterpolationDirsBlockVisitor.cpp +++ /dev/null @@ -1,162 +0,0 @@ -#include "SetInterpolationDirsBlockVisitor.h" -#include "Grid3DSystem.h" -#include <D3Q27System.h> -#include "Grid3D.h" -#include "Block3D.h" - - -SetInterpolationDirsBlockVisitor::SetInterpolationDirsBlockVisitor(std::vector<int>& dirs) : - Block3DVisitor(0, Grid3DSystem::MAXLEVEL), dirs(dirs) -{ - -} -////////////////////////////////////////////////////////////////////////// -void SetInterpolationDirsBlockVisitor::visit(Grid3DPtr grid, Block3DPtr block) -{ - int ix1, ix2, ix3, level; - ix1 = block->getX1(); - ix2 = block->getX2(); - ix3 = block->getX3(); - level = block->getLevel(); - using namespace D3Q27System; - if(level==0) return; - - Block3DPtr parentblock = grid->getSuperBlock(ix1,ix2,ix3,level); - if(!parentblock) return; - - for(int dir : dirs) - { - Block3DPtr nblock = grid->getNeighborBlock(dir, ix1, ix2, ix3, level); - if(!nblock) - { - Block3DPtr p_nblock = grid->getNeighborBlock(dir, parentblock); - - if (p_nblock) - { - bool flagDir; - switch (dir) - { - case NE: - checkFlagDir(grid, E, N, flagDir, ix1, ix2, ix3, level); - if(!flagDir) continue; - break; - case SW: - checkFlagDir(grid, W, S, flagDir, ix1, ix2, ix3, level); - if(!flagDir) continue; - break; - case SE: - checkFlagDir(grid, E, S, flagDir, ix1, ix2, ix3, level); - if(!flagDir) continue; - break; - case NW: - checkFlagDir(grid, W, N, flagDir, ix1, ix2, ix3, level); - if(!flagDir) continue; - break; - case TE: - checkFlagDir(grid, E, T, flagDir, ix1, ix2, ix3, level); - if(!flagDir)continue; - break; - case BW: - checkFlagDir(grid, W, B, flagDir, ix1, ix2, ix3, level); - if(!flagDir) continue; - break; - case BE: - checkFlagDir(grid, E, B, flagDir, ix1, ix2, ix3, level); - if(!flagDir) continue; - break; - case TW: - checkFlagDir(grid, W, T, flagDir, ix1, ix2, ix3, level); - if(!flagDir) continue; - break; - case TN: - checkFlagDir(grid, N, T, flagDir, ix1, ix2, ix3, level); - if(!flagDir) continue; - break; - case BS: - checkFlagDir(grid, S, B, flagDir, ix1, ix2, ix3, level); - if(!flagDir) continue; - break; - case BN: - checkFlagDir(grid, N, B, flagDir, ix1, ix2, ix3, level); - if(!flagDir) continue; - break; - case TS: - checkFlagDir(grid, S, T, flagDir, ix1, ix2, ix3, level); - if(!flagDir) continue; - break; - case TNE: - checkFlagDir(grid, E, N, T, flagDir, ix1, ix2, ix3, level); - if (!flagDir) continue; - break; - case TSW: - checkFlagDir(grid, W, S, T, flagDir, ix1, ix2, ix3, level); - if (!flagDir) continue; - break; - case TSE: - checkFlagDir(grid, E, S, T, flagDir, ix1, ix2, ix3, level); - if (!flagDir) continue; - break; - case TNW: - checkFlagDir(grid, W, N, T, flagDir, ix1, ix2, ix3, level); - if (!flagDir) continue; - break; - case BNE: - checkFlagDir(grid, E, N, B, flagDir, ix1, ix2, ix3, level); - if (!flagDir) continue; - break; - case BSW: - checkFlagDir(grid, W, S, B, flagDir, ix1, ix2, ix3, level); - if (!flagDir) continue; - break; - case BSE: - checkFlagDir(grid, E, S, B, flagDir, ix1, ix2, ix3, level); - if (!flagDir) continue; - break; - case BNW: - checkFlagDir(grid, W, N, B, flagDir, ix1, ix2, ix3, level); - if (!flagDir) continue; - break; - } - - block->setInterpolationFlagFC(dir); - parentblock->setInterpolationFlagCF(dir); - } - } - } -} -////////////////////////////////////////////////////////////////////////// -//void SetInterpolationDirsBlockVisitor::checkFlagDir(Grid3DPtr grid, int dir1, int dir2, bool &flagDirection, int ix1, int ix2, int ix3, int level) -//{ -// Block3DPtr block1 = grid->getNeighborBlock(dir1, ix1, ix2, ix3, level); -// Block3DPtr block2 = grid->getNeighborBlock(dir2, ix1, ix2, ix3, level); -// if (!((block1 && block2) || (!block1 && !block2))) -// flagDirection = false; -// else -// flagDirection = true; -//} - -void SetInterpolationDirsBlockVisitor::checkFlagDir(Grid3DPtr grid, int dir1, int dir2, bool &flagDirection, int ix1, int ix2, int ix3, int level) -{ - Block3DPtr block1 = grid->getNeighborBlock(dir1, ix1, ix2, ix3, level); - Block3DPtr block2 = grid->getNeighborBlock(dir2, ix1, ix2, ix3, level); - - Block3DPtr pblock = grid->getSuperBlock(ix1,ix2,ix3,level); - Block3DPtr pblock1 = grid->getNeighborBlock(dir1, pblock); - Block3DPtr pblock2 = grid->getNeighborBlock(dir2, pblock); - - if (!((block1 && block2)||(!block1 && !block2)) || !((pblock1 && pblock2)||(!pblock1 && !pblock2))) - flagDirection = false; - else - flagDirection = true; -} -////////////////////////////////////////////////////////////////////////// -void SetInterpolationDirsBlockVisitor::checkFlagDir(Grid3DPtr grid, int dir1, int dir2, int dir3, bool &flagDirection, int ix1, int ix2, int ix3, int level) -{ - Block3DPtr block1 = grid->getNeighborBlock(dir1, ix1, ix2, ix3, level); - Block3DPtr block2 = grid->getNeighborBlock(dir2, ix1, ix2, ix3, level); - Block3DPtr block3 = grid->getNeighborBlock(dir3, ix1, ix2, ix3, level); - if (!((block1 && block2 && block3) || (!block1 && !block2 && !block3))) - flagDirection=false; - else - flagDirection=true; -} diff --git a/src/VirtualFluids/Visitors/SetInterpolationDirsBlockVisitor.h b/src/VirtualFluids/Visitors/SetInterpolationDirsBlockVisitor.h deleted file mode 100644 index 4ceb754de..000000000 --- a/src/VirtualFluids/Visitors/SetInterpolationDirsBlockVisitor.h +++ /dev/null @@ -1,27 +0,0 @@ -#ifndef SetInterpolationDirsBlockVisitor_h -#define SetInterpolationDirsBlockVisitor_h - -#include <vector> -#include <memory> - -#include "Block3DVisitor.h" - -class Grid3D; -class Block3D; - -class SetInterpolationDirsBlockVisitor : public Block3DVisitor -{ -public: - SetInterpolationDirsBlockVisitor(std::vector<int>& dirs); - - virtual ~SetInterpolationDirsBlockVisitor() {} - - void visit(std::shared_ptr<Grid3D> grid, std::shared_ptr<Block3D> block) override; - -private: - std::vector<int> dirs; - void checkFlagDir(std::shared_ptr<Grid3D> grid, int dir1, int dir2, bool &flagDirection, int ix1, int ix2, int ix3, int level); - void checkFlagDir(std::shared_ptr<Grid3D> grid, int dir1, int dir2, int dir3, bool &flagDirection, int ix1, int ix2, int ix3, int level); -}; - -#endif diff --git a/src/VirtualFluids/Visitors/SetKernelBlockVisitor.cpp b/src/VirtualFluids/Visitors/SetKernelBlockVisitor.cpp deleted file mode 100644 index 24d7cd579..000000000 --- a/src/VirtualFluids/Visitors/SetKernelBlockVisitor.cpp +++ /dev/null @@ -1,90 +0,0 @@ -#include "SetKernelBlockVisitor.h" -#include "Grid3DSystem.h" -#include "LBMSystem.h" -#include "DataSet3D.h" -#include "BCProcessor.h" -#include "Grid3D.h" -#include "Block3D.h" -#include "LBMKernel.h" - -//SetKernelBlockVisitor::SetKernelBlockVisitor(LBMKernel3DPtr kernel, LBMReal nue) : -// Block3DVisitor(0, Grid3DSystem::MAXLEVEL), kernel(kernel), nue(nue) -//{ -// -//} -////////////////////////////////////////////////////////////////////////// -//SetKernelBlockVisitor::SetKernelBlockVisitor( LBMKernel3DPtr kernel, LBMReal nue, double availMem, double needMem ) : -// Block3DVisitor(0, Grid3DSystem::MAXLEVEL), kernel(kernel), nue(nue) -//{ -// if (needMem > availMem) -// { -// throw UbException(UB_EXARGS,"SetKernelBlockVisitor: Not enough memory!!!"); -// } -//} -////////////////////////////////////////////////////////////////////////// -SetKernelBlockVisitor::SetKernelBlockVisitor(LBMKernelPtr kernel, LBMReal nue, double availMem, double needMem, SetKernelBlockVisitor::Action action /*= SetKernelBlockVisitor::New*/) : - Block3DVisitor(0, Grid3DSystem::MAXLEVEL), kernel(kernel), nue(nue), action(action), dataSetFlag(true) -{ - if (needMem > availMem) - { - throw UbException(UB_EXARGS, "SetKernelBlockVisitor: Not enough memory!!!"); - } -} -////////////////////////////////////////////////////////////////////////// -void SetKernelBlockVisitor::visit(Grid3DPtr grid, Block3DPtr block) -{ - if(kernel && (block->getRank() == grid->getRank())) - { - LBMReal collFactor = LBMSystem::calcCollisionFactor(nue, block->getLevel()); - kernel->setCollisionFactor(collFactor); - kernel->setIndex(block->getX1(), block->getX2(), block->getX3()); - kernel->setDeltaT(LBMSystem::getDeltaT(block->getLevel())); - kernel->setBlock(block); - LBMKernelPtr newKernel = kernel->clone(); - - switch (action) - { - case SetKernelBlockVisitor::NewKernel: - block->setKernel(newKernel); - break; - case SetKernelBlockVisitor::ChangeKernel: - { - DataSet3DPtr dataSet = block->getKernel()->getDataSet(); - if (!dataSet) - { - UB_THROW(UbException(UB_EXARGS, "It is not possible to change a DataSet in kernel! Old DataSet is not exist!")); - } - - newKernel->setDataSet(dataSet); - - BCProcessorPtr bcProc = block->getKernel()->getBCProcessor(); - if (!bcProc) - { - UB_THROW(UbException(UB_EXARGS, "It is not possible to change a BCProcessor in kernel! Old BCProcessor is not exist!")); - } - newKernel->setBCProcessor(bcProc); - block->setKernel(newKernel); - } - break; - - case SetKernelBlockVisitor::ChangeKernelWithData: - { - BCProcessorPtr bcProc = block->getKernel()->getBCProcessor(); - if (!bcProc) - { - UB_THROW(UbException(UB_EXARGS, "It is not possible to change a BCProcessor in kernel! Old BCProcessor is not exist!")); - } - newKernel->setBCProcessor(bcProc); - block->setKernel(newKernel); - } - break; - } - - } -} - -void SetKernelBlockVisitor::setNoDataSetFlag(bool flag) -{ - dataSetFlag = flag; -} - diff --git a/src/VirtualFluids/Visitors/SetKernelBlockVisitor.h b/src/VirtualFluids/Visitors/SetKernelBlockVisitor.h deleted file mode 100644 index 8177d433c..000000000 --- a/src/VirtualFluids/Visitors/SetKernelBlockVisitor.h +++ /dev/null @@ -1,36 +0,0 @@ -#ifndef SetKernelBlockVisitor_h -#define SetKernelBlockVisitor_h - -#include <memory> - -#include "Block3DVisitor.h" -#include "LBMSystem.h" - -class Grid3D; -class Block3D; -class LBMKernel; - -class SetKernelBlockVisitor : public Block3DVisitor -{ -public: - enum Action { NewKernel, ChangeKernel, ChangeKernelWithData}; - - //SetKernelBlockVisitor(LBMKernel3DPtr kernel, LBMReal nue); - - //SetKernelBlockVisitor(LBMKernel3DPtr kernel, LBMReal nue, double availMem, double needMem); - - SetKernelBlockVisitor(std::shared_ptr<LBMKernel> kernel, LBMReal nue, double availMem, double needMem, SetKernelBlockVisitor::Action action = SetKernelBlockVisitor::NewKernel); - virtual ~SetKernelBlockVisitor() {} - - void visit(std::shared_ptr<Grid3D> grid, std::shared_ptr<Block3D> block) override; - - void setNoDataSetFlag(bool flag); - -private: - std::shared_ptr<LBMKernel> kernel; - LBMReal nue; - Action action; - bool dataSetFlag; -}; - -#endif diff --git a/src/VirtualFluids/Visitors/SetSolidBlockVisitor.cpp b/src/VirtualFluids/Visitors/SetSolidBlockVisitor.cpp deleted file mode 100644 index 82bff0662..000000000 --- a/src/VirtualFluids/Visitors/SetSolidBlockVisitor.cpp +++ /dev/null @@ -1,33 +0,0 @@ -#include "SetSolidBlockVisitor.h" - -#include "Interactor3D.h" -#include "Grid3DSystem.h" -#include "Grid3D.h" -#include "Block3D.h" - -SetSolidBlockVisitor::SetSolidBlockVisitor(Interactor3DPtr interactor, BlockType type) : - Block3DVisitor(0, Grid3DSystem::MAXLEVEL), interactor(interactor), - type(type) -{ - -} - -void SetSolidBlockVisitor::visit(Grid3DPtr grid, Block3DPtr block) -{ - if(block->getRank() == grid->getRank()) - { - if (block->isActive()) - { - switch (type) - { - case BlockType::SOLID: - interactor->setSolidBlock(block); - break; - case BlockType::BC: - interactor->setBCBlock(block); - break; - } - } - } -} - diff --git a/src/VirtualFluids/Visitors/SetSolidBlockVisitor.h b/src/VirtualFluids/Visitors/SetSolidBlockVisitor.h deleted file mode 100644 index 6c60ef5e8..000000000 --- a/src/VirtualFluids/Visitors/SetSolidBlockVisitor.h +++ /dev/null @@ -1,30 +0,0 @@ -#ifndef SET_SOLID_OR_TRANS_BLOCK_VISITOR_H -#define SET_SOLID_OR_TRANS_BLOCK_VISITOR_H - -#include <memory> - -#include "Block3DVisitor.h" - -#include <VirtualFluidsDefinitions.h> - -class Grid3D; -class Block3D; -class Interactor3D; - -enum class BlockType { SOLID, BC }; - -class VF_PUBLIC SetSolidBlockVisitor : public Block3DVisitor -{ -public: - SetSolidBlockVisitor(std::shared_ptr<Interactor3D> interactor, BlockType type); - virtual ~SetSolidBlockVisitor() {} - - virtual void visit(std::shared_ptr<Grid3D> grid, std::shared_ptr<Block3D> block); - -private: - std::shared_ptr<Interactor3D> interactor; - BlockType type; -}; - -#endif - diff --git a/src/VirtualFluids/Visitors/SetSpongeLayerBlockVisitor.cpp b/src/VirtualFluids/Visitors/SetSpongeLayerBlockVisitor.cpp deleted file mode 100644 index d00d2900a..000000000 --- a/src/VirtualFluids/Visitors/SetSpongeLayerBlockVisitor.cpp +++ /dev/null @@ -1,31 +0,0 @@ -#include "SetSpongeLayerBlockVisitor.h" -#include "Grid3DSystem.h" -#include "LBMSystem.h" - -#include "LBMKernel.h" -#include "Grid3D.h" -#include "Block3D.h" - -SetSpongeLayerBlockVisitor::SetSpongeLayerBlockVisitor( const mu::Parser& spongeLayer ) : Block3DVisitor(0, Grid3DSystem::MAXLEVEL), spongeLayer(spongeLayer) -{ - -} -////////////////////////////////////////////////////////////////////////// -SetSpongeLayerBlockVisitor::~SetSpongeLayerBlockVisitor() -{ - -} -////////////////////////////////////////////////////////////////////////// -void SetSpongeLayerBlockVisitor::visit( Grid3DPtr grid, Block3DPtr block ) -{ - if(block->getRank() == grid->getRank()) - { - LBMKernelPtr kernel = std::dynamic_pointer_cast<LBMKernel>(block->getKernel()); - if (!kernel) - throw std::runtime_error("SetSpongeLayerBlockVisitor: Kernel is not a LBMKernel"); - kernel->setWithSpongeLayer(true); - kernel->setSpongeLayer(spongeLayer); - } -} - - diff --git a/src/VirtualFluids/Visitors/SetSpongeLayerBlockVisitor.h b/src/VirtualFluids/Visitors/SetSpongeLayerBlockVisitor.h deleted file mode 100644 index a92f6daf0..000000000 --- a/src/VirtualFluids/Visitors/SetSpongeLayerBlockVisitor.h +++ /dev/null @@ -1,28 +0,0 @@ -#ifndef SetSpongeLayerBlockVisitor_h__ -#define SetSpongeLayerBlockVisitor_h__ - -#include <memory> - -#include <MuParser/include/muParser.h> - -#include "Block3DVisitor.h" - -class Grid3D; -class Block3D; - -//! \brief Set sponge layer for all kernels of grid -//! \details This visitor is useful if you need to set or reset sponge layer in kernels (e.g. after restart because sponge layer is not serializable). -//! \author K. Kucher -class SetSpongeLayerBlockVisitor : public Block3DVisitor -{ -public: - SetSpongeLayerBlockVisitor(const mu::Parser& spongeLayer); - virtual ~SetSpongeLayerBlockVisitor(); - - void visit(std::shared_ptr<Grid3D> grid, std::shared_ptr<Block3D> block) override; -protected: -private: - mu::Parser spongeLayer; -}; - -#endif // SetSpongeLayerBlockVisitor_h__ diff --git a/src/VirtualFluids/Visitors/SetUndefinedNodesBlockVisitor.cpp b/src/VirtualFluids/Visitors/SetUndefinedNodesBlockVisitor.cpp deleted file mode 100644 index a38ff7c79..000000000 --- a/src/VirtualFluids/Visitors/SetUndefinedNodesBlockVisitor.cpp +++ /dev/null @@ -1,678 +0,0 @@ -#include "SetUndefinedNodesBlockVisitor.h" -#include "BCArray3D.h" -#include "BoundaryConditions.h" -#include "BCProcessor.h" -#include "Grid3DSystem.h" -#include "D3Q27System.h" -#include "BCArray3D.h" -#include "Grid3D.h" -#include "Block3D.h" -#include "ILBMKernel.h" - - -SetUndefinedNodesBlockVisitor::SetUndefinedNodesBlockVisitor() : - Block3DVisitor(0, Grid3DSystem::MAXLEVEL) -{ - -} -////////////////////////////////////////////////////////////////////////// -void SetUndefinedNodesBlockVisitor::visit(Grid3DPtr grid, Block3DPtr block) -{ - if(!block->hasInterpolationFlag()) return; - - ILBMKernelPtr kernel = block->getKernel(); - - if(!kernel && (block->getRank() != grid->getRank())) return; - - //width of ghost layer - //int gl = kernel->getGhostLayerWidth(); - int gl = 0; - - BCArray3DPtr bcMatrix = kernel->getBCProcessor()->getBCArray(); - - int minX1 = gl; - int minX2 = gl; - int minX3 = gl; - - int maxX1 = static_cast<int>(bcMatrix->getNX1())-1-gl; - int maxX2 = static_cast<int>(bcMatrix->getNX2())-1-gl; - int maxX3 = static_cast<int>(bcMatrix->getNX3())-1-gl; - - //int offset = 2; - int offset = 3; - - if(block->hasInterpolationFlag(D3Q27System::E)) - { - int startix1 = maxX1; - int endix1 = maxX1; - if(block->hasInterpolationFlagCF()) startix1 = startix1-offset; - int startix2 = minX2; - int endix2 = maxX2; - int startix3 = minX3; - int endix3 = maxX3; - this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix); - } - if(block->hasInterpolationFlag(D3Q27System::W)) - { - int startix1 = minX1; - int endix1 = minX1; - if(block->hasInterpolationFlagCF()) endix1 = endix1+offset; - int startix2 = minX2; - int endix2 = maxX2; - int startix3 = minX3; - int endix3 = maxX3; - this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix); - } - if(block->hasInterpolationFlag(D3Q27System::N)) - { - int startix1 = minX1; - int endix1 = maxX1; - int startix2 = maxX2; - int endix2 = maxX2; - if(block->hasInterpolationFlagCF()) startix2 = startix2-offset; - int startix3 = minX3; - int endix3 = maxX3; - this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix); - } - if(block->hasInterpolationFlag(D3Q27System::S)) - { - int startix1 = minX1; - int endix1 = maxX1; - int startix2 = minX2; - int endix2 = minX2; - if(block->hasInterpolationFlagCF()) endix2 = endix2+offset; - int startix3 = minX3; - int endix3 = maxX3; - this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix); - } - if(block->hasInterpolationFlag(D3Q27System::T)) - { - int startix1 = minX1; - int endix1 = maxX1; - int startix2 = minX2; - int endix2 = maxX2; - int startix3 = maxX3; - int endix3 = maxX3; - if(block->hasInterpolationFlagCF()) startix3 = startix3-offset; - this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix); - } - if(block->hasInterpolationFlag(D3Q27System::B)) - { - int startix1 = minX1; - int endix1 = maxX1; - int startix2 = minX2; - int endix2 = maxX2; - int startix3 = minX3; - int endix3 = minX3; - if(block->hasInterpolationFlagCF()) endix3 = endix3+offset; - this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix); - } - if(block->hasInterpolationFlag(D3Q27System::NE)) - { - int startix1 = maxX1; - int endix1 = maxX1; - if(block->hasInterpolationFlagCF()) startix1 = startix1-offset; - int startix2 = maxX2; - int endix2 = maxX2; - if(block->hasInterpolationFlagCF()) startix2 = startix2-offset; - int startix3 = minX3; - int endix3 = maxX3; - this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix); - } - if(block->hasInterpolationFlag(D3Q27System::SW)) - { - int startix1 = minX1; - int endix1 = minX1; - if(block->hasInterpolationFlagCF()) endix1 = endix1+offset; - int startix2 = minX2; - int endix2 = minX2; - if(block->hasInterpolationFlagCF()) endix2 = endix2+offset; - int startix3 = minX3; - int endix3 = maxX3; - this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix); - } - if(block->hasInterpolationFlag(D3Q27System::SE)) - { - int startix1 = maxX1; - int endix1 = maxX1; - if(block->hasInterpolationFlagCF()) startix1 = startix1-offset; - int startix2 = minX2; - int endix2 = minX2; - if(block->hasInterpolationFlagCF()) endix2 = endix2+offset; - int startix3 = minX3; - int endix3 = maxX3; - this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix); - } - if(block->hasInterpolationFlag(D3Q27System::NW)) - { - int startix1 = minX1; - int endix1 = minX1; - if(block->hasInterpolationFlagCF()) endix1 = endix1+offset; - int startix2 = maxX2; - int endix2 = maxX2; - if(block->hasInterpolationFlagCF()) startix2 = startix2-offset; - int startix3 = minX3; - int endix3 = maxX3; - this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix); - } - if(block->hasInterpolationFlag(D3Q27System::TE)) - { - int startix1 = maxX1; - int endix1 = maxX1; - if(block->hasInterpolationFlagCF()) startix1 = startix1-offset; - int startix2 = minX2; - int endix2 = maxX2; - int startix3 = maxX3; - int endix3 = maxX3; - if(block->hasInterpolationFlagCF()) startix3 = startix3-offset; - this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix); - } - if(block->hasInterpolationFlag(D3Q27System::BW)) - { - int startix1 = minX1; - int endix1 = minX1; - if(block->hasInterpolationFlagCF()) endix1 = endix1+offset; - int startix2 = minX2; - int endix2 = maxX2; - int startix3 = minX3; - int endix3 = minX3; - if(block->hasInterpolationFlagCF()) endix3 = endix3+offset; - this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix); - } - if(block->hasInterpolationFlag(D3Q27System::BE)) - { - int startix1 = maxX1; - int endix1 = maxX1; - if(block->hasInterpolationFlagCF()) startix1 = startix1-offset; - int startix2 = minX2; - int endix2 = maxX2; - int startix3 = minX3; - int endix3 = minX3; - if(block->hasInterpolationFlagCF()) endix3 = endix3+offset; - this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix); - } - if(block->hasInterpolationFlag(D3Q27System::TW)) - { - int startix1 = minX1; - int endix1 = minX1; - if(block->hasInterpolationFlagCF()) endix1 = endix1+offset; - int startix2 = minX2; - int endix2 = maxX2; - int startix3 = maxX3; - int endix3 = maxX3; - if(block->hasInterpolationFlagCF()) startix3 = startix3-offset; - this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix); - } - if(block->hasInterpolationFlag(D3Q27System::TN)) - { - int startix1 = minX1; - int endix1 = maxX1; - int startix2 = maxX2; - int endix2 = maxX2; - if(block->hasInterpolationFlagCF()) startix2 = startix2-offset; - int startix3 = maxX3; - int endix3 = maxX3; - if(block->hasInterpolationFlagCF()) startix3 = startix3-offset; - this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix); - } - if(block->hasInterpolationFlag(D3Q27System::BS)) - { - int startix1 = minX1; - int endix1 = maxX1; - int startix2 = minX2; - int endix2 = minX2; - if(block->hasInterpolationFlagCF()) endix2 = endix2+offset; - int startix3 = minX3; - int endix3 = minX3; - if(block->hasInterpolationFlagCF()) endix3 = endix3+offset; - this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix); - } - if(block->hasInterpolationFlag(D3Q27System::BN)) - { - int startix1 = minX1; - int endix1 = maxX1; - int startix2 = maxX2; - int endix2 = maxX2; - if(block->hasInterpolationFlagCF()) startix2 = startix2-offset; - int startix3 = minX3; - int endix3 = minX3; - if(block->hasInterpolationFlagCF()) endix3 = endix3+offset; - this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix); - } - if(block->hasInterpolationFlag(D3Q27System::TS)) - { - int startix1 = minX1; - int endix1 = maxX1; - int startix2 = minX2; - int endix2 = minX2; - if(block->hasInterpolationFlagCF()) endix2 = endix2+offset; - int startix3 = maxX3; - int endix3 = maxX3; - if(block->hasInterpolationFlagCF()) startix3 = startix3-offset; - this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix); - } - if(block->hasInterpolationFlag(D3Q27System::TNE)) - { - int startix1 = maxX1; - int endix1 = maxX1; - if(block->hasInterpolationFlagCF()) startix1 = startix1-offset; - int startix2 = maxX2; - int endix2 = maxX2; - if(block->hasInterpolationFlagCF()) startix2 = startix2-offset; - int startix3 = maxX3; - int endix3 = maxX3; - if(block->hasInterpolationFlagCF()) startix3 = startix3-offset; - this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix); - } - if(block->hasInterpolationFlag(D3Q27System::TNW)) - { - int startix1 = minX1; - int endix1 = minX1; - if(block->hasInterpolationFlagCF()) endix1 = endix1+offset; - int startix2 = maxX2; - int endix2 = maxX2; - if(block->hasInterpolationFlagCF()) startix2 = startix2-offset; - int startix3 = maxX3; - int endix3 = maxX3; - if(block->hasInterpolationFlagCF()) startix3 = startix3-offset; - this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix); - } - if(block->hasInterpolationFlag(D3Q27System::TSE)) - { - int startix1 = maxX1; - int endix1 = maxX1; - if(block->hasInterpolationFlagCF()) startix1 = startix1-offset; - int startix2 = minX2; - int endix2 = minX2; - if(block->hasInterpolationFlagCF()) endix2 = endix2+offset; - int startix3 = maxX3; - int endix3 = maxX3; - if(block->hasInterpolationFlagCF()) startix3 = startix3-offset; - this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix); - } - if(block->hasInterpolationFlag(D3Q27System::TSW)) - { - int startix1 = minX1; - int endix1 = minX1; - if(block->hasInterpolationFlagCF()) endix1 = endix1+offset; - int startix2 = minX2; - int endix2 = minX2; - if(block->hasInterpolationFlagCF()) endix2 = endix2+offset; - int startix3 = maxX3; - int endix3 = maxX3; - if(block->hasInterpolationFlagCF()) startix3 = startix3-offset; - this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix); - } - if(block->hasInterpolationFlag(D3Q27System::BNE)) - { - int startix1 = maxX1; - int endix1 = maxX1; - if(block->hasInterpolationFlagCF()) startix1 = startix1-offset; - int startix2 = maxX2; - int endix2 = maxX2; - if(block->hasInterpolationFlagCF()) startix2 = startix2-offset; - int startix3 = minX3; - int endix3 = minX3; - if(block->hasInterpolationFlagCF()) endix3 = endix3+offset; - this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix); - } - if(block->hasInterpolationFlag(D3Q27System::BNW)) - { - int startix1 = minX1; - int endix1 = minX1; - if(block->hasInterpolationFlagCF()) endix1 = endix1+offset; - int startix2 = maxX2; - int endix2 = maxX2; - if(block->hasInterpolationFlagCF()) startix2 = startix2-offset; - int startix3 = minX3; - int endix3 = minX3; - if(block->hasInterpolationFlagCF()) endix3 = endix3+offset; - this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix); - } - if(block->hasInterpolationFlag(D3Q27System::BSE)) - { - int startix1 = maxX1; - int endix1 = maxX1; - if(block->hasInterpolationFlagCF()) startix1 = startix1-offset; - int startix2 = minX2; - int endix2 = minX2; - if(block->hasInterpolationFlagCF()) endix2 = endix2+offset; - int startix3 = minX3; - int endix3 = minX3; - if(block->hasInterpolationFlagCF()) endix3 = endix3+offset; - this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix); - } - if(block->hasInterpolationFlag(D3Q27System::BSW)) - { - int startix1 = minX1; - int endix1 = minX1; - if(block->hasInterpolationFlagCF()) endix1 = endix1+offset; - int startix2 = minX2; - int endix2 = minX2; - if(block->hasInterpolationFlagCF()) endix2 = endix2+offset; - int startix3 = minX3; - int endix3 = minX3; - if(block->hasInterpolationFlagCF()) endix3 = endix3+offset; - this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix); - } - - - - ////////////////////////////////////////////////////////////////////////// - int offset2 = 1; - int ll = 0; - - minX1 = ll; - minX2 = ll; - minX3 = ll; - - maxX1 = static_cast<int>(bcMatrix->getNX1())-1-ll; - maxX2 = static_cast<int>(bcMatrix->getNX2())-1-ll; - maxX3 = static_cast<int>(bcMatrix->getNX3())-1-ll; - - if(block->hasInterpolationFlagFC(D3Q27System::E)) - { - int startix1 = maxX1-offset2; - int endix1 = maxX1; - int startix2 = minX2; - int endix2 = maxX2; - int startix3 = minX3; - int endix3 = maxX3; - this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix); - } - if(block->hasInterpolationFlagFC(D3Q27System::W)) - { - int startix1 = minX1; - int endix1 = minX1+offset2; - int startix2 = minX2; - int endix2 = maxX2; - int startix3 = minX3; - int endix3 = maxX3; - this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix); - } - if(block->hasInterpolationFlagFC(D3Q27System::N)) - { - int startix1 = minX1; - int endix1 = maxX1; - int startix2 = maxX2-offset2; - int endix2 = maxX2; - int startix3 = minX3; - int endix3 = maxX3; - this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix); - } - if(block->hasInterpolationFlagFC(D3Q27System::S)) - { - int startix1 = minX1; - int endix1 = maxX1; - int startix2 = minX2; - int endix2 = minX2+offset2; - int startix3 = minX3; - int endix3 = maxX3; - this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix); - } - if(block->hasInterpolationFlagFC(D3Q27System::T)) - { - int startix1 = minX1; - int endix1 = maxX1; - int startix2 = minX2; - int endix2 = maxX2; - int startix3 = maxX3-offset2; - int endix3 = maxX3; - this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix); - } - if(block->hasInterpolationFlagFC(D3Q27System::B)) - { - int startix1 = minX1; - int endix1 = maxX1; - int startix2 = minX2; - int endix2 = maxX2; - int startix3 = minX3; - int endix3 = minX3+offset2; - this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix); - } - if(block->hasInterpolationFlagFC(D3Q27System::NE)) - { - int startix1 = maxX1-offset2; - int endix1 = maxX1; - int startix2 = maxX2-offset2; - int endix2 = maxX2; - int startix3 = minX3; - int endix3 = maxX3; - this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix); - } - if(block->hasInterpolationFlagFC(D3Q27System::SW)) - { - int startix1 = minX1; - int endix1 = minX1+offset2; - int startix2 = minX2; - int endix2 = minX2+offset2; - int startix3 = minX3; - int endix3 = maxX3; - this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix); - } - if(block->hasInterpolationFlagFC(D3Q27System::SE)) - { - int startix1 = maxX1-offset2; - int endix1 = maxX1; - int startix2 = minX2; - int endix2 = minX2+offset2; - int startix3 = minX3; - int endix3 = maxX3; - this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix); - } - if(block->hasInterpolationFlagFC(D3Q27System::NW)) - { - int startix1 = minX1; - int endix1 = minX1+offset2; - int startix2 = maxX2-offset2; - int endix2 = maxX2; - int startix3 = minX3; - int endix3 = maxX3; - this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix); - } - if(block->hasInterpolationFlagFC(D3Q27System::TE)) - { - int startix1 = maxX1-offset2; - int endix1 = maxX1; - int startix2 = minX2; - int endix2 = maxX2; - int startix3 = maxX3-offset2; - int endix3 = maxX3; - this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix); - } - if(block->hasInterpolationFlagFC(D3Q27System::BW)) - { - int startix1 = minX1; - int endix1 = minX1+offset2; - int startix2 = minX2; - int endix2 = maxX2; - int startix3 = minX3; - int endix3 = minX3+offset2; - this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix); - } - if(block->hasInterpolationFlagFC(D3Q27System::BE)) - { - int startix1 = maxX1-offset2; - int endix1 = maxX1; - int startix2 = minX2; - int endix2 = maxX2; - int startix3 = minX3; - int endix3 = minX3+offset2; - this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix); - } - if(block->hasInterpolationFlagFC(D3Q27System::TW)) - { - int startix1 = minX1; - int endix1 = minX1+offset2; - int startix2 = minX2; - int endix2 = maxX2; - int startix3 = maxX3-offset2; - int endix3 = maxX3; - this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix); - } - if(block->hasInterpolationFlagFC(D3Q27System::TN)) - { - int startix1 = minX1; - int endix1 = maxX1; - int startix2 = maxX2-offset2; - int endix2 = maxX2; - int startix3 = maxX3-offset2; - int endix3 = maxX3; - this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix); - } - if(block->hasInterpolationFlagFC(D3Q27System::BS)) - { - int startix1 = minX1; - int endix1 = maxX1; - int startix2 = minX2; - int endix2 = minX2+offset2; - int startix3 = minX3; - int endix3 = minX3+offset2; - this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix); - } - if(block->hasInterpolationFlagFC(D3Q27System::BN)) - { - int startix1 = minX1; - int endix1 = maxX1; - int startix2 = maxX2-offset2; - int endix2 = maxX2; - int startix3 = minX3; - int endix3 = minX3+offset2; - this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix); - } - if(block->hasInterpolationFlagFC(D3Q27System::TS)) - { - int startix1 = minX1; - int endix1 = maxX1; - int startix2 = minX2; - int endix2 = minX2+offset2; - int startix3 = maxX3-offset2; - int endix3 = maxX3; - this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix); - } - if(block->hasInterpolationFlagFC(D3Q27System::TNE)) - { - int startix1 = maxX1-offset2; - int endix1 = maxX1; - int startix2 = maxX2-offset2; - int endix2 = maxX2; - int startix3 = maxX3-offset2; - int endix3 = maxX3; - this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix); - } - if(block->hasInterpolationFlagFC(D3Q27System::TNW)) - { - int startix1 = minX1; - int endix1 = minX1+offset2; - int startix2 = maxX2-offset2; - int endix2 = maxX2; - int startix3 = maxX3-offset2; - int endix3 = maxX3; - this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix); - } - if(block->hasInterpolationFlagFC(D3Q27System::TSE)) - { - int startix1 = maxX1-offset2; - int endix1 = maxX1; - int startix2 = minX2; - int endix2 = minX2+offset2; - int startix3 = maxX3-offset2; - int endix3 = maxX3; - this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix); - } - if(block->hasInterpolationFlagFC(D3Q27System::TSW)) - { - int startix1 = minX1; - int endix1 = minX1+offset2; - int startix2 = minX2; - int endix2 = minX2+offset2; - int startix3 = maxX3-offset2; - int endix3 = maxX3; - this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix); - } - if(block->hasInterpolationFlagFC(D3Q27System::BNE)) - { - int startix1 = maxX1-offset2; - int endix1 = maxX1; - int startix2 = maxX2-offset2; - int endix2 = maxX2; - int startix3 = minX3; - int endix3 = minX3+offset2; - this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix); - } - if(block->hasInterpolationFlagFC(D3Q27System::BNW)) - { - int startix1 = minX1; - int endix1 = minX1+offset2; - int startix2 = maxX2-offset2; - int endix2 = maxX2; - int startix3 = minX3; - int endix3 = minX3+offset2; - this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix); - } - if(block->hasInterpolationFlagFC(D3Q27System::BSE)) - { - int startix1 = maxX1-offset2; - int endix1 = maxX1; - int startix2 = minX2; - int endix2 = minX2+offset2; - int startix3 = minX3; - int endix3 = minX3+offset2; - this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix); - } - if(block->hasInterpolationFlagFC(D3Q27System::BSW)) - { - int startix1 = minX1; - int endix1 = minX1+offset2; - int startix2 = minX2; - int endix2 = minX2+offset2; - int startix3 = minX3; - int endix3 = minX3+offset2; - this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix); - } - - //invert scaleCF blocks - if(block->hasInterpolationFlagCF()) - { - if(block->hasInterpolationFlagFC()) - { - for (int i = D3Q27System::E; i <= D3Q27System::BSW; i++) - { - UBLOG(logINFO, "FC in dir="<<i<<" "<<block->hasInterpolationFlagFC(i)); - } - for (int i = D3Q27System::E; i<=D3Q27System::BSW; i++) - { - UBLOG(logINFO, "CF in dir="<<i<<" "<<block->hasInterpolationFlagCF(i)); - } - throw UbException(UB_EXARGS, "block "+block->toString()+" has CF and FC"); - } - - minX1 = gl; - minX2 = gl; - minX3 = gl; - - maxX1 = static_cast<int>(bcMatrix->getNX1())-1-gl; - maxX2 = static_cast<int>(bcMatrix->getNX2())-1-gl; - maxX3 = static_cast<int>(bcMatrix->getNX3())-1-gl; - - for (int ix3=minX3; ix3<=maxX3; ix3++) - for (int ix2=minX2; ix2<=maxX2; ix2++) - for (int ix1=minX1; ix1<=maxX1; ix1++) - { - if(bcMatrix->isUndefined(ix1, ix2, ix3)) bcMatrix->setFluid(ix1, ix2, ix3); - else bcMatrix->setUndefined(ix1, ix2, ix3); - } - return; - } - -} -////////////////////////////////////////////////////////////////////////// -void SetUndefinedNodesBlockVisitor::setNodesUndefined( int startix1, int endix1, int startix2, int endix2, int startix3, int endix3, BCArray3DPtr bcMatrix ) -{ - for (int ix3=startix3; ix3<=endix3; ix3++) - for (int ix2=startix2; ix2<=endix2; ix2++) - for (int ix1=startix1; ix1<=endix1; ix1++) - { - bcMatrix->setUndefined(ix1, ix2, ix3); - } -} diff --git a/src/VirtualFluids/Visitors/SetUndefinedNodesBlockVisitor.h b/src/VirtualFluids/Visitors/SetUndefinedNodesBlockVisitor.h deleted file mode 100644 index 00c37cc24..000000000 --- a/src/VirtualFluids/Visitors/SetUndefinedNodesBlockVisitor.h +++ /dev/null @@ -1,24 +0,0 @@ -#ifndef SetUndefinedNodesBlockVisitor_h -#define SetUndefinedNodesBlockVisitor_h - -#include <memory> - -#include "Block3DVisitor.h" - -class Grid3D; -class Block3D; -class BCArray3D; - -class SetUndefinedNodesBlockVisitor : public Block3DVisitor -{ -public: - SetUndefinedNodesBlockVisitor(); - - virtual ~SetUndefinedNodesBlockVisitor() {} - - void visit(std::shared_ptr<Grid3D> grid, std::shared_ptr<Block3D> block) override; - -private: - void setNodesUndefined( int startix1, int endix1, int startix2, int endix2, int startix3, int endix3, std::shared_ptr<BCArray3D> bcMatix ); -}; -#endif diff --git a/src/VirtualFluids/Visitors/SpongeLayerBlockVisitor.cpp b/src/VirtualFluids/Visitors/SpongeLayerBlockVisitor.cpp deleted file mode 100644 index b1890fefd..000000000 --- a/src/VirtualFluids/Visitors/SpongeLayerBlockVisitor.cpp +++ /dev/null @@ -1,44 +0,0 @@ -#include "SpongeLayerBlockVisitor.h" - -#include <vector> - -#include "Grid3DSystem.h" -#include "LBMSystem.h" -#include <numerics/geometry3d/GbCuboid3D.h> -#include "Grid3D.h" -#include "Block3D.h" -#include "ILBMKernel.h" - - -SpongeLayerBlockVisitor::SpongeLayerBlockVisitor(GbCuboid3DPtr boundingBox) : Block3DVisitor(0, Grid3DSystem::MAXLEVEL), boundingBox(boundingBox) -{ - -} -////////////////////////////////////////////////////////////////////////// -SpongeLayerBlockVisitor::~SpongeLayerBlockVisitor() -{ - -} -////////////////////////////////////////////////////////////////////////// -void SpongeLayerBlockVisitor::visit(Grid3DPtr grid, Block3DPtr block) -{ - if (block->getRank() == grid->getRank()) - { - UbTupleDouble3 org = grid->getBlockWorldCoordinates(block); - UbTupleDouble3 blockLengths = grid->getBlockLengths(block); - - double minX1 = val<1>(org); - double minX2 = val<2>(org); - double minX3 = val<3>(org); - double maxX1 = val<1>(org) + val<1>(blockLengths); - double maxX2 = val<2>(org) + val<2>(blockLengths); - double maxX3 = val<3>(org) + val<3>(blockLengths); - - if (boundingBox->isCellInsideGbObject3D(minX1, minX2, minX3, maxX1, maxX2, maxX3)) - { - ILBMKernelPtr kernel = block->getKernel(); - kernel->setCollisionFactor(LBMSystem::calcCollisionFactor(0.01, block->getLevel())); - } - } -} - diff --git a/src/VirtualFluids/Visitors/SpongeLayerBlockVisitor.h b/src/VirtualFluids/Visitors/SpongeLayerBlockVisitor.h deleted file mode 100644 index e5c89f4a2..000000000 --- a/src/VirtualFluids/Visitors/SpongeLayerBlockVisitor.h +++ /dev/null @@ -1,25 +0,0 @@ -#ifndef SpongeLayerBlockVisitor_h__ -#define SpongeLayerBlockVisitor_h__ - -#include "Block3DVisitor.h" - -class Grid3D; -class Block3D; -class GbCuboid3D; - -//! \brief Set sponge layer for all kernels of grid -//! \details This visitor is useful if you need to set or reset sponge layer in kernels (e.g. after restart because sponge layer is not serializable). -//! \author K. Kutscher -class SpongeLayerBlockVisitor : public Block3DVisitor -{ -public: - SpongeLayerBlockVisitor(std::shared_ptr<GbCuboid3D> boundingBox); - virtual ~SpongeLayerBlockVisitor(); - - void visit(std::shared_ptr<Grid3D> grid, std::shared_ptr<Block3D> block) override; - -private: - std::shared_ptr<GbCuboid3D> boundingBox; -}; - -#endif // SetSpongeLayerBlockVisitor_h__ diff --git a/src/VirtualFluids/Visitors/ViscosityBlockVisitor.cpp b/src/VirtualFluids/Visitors/ViscosityBlockVisitor.cpp deleted file mode 100644 index add632c87..000000000 --- a/src/VirtualFluids/Visitors/ViscosityBlockVisitor.cpp +++ /dev/null @@ -1,22 +0,0 @@ -#include "ViscosityBlockVisitor.h" -#include "Grid3DSystem.h" -#include "LBMSystem.h" -#include "Block3D.h" -#include "Grid3D.h" -#include "ILBMKernel.h" - -ViscosityBlockVisitor::ViscosityBlockVisitor(LBMReal nu) : -Block3DVisitor(0, Grid3DSystem::MAXLEVEL), nu(nu) -{ - -} -////////////////////////////////////////////////////////////////////////// -void ViscosityBlockVisitor::visit(Grid3DPtr grid, Block3DPtr block) -{ - if (block->getRank() == grid->getRank()) - { - LBMReal collFactor = LBMSystem::calcCollisionFactor(nu, block->getLevel()); - block->getKernel()->setCollisionFactor(collFactor); - } -} - diff --git a/src/VirtualFluids/Visitors/ViscosityBlockVisitor.h b/src/VirtualFluids/Visitors/ViscosityBlockVisitor.h deleted file mode 100644 index c5ec45ec2..000000000 --- a/src/VirtualFluids/Visitors/ViscosityBlockVisitor.h +++ /dev/null @@ -1,25 +0,0 @@ -#ifndef ViscosityBlockVisitor_h -#define ViscosityBlockVisitor_h - -#include <memory> - -#include "Block3DVisitor.h" -#include "LBMSystem.h" - -class Grid3D; -class Block3D; - -class ViscosityBlockVisitor : public Block3DVisitor -{ -public: - ViscosityBlockVisitor(LBMReal nu); - - virtual ~ViscosityBlockVisitor() {} - - void visit(std::shared_ptr<Grid3D> grid, std::shared_ptr<Block3D> block) override; - -private: - LBMReal nu; -}; - -#endif diff --git a/src/VirtualFluids/Visitors/ZoltanPartitioningGridVisitor.cpp b/src/VirtualFluids/Visitors/ZoltanPartitioningGridVisitor.cpp deleted file mode 100644 index 87a745c69..000000000 --- a/src/VirtualFluids/Visitors/ZoltanPartitioningGridVisitor.cpp +++ /dev/null @@ -1,144 +0,0 @@ -#if defined VF_ZOLTAN && defined VF_MPI - -#include "ZoltanPartitioningGridVisitor.h" -#include <vector> - -using namespace std; - -ZoltanPartitioningGridVisitor::ZoltanPartitioningGridVisitor(CommunicatorPtr comm, int numOfDirs, int numOfLocalParts) : -comm(comm), -numOfDirs(numOfDirs), -numOfLocalParts(numOfLocalParts) -{ -} -////////////////////////////////////////////////////////////////////////// -ZoltanPartitioningGridVisitor::~ZoltanPartitioningGridVisitor() -{ - -} -////////////////////////////////////////////////////////////////////////// -void ZoltanPartitioningGridVisitor::visit(Grid3DPtr grid) -{ - UBLOG(logDEBUG5, "ZoltanPartitioningPatchVisitor::visit() - start"); - - //MPI_Comm mpi_comm = *((MPI_Comm*) comm->getNativeCommunicator()); - - //ZoltanPartitioner zp(mpi_comm, comm->getProcessID(), numOfLocalParts); - // - //graph = zp.getGraphData(); - - collectData(grid); - - //zp.partition(); - - //repartGrid(grid, zp); - - UBLOG(logDEBUG5, "ZoltanPartitioningPatchVisitor::visit() - end"); -} -////////////////////////////////////////////////////////////////////////// -void ZoltanPartitioningGridVisitor::collectData(Grid3DPtr grid) -{ - int myRank = comm->getProcessID(); - int numOfProc = comm->getNumberOfProcesses(); - - if (numOfProc < 2) - { - return; - } - - int minInitLevel = grid->getCoarsestInitializedLevel(); - int maxInitLevel = grid->getFinestInitializedLevel(); - - for (int l = minInitLevel; l<=maxInitLevel; l++) - { - MPI_Comm mpi_comm = *((MPI_Comm*)comm->getNativeCommunicator()); - ZoltanPartitioner zp(mpi_comm, comm->getProcessID(), numOfLocalParts); - graph = zp.getGraphData(); - - int n = 0; - vector<Block3DPtr> blockVector; - grid->getBlocks(l, blockVector); - - if (blockVector.size() == 0) - { - UB_THROW(UbException(UB_EXARGS, "Blocks for decomposition don't exist!")); - } - - //Verteilung von Ranks - int rank = 0; - for(Block3DPtr block : blockVector) - { - block->setRank(rank); - block->setPart(rank); - rank++; - if (rank > numOfProc - 1) - rank = 0; - } - - int vertices = 0; - - for(Block3DPtr block : blockVector) - { - if (block->getRank() == myRank) - { - vertices++; - - vertexGID.push_back(block->getGlobalID()); - - int edges = 0; - for (int dir = 0; dir <= numOfDirs; dir++) - { - Block3DPtr neighBlock = (grid->getNeighborBlock(dir, - block->getX1(), block->getX2(), block->getX3(), l)); - - if (neighBlock) - { - edges++; - nborGID.push_back(neighBlock->getGlobalID()); - nborProc.push_back(neighBlock->getRank()); - } - } - numEdges.push_back(edges); - } - } - graph->numLocalVertices = vertices; - graph->vnumEdges = numEdges; - graph->vvertexGID = vertexGID; - graph->vnborGID = nborGID; - graph->vnborProc = nborProc; - - zp.partition(); - repartGrid(grid, zp); - } -} -////////////////////////////////////////////////////////////////////////// -void ZoltanPartitioningGridVisitor::repartGrid(Grid3DPtr grid, ZoltanPartitioner& zp) -{ - if (zp.areChanges()) - { - UBLOG(logDEBUG5, "ZoltanPartitioningPatchVisitor::repartGrid - start" ); - vector<int> sExportGlobalGids, sExportToPart, sExportProcs; - vector<int> rExportGlobalGids, rExportToPart, rExportProcs; - - zp.getExportData(sExportGlobalGids, sExportToPart, sExportProcs); - - comm->allGather(sExportGlobalGids, rExportGlobalGids); - comm->allGather(sExportToPart, rExportToPart); - comm->allGather(sExportProcs, rExportProcs); - - for (int i = 0; i < (int)rExportGlobalGids.size(); i++) - { - if (rExportGlobalGids[i] != -1) - { - Block3DPtr block = grid->getBlock(rExportGlobalGids[i]); - if(block) - { - block->setRank(rExportProcs[i]); - block->setPart(rExportToPart[i]); - } - } - } - UBLOG(logDEBUG5, "ZoltanPartitioningPatchVisitor::repartGrid - end" ); - } -} -#endif diff --git a/src/VirtualFluids/Visitors/ZoltanPartitioningGridVisitor.h b/src/VirtualFluids/Visitors/ZoltanPartitioningGridVisitor.h deleted file mode 100644 index 0b39fa1ab..000000000 --- a/src/VirtualFluids/Visitors/ZoltanPartitioningGridVisitor.h +++ /dev/null @@ -1,38 +0,0 @@ -/** -* @file ZoltanPartitioningPatchVisitor.h -* @brief Visitor class wich apply Zoltan library partitioning. -* @author Kostyantyn Kucher -* @date 10.06.2011 -*/ - -#ifndef ZoltanPartitioningGridVisitor_H -#define ZoltanPartitioningGridVisitor_H - -#if defined VF_ZOLTAN && defined VF_MPI - -#include "Grid3DVisitor.h" -#include "Communicator.h" -#include "ZoltanPartitioner.h" - -class ZoltanPartitioningGridVisitor : public Grid3DVisitor -{ -public: - ZoltanPartitioningGridVisitor(CommunicatorPtr comm, int numOfDirs, int numOfLocalParts = 1); - ~ZoltanPartitioningGridVisitor(); - void visit(Grid3DPtr grid); -protected: - void collectData(Grid3DPtr grid); - void repartGrid(Grid3DPtr grid, ZoltanPartitioner& zp); -private: - CommunicatorPtr comm; - int numOfDirs; - int numOfLocalParts; - ZoltanGraph *graph; - std::vector<int> vertexGID; - std::vector<int> numEdges; - std::vector<int> nborGID; - std::vector<int> nborProc; -}; - -#endif -#endif diff --git a/src/VirtualFluids/Visitors/package.include b/src/VirtualFluids/Visitors/package.include deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/VirtualFluids/package.include b/src/VirtualFluids/package.include deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/VirtualFluidsBasics/basics/writer/WbWriterVtkXmlBinary.cpp b/src/VirtualFluidsBasics/basics/writer/WbWriterVtkXmlBinary.cpp index f7fdd7934..be80d2b3d 100644 --- a/src/VirtualFluidsBasics/basics/writer/WbWriterVtkXmlBinary.cpp +++ b/src/VirtualFluidsBasics/basics/writer/WbWriterVtkXmlBinary.cpp @@ -3,7 +3,7 @@ #include <basics/utilities/UbLogger.h> #include <basics/utilities/UbSystem.h> -#include <buildInfo.h> +#include "Core/buildInfo.h" #include <cstring> using namespace std; diff --git a/src/VirtualFluidsBasics/utilities/StringUtil/StringUtilTest.cpp b/src/VirtualFluidsBasics/utilities/StringUtil/StringUtilTest.cpp deleted file mode 100644 index 18c77d355..000000000 --- a/src/VirtualFluidsBasics/utilities/StringUtil/StringUtilTest.cpp +++ /dev/null @@ -1,116 +0,0 @@ -#include "gmock/gmock.h" - -#include "StringUtil.h" - -TEST(StringUtilTest, findAndReplace) -{ - std::string source0 = "2232fh"; - std::string source1 = "find_2232fh"; - std::string source2 = "2q232_find_2232fh"; - std::string source3 = "2q232_find"; - std::string source4 = "find_2q232_find"; - std::string source5 = "find_2q2find2_find"; - - std::string find = "find"; - std::string replace = "replace"; - - EXPECT_THAT(StringUtil::findAndReplace(source0, find, replace), "2232fh"); - EXPECT_THAT(StringUtil::findAndReplace(source1, find, replace), "replace_2232fh"); - EXPECT_THAT(StringUtil::findAndReplace(source2, find, replace), "2q232_replace_2232fh"); - EXPECT_THAT(StringUtil::findAndReplace(source3, find, replace), "2q232_replace"); - EXPECT_THAT(StringUtil::findAndReplace(source4, find, replace), "replace_2q232_replace"); - EXPECT_THAT(StringUtil::findAndReplace(source5, find, replace), "replace_2q2replace2_replace"); -} - -TEST(StringUtilTest, makeUpper) -{ - std::string source = "hello123world"; - EXPECT_THAT(StringUtil::makeUpper(source), "HELLO123WORLD"); -} - -TEST(StringUtilTest, makeLower) -{ - std::string source = "HELLO123WORLD"; - EXPECT_THAT(StringUtil::makeLower(source), "hello123world"); -} - -TEST(StringUtilTest, contains_shouldReturnTrue) -{ - std::string source = "fsd8998--++search++d"; - const char* find = "search"; - EXPECT_TRUE(StringUtil::contains(source, find)); -} - -TEST(StringUtilTest, contains_shouldReturnFalse) -{ - std::string source = "fsd8998--++++d"; - const char* find = "search"; - EXPECT_FALSE(StringUtil::contains(source, find)); -} - -TEST(StringUtilTest, pad) -{ - std::string source = "start"; - char pad = '1'; - int length = 6; - EXPECT_THAT(StringUtil::pad(source, pad, length), "start1"); -} - -TEST(StringUtilTest, trimAStringDeletesTrimAtTheStartAndTheEnd) -{ - std::string source = " for after "; - std::string trim = " "; - EXPECT_THAT(StringUtil::trim(source, trim), "for after"); -} - -TEST(StringUtilTest, convertStringToInt) -{ - std::string source = " 1 "; - EXPECT_THAT(StringUtil::toInt(source), 1); -} - -TEST(StringUtilTest, convertStringToFloat) -{ - std::string source = " 1.2 "; - EXPECT_THAT(StringUtil::toFloat(source), testing::FloatEq(1.2f)); -} - -TEST(StringUtilTest, convertStringToDouble) -{ - std::string source = " 1.2 "; - EXPECT_THAT(StringUtil::toDouble(source), testing::DoubleEq(1.2)); -} - -TEST(StringUtilTest, convertStringToBool) -{ - std::string source0 = "false"; - EXPECT_FALSE(StringUtil::toBool(source0)); - - std::string source = "true"; - EXPECT_TRUE(StringUtil::toBool(source)); -} - -TEST(StringUtilTest, toVector) -{ - std::string source = " 1 2 3 "; - auto values = StringUtil::toVector(source); - - EXPECT_THAT(values[0], 1); - EXPECT_THAT(values[1], 2); - EXPECT_THAT(values[2], 3); - - EXPECT_THAT(values.size(), 3); -} - -TEST(StringUtilTest, toString_implementedWithInt) -{ - int i = 123; - EXPECT_THAT(StringUtil::toString(i), "123"); -} - -TEST(StringUtilTest, string_ends_with) -{ - std::string myString = "MyString"; - EXPECT_TRUE(StringUtil::endsWith(myString, "String")); - EXPECT_FALSE(StringUtil::endsWith(myString, "FOO")); -} diff --git a/src/VirtualFluidsBasics/utilities/StringUtil/package.include b/src/VirtualFluidsBasics/utilities/StringUtil/package.include deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/VirtualFluidsBasics/utilities/input/ConfigInput/ConfigInputTest.cpp b/src/VirtualFluidsBasics/utilities/input/ConfigInput/ConfigInputTest.cpp deleted file mode 100644 index e8ae86b03..000000000 --- a/src/VirtualFluidsBasics/utilities/input/ConfigInput/ConfigInputTest.cpp +++ /dev/null @@ -1,144 +0,0 @@ -#include "ConfigInput.h" -#include "gmock/gmock.h" - - - -using namespace input; - - -TEST(ConfigInputTest, configFileWithKeyValuePair_ShouldReadTheCorrectValuePair) -{ - std::istringstream stringstream( - "key=value\n" - "key2=value2\n" - ); - - ConfigInput input(stringstream); - - EXPECT_THAT(input.getValue("key"), "value"); - EXPECT_THAT(input.getValue("key2"), "value2"); -} - -TEST(ConfigInputTest, configFileWithKeyValuePair_ShouldReadTheCorrectValuePair_WithIgnoringBlankLines) -{ - std::istringstream stringstream( - "\n\n" - "key=value\n" - "\n" - "key2=value2\n" - "\n" - ); - - ConfigInput input(stringstream); - - EXPECT_THAT(input.getValue("key"), "value"); - EXPECT_THAT(input.getValue("key2"), "value2"); -} - -TEST(ConfigInputTest, configFileWithKeyValuePair_ShouldReadTheCorrectValuePair_WithIgnoringSpacesAfterEqual) -{ - std::istringstream stringstream( - "\n\n" - "key= value\n" - "\n" - "key2= value2\n" - "\n" - ); - - ConfigInput input(stringstream); - - EXPECT_THAT(input.getValue("key"), "value"); - EXPECT_THAT(input.getValue("key2"), "value2"); -} - - -TEST(DISABLED_ConfigInputTest, configFileWithKeyValuePair_ShouldReadTheCorrectValuePair_WithIgnoringSpacesBeforeEqual) -{ - std::istringstream stringstream( - "\n\n" - "key = value\n" - "\n" - "key2 = value2\n" - "\n" - ); - - ConfigInput input(stringstream); - - EXPECT_THAT(input.getValue("key"), "value"); - EXPECT_THAT(input.getValue("key2"), "value2"); -} - -TEST(ConfigInputTest, configFileWithKeyValuePair_ShouldReadTheCorrectValuePair_WithMissingValue) -{ - std::istringstream stringstream( - "\n\n" - "key= \n" - "\n" - "key2= value2\n" - "\n" - ); - - ConfigInput input(stringstream); - - EXPECT_THAT(input.getValue("key"), ""); - EXPECT_THAT(input.getValue("key2"), "value2"); -} - -TEST(ConfigInputTest, configFileWithKeyValuePair_getValueFromInvalidKey_ShouldReturnEmptyString) -{ - std::istringstream stringstream( - "" - ); - - ConfigInput input(stringstream); - - EXPECT_THAT(input.getValue("key"), ""); -} - -TEST(ConfigInputTest, configFileWithKeyValuePair_HasKeyWithInvalidKey_ReturnFalse) -{ - std::istringstream stringstream( - "" - ); - - ConfigInput input(stringstream); - - EXPECT_THAT(input.hasValue("key"), false); -} - -TEST(ConfigInputTest, configFileWithKeyValuePair_HasKeyWithValidKey_ReturnTrue) -{ - std::istringstream stringstream( - "key=value\n" - ); - - ConfigInput input(stringstream); - - EXPECT_THAT(input.hasValue("key"), true); -} - -TEST(ConfigInputTest, configFileWithKeyValuePair_ReturnValueAndIgnoreComments) -{ - std::istringstream stringstream( - "# comment\n" - "key=value\n" - "# comment\n" - ); - - ConfigInput input(stringstream); - - EXPECT_THAT(input.getValue("key"), "value"); -} - -TEST(ConfigInputTest, configFileWithKeyValuePair_ReturnValue_ShouldIgnoreQuotationMarks) -{ - std::istringstream stringstream( - "# comment\n" - "key=\"value\"\n" - "# comment\n" - ); - - ConfigInput input(stringstream); - - EXPECT_THAT(input.getValue("key"), "value"); -} diff --git a/src/VirtualFluidsBasics/utilities/input/ConfigInput/package.include b/src/VirtualFluidsBasics/utilities/input/ConfigInput/package.include deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/VirtualFluidsBasics/utilities/input/JsonInput/JsonInputTest.cpp b/src/VirtualFluidsBasics/utilities/input/JsonInput/JsonInputTest.cpp deleted file mode 100644 index f5df9d9c2..000000000 --- a/src/VirtualFluidsBasics/utilities/input/JsonInput/JsonInputTest.cpp +++ /dev/null @@ -1,117 +0,0 @@ -#ifdef BUILD_JSONCPP - -#include "JsonInput.h" -#include "gmock/gmock.h" - - -using namespace input; - - -TEST(JsonInputTest, configFileWithKeyValuePair_ShouldReadTheCorrectValuePair) -{ - std::istringstream stringstream( - "{\n" - "\"key\": \"value\",\n" - "\"key2\": \"value2\"\n" - "}" - ); - - JsonInput input(stringstream); - - EXPECT_THAT(input.getValue("key"), "value"); - EXPECT_THAT(input.getValue("key2"), "value2"); -} - -TEST(JsonInputTest, configFileWith3DKeyValuePair_ShouldReadTheCorrectValuePair) -{ - std::istringstream stringstream - ( - "{\n" - "\"1Dkey\":\n" - "{\n" - "\"2Dkey\":\n" - "{\n" - "\"key\": \"value\"\n" - "}\n" - "}\n" - "}\n" - ); - - JsonInput input(stringstream); - - EXPECT_THAT(input.getValue("1Dkey 2Dkey key"), "value"); -} - -TEST(JsonInputTest, configFileWithKeyValuePair_ShouldReadTheCorrectValuePair_WithIgnoringBlankLines) -{ - std::istringstream stringstream( - "{\n" - "\"key\": \"value\",\n" - - "\"key2\": \"value2\"\n" - - - "}" - ); - - JsonInput input(stringstream); - - EXPECT_THAT(input.getValue("key"), "value"); - EXPECT_THAT(input.getValue("key2"), "value2"); -} - -TEST(JsonInputTest, configFileWithKeyValuePair_ShouldReadTheCorrectValuePair_WithIgnoringSpacesAfterAndBeforeColon) -{ - std::istringstream stringstream( - "{\n" - "\"key\": \"value\",\n" - - "\"key2\" : \"value2\"\n" - - - "}" - ); - - JsonInput input(stringstream); - - EXPECT_THAT(input.getValue("key"), "value"); - EXPECT_THAT(input.getValue("key2"), "value2"); -} - -TEST(JsonInputTest, configFileWithKeyValuePair_getValueFromInvalidKey_ShouldReturnEmptyString) -{ - std::istringstream stringstream( - "" - ); - - JsonInput input(stringstream); - - EXPECT_THAT(input.getValue("key"), ""); -} - -TEST(JsonInputTest, configFileWithKeyValuePair_HasKeyWithInvalidKey_ReturnFalse) -{ - std::istringstream stringstream( - "" - ); - - JsonInput input(stringstream); - - EXPECT_THAT(input.hasValue("key"), false); -} - -TEST(JsonInputTest, configFileWithKeyValuePair_HasKeyWithValidKey_ReturnTrue) -{ - std::istringstream stringstream( - "{\n" - "\"key\": \"value\",\n" - "\"key2\": \"value2\"\n" - "}" - ); - - JsonInput input(stringstream); - - EXPECT_THAT(input.hasValue("key"), true); -} - -#endif diff --git a/src/VirtualFluidsBasics/utilities/input/JsonInput/package.include b/src/VirtualFluidsBasics/utilities/input/JsonInput/package.include deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/VirtualFluidsBasics/utilities/input/package.include b/src/VirtualFluidsBasics/utilities/input/package.include deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/VirtualFluidsBasics/utilities/logger/implementations/package.include b/src/VirtualFluidsBasics/utilities/logger/implementations/package.include deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/VirtualFluidsBasics/utilities/logger/package.include b/src/VirtualFluidsBasics/utilities/logger/package.include deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/VirtualFluids_GPU/Calculation/ForceCalculations.cpp b/src/VirtualFluids_GPU/Calculation/ForceCalculations.cpp index b72b692e4..fcf1a76d7 100644 --- a/src/VirtualFluids_GPU/Calculation/ForceCalculations.cpp +++ b/src/VirtualFluids_GPU/Calculation/ForceCalculations.cpp @@ -7,7 +7,7 @@ #include <stdio.h> #include <fstream> #include <sstream> -#include "utilities/StringUtil/StringUtil.h" +#include "Core/StringUtilities/StringUtil.h" using namespace std; ////////////////////////////////////////////////////////////////////////// diff --git a/src/VirtualFluids_GPU/Calculation/ForceCalculations.h b/src/VirtualFluids_GPU/Calculation/ForceCalculations.h index 90bd5f3ac..587fd3da9 100644 --- a/src/VirtualFluids_GPU/Calculation/ForceCalculations.h +++ b/src/VirtualFluids_GPU/Calculation/ForceCalculations.h @@ -2,7 +2,7 @@ #define FORCE_CALCULATIONS_H #include "Parameter/Parameter.h" -#include "basics/utilities/UbSystem.h" +#include "VirtualFluidsBasics/basics/utilities/UbSystem.h" #include <iostream> #include <stdio.h> diff --git a/src/VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/GridGenerator.h b/src/VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/GridGenerator.h index b6c8a4768..2991a8cd7 100644 --- a/src/VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/GridGenerator.h +++ b/src/VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/GridGenerator.h @@ -7,7 +7,7 @@ #include <string> #include <memory> -#include <core/DataTypes.h> +#include "Core/DataTypes.h" class Parameter; class GridBuilder; diff --git a/src/VirtualFluids_GPU/Init/InitLattice.h b/src/VirtualFluids_GPU/Init/InitLattice.h index 539a29201..322b945b0 100644 --- a/src/VirtualFluids_GPU/Init/InitLattice.h +++ b/src/VirtualFluids_GPU/Init/InitLattice.h @@ -1,7 +1,7 @@ #ifndef INIT_LATTICE_H #define INIT_LATTICE_H -#include "core/PointerDefinitions.h" +#include "Core/PointerDefinitions.h" class Parameter; diff --git a/src/VirtualFluids_GPU/Input/PositionReader.cpp b/src/VirtualFluids_GPU/Input/PositionReader.cpp index d0df59759..ff8f88d99 100644 --- a/src/VirtualFluids_GPU/Input/PositionReader.cpp +++ b/src/VirtualFluids_GPU/Input/PositionReader.cpp @@ -1,6 +1,6 @@ #include "PositionReader.h" -#include "basics/utilities/UbFileInputASCII.h" +#include "VirtualFluidsBasics/basics/utilities/UbFileInputASCII.h" static const int E = dirE; //static const int E = 0; static const int W = dirW; //static const int W = 1; diff --git a/src/VirtualFluids_GPU/Input/VtkGeometryReader.cpp b/src/VirtualFluids_GPU/Input/VtkGeometryReader.cpp index 39cbde1d8..2bb49c5c2 100644 --- a/src/VirtualFluids_GPU/Input/VtkGeometryReader.cpp +++ b/src/VirtualFluids_GPU/Input/VtkGeometryReader.cpp @@ -1,6 +1,6 @@ #include "VtkGeometryReader.h" -#include "basics/utilities/UbFileInputASCII.h" +#include "VirtualFluidsBasics/basics/utilities/UbFileInputASCII.h" void VtkGeometryReader::readFile(const std::string& fileName, unsigned int* geoMat) { diff --git a/src/VirtualFluids_GPU/Input/kFullReader.cpp b/src/VirtualFluids_GPU/Input/kFullReader.cpp index 69f20d48d..fe738fda1 100644 --- a/src/VirtualFluids_GPU/Input/kFullReader.cpp +++ b/src/VirtualFluids_GPU/Input/kFullReader.cpp @@ -1,6 +1,6 @@ #include "kFullReader.h" -#include "basics/utilities/UbFileInputASCII.h" +#include "VirtualFluidsBasics/basics/utilities/UbFileInputASCII.h" void kFullReader::readFileForAlloc(const std::string fileName, Parameter* para) { diff --git a/src/VirtualFluids_GPU/LBM/LB.h b/src/VirtualFluids_GPU/LBM/LB.h index ff07d6276..f0b7e617a 100644 --- a/src/VirtualFluids_GPU/LBM/LB.h +++ b/src/VirtualFluids_GPU/LBM/LB.h @@ -47,7 +47,7 @@ ////////////////////////////////////////////////////////////////////////// // precision (change between double and float) // -#include <core/DataTypes.h> +#include "Core/DataTypes.h" ////////////////////////////////////////////////////////////////////////// #include <string> diff --git a/src/VirtualFluids_GPU/LBM/Simulation.h b/src/VirtualFluids_GPU/LBM/Simulation.h index a4261c5a1..4a43ffd6e 100644 --- a/src/VirtualFluids_GPU/LBM/Simulation.h +++ b/src/VirtualFluids_GPU/LBM/Simulation.h @@ -2,9 +2,9 @@ #define _SIMULATION_H_ #include <memory> -#include <core/PointerDefinitions.h> +#include "Core/PointerDefinitions.h" -#include <VirtualFluidsDefinitions.h> +#include "VirtualFluidsDefinitions.h" #include "Output/LogWriter.hpp" #include "Utilities/Buffer2D.hpp" diff --git a/src/VirtualFluids_GPU/Output/FileWriter.cpp b/src/VirtualFluids_GPU/Output/FileWriter.cpp index 0626e9b70..7b199f7f3 100644 --- a/src/VirtualFluids_GPU/Output/FileWriter.cpp +++ b/src/VirtualFluids_GPU/Output/FileWriter.cpp @@ -5,7 +5,7 @@ #include <sstream> #include <cmath> -#include <utilities/StringUtil/StringUtil.h> +#include "Core/StringUtilities/StringUtil.h" #include "Parameter/Parameter.h" diff --git a/src/VirtualFluids_GPU/Parameter/Parameter.h b/src/VirtualFluids_GPU/Parameter/Parameter.h index b5bb7c85f..92926a7c5 100644 --- a/src/VirtualFluids_GPU/Parameter/Parameter.h +++ b/src/VirtualFluids_GPU/Parameter/Parameter.h @@ -14,7 +14,7 @@ //random numbers #include <curand.h> #include <curand_kernel.h> -#include "core/PointerDefinitions.h" +#include "Core/PointerDefinitions.h" #include "VirtualFluidsDefinitions.h" //struct diff --git a/src/core/A.cpp b/src/core/A.cpp deleted file mode 100644 index 1218a2e19..000000000 --- a/src/core/A.cpp +++ /dev/null @@ -1,7 +0,0 @@ -#include "A.h" - - -SPtr<A> A::make() -{ - return SPtr<A>(new A()); -} diff --git a/src/core/A.h b/src/core/A.h deleted file mode 100644 index b3de9c274..000000000 --- a/src/core/A.h +++ /dev/null @@ -1,24 +0,0 @@ -/* -* Author: S. Peters -* mail: peters@irmb.tu-bs.de -*/ -#ifndef A_H -#define A_H - - -#include "PointerDefinitions.h" - - -class VF_PUBLIC A -{ -public: - virtual ~A() = default; - static SPtr<A> make(); - -private: - A() = default; - A(const A& a) = default; - -}; - -#endif diff --git a/src/core/Timer/Timer.cpp b/src/core/Timer/Timer.cpp index dab01ff78..a5d6f8708 100644 --- a/src/core/Timer/Timer.cpp +++ b/src/core/Timer/Timer.cpp @@ -1,6 +1,4 @@ #include "Timer.h" -#include <ctime> - Timer::Timer() { diff --git a/src/core/Timer/Timer.h b/src/core/Timer/Timer.h index 61c6597d7..8ee72118f 100644 --- a/src/core/Timer/Timer.h +++ b/src/core/Timer/Timer.h @@ -3,8 +3,9 @@ #include <chrono> -#include <VirtualFluidsDefinitions.h> -#include <DataTypes.h> +#include "VirtualFluidsDefinitions.h" + +#include "DataTypes.h" class VF_PUBLIC Timer { diff --git a/src/dem_coupling/DemCalculator.cpp b/src/dem_coupling/DemCalculator.cpp deleted file mode 100644 index 26b2a2244..000000000 --- a/src/dem_coupling/DemCalculator.cpp +++ /dev/null @@ -1,84 +0,0 @@ -#include "DemCalculator.h" - - -#include "Grid3D.h" -#include "Synchronizer.h" -#include "CalculationManager.h" -#include "UbLogger.h" -#include "Communicator.h" -#include "TimeAveragedValuesCoProcessor.h" -#include "UbScheduler.h" - - -DemCalculator::DemCalculator(Grid3DPtr grid, SynchronizerPtr sync, bool mainThread) : Calculator(grid, sync, mainThread) -{ - -} - -void DemCalculator::calculate(const double& endTime, CalculationManagerPtr cm, boost::exception_ptr& error) -{ - UBLOG(logINFO, "Calculator PE::calculate() - started"); - try - { - initConnectors(); - - const int minInitLevel = minLevel; - const int maxInitLevel = maxLevel - minLevel; - int straightStartLevel = minInitLevel; - const int internalIterations = 1 << (maxInitLevel - minInitLevel); - int threshold; - const int startStep = int(grid->getTimeStep()) + 1; - const int anzCalcSteps = static_cast<int>(endTime); - - for (calcStep = startStep; calcStep <= anzCalcSteps + 1; calcStep++) - { - sync->wait(); - if (mainThread) - grid->coProcess((double)(calcStep - 1)); - sync->wait(); - - //new part from this calculator: - exchangeBlockData(straightStartLevel, maxInitLevel); - - for (int staggeredStep = 1; staggeredStep <= internalIterations; staggeredStep++) - { - if (staggeredStep == internalIterations) - straightStartLevel = minInitLevel; - else - { - for (straightStartLevel = maxInitLevel, threshold = 1; - (staggeredStep & threshold) != threshold; straightStartLevel--, threshold <<= 1); - } - - calculateBlocks(straightStartLevel, maxInitLevel); - - exchangeBlockData(straightStartLevel, maxInitLevel); - - applyPostCollisionBC(straightStartLevel, maxInitLevel); - - swapDistributions(straightStartLevel, maxInitLevel); - - sync->wait(); - if (taValuesCoProcessor && mainThread) - taValuesCoProcessor->calculateSubtotal(calcStep - 1); - sync->wait(); - } - - //exchange data between blocks for visualization - if (mainThread) visScheduler->isDue((double)(calcStep - 1)); - if ((int)visScheduler->getNextDueTime() == calcStep) - { - exchangeBlockData(straightStartLevel, maxInitLevel); - } - - } - UBLOG(logDEBUG1, "Calculator::calculate() - stoped"); - } - catch (std::exception& e) - { - UBLOG(logERROR, e.what()); - UBLOG(logERROR, " step = " << calcStep); - Communicator::getInstance()->abort(1); - exit(EXIT_FAILURE); - } -} diff --git a/src/dem_coupling/DemCalculator.h b/src/dem_coupling/DemCalculator.h deleted file mode 100644 index 7d8b7d153..000000000 --- a/src/dem_coupling/DemCalculator.h +++ /dev/null @@ -1,28 +0,0 @@ -/* -* Author: S. Peters -* mail: peters@irmb.tu-bs.de -*/ -#ifndef DEM_CALCULATOR_H -#define DEM_CALCULATOR_H - -#include <memory> - -#include <VirtualFluids/Grid/Calculator.h> - -class Grid3D; -class Synchronizer; -class DemCoProcessor; -class CalculationManager; - -class DemCalculator - : public Calculator -{ -public: - DemCalculator(std::shared_ptr<Grid3D> grid, std::shared_ptr<Synchronizer> synchronizer, bool mainThread = true); - virtual ~DemCalculator() {} - - void calculate(const double& endTime, std::shared_ptr<CalculationManager> cm, boost::exception_ptr& error) override; - -}; - -#endif diff --git a/src/dem_coupling/DemCalculatorFactory.h b/src/dem_coupling/DemCalculatorFactory.h deleted file mode 100644 index 3b49da292..000000000 --- a/src/dem_coupling/DemCalculatorFactory.h +++ /dev/null @@ -1,45 +0,0 @@ -/* -* Author: S. Peters -* mail: peters@irmb.tu-bs.de -*/ -#ifndef DEM_CALCULATOR_FACTORY_H -#define DEM_CALCULATOR_FACTORY_H - -#include <memory> - -#include "CalculatorFactory.h" - -#include "Calculator.h" -#include "Grid3D.h" - -#include <dem_coupling/DemCalculator.h> - -class DemCalculatorFactory : public CalculatorFactory -{ -public: - DemCalculatorFactory(UbSchedulerPtr visScheduler) : CalculatorFactory(visScheduler){} - virtual ~DemCalculatorFactory() {} - - std::shared_ptr<Calculator> makeCalculator(Grid3DPtr grid, SynchronizerPtr sync, bool isMainThread, CalculatorType type) override - { - std::shared_ptr<Calculator> calculator; - switch(type) - { - case CalculatorType::DEM: - calculator = std::make_shared<DemCalculator>(grid, sync, isMainThread); - break; - default: - throw std::runtime_error("CalculatorType not valid in DemCalculatorFactory"); - } - - calculator->setVisScheduler(visScheduler); - return calculator; - } - - -}; - - - -#endif - diff --git a/src/dem_coupling/DemCoProcessor.cpp b/src/dem_coupling/DemCoProcessor.cpp deleted file mode 100644 index cfa6923bc..000000000 --- a/src/dem_coupling/DemCoProcessor.cpp +++ /dev/null @@ -1,165 +0,0 @@ -#include "DemCoProcessor.h" - -#include "GbSphere3D.h" -#include "MovableObjectInteractor.h" -#include "Communicator.h" -#include "ForceCalculator.h" -#include "Grid3D.h" -#include "UbScheduler.h" -#include "ILBMKernel.h" -#include "DistributionArray3D.h" -#include "BCProcessor.h" -#include "DataSet3D.h" - -#include <dem_coupling/physicsEngineAdapter/PhysicsEngineMaterialAdapter.h> -#include <dem_coupling/physicsEngineAdapter/PhysicsEngineGeometryAdapter.h> -#include <dem_coupling/physicsEngineAdapter/PhysicsEngineSolverAdapter.h> - -#include "BoundaryConditions.h" -#include "Block3D.h" -#include "BCArray3D.h" - -DemCoProcessor::DemCoProcessor( Grid3DPtr grid, UbSchedulerPtr s, CommunicatorPtr comm, std::shared_ptr<ForceCalculator> forceCalculator, std::shared_ptr<PhysicsEngineSolverAdapter> physicsEngineSolver, double intermediatePeSteps) : - CoProcessor(grid, s), comm(comm), forceCalculator(forceCalculator), physicsEngineSolver(physicsEngineSolver), intermediateDemSteps(intermediatePeSteps) -{ - -} - -DemCoProcessor::~DemCoProcessor() -{ - -} - -void DemCoProcessor::addInteractor(std::shared_ptr<MovableObjectInteractor> interactor, std::shared_ptr<PhysicsEngineMaterialAdapter> physicsEngineMaterial, Vector3D initalVelocity) -{ - interactors.push_back(interactor); - const auto peGeometry = this->createPhysicsEngineGeometryAdapter(interactor, physicsEngineMaterial); - peGeometry->setLinearVelolocity(initalVelocity); - physicsEngineGeometries.push_back(peGeometry); -} - - -std::shared_ptr<PhysicsEngineGeometryAdapter> DemCoProcessor::createPhysicsEngineGeometryAdapter(std::shared_ptr<MovableObjectInteractor> interactor, std::shared_ptr<PhysicsEngineMaterialAdapter> physicsEngineMaterial) const -{ - const int id = static_cast<int>(interactors.size()) - 1; - GbSphere3DPtr vfSphere = std::static_pointer_cast<GbSphere3D>(interactor->getGbObject3D()); - const Vector3D position(vfSphere->getX1Centroid(), vfSphere->getX2Centroid(), vfSphere->getX3Centroid()); - - auto peGeometry = this->physicsEngineSolver->createPhysicsEngineGeometryAdapter(id, position, vfSphere->getRadius(), physicsEngineMaterial); - interactor->setPhysicsEngineGeometry(peGeometry); - return peGeometry; -} - - -void DemCoProcessor::process(double actualTimeStep) -{ - this->applyForcesOnObjects(); - - if(scheduler->isDue(actualTimeStep) ) - { - //UBLOG(logINFO, "DemCoProcessor::update - START" << step); - const double timeStep = scheduler->getMinStep(); - - if (timeStep != 1) - this->scaleForcesAndTorques(1.0 / timeStep); - - if (this->intermediateDemSteps == 1) - this->calculateDemTimeStep(timeStep); - - //const double subPeTimestep = timeStep / intermediateDemSteps; - // - //for (int i = 0; i < intermediateDemSteps; i++) - //{ - // // in the first set forces on local bodies are already set by force synchronization - // if (i != 0) - // { - // physicsEngineGeometries[i]->addForce(); - // physicsEngineGeometries[i]->addTorque(); - // } - - // this->calculatePeTimeStep(subPeTimestep); - //} - - this->moveVfGeoObject(); - - //UBLOG(logINFO, "DemCoProcessor::update - END" << step); - } -} - -void DemCoProcessor::applyForcesOnObjects() -{ - for (int i = 0; i < physicsEngineGeometries.size(); i++) - { - this->setForcesToObject(grid, interactors[i], physicsEngineGeometries[i]); - //physicsEngineGeometries[i]->setLinearVelolocity(Vector3D(0.05, 0.0, 0.0)); - //physicsEngineGeometries[i]->setAngularVelocity(Vector3D(0.01, 0.01, 0.01)); - UBLOG(logINFO, "F: (x,y,z) " << physicsEngineGeometries[i]->getLinearVelocity()); - - } -} - -void DemCoProcessor::setForcesToObject(Grid3DPtr grid, MovableObjectInteractorPtr interactor, std::shared_ptr<PhysicsEngineGeometryAdapter> physicsEngineGeometry) -{ - for (BcNodeIndicesMap::value_type t : interactor->getBcNodeIndicesMap()) - { - Block3DPtr block = t.first; - ILBMKernelPtr kernel = block->getKernel(); - BCArray3DPtr bcArray = kernel->getBCProcessor()->getBCArray(); - DistributionArray3DPtr distributions = kernel->getDataSet()->getFdistributions(); - distributions->swap(); - - std::set< std::vector<int> >& transNodeIndicesSet = t.second; - for (std::vector<int> node : transNodeIndicesSet) - { - int x1 = node[0]; - int x2 = node[1]; - int x3 = node[2]; - - if (kernel->isInsideOfDomain(x1, x2, x3) && bcArray->isFluid(x1, x2, x3)) - { - //TODO: calculate assumed boundary position - - const Vector3D worldCoordinates = grid->getNodeCoordinates(block, x1, x2, x3); - const auto boundaryVelocity = physicsEngineGeometry->getVelocityAtPosition(worldCoordinates); - - BoundaryConditionsPtr bc = bcArray->getBC(x1, x2, x3); - const Vector3D force = forceCalculator->getForces(x1, x2, x3, distributions, bc, boundaryVelocity); - physicsEngineGeometry->addForceAtPosition(force, worldCoordinates); - } - } - distributions->swap(); - } -} - - -void DemCoProcessor::scaleForcesAndTorques(double scalingFactor) -{ - for (int i = 0; i < physicsEngineGeometries.size(); i++) - { - const Vector3D force = physicsEngineGeometries[i]->getForce() * scalingFactor; - const Vector3D torque = physicsEngineGeometries[i]->getTorque() * scalingFactor; - - physicsEngineGeometries[i]->resetForceAndTorque(); - - physicsEngineGeometries[i]->setForce(force); - physicsEngineGeometries[i]->setTorque(torque); - - //UBLOG(logINFO, "F: (x,y,z) " << force); - //UBLOG(logINFO, "T: (x,y,z) " << torque); - } -} - - -void DemCoProcessor::calculateDemTimeStep(double step) const -{ - physicsEngineSolver->runTimestep(step); - - for (int i = 0; i < physicsEngineGeometries.size(); i++) - physicsEngineSolver->updateGeometry(physicsEngineGeometries[i]); -} - -void DemCoProcessor::moveVfGeoObject() -{ - for (int i = 0; i < interactors.size(); i++) - interactors[i]->moveGbObjectTo(physicsEngineGeometries[i]->getPosition()); -} diff --git a/src/dem_coupling/DemCoProcessor.h b/src/dem_coupling/DemCoProcessor.h deleted file mode 100644 index d071f7d02..000000000 --- a/src/dem_coupling/DemCoProcessor.h +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Author: S. Peters - * mail: peters@irmb.tu-bs.de - */ -#ifndef DEM_CO_PROCESSOR_H -#define DEM_CO_PROCESSOR_H - -#include <memory> -#include <vector> - -#include "VirtualFluidsBasics/basics/utilities/Vector3D.h" - -#include <boost/serialization/access.hpp> - -#include <VirtualFluids/CoProcessors/CoProcessor.h> - -class PhysicsEngineGeometryAdapter; -class PhysicsEngineSolverAdapter; -class PhysicsEngineMaterialAdapter; - -class UbScheduler; -class Grid3D; -class ForceCalculator; -class Communicator; -class MovableObjectInteractor; - - -class DemCoProcessor : public CoProcessor -{ -public: - DemCoProcessor(std::shared_ptr<Grid3D> grid, std::shared_ptr<UbScheduler> s, std::shared_ptr<Communicator> comm, std::shared_ptr<ForceCalculator> forceCalculator, std::shared_ptr<PhysicsEngineSolverAdapter> physicsEngineSolver, double intermediatePeSteps = 1.0); - virtual ~DemCoProcessor(); - - void addInteractor(std::shared_ptr<MovableObjectInteractor> interactor, std::shared_ptr<PhysicsEngineMaterialAdapter> physicsEngineMaterial, Vector3D initalVelocity = Vector3D(0.0, 0.0, 0.0)); - - void process(double step) override; - -private: - std::shared_ptr<PhysicsEngineGeometryAdapter> createPhysicsEngineGeometryAdapter(std::shared_ptr<MovableObjectInteractor> interactor, std::shared_ptr<PhysicsEngineMaterialAdapter> physicsEngineMaterial) const; - - void applyForcesOnObjects(); - void setForcesToObject(Grid3DPtr grid, std::shared_ptr<MovableObjectInteractor> interactor, std::shared_ptr<PhysicsEngineGeometryAdapter> physicsEngineGeometry); - void scaleForcesAndTorques(double scalingFactor); - - void calculateDemTimeStep(double step) const; - void moveVfGeoObject(); - -private: - std::shared_ptr<Communicator> comm; - std::vector<std::shared_ptr<MovableObjectInteractor> > interactors; - std::shared_ptr<ForceCalculator> forceCalculator; - - std::shared_ptr<PhysicsEngineSolverAdapter> physicsEngineSolver; - std::vector<std::shared_ptr<PhysicsEngineGeometryAdapter> > physicsEngineGeometries; - - double intermediateDemSteps; - - friend class boost::serialization::access; - template<class Archive> - void serialize(Archive & ar, const unsigned int version) - { - //ar & boost::serialization::base_object<CoProcessor>(*this); - } -}; - - -#endif - diff --git a/src/dem_coupling/MovableObjectInteractor.cpp b/src/dem_coupling/MovableObjectInteractor.cpp deleted file mode 100644 index b8bd231e9..000000000 --- a/src/dem_coupling/MovableObjectInteractor.cpp +++ /dev/null @@ -1,138 +0,0 @@ -#include "MovableObjectInteractor.h" - -#include <basics/utilities/UbLogger.h> -#include <numerics/geometry3d/GbObject3D.h> -#include "VirtualFluidsBasics/basics/utilities/Vector3D.h" - -#include "Block3D.h" -#include "Grid3D.h" -#include "BCArray3D.h" -#include "BCAdapter.h" -#include "BCProcessor.h" -#include "ILBMKernel.h" - -#include "SetSolidBlockVisitor.h" -#include "BoundaryConditionsBlockVisitor.h" - -#include "physicsEngineAdapter/PhysicsEngineGeometryAdapter.h" -#include "reconstructor/Reconstructor.h" - - -MovableObjectInteractor::MovableObjectInteractor(std::shared_ptr<GbObject3D> geoObject3D, std::shared_ptr<Grid3D> grid, std::shared_ptr<BCAdapter> bcAdapter, int type, std::shared_ptr<Reconstructor> reconstructor, State state) - : D3Q27Interactor(geoObject3D, grid, bcAdapter, type), reconstructor(reconstructor), state(state) -{ - -} - -MovableObjectInteractor::~MovableObjectInteractor() -{ - -} - -void MovableObjectInteractor::setPhysicsEngineGeometry(std::shared_ptr<PhysicsEngineGeometryAdapter> physicsEngineGeometry) -{ - this->physicsEngineGeometry = physicsEngineGeometry; - physicsEngineGeometry->changeState(this->state); -} - -void MovableObjectInteractor::setBlockVisitor(std::shared_ptr<BoundaryConditionsBlockVisitor> boundaryConditionsBlockVisitor) -{ - this->boundaryConditionsBlockVisitor = boundaryConditionsBlockVisitor; -} - -void MovableObjectInteractor::moveGbObjectTo(const Vector3D& position) -{ - //UBLOG(logINFO, "new position: (x,y,z) " << val<1>(position) << ", " << val<2>(position) << ", " << val<3>(position)); - - this->getGbObject3D()->setCenterCoordinates(UbTupleDouble3(position[0], position[1], position[2])); - this->rearrangeGrid(); -} - -void MovableObjectInteractor::rearrangeGrid() -{ - this->reconstructSolidNodes(); - this->setSolidNodesToFluid(); - - this->removeSolidBlocks(); - this->removeBcBlocks(); - - this->setBcBlocks(); - - this->initInteractor(); - - this->setBcs(); - this->updateVelocityBc(); -} - -void MovableObjectInteractor::reconstructSolidNodes() -{ - for(SolidNodeIndicesMap::value_type t : solidNodeIndicesMap) - { - Block3DPtr block = t.first; - std::set< UbTupleInt3 >& solidNodeIndices = t.second; - - - ILBMKernelPtr kernel = block->getKernel(); - - for (UbTupleInt3 node : solidNodeIndices) - { - const int x1 = val<1>(node); - const int x2 = val<2>(node); - const int x3 = val<3>(node); - - const Vector3D worldCoordinates = this->grid.lock()->getNodeCoordinates(block, x1, x2, x3); - - if (kernel->isInsideOfDomain(x1, x2, x3)) - reconstructor->reconstructNode(x1, x2, x3, worldCoordinates, physicsEngineGeometry, kernel); - } - } -} - -void MovableObjectInteractor::setSolidNodesToFluid() -{ - for (SolidNodeIndicesMap::value_type t : solidNodeIndicesMap) - { - Block3DPtr block = t.first; - std::set< UbTupleInt3 >& solidNodeIndices = t.second; - - ILBMKernelPtr kernel = block->getKernel(); - BCArray3DPtr bcArray = kernel->getBCProcessor()->getBCArray(); - - for (UbTupleInt3 node : solidNodeIndices) - bcArray->setFluid(val<1>(node), val<2>(node), val<3>(node)); - } -} - -void MovableObjectInteractor::setBcBlocks() -{ - SetSolidBlockVisitor v(shared_from_this(), BlockType::BC); - this->grid.lock()->accept(v); -} - -void MovableObjectInteractor::setBcs() const -{ - this->grid.lock()->accept(*boundaryConditionsBlockVisitor.get()); -} - -void MovableObjectInteractor::updateVelocityBc() -{ - for(BcNodeIndicesMap::value_type t : this->getBcNodeIndicesMap()) - { - Block3DPtr block = t.first; - std::set< std::vector<int> >& bcNodeIndices = t.second; - - BCArray3DPtr bcArray = block->getKernel()->getBCProcessor()->getBCArray(); - - for(std::vector<int> node : bcNodeIndices) - setGeometryVelocityToBoundaryCondition(node, block, bcArray); - } -} - - -void MovableObjectInteractor::setGeometryVelocityToBoundaryCondition(std::vector<int> node, Block3DPtr block, BCArray3DPtr bcArray) const -{ - const BoundaryConditionsPtr bc = bcArray->getBC(node[0], node[1], node[2]); - const Vector3D worldCoordinates = this->grid.lock()->getNodeCoordinates(block, node[0], node[1], node[2]); - const Vector3D velocity = this->physicsEngineGeometry->getVelocityAtPosition(worldCoordinates); - bc->setBoundaryVelocity(velocity); -} diff --git a/src/dem_coupling/MovableObjectInteractor.h b/src/dem_coupling/MovableObjectInteractor.h deleted file mode 100644 index 747f44dd3..000000000 --- a/src/dem_coupling/MovableObjectInteractor.h +++ /dev/null @@ -1,68 +0,0 @@ -/* -* Author: S. Peters -* mail: peters@irmb.tu-bs.de -*/ -#ifndef D3Q27_MOVABLE_OBJECT_INTERACTOR_H -#define D3Q27_MOVABLE_OBJECT_INTERACTOR_H - -#include <memory> -#include <vector> - -#include <boost/serialization/base_object.hpp> - -#include <VirtualFluids/Interactors/D3Q27Interactor.h> - -#include <VirtualFluidsBasics/basics/utilities/Vector3D.h> -#include "physicsEngineAdapter/PhysicsEngineGeometryAdapter.h" - -class MovableObjectInteractor; -typedef std::shared_ptr<MovableObjectInteractor> MovableObjectInteractorPtr; - -class Grid3D; -class Block3D; -class BCArray3D; -class BCAdapter; -class GbObject3D; -class BoundaryConditionsBlockVisitor; - -class PhysicsEngineGeometryAdapter; -class Reconstructor; - -class MovableObjectInteractor : public D3Q27Interactor -{ -public: - MovableObjectInteractor(std::shared_ptr<GbObject3D> geoObject3D, std::shared_ptr<Grid3D> grid, std::shared_ptr<BCAdapter> bcAdapter, int type, std::shared_ptr<Reconstructor> reconstructor, State isPinned); - virtual ~MovableObjectInteractor(); - - void setPhysicsEngineGeometry(std::shared_ptr<PhysicsEngineGeometryAdapter> physicsEngineGeometry); - void setBlockVisitor(std::shared_ptr<BoundaryConditionsBlockVisitor> blockVisitor); - - void moveGbObjectTo(const Vector3D& position); - -private: - void rearrangeGrid(); - void setSolidNodesToFluid(); - void reconstructSolidNodes(); - void setBcs() const; - void setBcBlocks(); - - void updateVelocityBc(); - void setGeometryVelocityToBoundaryCondition(std::vector<int> node, std::shared_ptr<Block3D> block, std::shared_ptr<BCArray3D> bcArray) const; - - std::shared_ptr<BoundaryConditionsBlockVisitor> boundaryConditionsBlockVisitor; - std::shared_ptr<PhysicsEngineGeometryAdapter> physicsEngineGeometry; - - std::shared_ptr<Reconstructor> reconstructor; - State state; - -protected: - friend class boost::serialization::access; - template<class Archive> - void serialize(Archive & ar, const unsigned int version) - { - ar & boost::serialization::base_object<D3Q27Interactor>(*this); - } -}; - - -#endif diff --git a/src/dem_coupling/dem_coupling_EXPORT.h b/src/dem_coupling/dem_coupling_EXPORT.h deleted file mode 100644 index 842b50768..000000000 --- a/src/dem_coupling/dem_coupling_EXPORT.h +++ /dev/null @@ -1,42 +0,0 @@ - -#ifndef dem_coupling_EXPORT_H -#define dem_coupling_EXPORT_H - -#ifdef dem_coupling_BUILT_AS_STATIC -# define dem_coupling_EXPORT -# define DEM_COUPLING_NO_EXPORT -#else -# ifndef dem_coupling_EXPORT -# ifdef dem_coupling_EXPORTS - /* We are building this library */ -# define dem_coupling_EXPORT __declspec(dllexport) -# else - /* We are using this library */ -# define dem_coupling_EXPORT __declspec(dllimport) -# endif -# endif - -# ifndef DEM_COUPLING_NO_EXPORT -# define DEM_COUPLING_NO_EXPORT -# endif -#endif - -#ifndef DEM_COUPLING_DEPRECATED -# define DEM_COUPLING_DEPRECATED __declspec(deprecated) -#endif - -#ifndef DEM_COUPLING_DEPRECATED_EXPORT -# define DEM_COUPLING_DEPRECATED_EXPORT dem_coupling_EXPORT DEM_COUPLING_DEPRECATED -#endif - -#ifndef DEM_COUPLING_DEPRECATED_NO_EXPORT -# define DEM_COUPLING_DEPRECATED_NO_EXPORT DEM_COUPLING_NO_EXPORT DEM_COUPLING_DEPRECATED -#endif - -#if 0 /* DEFINE_NO_DEPRECATED */ -# ifndef DEM_COUPLING_NO_DEPRECATED -# define DEM_COUPLING_NO_DEPRECATED -# endif -#endif - -#endif diff --git a/src/dem_coupling/package.include b/src/dem_coupling/package.include deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/dem_coupling/physicsEngineAdapter/PhysicsEngineGeometryAdapter.h b/src/dem_coupling/physicsEngineAdapter/PhysicsEngineGeometryAdapter.h deleted file mode 100644 index 3f0d90d47..000000000 --- a/src/dem_coupling/physicsEngineAdapter/PhysicsEngineGeometryAdapter.h +++ /dev/null @@ -1,45 +0,0 @@ -/* -* Author: S. Peters -* mail: peters@irmb.tu-bs.de -*/ -#ifndef PHYSICS_ENGINE_GEOMETRY_ADAPTER_H -#define PHYSICS_ENGINE_GEOMETRY_ADAPTER_H - -#include "VirtualFluidsBasics/basics/utilities/Vector3D.h" - -enum class State -{ - PIN, UNPIN -}; - -class PhysicsEngineGeometryAdapter -{ -public: - virtual ~PhysicsEngineGeometryAdapter() {} - - virtual void addForce(const Vector3D& force) = 0; - virtual void addTorque(const Vector3D& torque) = 0; - - virtual void setForce(const Vector3D& force) = 0; - virtual void setTorque(const Vector3D& torque) = 0; - - virtual void addForceAtPosition(const Vector3D& force, const Vector3D& position) = 0; - virtual void setLinearVelolocity(const Vector3D& velocity) = 0; - virtual void setAngularVelocity(const Vector3D& velocity) = 0; - - virtual void resetForceAndTorque() = 0; - - virtual Vector3D getPosition() const = 0; - virtual Vector3D getVelocityAtPosition(const Vector3D& position) const = 0; - virtual Vector3D getLinearVelocity() const = 0; - virtual Vector3D getAngularVelocity() const = 0; - - virtual Vector3D getForce() const = 0; - virtual Vector3D getTorque() const = 0; - - virtual void changeState(State state) = 0; -}; - - -#endif - diff --git a/src/dem_coupling/physicsEngineAdapter/PhysicsEngineMaterialAdapter.h b/src/dem_coupling/physicsEngineAdapter/PhysicsEngineMaterialAdapter.h deleted file mode 100644 index 1b887cda1..000000000 --- a/src/dem_coupling/physicsEngineAdapter/PhysicsEngineMaterialAdapter.h +++ /dev/null @@ -1,33 +0,0 @@ -/* -* Author: S. Peters -* mail: peters@irmb.tu-bs.de -*/ -#ifndef PHYSICS_ENGINE_MATERIAL_ADAPTER_H -#define PHYSICS_ENGINE_MATERIAL_ADAPTER_H - -#include <string> - -class PhysicsEngineMaterialAdapter -{ -public: - PhysicsEngineMaterialAdapter(std::string name, double density, double restitution, double staticFriction, double dynamicFriction, double poissonRatio, double youngModul, double stiffnessInNormalDirection, double dampingoefficientNormalDirection, double dampingTangentialDirection) - : name(name), density(density), restitution(restitution), staticFriction(staticFriction), dynamicFriction(dynamicFriction), poissonRatio(poissonRatio), youngModul(youngModul), stiffnessInNormalDirection(stiffnessInNormalDirection), dampingoefficientNormalDirection(dampingoefficientNormalDirection), dampingTangentialDirection(dampingTangentialDirection) - {} - virtual ~PhysicsEngineMaterialAdapter() {} - -protected: - std::string name; - double density; - double restitution; - double staticFriction; // Note: pe doubles the input coefficient of friction for material-material contacts. - double dynamicFriction; // Similar to static friction for low speed friction. - double poissonRatio; - double youngModul; - double stiffnessInNormalDirection; - double dampingoefficientNormalDirection; - double dampingTangentialDirection; -}; - - -#endif - diff --git a/src/dem_coupling/physicsEngineAdapter/PhysicsEngineSolverAdapter.h b/src/dem_coupling/physicsEngineAdapter/PhysicsEngineSolverAdapter.h deleted file mode 100644 index 15d440f3d..000000000 --- a/src/dem_coupling/physicsEngineAdapter/PhysicsEngineSolverAdapter.h +++ /dev/null @@ -1,29 +0,0 @@ -/* -* Author: S. Peters -* mail: peters@irmb.tu-bs.de -*/ -#ifndef PHYSICS_ENGINE_SOLVER_ADAPTER_H -#define PHYSICS_ENGINE_SOLVER_ADAPTER_H - -#include "VirtualFluidsBasics/basics/utilities/Vector3D.h" - - -class PhysicsEngineGeometryAdapter; -class PhysicsEngineMaterialAdapter; - -class PhysicsEngineSolverAdapter -{ -public: - virtual ~PhysicsEngineSolverAdapter() {} - - virtual std::shared_ptr<PhysicsEngineGeometryAdapter> createPhysicsEngineGeometryAdapter(int id, const Vector3D& position, double radius, std::shared_ptr<PhysicsEngineMaterialAdapter> material) const = 0; - virtual void runTimestep(double step) = 0; - - virtual void updateGeometry(std::shared_ptr<PhysicsEngineGeometryAdapter>) = 0; - -}; - - - -#endif - diff --git a/src/dem_coupling/physicsEngineAdapter/dummy/DummyPhysicsEngineGeometryAdapter.cpp b/src/dem_coupling/physicsEngineAdapter/dummy/DummyPhysicsEngineGeometryAdapter.cpp deleted file mode 100644 index ababa676a..000000000 --- a/src/dem_coupling/physicsEngineAdapter/dummy/DummyPhysicsEngineGeometryAdapter.cpp +++ /dev/null @@ -1,79 +0,0 @@ -#include "DummyPhysicsEngineGeometryAdapter.h" - - - -void DummyPhysicsEngineGeometryAdapter::addForce(const Vector3D& force) -{ - -} - -void DummyPhysicsEngineGeometryAdapter::addTorque(const Vector3D& torque) -{ - -} - -void DummyPhysicsEngineGeometryAdapter::setForce(const Vector3D& force) -{ - -} - -void DummyPhysicsEngineGeometryAdapter::setTorque(const Vector3D& torque) -{ - -} - -void DummyPhysicsEngineGeometryAdapter::addForceAtPosition(const Vector3D& force, const Vector3D& position) -{ - -} - -void DummyPhysicsEngineGeometryAdapter::setLinearVelolocity(const Vector3D& velocity) -{ - this->velocity = velocity; -} - -void DummyPhysicsEngineGeometryAdapter::setAngularVelocity(const Vector3D& velocity) -{ - -} - -void DummyPhysicsEngineGeometryAdapter::resetForceAndTorque() -{ - -} - -Vector3D DummyPhysicsEngineGeometryAdapter::getVelocityAtPosition(const Vector3D& position) const -{ - return velocity; -} - -Vector3D DummyPhysicsEngineGeometryAdapter::getLinearVelocity() const -{ - return Vector3D(); -} - -Vector3D DummyPhysicsEngineGeometryAdapter::getAngularVelocity() const -{ - return Vector3D(); -} - -Vector3D DummyPhysicsEngineGeometryAdapter::getPosition() const -{ - return Vector3D(); -} - -Vector3D DummyPhysicsEngineGeometryAdapter::getForce() const -{ - return Vector3D(); -} - -Vector3D DummyPhysicsEngineGeometryAdapter::getTorque() const -{ - return Vector3D(); -} - -void DummyPhysicsEngineGeometryAdapter::changeState(State state) -{ - -} - diff --git a/src/dem_coupling/physicsEngineAdapter/dummy/DummyPhysicsEngineGeometryAdapter.h b/src/dem_coupling/physicsEngineAdapter/dummy/DummyPhysicsEngineGeometryAdapter.h deleted file mode 100644 index 8ce39d7f0..000000000 --- a/src/dem_coupling/physicsEngineAdapter/dummy/DummyPhysicsEngineGeometryAdapter.h +++ /dev/null @@ -1,45 +0,0 @@ -/* -* Author: S. Peters -* mail: peters@irmb.tu-bs.de -*/ -#ifndef DUMMY_PHYSICS_ENGINE_GEOMETRY_ADAPTER_H -#define DUMMY_PHYSICS_ENGINE_GEOMETRY_ADAPTER_H - -#include "UbTuple.h" - -#include "../PhysicsEngineGeometryAdapter.h" - - - -class DummyPhysicsEngineGeometryAdapter : public PhysicsEngineGeometryAdapter -{ -public: - DummyPhysicsEngineGeometryAdapter() {} - virtual ~DummyPhysicsEngineGeometryAdapter() {} - - void addForce(const Vector3D& force) override; - void addTorque(const Vector3D& torque) override; - - void setForce(const Vector3D& force) override; - void setTorque(const Vector3D& torque) override; - - void addForceAtPosition(const Vector3D& force, const Vector3D& position) override; - void setLinearVelolocity(const Vector3D& velocity) override; - void setAngularVelocity(const Vector3D& velocity) override; - - void resetForceAndTorque() override; - - Vector3D getVelocityAtPosition(const Vector3D& position) const override; - Vector3D getLinearVelocity() const override; - Vector3D getAngularVelocity() const override; - Vector3D getPosition() const override; - Vector3D getForce() const override; - Vector3D getTorque() const override; - - void changeState(State state) override; -private: - Vector3D velocity; -}; - -#endif - diff --git a/src/dem_coupling/physicsEngineAdapter/dummy/DummyPhysicsEngineMaterialAdapter.cpp b/src/dem_coupling/physicsEngineAdapter/dummy/DummyPhysicsEngineMaterialAdapter.cpp deleted file mode 100644 index 7890f9668..000000000 --- a/src/dem_coupling/physicsEngineAdapter/dummy/DummyPhysicsEngineMaterialAdapter.cpp +++ /dev/null @@ -1 +0,0 @@ -#include "DummyPhysicsEngineMaterialAdapter.h" diff --git a/src/dem_coupling/physicsEngineAdapter/dummy/DummyPhysicsEngineMaterialAdapter.h b/src/dem_coupling/physicsEngineAdapter/dummy/DummyPhysicsEngineMaterialAdapter.h deleted file mode 100644 index 89a5b472d..000000000 --- a/src/dem_coupling/physicsEngineAdapter/dummy/DummyPhysicsEngineMaterialAdapter.h +++ /dev/null @@ -1,23 +0,0 @@ -/* -* Author: S. Peters -* mail: peters@irmb.tu-bs.de -*/ -#ifndef DUMMY_PHYSICS_ENGINE_MATERIAL_ADAPTER -#define DUMMY_PHYSICS_ENGINE_MATERIAL_ADAPTER - -#include "../PhysicsEngineMaterialAdapter.h" - - -class DummyPhysicsEngineMaterialAdapter : public PhysicsEngineMaterialAdapter -{ -public: - DummyPhysicsEngineMaterialAdapter(std::string name, double density, double restitution, double staticFriction, double dynamicFriction, double poissonRatio, double youngModul, double stiffnessInNormalDirection, double dampingoefficientNormalDirection, double dampingTangentialDirection) - : PhysicsEngineMaterialAdapter(name, density, restitution, staticFriction, dynamicFriction, poissonRatio, youngModul, stiffnessInNormalDirection, dampingoefficientNormalDirection, dampingTangentialDirection) - { - } - virtual ~DummyPhysicsEngineMaterialAdapter() {} - -}; - -#endif - diff --git a/src/dem_coupling/physicsEngineAdapter/dummy/DummyPhysicsEngineSolverAdapter.cpp b/src/dem_coupling/physicsEngineAdapter/dummy/DummyPhysicsEngineSolverAdapter.cpp deleted file mode 100644 index a48e2ff53..000000000 --- a/src/dem_coupling/physicsEngineAdapter/dummy/DummyPhysicsEngineSolverAdapter.cpp +++ /dev/null @@ -1,13 +0,0 @@ -#include "DummyPhysicsEngineSolverAdapter.h" - -#include "DummyPhysicsEngineGeometryAdapter.h" - - -std::shared_ptr<PhysicsEngineGeometryAdapter> DummyPhysicsEngineSolverAdapter::createPhysicsEngineGeometryAdapter(int id, const Vector3D& position, double radius, std::shared_ptr<PhysicsEngineMaterialAdapter> material) const -{ - return std::static_pointer_cast<PhysicsEngineGeometryAdapter>(std::make_shared<DummyPhysicsEngineGeometryAdapter>()); -} - -void DummyPhysicsEngineSolverAdapter::runTimestep(double step) -{ -} diff --git a/src/dem_coupling/physicsEngineAdapter/dummy/DummyPhysicsEngineSolverAdapter.h b/src/dem_coupling/physicsEngineAdapter/dummy/DummyPhysicsEngineSolverAdapter.h deleted file mode 100644 index a966fd6e5..000000000 --- a/src/dem_coupling/physicsEngineAdapter/dummy/DummyPhysicsEngineSolverAdapter.h +++ /dev/null @@ -1,28 +0,0 @@ -/* -* Author: S. Peters -* mail: peters@irmb.tu-bs.de -*/ -#ifndef DUMMY_PHYSICS_ENGINE_SOLVER_ADAPTER_H -#define DUMMY_PHYSICS_ENGINE_SOLVER_ADAPTER_H - -#include <memory> - -#include "UbTuple.h" - -#include "../PhysicsEngineSolverAdapter.h" - - - -class DummyPhysicsEngineSolverAdapter : public PhysicsEngineSolverAdapter -{ -public: - DummyPhysicsEngineSolverAdapter() {}; - virtual ~DummyPhysicsEngineSolverAdapter() {} - - std::shared_ptr<PhysicsEngineGeometryAdapter> createPhysicsEngineGeometryAdapter(int id, const Vector3D& position, double radius, std::shared_ptr<PhysicsEngineMaterialAdapter> material) const override; - void runTimestep(double step) override; - -}; - -#endif - diff --git a/src/dem_coupling/physicsEngineAdapter/dummy/package.include b/src/dem_coupling/physicsEngineAdapter/dummy/package.include deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/dem_coupling/physicsEngineAdapter/package.include b/src/dem_coupling/physicsEngineAdapter/package.include deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/dem_coupling/physicsEngineAdapter/pe/PeAdapter.h b/src/dem_coupling/physicsEngineAdapter/pe/PeAdapter.h deleted file mode 100644 index f9bde1c90..000000000 --- a/src/dem_coupling/physicsEngineAdapter/pe/PeAdapter.h +++ /dev/null @@ -1,28 +0,0 @@ -/* -* Author: S. Peters -* mail: peters@irmb.tu-bs.de -*/ -#ifndef PE_ADAPTER_H -#define PE_ADAPTER_H - -#include <pe/basic.h> -#include "VirtualFluidsBasics/basics/utilities/Vector3D.h" - - -class PeConverter -{ -public: - static Vector3D convert(walberla::pe::Vec3 vec3) - { - return Vector3D(vec3[0], vec3[1], vec3[2]); - } - - static walberla::pe::Vec3 convert(const Vector3D& vec3) - { - return walberla::pe::Vec3(vec3[0], vec3[1], vec3[2]); - } -}; - - -#endif - diff --git a/src/dem_coupling/physicsEngineAdapter/pe/PeAdapterTest.cpp b/src/dem_coupling/physicsEngineAdapter/pe/PeAdapterTest.cpp deleted file mode 100644 index 87e6fa82b..000000000 --- a/src/dem_coupling/physicsEngineAdapter/pe/PeAdapterTest.cpp +++ /dev/null @@ -1,28 +0,0 @@ -#include "gmock/gmock.h" - -#include "PeAdapter.h" -#include <pe/basic.h> - -#include "UbTuple.h" - - -TEST(PeAdapterTest, convert_WalberlaVec3_to_Vector3D) -{ - walberla::pe::Vec3 walberlaVec(1.0, -2.0, 3.4); - Vector3D ubTuple = PeConverter::convert(walberlaVec); - - EXPECT_THAT(ubTuple[0], testing::DoubleEq(walberlaVec[0])); - EXPECT_THAT(ubTuple[1], testing::DoubleEq(walberlaVec[1])); - EXPECT_THAT(ubTuple[2], testing::DoubleEq(walberlaVec[2])); -} - -TEST(PeAdapterTest, convert_Vector3D_to_WalberlaVec3) -{ - Vector3D ubTuple(1.0, -2.0, 3.4); - walberla::pe::Vec3 walberlaVec = PeConverter::convert(ubTuple); - - EXPECT_THAT(ubTuple[0], testing::DoubleEq(walberlaVec[0])); - EXPECT_THAT(ubTuple[1], testing::DoubleEq(walberlaVec[1])); - EXPECT_THAT(ubTuple[2], testing::DoubleEq(walberlaVec[2])); -} - diff --git a/src/dem_coupling/physicsEngineAdapter/pe/PePhysicsEngineGeometryAdapter.cpp b/src/dem_coupling/physicsEngineAdapter/pe/PePhysicsEngineGeometryAdapter.cpp deleted file mode 100644 index 19247ab57..000000000 --- a/src/dem_coupling/physicsEngineAdapter/pe/PePhysicsEngineGeometryAdapter.cpp +++ /dev/null @@ -1,103 +0,0 @@ -#include "PePhysicsEngineGeometryAdapter.h" - -#include <pe/basic.h> - -#include "PeAdapter.h" - - -PePhysicsEngineGeometryAdapter::PePhysicsEngineGeometryAdapter(walberla::pe::RigidBody* peGeoObject) : peGeoObject(peGeoObject) -{ - this->id = (int)peGeoObject->getID(); -} - -void PePhysicsEngineGeometryAdapter::addForce(const Vector3D& force) -{ - peGeoObject->addForce(PeConverter::convert(force)); -} - -void PePhysicsEngineGeometryAdapter::addTorque(const Vector3D& torque) -{ - peGeoObject->addTorque(PeConverter::convert(torque)); -} - -void PePhysicsEngineGeometryAdapter::setForce(const Vector3D& force) -{ - peGeoObject->setForce(PeConverter::convert(force)); -} - -void PePhysicsEngineGeometryAdapter::setTorque(const Vector3D& torque) -{ - peGeoObject->setTorque(PeConverter::convert(torque)); -} - -void PePhysicsEngineGeometryAdapter::addForceAtPosition(const Vector3D& force, const Vector3D& position) -{ - peGeoObject->addForceAtPos(PeConverter::convert(force), PeConverter::convert(position)); -} - -void PePhysicsEngineGeometryAdapter::setLinearVelolocity(const Vector3D& velocity) -{ - peGeoObject->setLinearVel(PeConverter::convert(velocity)); -} - -void PePhysicsEngineGeometryAdapter::setAngularVelocity(const Vector3D& velocity) -{ - peGeoObject->setAngularVel(PeConverter::convert(velocity)); -} - -void PePhysicsEngineGeometryAdapter::resetForceAndTorque() -{ - peGeoObject->resetForceAndTorque(); -} - -Vector3D PePhysicsEngineGeometryAdapter::getVelocityAtPosition(const Vector3D& position) const -{ - return PeConverter::convert(peGeoObject->velFromWF(PeConverter::convert(position))); -} - -Vector3D PePhysicsEngineGeometryAdapter::getLinearVelocity() const -{ - return PeConverter::convert(peGeoObject->getLinearVel()); -} - -Vector3D PePhysicsEngineGeometryAdapter::getAngularVelocity() const -{ - return PeConverter::convert(peGeoObject->getAngularVel()); -} - -Vector3D PePhysicsEngineGeometryAdapter::getPosition() const -{ - return PeConverter::convert(peGeoObject->getPosition()); -} - -Vector3D PePhysicsEngineGeometryAdapter::getForce() const -{ - return PeConverter::convert(peGeoObject->getForce()); -} - -Vector3D PePhysicsEngineGeometryAdapter::getTorque() const -{ - return PeConverter::convert(peGeoObject->getTorque()); -} - -void PePhysicsEngineGeometryAdapter::changeState(State state) -{ - bool infinite; - if (state == State::UNPIN) - infinite = false; - else - infinite = true; - - peGeoObject->setMass(infinite); -} - -int PePhysicsEngineGeometryAdapter::getId() const -{ - return id; -} - -void PePhysicsEngineGeometryAdapter::setGeometry(walberla::pe::RigidBody* peGeoObject) -{ - this->peGeoObject = peGeoObject; -} - diff --git a/src/dem_coupling/physicsEngineAdapter/pe/PePhysicsEngineGeometryAdapter.h b/src/dem_coupling/physicsEngineAdapter/pe/PePhysicsEngineGeometryAdapter.h deleted file mode 100644 index cce2c8e03..000000000 --- a/src/dem_coupling/physicsEngineAdapter/pe/PePhysicsEngineGeometryAdapter.h +++ /dev/null @@ -1,56 +0,0 @@ -/* -* Author: S. Peters -* mail: peters@irmb.tu-bs.de -*/ -#ifndef PE_PHYSICS_ENGINE_GEOMETRY_ADAPTER_H -#define PE_PHYSICS_ENGINE_GEOMETRY_ADAPTER_H - - -#include "../PhysicsEngineGeometryAdapter.h" - - -namespace walberla -{ - namespace pe - { - class RigidBody; - } -} - -class PePhysicsEngineGeometryAdapter : public PhysicsEngineGeometryAdapter -{ -public: - PePhysicsEngineGeometryAdapter(walberla::pe::RigidBody* peGeoObject); - virtual ~PePhysicsEngineGeometryAdapter() {} - - void addForce(const Vector3D& force) override; - void addTorque(const Vector3D& torque) override; - - void setForce(const Vector3D& force) override; - void setTorque(const Vector3D& torque) override; - - void addForceAtPosition(const Vector3D& force, const Vector3D& position) override; - void setLinearVelolocity(const Vector3D& velocity) override; - void setAngularVelocity(const Vector3D& velocity) override; - - void resetForceAndTorque() override; - - Vector3D getVelocityAtPosition(const Vector3D& position) const override; - Vector3D getLinearVelocity() const override; - Vector3D getAngularVelocity() const override; - Vector3D getPosition() const override; - Vector3D getForce() const override; - Vector3D getTorque() const override; - - void changeState(State state) override; - - int getId() const; - void setGeometry(walberla::pe::RigidBody* peGeoObject); - -private: - walberla::pe::RigidBody* peGeoObject; - int id; -}; - -#endif - diff --git a/src/dem_coupling/physicsEngineAdapter/pe/PePhysicsEngineMaterialAdapter.cpp b/src/dem_coupling/physicsEngineAdapter/pe/PePhysicsEngineMaterialAdapter.cpp deleted file mode 100644 index fcd4e6eee..000000000 --- a/src/dem_coupling/physicsEngineAdapter/pe/PePhysicsEngineMaterialAdapter.cpp +++ /dev/null @@ -1,10 +0,0 @@ -#include "PePhysicsEngineMaterialAdapter.h" - - -walberla::pe::MaterialID PePhysicsEngineMaterialAdapter::getPeMaterial() const -{ - if (walberla::pe::Material::find(name) != -1) - return walberla::pe::Material::find(name); - - return walberla::pe::createMaterial(name, density, restitution, staticFriction, dynamicFriction, poissonRatio, youngModul, stiffnessInNormalDirection, dampingoefficientNormalDirection, dampingTangentialDirection); -} diff --git a/src/dem_coupling/physicsEngineAdapter/pe/PePhysicsEngineMaterialAdapter.h b/src/dem_coupling/physicsEngineAdapter/pe/PePhysicsEngineMaterialAdapter.h deleted file mode 100644 index b99afaa38..000000000 --- a/src/dem_coupling/physicsEngineAdapter/pe/PePhysicsEngineMaterialAdapter.h +++ /dev/null @@ -1,26 +0,0 @@ -/* -* Author: S. Peters -* mail: peters@irmb.tu-bs.de -*/ -#ifndef PE_PHYSICS_ENGINE_MATERIAL_ADAPTER -#define PE_PHYSICS_ENGINE_MATERIAL_ADAPTER - -#include "../PhysicsEngineMaterialAdapter.h" -#include <pe/basic.h> - - -class PePhysicsEngineMaterialAdapter : public PhysicsEngineMaterialAdapter -{ -public: - PePhysicsEngineMaterialAdapter(std::string name, double density, double restitution, double staticFriction, double dynamicFriction, double poissonRatio, double youngModul, double stiffnessInNormalDirection, double dampingoefficientNormalDirection, double dampingTangentialDirection) - : PhysicsEngineMaterialAdapter(name, density, restitution, staticFriction, dynamicFriction, poissonRatio, youngModul, stiffnessInNormalDirection, dampingoefficientNormalDirection, dampingTangentialDirection) - { - } - virtual ~PePhysicsEngineMaterialAdapter() {} - - virtual walberla::pe::MaterialID getPeMaterial() const; - -}; - -#endif - diff --git a/src/dem_coupling/physicsEngineAdapter/pe/PePhysicsEngineSolverAdapter.cpp b/src/dem_coupling/physicsEngineAdapter/pe/PePhysicsEngineSolverAdapter.cpp deleted file mode 100644 index 018902bce..000000000 --- a/src/dem_coupling/physicsEngineAdapter/pe/PePhysicsEngineSolverAdapter.cpp +++ /dev/null @@ -1,123 +0,0 @@ -#include "PePhysicsEngineSolverAdapter.h" - -#include <exception> - -#include <pe/basic.h> -#include "PeAdapter.h" -#include "PePhysicsEngineGeometryAdapter.h" -#include "PePhysicsEngineMaterialAdapter.h" - -typedef boost::tuple<walberla::pe::Sphere, walberla::pe::Plane> BodyTypeTuple; - - -PePhysicsEngineSolverAdapter::PePhysicsEngineSolverAdapter(std::shared_ptr<PeParameter> peParameter) : peParameter(peParameter) -{ - this->initalizePeEnvironment(); -} - -void PePhysicsEngineSolverAdapter::initalizePeEnvironment() -{ - this->initialPeBodyStorage(); - this->initalPeBlockForest(); - this->initalBlockData(); - this->initalPeIntegrator(); - this->executePeBodyTypeTuple(); - this->initalPeChannel(); -} - - -std::shared_ptr<PhysicsEngineGeometryAdapter> PePhysicsEngineSolverAdapter::createPhysicsEngineGeometryAdapter(int id, const Vector3D& position, double radius, std::shared_ptr<PhysicsEngineMaterialAdapter> material) const -{ - const std::shared_ptr<PePhysicsEngineMaterialAdapter> peMaterial = std::dynamic_pointer_cast<PePhysicsEngineMaterialAdapter>(material); - - walberla::pe::GeomID peGeometry = createSphere(*globalBodyStorage, *forest, *storageId, id, PeConverter::convert(position), radius, peMaterial->getPeMaterial()); - - return std::static_pointer_cast<PhysicsEngineGeometryAdapter>( - std::make_shared<PePhysicsEngineGeometryAdapter>(peGeometry)); -} - -void PePhysicsEngineSolverAdapter::runTimestep(double step) -{ - cr->timestep(walberla::real_c(step)); - walberla::pe::syncNextNeighbors<BodyTypeTuple>(*forest, *storageId); -} - - - -void PePhysicsEngineSolverAdapter::initialPeBodyStorage() -{ - globalBodyStorage = boost::make_shared<walberla::pe::BodyStorage>(); -} - -void PePhysicsEngineSolverAdapter::initalPeBlockForest() -{ - forest = walberla::pe::createBlockForest - ( - walberla::AABB(0, 0, 0, val<1>(peParameter->simulationDomain), val<2>(peParameter->simulationDomain), val<3>(peParameter->simulationDomain)), // simulationDomain - walberla::Vector3<walberla::uint_t>(val<1>(peParameter->numberOfBlocks), val<2>(peParameter->numberOfBlocks), val<3>(peParameter->numberOfBlocks)), // blocks in each direction - walberla::Vector3<bool>(val<1>(peParameter->isPeriodic), val<2>(peParameter->isPeriodic), val<3>(peParameter->isPeriodic)) // periodicity - ); - - if (!forest) - throw std::runtime_error("No PE BlockForest created ... "); -} - -void PePhysicsEngineSolverAdapter::initalBlockData() -{ - storageId = std::make_shared<walberla::domain_decomposition::BlockDataID> - ( - forest->addBlockData(walberla::pe::createStorageDataHandling<BodyTypeTuple>(), "Storage") - ); -} - -void PePhysicsEngineSolverAdapter::initalPeIntegrator() -{ - auto ccdID = forest->addBlockData(walberla::pe::ccd::createHashGridsDataHandling(globalBodyStorage, *storageId), "CCD"); - auto fcdID = forest->addBlockData(walberla::pe::fcd::createGenericFCDDataHandling<BodyTypeTuple, walberla::pe::fcd::AnalyticCollideFunctor>(), "FCD"); - - cr = std::make_shared<walberla::pe::cr::HardContactSemiImplicitTimesteppingSolvers>(globalBodyStorage, forest, *storageId, ccdID, fcdID); - cr->setMaxIterations(peParameter->maxPeIterations); - cr->setRelaxationModel(walberla::pe::cr::HardContactSemiImplicitTimesteppingSolvers::ApproximateInelasticCoulombContactByDecoupling); - cr->setRelaxationParameter(walberla::real_t(peParameter->relaxationParameter)); - cr->setGlobalLinearAcceleration(PeConverter::convert(peParameter->globalLinearAcceleration)); -} - -void PePhysicsEngineSolverAdapter::executePeBodyTypeTuple() -{ - walberla::pe::SetBodyTypeIDs<BodyTypeTuple>::execute(); -} - -void PePhysicsEngineSolverAdapter::initalPeChannel() const -{ - const walberla::pe::MaterialID material = peParameter->planes->getPeMaterial(); - - auto simulationDomain = forest->getDomain(); - createPlane(*globalBodyStorage, 0, walberla::pe::Vec3(1, 0, 0), simulationDomain.minCorner(), material); - createPlane(*globalBodyStorage, 0, walberla::pe::Vec3(-1, 0, 0), simulationDomain.maxCorner(), material); - createPlane(*globalBodyStorage, 0, walberla::pe::Vec3(0, 1, 0), simulationDomain.minCorner(), material); - createPlane(*globalBodyStorage, 0, walberla::pe::Vec3(0, -1, 0), simulationDomain.maxCorner(), material); - createPlane(*globalBodyStorage, 0, walberla::pe::Vec3(0, 0, 1), simulationDomain.minCorner(), material); - createPlane(*globalBodyStorage, 0, walberla::pe::Vec3(0, 0, -1), simulationDomain.maxCorner(), material); -} - -walberla::pe::RigidBody* PePhysicsEngineSolverAdapter::getPeGeoObject(int id) -{ - for (auto blockIt = forest->begin(); blockIt != forest->end(); ++blockIt) - { - for (auto bodyIt = walberla::pe::BodyIterator::begin(*blockIt, *storageId.get()); bodyIt != walberla::pe::BodyIterator::end(); ++bodyIt) - { - if(bodyIt->getID() == id) - { - walberla::pe::RigidBody* geo = *(bodyIt); - return geo; - } - } - } -} - -void PePhysicsEngineSolverAdapter::updateGeometry(std::shared_ptr<PhysicsEngineGeometryAdapter> geometryAdapter) -{ - auto geometry = std::static_pointer_cast<PePhysicsEngineGeometryAdapter>(geometryAdapter); - const int id = geometry->getId(); - geometry->setGeometry(this->getPeGeoObject(id)); -} diff --git a/src/dem_coupling/physicsEngineAdapter/pe/PePhysicsEngineSolverAdapter.h b/src/dem_coupling/physicsEngineAdapter/pe/PePhysicsEngineSolverAdapter.h deleted file mode 100644 index bccd3556b..000000000 --- a/src/dem_coupling/physicsEngineAdapter/pe/PePhysicsEngineSolverAdapter.h +++ /dev/null @@ -1,93 +0,0 @@ -/* -* Author: S. Peters -* mail: peters@irmb.tu-bs.de -*/ -#ifndef PE_PHYSICS_ENGINE_SOLVER_ADAPTER_H -#define PE_PHYSICS_ENGINE_SOLVER_ADAPTER_H - -#include <memory> - -#include <boost/shared_ptr.hpp> - -#include <pe/basic.h> -#include "UbTuple.h" - -#include "../PhysicsEngineSolverAdapter.h" - - -class PePhysicsEngineMaterialAdapter; -class PhysicsEngineGeometryAdapter; - -namespace walberla -{ - namespace domain_decomposition - { - class BlockDataID; - } - namespace blockforest - { - class BlockForest; - } - namespace pe - { - class BodyStorage; - class RigidBody; - namespace cr - { - class HardContactSemiImplicitTimesteppingSolvers; - } - } -} - -struct PeParameter -{ - PeParameter(double relaxationParameter, int maxPeIterations, Vector3D globalLinearAcceleration, std::shared_ptr<PePhysicsEngineMaterialAdapter> planes, UbTupleInt3 simulationDomain, UbTupleInt3 numberOfBlocks, UbTupleBool3 isPeriodic) - : relaxationParameter(relaxationParameter), maxPeIterations(maxPeIterations), globalLinearAcceleration(globalLinearAcceleration), simulationDomain(simulationDomain), numberOfBlocks(numberOfBlocks), isPeriodic(isPeriodic), planes(planes) - { - } - - double relaxationParameter; - int maxPeIterations; - Vector3D globalLinearAcceleration; - - UbTupleInt3 simulationDomain; - UbTupleInt3 numberOfBlocks; - UbTupleBool3 isPeriodic; - - std::shared_ptr<PePhysicsEngineMaterialAdapter> planes; -}; - -class PePhysicsEngineSolverAdapter : public PhysicsEngineSolverAdapter -{ -public: - PePhysicsEngineSolverAdapter(std::shared_ptr<PeParameter> peParameter); - virtual ~PePhysicsEngineSolverAdapter() {} - - std::shared_ptr<PhysicsEngineGeometryAdapter> createPhysicsEngineGeometryAdapter(int id, const Vector3D& position, double radius, std::shared_ptr<PhysicsEngineMaterialAdapter> material) const override; - void runTimestep(double step) override; - walberla::pe::RigidBody* getPeGeoObject(int id); - void updateGeometry(std::shared_ptr<PhysicsEngineGeometryAdapter>) override; - -private: - void initalizePeEnvironment(); - void initialPeBodyStorage(); - void initalPeBlockForest(); - void initalBlockData(); - - void initalPeIntegrator(); - static void executePeBodyTypeTuple(); - void initalPeChannel() const; - - -private: - std::shared_ptr<PeParameter> peParameter; - - boost::shared_ptr<walberla::pe::BodyStorage> globalBodyStorage; - boost::shared_ptr< walberla::blockforest::BlockForest > forest; - std::shared_ptr<walberla::domain_decomposition::BlockDataID> storageId; - std::shared_ptr<walberla::pe::cr::HardContactSemiImplicitTimesteppingSolvers> cr; - -}; - -#endif - diff --git a/src/dem_coupling/physicsEngineAdapter/pe/package.include b/src/dem_coupling/physicsEngineAdapter/pe/package.include deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/dem_coupling/reconstructor/EquilibriumReconstructor.cpp b/src/dem_coupling/reconstructor/EquilibriumReconstructor.cpp deleted file mode 100644 index 481ee721c..000000000 --- a/src/dem_coupling/reconstructor/EquilibriumReconstructor.cpp +++ /dev/null @@ -1,56 +0,0 @@ -#include "EquilibriumReconstructor.h" - -#include "ILBMKernel.h" -#include "D3Q27System.h" -#include "DataSet3D.h" -#include "BCProcessor.h" -#include "BCArray3D.h" - -#include <dem_coupling/physicsEngineAdapter/PhysicsEngineGeometryAdapter.h> - -void EquilibriumReconstructor::reconstructNode(const int& x1, const int& x2, const int& x3, - const Vector3D& worldCoordinates, std::shared_ptr<PhysicsEngineGeometryAdapter> physicsEngineGeometry, std::shared_ptr<ILBMKernel> kernel) const -{ - const double averageDensity = this->getLocalAverageDensity(x1, x2, x3, kernel); - LBMReal feq[27]; - const Vector3D boundaryVelocity = physicsEngineGeometry->getVelocityAtPosition(worldCoordinates); - - if (kernel->getCompressible()) - D3Q27System::calcCompFeq(feq, averageDensity, boundaryVelocity[0], boundaryVelocity[1], boundaryVelocity[2]); - else - D3Q27System::calcIncompFeq(feq, averageDensity, boundaryVelocity[0], boundaryVelocity[1], boundaryVelocity[2]); - - - DistributionArray3DPtr distributions = kernel->getDataSet()->getFdistributions(); - distributions->setDistribution(feq, x1, x2, x3); - distributions->setDistributionInv(feq, x1, x2, x3); -} - - -double EquilibriumReconstructor::getLocalAverageDensity(const int &x1, const int &x2, const int &x3, std::shared_ptr<ILBMKernel> kernel) const -{ - int nAverage = 0; - double averageDensity = 0.0; - - BCArray3DPtr bcArray = kernel->getBCProcessor()->getBCArray(); - - LBMReal f[D3Q27System::ENDF + 1]; - DistributionArray3DPtr distributions = kernel->getDataSet()->getFdistributions(); - - int neighborX1, neighborX2, neighborX3; - for (int fDir = D3Q27System::FSTARTDIR; fDir <= D3Q27System::FENDDIR; fDir++) - { - neighborX1 = x1 + D3Q27System::DX1[fDir]; - neighborX2 = x2 + D3Q27System::DX2[fDir]; - neighborX3 = x3 + D3Q27System::DX3[fDir]; - - if (bcArray->isFluid(neighborX1, neighborX2, neighborX3)) - { - distributions->getDistribution(f, neighborX1, neighborX2, neighborX3); - averageDensity += D3Q27System::getDensity(f); - ++nAverage; - } - } - return (nAverage > 0) ? averageDensity / nAverage : 0.0; -} - diff --git a/src/dem_coupling/reconstructor/EquilibriumReconstructor.h b/src/dem_coupling/reconstructor/EquilibriumReconstructor.h deleted file mode 100644 index 92d9cad0b..000000000 --- a/src/dem_coupling/reconstructor/EquilibriumReconstructor.h +++ /dev/null @@ -1,30 +0,0 @@ -/* -* Author: S. Peters -* mail: peters@irmb.tu-bs.de -*/ -#ifndef EQUILIBRIUM_RECONSTRUCTOR_H -#define EQUILIBRIUM_RECONSTRUCTOR_H - -#include "boost/shared_ptr.hpp" -#include "UbTuple.h" - -#include "Reconstructor.h" - -class ILBMKernel; -class PhysicsEngineGeometryAdapter; - -class EquilibriumReconstructor : public Reconstructor -{ -public: - virtual ~EquilibriumReconstructor() {} - - void reconstructNode(const int &x1, const int &x2, const int &x3, const Vector3D& worldCoordinates, std::shared_ptr<PhysicsEngineGeometryAdapter> physicsEngineGeometry, std::shared_ptr<ILBMKernel> kernel) const override; - -private: - double getLocalAverageDensity(const int &x1, const int &x2, const int &x3, std::shared_ptr<ILBMKernel> kernel) const; -}; - - - -#endif - diff --git a/src/dem_coupling/reconstructor/ExtrapolationReconstructor.cpp b/src/dem_coupling/reconstructor/ExtrapolationReconstructor.cpp deleted file mode 100644 index 15d6f7cc7..000000000 --- a/src/dem_coupling/reconstructor/ExtrapolationReconstructor.cpp +++ /dev/null @@ -1,120 +0,0 @@ -#include "ExtrapolationReconstructor.h" - -#include "ILBMKernel.h" -#include "D3Q27System.h" -#include "DataSet3D.h" -#include "BCProcessor.h" -#include "BCArray3D.h" - -#include <dem_coupling/physicsEngineAdapter/PhysicsEngineGeometryAdapter.h> -#include "DistributionArray3D.h" - -void ExtrapolationReconstructor::setAlternativeReconstructor(std::shared_ptr<Reconstructor> alternativeReconstructor) -{ - this->alternativeReconstructor = alternativeReconstructor; -} - - -ExtrapolationReconstructor::ExtrapolationReconstructor(std::shared_ptr<Reconstructor> alternativeReconstructor) : alternativeReconstructor(alternativeReconstructor) -{ -} - -void ExtrapolationReconstructor::reconstructNode(const int& x1, const int& x2, const int& x3, - const Vector3D& worldCoordinates, std::shared_ptr<PhysicsEngineGeometryAdapter> physicsEngineGeometry, std::shared_ptr<ILBMKernel> kernel) const -{ - const UbTupleInt3 extrapolationDirection = getSphereDirection(worldCoordinates, physicsEngineGeometry); - const int numberOfCellsForExtrapolation = getNumberOfExtrapolationCells(x1, x2, x3, extrapolationDirection, kernel); - - if (numberOfCellsForExtrapolation < 2) - alternativeReconstructor->reconstructNode(x1, x2, x3, worldCoordinates, physicsEngineGeometry, kernel); - else - { - //UBLOG(logINFO, "point (x,y,z) " << val<1>(worldCoordinates) << ", " << val<2>(worldCoordinates) << ", " << val<3>(worldCoordinates)); - //UBLOG(logINFO, "extradir (x,y,z) " << val<1>(extrapolationDirection) << ", " << val<2>(extrapolationDirection) << ", " << val<3>(extrapolationDirection)); - //UBLOG(logINFO, "numberOfCellsForExtrapolation: " << numberOfCellsForExtrapolation ); - - this->extrapolatePdFs(x1, x2, x3, extrapolationDirection, numberOfCellsForExtrapolation, kernel); - } - -} - -UbTupleInt3 ExtrapolationReconstructor::getSphereDirection(const Vector3D& worldCoordinates, std::shared_ptr<PhysicsEngineGeometryAdapter> physicsEngineGeometry) const -{ - const Vector3D spherePosition = physicsEngineGeometry->getPosition(); - const Vector3D bodyNormal = worldCoordinates - spherePosition; - return this->getCorrespondingLatticeDirection(bodyNormal); -} - -UbTupleInt3 ExtrapolationReconstructor::getCorrespondingLatticeDirection(const Vector3D& direction) const -{ - int correspondingDirection = 0; - double innerProduct = 0.0; - for (int fDir = D3Q27System::FSTARTDIR; fDir <= D3Q27System::FENDDIR; fDir++) - { - // compute inner product <dir,c_i> - const double temporaryInnerProduct = direction[0] * D3Q27System::cNorm[0][fDir] + direction[1] * D3Q27System::cNorm[1][fDir] + direction[2] * D3Q27System::cNorm[2][fDir]; - if (temporaryInnerProduct > innerProduct) - { - innerProduct = temporaryInnerProduct; - correspondingDirection = fDir; - } - } - - return UbTupleInt3(D3Q27System::DX1[correspondingDirection], D3Q27System::DX2[correspondingDirection], D3Q27System::DX3[correspondingDirection]); -} - -int ExtrapolationReconstructor::getNumberOfExtrapolationCells(const int x1, const int x2, const int x3, const UbTupleInt3& extrapolationDirection, std::shared_ptr<ILBMKernel> kernel) const -{ - if (extrapolationDirection == UbTupleInt3(0, 0, 0)) - return 0; - - const int desiredCellsInExtrapolationDirection = 3; - - for (int numCells = 1; numCells <= desiredCellsInExtrapolationDirection; ++numCells) - { - UbTupleInt3 neighbor(x1 + numCells * val<1>(extrapolationDirection), x2 + numCells * val<2>(extrapolationDirection), x3 + numCells * val<3>(extrapolationDirection)); - - if(!kernel->isInsideOfDomain(val<1>(neighbor), val<2>(neighbor), val<3>(neighbor))) - return numCells - 1; - - - if (!kernel->getBCProcessor()->getBCArray()->isFluid(val<1>(neighbor), val<2>(neighbor), val<3>(neighbor))) - return numCells - 1; - } - return desiredCellsInExtrapolationDirection; -} - - -void ExtrapolationReconstructor::extrapolatePdFs(const int x1, const int x2, const int x3, - const UbTupleInt3& extrapolationDirection, int numberOfCellsForExtrapolation, std::shared_ptr<ILBMKernel> kernel) const -{ - DistributionArray3DPtr distributions = kernel->getDataSet()->getFdistributions(); - - const int nx1 = val<1>(extrapolationDirection); - const int nx2 = val<2>(extrapolationDirection); - const int nx3 = val<3>(extrapolationDirection); - - LBMReal pdf[D3Q27System::ENDF + 1]; - LBMReal pdfNeighbor1[D3Q27System::ENDF + 1]; - LBMReal pdfNeighbor2[D3Q27System::ENDF + 1]; - - distributions->getDistribution(pdf, x1, x2, x3); - distributions->getDistribution(pdfNeighbor1, x1 + nx1, x2 + nx2, x3 + nx3); - distributions->getDistribution(pdfNeighbor2, x1 + 2 * nx1, x2 + 2 * nx2, x3 + 2 * nx3); - - if (numberOfCellsForExtrapolation == 3) // quadratic normal extrapolation - { - LBMReal pdfNeighbor3[D3Q27System::ENDF + 1]; - distributions->getDistribution(pdfNeighbor3, x1 + 3 * nx1, x2 + 3 * nx2, x3 + 3 * nx3); - - for (int fDir = D3Q27System::FSTARTDIR; fDir <= D3Q27System::FENDDIR; fDir++) - pdf[fDir] = 3 * pdfNeighbor1[fDir] - 3 * pdfNeighbor2[fDir] + pdfNeighbor3[fDir]; - } - else // numberOfCellsForExtrapolation == 2 // linear normal extrapolation - { - for (int fDir = D3Q27System::FSTARTDIR; fDir <= D3Q27System::FENDDIR; fDir++) - pdf[fDir] = 2 * pdfNeighbor1[fDir] - pdfNeighbor2[fDir]; - } - - distributions->setDistribution(pdf, x1, x2, x3); -} diff --git a/src/dem_coupling/reconstructor/ExtrapolationReconstructor.h b/src/dem_coupling/reconstructor/ExtrapolationReconstructor.h deleted file mode 100644 index 0ccb2112e..000000000 --- a/src/dem_coupling/reconstructor/ExtrapolationReconstructor.h +++ /dev/null @@ -1,43 +0,0 @@ -/* -* Author: S. Peters -* mail: peters@irmb.tu-bs.de -*/ -#ifndef EXTRAPOLATION_RECONSTRUCTOR_H -#define EXTRAPOLATION_RECONSTRUCTOR_H - -#include <memory> - -#include "boost/shared_ptr.hpp" -#include "UbTuple.h" - -#include "Reconstructor.h" - -class ILBMKernel; -class PhysicsEngineGeometryAdapter; - -class ExtrapolationReconstructor : public Reconstructor -{ -public: - ExtrapolationReconstructor(std::shared_ptr<Reconstructor> alternativeReconstructor); - virtual ~ExtrapolationReconstructor() {} - - - void reconstructNode(const int &x1, const int &x2, const int &x3, const Vector3D& worldCoordinates, std::shared_ptr<PhysicsEngineGeometryAdapter> physicsEngineGeometry, std::shared_ptr<ILBMKernel> kernel) const override; - - void setAlternativeReconstructor(std::shared_ptr<Reconstructor> alternativeReconstructor); - -private: - int getNumberOfExtrapolationCells(const int x1, const int x2, const int x3, const UbTupleInt3& ubTuple, std::shared_ptr<ILBMKernel> kernel) const; - UbTupleInt3 getSphereDirection(const Vector3D& worldCoordinates, std::shared_ptr<PhysicsEngineGeometryAdapter> physicsEngineGeometry) const; - UbTupleInt3 getCorrespondingLatticeDirection(const Vector3D& direction) const; - void extrapolatePdFs(const int x1, const int x2, const int x3, const UbTupleInt3& ubTuple, int numberOfCellsForExtrapolation, std::shared_ptr<ILBMKernel> kernel) const; - - - std::shared_ptr<Reconstructor> alternativeReconstructor; - -}; - - - -#endif - diff --git a/src/dem_coupling/reconstructor/Reconstructor.h b/src/dem_coupling/reconstructor/Reconstructor.h deleted file mode 100644 index 5bd7883c8..000000000 --- a/src/dem_coupling/reconstructor/Reconstructor.h +++ /dev/null @@ -1,27 +0,0 @@ -/* -* Author: S. Peters -* mail: peters@irmb.tu-bs.de -*/ -#ifndef RECONSTRCUTOR_H -#define RECONSTRCUTOR_H - -#include "boost/shared_ptr.hpp" - -#include "VirtualFluidsBasics/basics/utilities/Vector3D.h" - -class ILBMKernel; -class PhysicsEngineGeometryAdapter; - -class Reconstructor -{ -public: - virtual ~Reconstructor() {} - - virtual void reconstructNode(const int &x1, const int &x2, const int &x3, const Vector3D& worldCoordinates, std::shared_ptr<PhysicsEngineGeometryAdapter> physicsEngineGeometry, std::shared_ptr<ILBMKernel> kernel) const = 0; - -}; - - - -#endif - diff --git a/src/dem_coupling/reconstructor/VelocityBcReconstructor.cpp b/src/dem_coupling/reconstructor/VelocityBcReconstructor.cpp deleted file mode 100644 index 128875607..000000000 --- a/src/dem_coupling/reconstructor/VelocityBcReconstructor.cpp +++ /dev/null @@ -1,102 +0,0 @@ -#include "VelocityBcReconstructor.h" - -#include <exception> - -#include "ILBMKernel.h" -#include "D3Q27System.h" -#include "BCArray3D.h" -#include "EsoTwist3D.h" -#include "BCProcessor.h" -#include "DataSet3D.h" - -#include <dem_coupling/physicsEngineAdapter/PhysicsEngineGeometryAdapter.h> - -void VelocityBcReconstructor::reconstructNode(const int& x1, const int& x2, const int& x3, - const Vector3D& worldCoordinates, std::shared_ptr<PhysicsEngineGeometryAdapter> physicsEngineGeometry, std::shared_ptr<ILBMKernel> kernel) const -{ - if (kernel->getCompressible()) - throw std::runtime_error("not implemented yet!"); - - const Vector3D boundaryVelocity = physicsEngineGeometry->getVelocityAtPosition(worldCoordinates); - //TODO: move to D3Q27 system - LBMReal wijk[D3Q27System::ENDF + 1]; - D3Q27System::calcIncompFeq(wijk, 1, 0, 0, 0); - - BCArray3DPtr bcArray = kernel->getBCProcessor()->getBCArray(); - - BoundaryConditionsPtr bc = BoundaryConditionsPtr(new BoundaryConditions()); - bc->setBoundaryVelocityX1((float)boundaryVelocity[0]); - bc->setBoundaryVelocityX2((float)boundaryVelocity[1]); - bc->setBoundaryVelocityX3((float)boundaryVelocity[2]); - - LBMReal feqNullRho[D3Q27System::ENDF + 1]; - D3Q27System::calcIncompFeq(feqNullRho, 0, boundaryVelocity[0], boundaryVelocity[1], boundaryVelocity[2]); - - LBMReal fpre[D3Q27System::ENDF + 1]; - LBMReal fpost[D3Q27System::ENDF + 1]; - DistributionArray3DPtr distributions = kernel->getDataSet()->getFdistributions(); - - distributions->swap(); - distributions->getDistributionInv(fpost, x1, x2, x3); - distributions->swap(); - distributions->getDistribution(fpre, x1, x2, x3); - - int neighborX1, neighborX2, neighborX3; - int neighborX1Inv, neighborX2Inv, neighborX3Inv; - - double sumRho = 0, sumWijk = 0; - double collFactor = kernel->getCollisionFactor(); - - for (int fDir = D3Q27System::FSTARTDIR; fDir <= D3Q27System::FENDDIR; fDir++) - { - neighborX1 = x1 + D3Q27System::DX1[fDir]; - neighborX2 = x2 + D3Q27System::DX2[fDir]; - neighborX3 = x3 + D3Q27System::DX3[fDir]; - - if (bcArray->isFluid(neighborX1, neighborX2, neighborX3)) - { - int invDir = D3Q27System::INVDIR[fDir]; - - neighborX1Inv = x1 + D3Q27System::DX1[invDir]; - neighborX2Inv = x2 + D3Q27System::DX2[invDir]; - neighborX3Inv = x3 + D3Q27System::DX3[invDir]; - if (!bcArray->isFluid(neighborX1Inv, neighborX2Inv, neighborX3Inv)) - { - - double velocity = bc->getBoundaryVelocity(invDir); - - fpre[fDir] = fpre[invDir] - velocity; - double Omega = fpost[fDir] - fpre[fDir]; - - sumRho += Omega / collFactor + fpre[fDir] - feqNullRho[fDir]; - sumWijk += wijk[fDir]; - } - - } - } - - double rho = 0.0; - if (sumWijk > 0.0) - rho = sumRho / sumWijk; - - for (int fDir = D3Q27System::FSTARTDIR; fDir <= D3Q27System::FENDDIR; fDir++) - { - neighborX1 = x1 + D3Q27System::DX1[fDir]; - neighborX2 = x2 + D3Q27System::DX2[fDir]; - neighborX3 = x3 + D3Q27System::DX3[fDir]; - - if (!bcArray->isFluid(neighborX1, neighborX2, neighborX3)) - { - int invDir = D3Q27System::INVDIR[fDir]; - neighborX1Inv = x1 + D3Q27System::DX1[invDir]; - neighborX2Inv = x2 + D3Q27System::DX2[invDir]; - neighborX3Inv = x3 + D3Q27System::DX3[invDir]; - if (!bcArray->isFluid(neighborX1Inv, neighborX2Inv, neighborX3Inv)) - { - fpre[fDir] = D3Q27System::getIncompFeqForDirection(fDir, rho, bc->getBoundaryVelocityX1(), bc->getBoundaryVelocityX2(), bc->getBoundaryVelocityX3()); - } - - } - } - -} diff --git a/src/dem_coupling/reconstructor/VelocityBcReconstructor.h b/src/dem_coupling/reconstructor/VelocityBcReconstructor.h deleted file mode 100644 index 3bb97ad37..000000000 --- a/src/dem_coupling/reconstructor/VelocityBcReconstructor.h +++ /dev/null @@ -1,28 +0,0 @@ -/* -* Author: S. Peters -* mail: peters@irmb.tu-bs.de -*/ -#ifndef VELOCITY_BC_RECONSTRUCTOR_H -#define VELOCITY_BC_RECONSTRUCTOR_H - -#include "boost/shared_ptr.hpp" -#include "UbTuple.h" - -#include "Reconstructor.h" - -class ILBMKernel; -class PhysicsEngineGeometryAdapter; - -class VelocityBcReconstructor : public Reconstructor -{ -public: - virtual ~VelocityBcReconstructor() {} - - void reconstructNode(const int &x1, const int &x2, const int &x3, const Vector3D& worldCoordinates, std::shared_ptr<PhysicsEngineGeometryAdapter> physicsEngineGeometry, std::shared_ptr<ILBMKernel> kernel) const override; - -}; - - - -#endif - diff --git a/src/dem_coupling/reconstructor/package.include b/src/dem_coupling/reconstructor/package.include deleted file mode 100644 index e69de29bb..000000000 diff --git a/targets/apps/HULC/main.cpp b/targets/apps/HULC/main.cpp index a4420ef53..983133948 100644 --- a/targets/apps/HULC/main.cpp +++ b/targets/apps/HULC/main.cpp @@ -13,24 +13,19 @@ #define _USE_MATH_DEFINES #include <math.h> -#include "core/LbmOrGks.h" +#include "Core/LbmOrGks.h" +#include "Core/Input/Input.h" +#include "Core/StringUtilities/StringUtil.h" #include "VirtualFluids_GPU/LBM/Simulation.h" #include "VirtualFluids_GPU/Communication/Communicator.h" +#include "VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/GridGenerator.h" +#include "VirtualFluids_GPU/DataStructureInitializer/GridProvider.h" +#include "VirtualFluids_GPU/DataStructureInitializer/GridReaderFiles/GridReader.h" +#include "VirtualFluids_GPU/Parameter/Parameter.h" +#include "VirtualFluids_GPU/Output/FileWriter.h" -#include "DataStructureInitializer/GridReaderGenerator/GridGenerator.h" -#include "grid/GridBuilder/LevelGridBuilder.h" - -#include "Parameter/Parameter.h" -#include "DataStructureInitializer/GridProvider.h" -#include "VirtualFluidsBasics/utilities/input/Input.h" -#include "VirtualFluidsBasics/utilities/StringUtil/StringUtil.h" -#include "utilities/transformator/TransformatorImp.h" -#include "io/GridVTKWriter/GridVTKWriter.h" - -#include "io/SimulationFileWriter/SimulationFileWriter.h" -#include "grid/GridBuilder/LevelGridBuilder.h" -#include "grid/GridBuilder/ParallelGridBuilder.h" +#include "global.h" #include "geometries/Sphere/Sphere.h" #include "geometries/VerticalCylinder/VerticalCylinder.h" @@ -39,23 +34,20 @@ #include "geometries/Conglomerate/Conglomerate.h" #include "geometries/TriangularMesh/TriangularMeshStrategy.h" -#include "grid/GridFactory.h" +#include "grid/GridBuilder/LevelGridBuilder.h" #include "grid/GridBuilder/MultipleGridBuilder.h" -//#include "grid/GridMocks.h" -//#include "grid/GridStrategy/GridStrategyMocks.h" -#include "VirtualFluidsBasics/utilities/logger/Logger.h" -//#include "VirtualFluidsBasics/basics/utilities/UbLogger.h" +#include "grid/BoundaryConditions/Side.h" +#include "grid/BoundaryConditions/BoundaryCondition.h" +#include "grid/GridFactory.h" + +#include "io/SimulationFileWriter/SimulationFileWriter.h" +#include "io/GridVTKWriter/GridVTKWriter.h" #include "io/STLReaderWriter/STLReader.h" #include "io/STLReaderWriter/STLWriter.h" -#include "Output/FileWriter.h" -#include "DataStructureInitializer/GridReaderFiles/GridReader.h" #include "utilities/math/Math.h" - -#include "grid/BoundaryConditions/Side.h" -#include "grid/BoundaryConditions/BoundaryCondition.h" - #include "utilities/communication.h" +#include "utilities/transformator/TransformatorImp.h" std::string getGridPath(std::shared_ptr<Parameter> para, std::string Gridpath) { @@ -267,7 +259,7 @@ void setParameters(std::shared_ptr<Parameter> para, std::unique_ptr<input::Input void multipleLevel(const std::string& configPath) { - //std::ofstream logFile( "C:/Users/lenz/Desktop/Work/gridGenerator/grid/gridGeneratorLog.txt" ); + //std::ofstream logFile( "F:/Work/Computations/gridGenerator/grid/gridGeneratorLog.txt" ); std::ofstream logFile( "grid/gridGeneratorLog.txt" ); logging::Logger::addStream(&logFile); @@ -293,7 +285,7 @@ void multipleLevel(const std::string& configPath) //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - bool useGridGenerator = false; + bool useGridGenerator = true; if(useGridGenerator){ @@ -303,7 +295,7 @@ void multipleLevel(const std::string& configPath) MultiGPU }; - int testcase = DrivAer; + int testcase = MultiGPU; ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// if( testcase == DrivAer ) @@ -312,12 +304,12 @@ void multipleLevel(const std::string& configPath) real dx = 0.2; real vx = 0.05; - TriangularMesh* DrivAerSTL = TriangularMesh::make("C:/Users/lenz/Desktop/Work/gridGenerator/stl/DrivAer_Fastback_Coarse.stl"); + TriangularMesh* DrivAerSTL = TriangularMesh::make("F:/Work/Computations/gridGenerator/stl/DrivAer_Fastback_Coarse.stl"); //TriangularMesh* triangularMesh = TriangularMesh::make("M:/TestGridGeneration/STL/DrivAer_NoSTLGroups.stl"); //TriangularMesh* triangularMesh = TriangularMesh::make("M:/TestGridGeneration/STL/DrivAer_Coarse.stl"); //TriangularMesh* DrivAerSTL = TriangularMesh::make("stl/DrivAer_Fastback_Coarse.stl"); - TriangularMesh* DrivAerRefBoxSTL = TriangularMesh::make("C:/Users/lenz/Desktop/Work/gridGenerator/stl/DrivAer_REF_BOX_Adrea.stl"); + TriangularMesh* DrivAerRefBoxSTL = TriangularMesh::make("F:/Work/Computations/gridGenerator/stl/DrivAer_REF_BOX_Adrea.stl"); //TriangularMesh* DrivAerRefBoxSTL = TriangularMesh::make("stl/DrivAer_REF_BOX_Adrea.stl"); real z0 = 0.318+0.5*dx; @@ -369,12 +361,12 @@ void multipleLevel(const std::string& configPath) ////////////////////////////////////////////////////////////////////////// - gridBuilder->writeGridsToVtk("C:/Users/lenz/Desktop/Work/gridGenerator/grid/DrivAer_Grid"); - gridBuilder->writeArrows ("C:/Users/lenz/Desktop/Work/gridGenerator/grid/DrivAer_Grid_arrow"); + gridBuilder->writeGridsToVtk("F:/Work/Computations/gridGenerator/grid/DrivAer_Grid"); + gridBuilder->writeArrows ("F:/Work/Computations/gridGenerator/grid/DrivAer_Grid_arrow"); //SimulationFileWriter::write("D:/GRIDGENERATION/files/", gridBuilder, FILEFORMAT::ASCII); //SimulationFileWriter::write("C:/Users/lenz/Desktop/Work/gridGenerator/grid/", gridBuilder, FILEFORMAT::ASCII); - SimulationFileWriter::write("C:/Users/lenz/Desktop/Work/gridGenerator/grid/", gridBuilder, FILEFORMAT::BINARY); + SimulationFileWriter::write("F:/Work/Computations/gridGenerator/grid/", gridBuilder, FILEFORMAT::BINARY); //SimulationFileWriter::write("grid/", gridBuilder, FILEFORMAT::ASCII); return; @@ -509,18 +501,20 @@ void multipleLevel(const std::string& configPath) std::ofstream logFile2; if( generatePart == 0 ) - logFile2.open( "C:/Users/lenz/Desktop/Work/gridGenerator/grid/0/gridGeneratorLog.txt" ); + //logFile2.open( "F:/Work/Computations/gridGenerator/grid/0/gridGeneratorLog.txt" ); + logFile2.open( "grid/0/gridGeneratorLog.txt" ); if( generatePart == 1 ) - logFile2.open( "C:/Users/lenz/Desktop/Work/gridGenerator/grid/1/gridGeneratorLog.txt" ); + //logFile2.open( "F:/Work/Computations/gridGenerator/grid/1/gridGeneratorLog.txt" ); + logFile2.open( "grid/1/gridGeneratorLog.txt" ); logging::Logger::addStream(&logFile2); real dx = 1.0 / 40.0; real vx = 0.05; - TriangularMesh* triangularMesh = TriangularMesh::make("C:/Users/lenz/Desktop/Work/gridGenerator/stl/ShpereNotOptimal.stl"); - //TriangularMesh* triangularMesh = TriangularMesh::make("stl/ShpereNotOptimal.lnx.stl"); + //TriangularMesh* triangularMesh = TriangularMesh::make("F:/Work/Computations/gridGenerator/stl/ShpereNotOptimal.stl"); + TriangularMesh* triangularMesh = TriangularMesh::make("stl/ShpereNotOptimal.lnx.stl"); // all //gridBuilder->addCoarseGrid(-2, -2, -2, @@ -585,18 +579,20 @@ void multipleLevel(const std::string& configPath) ////////////////////////////////////////////////////////////////////////// if (generatePart == 0) { - gridBuilder->writeGridsToVtk("C:/Users/lenz/Desktop/Work/gridGenerator/grid/0/Test_"); - gridBuilder->writeArrows ("C:/Users/lenz/Desktop/Work/gridGenerator/grid/0/Test_Arrow"); + //gridBuilder->writeGridsToVtk("F:/Work/Computations/gridGenerator/grid/0/Test_"); + //gridBuilder->writeArrows ("F:/Work/Computations/gridGenerator/grid/0/Test_Arrow"); } if (generatePart == 1) { - gridBuilder->writeGridsToVtk("C:/Users/lenz/Desktop/Work/gridGenerator/grid/1/Test_"); - gridBuilder->writeArrows ("C:/Users/lenz/Desktop/Work/gridGenerator/grid/1/Test_Arrow"); + //gridBuilder->writeGridsToVtk("F:/Work/Computations/gridGenerator/grid/1/Test_"); + //gridBuilder->writeArrows ("F:/Work/Computations/gridGenerator/grid/1/Test_Arrow"); } if (generatePart == 0) - SimulationFileWriter::write("C:/Users/lenz/Desktop/Work/gridGenerator/grid/0/", gridBuilder, FILEFORMAT::ASCII); + //SimulationFileWriter::write("F:/Work/Computations/gridGenerator/grid/0/", gridBuilder, FILEFORMAT::ASCII); + SimulationFileWriter::write("grid/0/", gridBuilder, FILEFORMAT::ASCII); if (generatePart == 1) - SimulationFileWriter::write("C:/Users/lenz/Desktop/Work/gridGenerator/grid/1/", gridBuilder, FILEFORMAT::ASCII); + //SimulationFileWriter::write("F:/Work/Computations/gridGenerator/grid/1/", gridBuilder, FILEFORMAT::ASCII); + SimulationFileWriter::write("grid/1/", gridBuilder, FILEFORMAT::ASCII); //return; @@ -662,7 +658,7 @@ int main( int argc, char* argv[]) { try { - multipleLevel("C:/Users/lenz/Desktop/Work/gridGenerator/inp/configTest.txt"); + multipleLevel("F:/Work/Computations/gridGenerator/inp/configTest.txt"); } catch (const std::exception& e) { diff --git a/targets/libs/GridGenerator/3rdPartyLinking.cmake b/targets/libs/GridGenerator/3rdPartyLinking.cmake index 376fc4ee0..d7f5e137b 100644 --- a/targets/libs/GridGenerator/3rdPartyLinking.cmake +++ b/targets/libs/GridGenerator/3rdPartyLinking.cmake @@ -4,7 +4,7 @@ include (${CMAKE_SOURCE_DIR}/${cmakeMacroPath}/MPI/Link.cmake) linkMPI(${targetName}) include (${CMAKE_SOURCE_DIR}/${cmakeMacroPath}/Boost/Link.cmake) linkBoost(${targetName} "serialization") -include (${CMAKE_SOURCE_DIR}/${cmakeMacroPath}/Metis/Link.cmake) -linkMetis(${targetName}) +#include (${CMAKE_SOURCE_DIR}/${cmakeMacroPath}/Metis/Link.cmake) +#linkMetis(${targetName}) include (${CMAKE_SOURCE_DIR}/${cmakeMacroPath}/OpenMP/Link.cmake) linkOpenMP(${targetName}) \ No newline at end of file diff --git a/targets/libs/GridGenerator/CMakeLists.txt b/targets/libs/GridGenerator/CMakeLists.txt index 0d751001e..3d9796141 100644 --- a/targets/libs/GridGenerator/CMakeLists.txt +++ b/targets/libs/GridGenerator/CMakeLists.txt @@ -1,8 +1,11 @@ setTargetNameToFolderName(${CMAKE_CURRENT_LIST_DIR}) set(linkDirectories "") -set(libsToLink VirtualFluidsBasics core) -set(includeDirectories ${CMAKE_SOURCE_DIR}/src ${CMAKE_SOURCE_DIR}/src/${targetName} ${CMAKE_SOURCE_DIR}/src/VirtualFluidsBasics ${CMAKE_SOURCE_DIR}/src/core) +set(libsToLink VirtualFluidsBasics Core) +set(includeDirectories ${CMAKE_SOURCE_DIR}/src/${targetName} + ${CMAKE_SOURCE_DIR}/src + ${CMAKE_SOURCE_DIR}/src/VirtualFluidsBasics + ${CMAKE_SOURCE_DIR}/src/Core ) #glob files and save in MY_SRCS include(CMakePackage.cmake) diff --git a/targets/libs/VirtualFluids/3rdPartyLinking.cmake b/targets/libs/VirtualFluids/3rdPartyLinking.cmake deleted file mode 100644 index 8b9c63b97..000000000 --- a/targets/libs/VirtualFluids/3rdPartyLinking.cmake +++ /dev/null @@ -1,8 +0,0 @@ -include (${CMAKE_SOURCE_DIR}/${cmakeMacroPath}/MPI/Link.cmake) -linkMPI(${targetName}) -include (${CMAKE_SOURCE_DIR}/${cmakeMacroPath}/Boost/Link.cmake) -linkBoost(${targetName} "signals;thread;serialization;filesystem") -include (${CMAKE_SOURCE_DIR}/${cmakeMacroPath}/Metis/Link.cmake) -linkMetis(${targetName}) - -#target_link_libraries(${targetName} "pe" "core" "blockforest" "domain_decomposition") diff --git a/targets/libs/VirtualFluids/CMakeLists.txt b/targets/libs/VirtualFluids/CMakeLists.txt deleted file mode 100644 index 23dfb295e..000000000 --- a/targets/libs/VirtualFluids/CMakeLists.txt +++ /dev/null @@ -1,18 +0,0 @@ -setTargetNameToFolderName(${CMAKE_CURRENT_LIST_DIR}) - -set(linkDirectories "") -set(libsToLink "VirtualFluidsBasics" "muparser") -set(includeDirectories ${PE_ROOT}/src ${PE_BINARY_DIR}/src ${CMAKE_SOURCE_DIR}/src ${CMAKE_SOURCE_DIR}/src/${targetName} ${CMAKE_SOURCE_DIR}/3rdParty ) -#glob files and save in MY_SRCS -include(CMakePackage.cmake) - -buildLib(${targetName} "${MY_SRCS}" "${linkDirectories}" "${libsToLink}" "${includeDirectories}") -include(includes.cmake) -groupTarget(${targetName} ${libraryFolder}) - -IF(MSVC) -set_target_properties(${targetName} PROPERTIES LINK_FLAGS "/ignore:4251") -ENDIF(MSVC) - -#Specify the linking to 3rdParty libs -include(3rdPartyLinking.cmake) diff --git a/targets/libs/VirtualFluids/CMakePackage.cmake b/targets/libs/VirtualFluids/CMakePackage.cmake deleted file mode 100644 index 7ec316fe0..000000000 --- a/targets/libs/VirtualFluids/CMakePackage.cmake +++ /dev/null @@ -1,8 +0,0 @@ -#FILE ENDINGS -resetFileEndingsToCollect() -addCAndCPPFileTypes() - -#GLOB SOURCE FILES IN MY_SRCS -unset(MY_SRCS) -includeRecursiveAllFilesFrom(${targetName} ${CMAKE_CURRENT_LIST_DIR}) -includeRecursiveProductionFilesFrom(${targetName} ${CMAKE_SOURCE_DIR}/src/${targetName}) \ No newline at end of file diff --git a/targets/libs/VirtualFluids/includes.cmake b/targets/libs/VirtualFluids/includes.cmake deleted file mode 100644 index 829c3a6d0..000000000 --- a/targets/libs/VirtualFluids/includes.cmake +++ /dev/null @@ -1,24 +0,0 @@ -target_include_directories(${targetName} PUBLIC ${CMAKE_SOURCE_DIR}) -target_include_directories(${targetName} PUBLIC ${CMAKE_SOURCE_DIR}/src/VirtualFluids) -target_include_directories(${targetName} PUBLIC ${CMAKE_SOURCE_DIR}/src/VirtualFluids/BoundaryConditions) -target_include_directories(${targetName} PUBLIC ${CMAKE_SOURCE_DIR}/src/VirtualFluids/Connectors) -target_include_directories(${targetName} PUBLIC ${CMAKE_SOURCE_DIR}/src/VirtualFluids/Data) -target_include_directories(${targetName} PUBLIC ${CMAKE_SOURCE_DIR}/src/VirtualFluids/Interactors) -target_include_directories(${targetName} PUBLIC ${CMAKE_SOURCE_DIR}/src/VirtualFluids/LBM) -target_include_directories(${targetName} PUBLIC ${CMAKE_SOURCE_DIR}/src/VirtualFluids/Parallel) -target_include_directories(${targetName} PUBLIC ${CMAKE_SOURCE_DIR}/src/VirtualFluids/Grid) -target_include_directories(${targetName} PUBLIC ${CMAKE_SOURCE_DIR}/src/VirtualFluids/Visitors) -target_include_directories(${targetName} PUBLIC ${CMAKE_SOURCE_DIR}/src/VirtualFluids/CoProcessors) -target_include_directories(${targetName} PUBLIC ${CMAKE_SOURCE_DIR}/src/VirtualFluids/Utilities) - -target_include_directories(${targetName} PUBLIC ${CMAKE_SOURCE_DIR}/ThirdParty) -target_include_directories(${targetName} PUBLIC ${CMAKE_SOURCE_DIR}/src/VirtualFluidsBasics) -target_include_directories(${targetName} PUBLIC ${CMAKE_SOURCE_DIR}/src/VirtualFluidsBasics/numerics/geometry3d) -target_include_directories(${targetName} PUBLIC ${CMAKE_SOURCE_DIR}/src/VirtualFluidsBasics/numerics/geometry3d/Creator) -target_include_directories(${targetName} PUBLIC ${CMAKE_SOURCE_DIR}/src/VirtualFluidsBasics/numerics/geometry3d/KdTree) -target_include_directories(${targetName} PUBLIC ${CMAKE_SOURCE_DIR}/src/VirtualFluidsBasics/basics/container) -target_include_directories(${targetName} PUBLIC ${CMAKE_SOURCE_DIR}/src/VirtualFluidsBasics/basics/memory) -target_include_directories(${targetName} PUBLIC ${CMAKE_SOURCE_DIR}/src/VirtualFluidsBasics/basics/objects) -target_include_directories(${targetName} PUBLIC ${CMAKE_SOURCE_DIR}/src/VirtualFluidsBasics/basics/transmiitter) -target_include_directories(${targetName} PUBLIC ${CMAKE_SOURCE_DIR}/src/VirtualFluidsBasics/basics/utilities) -target_include_directories(${targetName} PUBLIC ${CMAKE_SOURCE_DIR}/src/VirtualFluidsBasics/basics/writer) \ No newline at end of file diff --git a/targets/libs/VirtualFluidsBasics/CMakeLists.txt b/targets/libs/VirtualFluidsBasics/CMakeLists.txt index 4e9298412..32d79ad49 100644 --- a/targets/libs/VirtualFluidsBasics/CMakeLists.txt +++ b/targets/libs/VirtualFluidsBasics/CMakeLists.txt @@ -1,14 +1,14 @@ setTargetNameToFolderName(${CMAKE_CURRENT_LIST_DIR}) set(linkDirectories "") -set(libsToLink "") -set(includeDirectories ${CMAKE_SOURCE_DIR}/src/${targetName} ${CMAKE_SOURCE_DIR}/src/core) +set(libsToLink Core) +set(includeDirectories ${CMAKE_SOURCE_DIR}/src/${targetName} + ${CMAKE_SOURCE_DIR}/src + ${CMAKE_SOURCE_DIR}/src/Core ) #glob files and save in MY_SRCS include(CMakePackage.cmake) -include(buildInfo.cmake) - buildLib(${targetName} "${MY_SRCS}" "${linkDirectories}" "${libsToLink}" "${includeDirectories}") groupTarget(${targetName} ${libraryFolder}) diff --git a/targets/libs/VirtualFluidsBasics/buildInfo.cmake b/targets/libs/VirtualFluidsBasics/buildInfo.cmake deleted file mode 100644 index f31656c71..000000000 --- a/targets/libs/VirtualFluidsBasics/buildInfo.cmake +++ /dev/null @@ -1,16 +0,0 @@ -set(buildInfoPath ${CMAKE_BINARY_DIR}/buildInfo) -set(buildInfoFile buildInfo.cpp) -set(buildInfoFileHeader buildInfo.h) -set(buildInfoInput ${CMAKE_CURRENT_LIST_DIR}/buildInfoInput/buildInfo.in.cpp) - -include(${CMAKE_SOURCE_DIR}/${cmakeMacroPath}/git/GetGitRevisionDescription.cmake) -get_git_head_revision(git_branch git_commit_hash) - -set(COMPILER_FLAGS "${CMAKE_CXX_FLAGS_${CMAKE_BUILD_TYPE}} ${CMAKE_CXX_FLAGS}") - -configure_file(${buildInfoInput} ${buildInfoPath}/${buildInfoFile}) - -include_directories(${buildInfoPath}) -set(MY_SRCS ${MY_SRCS} ${buildInfoPath}/${buildInfoFile} ${CMAKE_CURRENT_LIST_DIR}/${buildInfoFileHeader}) -source_group("" FILES ${buildInfoPath}/${buildInfoFile}) -source_group("" FILES ${CMAKE_CURRENT_LIST_DIR}/${buildInfoFileHeader}) \ No newline at end of file diff --git a/targets/libs/VirtualFluidsBasics/buildInfoInput/buildInfo.in.cpp b/targets/libs/VirtualFluidsBasics/buildInfoInput/buildInfo.in.cpp deleted file mode 100644 index 3a63a1f7a..000000000 --- a/targets/libs/VirtualFluidsBasics/buildInfoInput/buildInfo.in.cpp +++ /dev/null @@ -1,12 +0,0 @@ - - -namespace buildInfo -{ - const char *gitCommitHash() { return "@git_commit_hash@"; } - const char *gitBranch() { return "@git_branch@"; } - const char *buildType() { return "@CMAKE_BUILD_TYPE@"; } - const char *compilerFlags() { return "@COMPILER_FLAGS@"; } - const char *buildMachine() { return "@BUILD_computerName@";} - const char *projectDir() { return "@CMAKE_SOURCE_DIR@"; } - const char *binaryDir() { return "@CMAKE_BINARY_DIR@"; } -} diff --git a/targets/libs/VirtualFluidsBasics/package.include b/targets/libs/VirtualFluidsBasics/package.include deleted file mode 100644 index e69de29bb..000000000 diff --git a/targets/libs/VirtualFluids_GPU/CMakeLists.txt b/targets/libs/VirtualFluids_GPU/CMakeLists.txt index f787b4cac..0a5661ab4 100644 --- a/targets/libs/VirtualFluids_GPU/CMakeLists.txt +++ b/targets/libs/VirtualFluids_GPU/CMakeLists.txt @@ -3,12 +3,16 @@ setTargetNameToFolderName(${CMAKE_CURRENT_LIST_DIR}) set(linkDirectories "") IF(MSVC) - set(libsToLink ws2_32 GridGenerator VirtualFluidsBasics core) # ws_32 throws an error on Phoenix + set(libsToLink ws2_32 GridGenerator VirtualFluidsBasics Core) # ws_32 throws an error on Phoenix ELSE(MSVC) - set(libsToLink GridGenerator VirtualFluidsBasics core) + set(libsToLink GridGenerator VirtualFluidsBasics Core) ENDIF(MSVC) -set(includeDirectories ${CMAKE_SOURCE_DIR}/src/${targetName} ${CMAKE_SOURCE_DIR}/src ${CMAKE_SOURCE_DIR}/src/VirtualFluidsBasics ${CMAKE_SOURCE_DIR}/src/GridGenerator ${CMAKE_SOURCE_DIR}/src/core) +set(includeDirectories ${CMAKE_SOURCE_DIR}/src/${targetName} + ${CMAKE_SOURCE_DIR}/src + ${CMAKE_SOURCE_DIR}/src/GridGenerator + ${CMAKE_SOURCE_DIR}/src/VirtualFluidsBasics + ${CMAKE_SOURCE_DIR}/src/Core ) #glob files and save in MY_SRCS include(CMakePackage.cmake) diff --git a/targets/libs/core/3rdPartyLinking.cmake b/targets/libs/core/3rdPartyLinking.cmake index e69de29bb..94cb1c009 100644 --- a/targets/libs/core/3rdPartyLinking.cmake +++ b/targets/libs/core/3rdPartyLinking.cmake @@ -0,0 +1,6 @@ +include (${CMAKE_SOURCE_DIR}/${cmakeMacroPath}/Boost/Link.cmake) +linkBoost(${targetName} "thread;serialization") +include (${CMAKE_SOURCE_DIR}/${cmakeMacroPath}/MPI/Link.cmake) +linkMPI(${targetName}) +include (${CMAKE_SOURCE_DIR}/${cmakeMacroPath}/JsonCpp/Link.cmake) +linkJsonCpp(${targetName}) \ No newline at end of file diff --git a/targets/libs/core/CMakeLists.txt b/targets/libs/core/CMakeLists.txt index 4de5b48c5..b27eb99bf 100644 --- a/targets/libs/core/CMakeLists.txt +++ b/targets/libs/core/CMakeLists.txt @@ -1,5 +1,7 @@ setTargetNameToFolderName(${CMAKE_CURRENT_LIST_DIR}) +MESSAGE( STATUS ${CMAKE_CURRENT_LIST_DIR} ) + set(linkDirectories "") set(libsToLink "") set(includeDirectories ${CMAKE_SOURCE_DIR}/src/${targetName}) diff --git a/targets/libs/core/buildInfo.cmake b/targets/libs/core/buildInfo.cmake index f31656c71..4dd877bae 100644 --- a/targets/libs/core/buildInfo.cmake +++ b/targets/libs/core/buildInfo.cmake @@ -1,6 +1,6 @@ set(buildInfoPath ${CMAKE_BINARY_DIR}/buildInfo) set(buildInfoFile buildInfo.cpp) -set(buildInfoFileHeader buildInfo.h) +#set(buildInfoFileHeader buildInfo.h) set(buildInfoInput ${CMAKE_CURRENT_LIST_DIR}/buildInfoInput/buildInfo.in.cpp) include(${CMAKE_SOURCE_DIR}/${cmakeMacroPath}/git/GetGitRevisionDescription.cmake) @@ -11,6 +11,7 @@ set(COMPILER_FLAGS "${CMAKE_CXX_FLAGS_${CMAKE_BUILD_TYPE}} ${CMAKE_CXX_FLAGS}") configure_file(${buildInfoInput} ${buildInfoPath}/${buildInfoFile}) include_directories(${buildInfoPath}) -set(MY_SRCS ${MY_SRCS} ${buildInfoPath}/${buildInfoFile} ${CMAKE_CURRENT_LIST_DIR}/${buildInfoFileHeader}) +#set(MY_SRCS ${MY_SRCS} ${buildInfoPath}/${buildInfoFile} ${CMAKE_CURRENT_LIST_DIR}/${buildInfoFileHeader}) +set(MY_SRCS ${MY_SRCS} ${buildInfoPath}/${buildInfoFile}) source_group("" FILES ${buildInfoPath}/${buildInfoFile}) -source_group("" FILES ${CMAKE_CURRENT_LIST_DIR}/${buildInfoFileHeader}) \ No newline at end of file +#source_group("" FILES ${CMAKE_CURRENT_LIST_DIR}/${buildInfoFileHeader}) \ No newline at end of file diff --git a/targets/libs/core/buildInfo.h b/targets/libs/core/buildInfo.h deleted file mode 100644 index 269fe1fab..000000000 --- a/targets/libs/core/buildInfo.h +++ /dev/null @@ -1,25 +0,0 @@ -#ifndef buildInfo_H -#define buildInfo_H - -namespace buildInfo -{ - const char * gitCommitHash(); - const char * gitBranch(); - const char * buildType(); - const char * compilerFlags(); - const char * buildMachine(); - const char * projectDir(); - const char * binaryDir(); -} - -#define GIT_COMMIT_HASH buildinfo::gitCommitHash() -#define GIT_BRANCH buildinfo::gitBranch() -#define BUILD_MACHINE buildinfo::buildMachine() -#define PROJECT_DIR buildinfo::projectDir() -#define BINARY_DIR buildinfo::binaryDir() -#define COMPILER_FLAGS buildinfo::compilerFlags() -#define BUILD_TYPE buildinfo::buildType() - - - -#endif diff --git a/targets/libs/core/buildInfoInput/buildInfo.in.cpp b/targets/libs/core/buildInfoInput/buildInfo.in.cpp index 3a63a1f7a..f3df466c5 100644 --- a/targets/libs/core/buildInfoInput/buildInfo.in.cpp +++ b/targets/libs/core/buildInfoInput/buildInfo.in.cpp @@ -1,12 +1,12 @@ - +#include "VirtualFluidsDefinitions.h" namespace buildInfo { - const char *gitCommitHash() { return "@git_commit_hash@"; } - const char *gitBranch() { return "@git_branch@"; } - const char *buildType() { return "@CMAKE_BUILD_TYPE@"; } - const char *compilerFlags() { return "@COMPILER_FLAGS@"; } - const char *buildMachine() { return "@BUILD_computerName@";} - const char *projectDir() { return "@CMAKE_SOURCE_DIR@"; } - const char *binaryDir() { return "@CMAKE_BINARY_DIR@"; } + VF_PUBLIC const char *gitCommitHash() { return "@git_commit_hash@"; } + VF_PUBLIC const char *gitBranch() { return "@git_branch@"; } + VF_PUBLIC const char *buildType() { return "@CMAKE_BUILD_TYPE@"; } + VF_PUBLIC const char *compilerFlags() { return "@COMPILER_FLAGS@"; } + VF_PUBLIC const char *buildMachine() { return "@BUILD_computerName@";} + VF_PUBLIC const char *projectDir() { return "@CMAKE_SOURCE_DIR@"; } + VF_PUBLIC const char *binaryDir() { return "@CMAKE_BINARY_DIR@"; } } diff --git a/targets/libs/dem_coupling/3rdPartyLinking.cmake b/targets/libs/dem_coupling/3rdPartyLinking.cmake deleted file mode 100644 index 2b809d559..000000000 --- a/targets/libs/dem_coupling/3rdPartyLinking.cmake +++ /dev/null @@ -1,8 +0,0 @@ -include (${CMAKE_SOURCE_DIR}/${cmakeMacroPath}/MPI/Link.cmake) -linkMPI(${targetName}) -include (${CMAKE_SOURCE_DIR}/${cmakeMacroPath}/Boost/Link.cmake) -linkBoost(${targetName} "signals;thread;serialization;filesystem") -include (${CMAKE_SOURCE_DIR}/${cmakeMacroPath}/Metis/Link.cmake) -linkMetis(${targetName}) - -target_link_libraries(${targetName} "pe" "core" "blockforest" "domain_decomposition") diff --git a/targets/libs/dem_coupling/CMakeLists.txt b/targets/libs/dem_coupling/CMakeLists.txt deleted file mode 100644 index 7223c842d..000000000 --- a/targets/libs/dem_coupling/CMakeLists.txt +++ /dev/null @@ -1,15 +0,0 @@ -setTargetNameToFolderName(${CMAKE_CURRENT_LIST_DIR}) - -set(linkDirectories "") -set(libsToLink "VirtualFluidsBasics" "VirtualFluids") -set(includeDirectories ${PE_ROOT}/src ${PE_BINARY_DIR}/src ${CMAKE_SOURCE_DIR}/src) -#glob files and save in MY_SRCS -include(CMakePackage.cmake) - -buildLib(${targetName} "${MY_SRCS}" "${linkDirectories}" "${libsToLink}" "${includeDirectories}") -groupTarget(${targetName} ${libraryFolder}) -generateExportHeader(${targetName} ${CMAKE_SOURCE_DIR}/src/${targetName}) -set_target_properties(${targetName} PROPERTIES LINK_FLAGS "/ignore:4251") - -#Specify the linking to 3rdParty libs -include(3rdPartyLinking.cmake) diff --git a/targets/libs/dem_coupling/CMakePackage.cmake b/targets/libs/dem_coupling/CMakePackage.cmake deleted file mode 100644 index 7ec316fe0..000000000 --- a/targets/libs/dem_coupling/CMakePackage.cmake +++ /dev/null @@ -1,8 +0,0 @@ -#FILE ENDINGS -resetFileEndingsToCollect() -addCAndCPPFileTypes() - -#GLOB SOURCE FILES IN MY_SRCS -unset(MY_SRCS) -includeRecursiveAllFilesFrom(${targetName} ${CMAKE_CURRENT_LIST_DIR}) -includeRecursiveProductionFilesFrom(${targetName} ${CMAKE_SOURCE_DIR}/src/${targetName}) \ No newline at end of file diff --git a/targets/tests/GridGeneratorTest/3rdPartyLinking.cmake b/targets/tests/GridGeneratorTest/3rdPartyLinking.cmake deleted file mode 100644 index f621a1361..000000000 --- a/targets/tests/GridGeneratorTest/3rdPartyLinking.cmake +++ /dev/null @@ -1,8 +0,0 @@ -include (${CMAKE_SOURCE_DIR}/${cmakeMacroPath}/GMock/Link.cmake) -linkGMock(${targetName}) -include (${CMAKE_SOURCE_DIR}/${cmakeMacroPath}/MPI/Link.cmake) -linkMPI(${targetName}) -include (${CMAKE_SOURCE_DIR}/${cmakeMacroPath}/Cuda/Link.cmake) -linkCuda(${targetName}) -include (${CMAKE_SOURCE_DIR}/${cmakeMacroPath}/Boost/Link.cmake) -linkBoost(${targetName} "") \ No newline at end of file diff --git a/targets/tests/GridGeneratorTest/CMakeLists.txt b/targets/tests/GridGeneratorTest/CMakeLists.txt deleted file mode 100644 index 5554cd516..000000000 --- a/targets/tests/GridGeneratorTest/CMakeLists.txt +++ /dev/null @@ -1,14 +0,0 @@ -setTargetNameToFolderName(${CMAKE_CURRENT_LIST_DIR}) - -set(linkDirectories "") -set(libsToLink GridGenerator) -set(includeDirectories ${CMAKE_SOURCE_DIR}/src ${CMAKE_SOURCE_DIR}/src/GridGenerator "${CMAKE_SOURCE_DIR}/src/VirtualFluidsBasics") - -#glob files and save in MY_SRCS -include(CMakePackage.cmake) - -buildExe(${targetName} "${MY_SRCS}" "${linkDirectories}" "${libsToLink}" "${includeDirectories}") -groupTarget(${targetName} ${testFolder}) - -#Specify the linking to 3rdParty libs -include(3rdPartyLinking.cmake) diff --git a/targets/tests/GridGeneratorTest/CMakePackage.cmake b/targets/tests/GridGeneratorTest/CMakePackage.cmake deleted file mode 100644 index d4fe81711..000000000 --- a/targets/tests/GridGeneratorTest/CMakePackage.cmake +++ /dev/null @@ -1,8 +0,0 @@ -#FILE ENDINGS -resetFileEndingsToCollect() -addCAndCPPFileTypes() - -#GLOB SOURCE FILES IN MY_SRCS -unset(MY_SRCS) -includeRecursiveAllFilesFrom(${targetName} ${CMAKE_CURRENT_LIST_DIR}) -includeRecursiveTestFilesFrom(GridGenerator ${CMAKE_SOURCE_DIR}/src/GridGenerator) diff --git a/targets/tests/GridGeneratorTest/main.cpp b/targets/tests/GridGeneratorTest/main.cpp deleted file mode 100644 index 7a25db978..000000000 --- a/targets/tests/GridGeneratorTest/main.cpp +++ /dev/null @@ -1,20 +0,0 @@ -#include "gmock/gmock.h" -#include "mpi.h" -#include <fstream> -#include "VirtualFluidsBasics/utilities/logger/Logger.h" - -int main(int argc, char **argv) -{ - MPI_Init(&argc, &argv); - - std::ofstream file("log.txt", std::ofstream::out); - logging::Logger::addStream(&file); - - ::testing::InitGoogleTest(&argc, argv); - int i = RUN_ALL_TESTS(); - - file.close(); - MPI_Finalize(); - - return i; -} diff --git a/targets/tests/GridGeneratorTest/package.include b/targets/tests/GridGeneratorTest/package.include deleted file mode 100644 index e69de29bb..000000000 diff --git a/targets/tests/VirtualFluidsBasicsTest/3rdPartyLinking.cmake b/targets/tests/VirtualFluidsBasicsTest/3rdPartyLinking.cmake deleted file mode 100644 index 7e1651174..000000000 --- a/targets/tests/VirtualFluidsBasicsTest/3rdPartyLinking.cmake +++ /dev/null @@ -1,2 +0,0 @@ -include (${CMAKE_SOURCE_DIR}/${cmakeMacroPath}/GMock/Link.cmake) -linkGMock(${targetName}) \ No newline at end of file diff --git a/targets/tests/VirtualFluidsBasicsTest/CMakeLists.txt b/targets/tests/VirtualFluidsBasicsTest/CMakeLists.txt deleted file mode 100644 index 67509182f..000000000 --- a/targets/tests/VirtualFluidsBasicsTest/CMakeLists.txt +++ /dev/null @@ -1,14 +0,0 @@ -setTargetNameToFolderName(${CMAKE_CURRENT_LIST_DIR}) - -set(linkDirectories "") -set(libsToLink "VirtualFluidsBasics") -set(includeDirectories ${CMAKE_SOURCE_DIR}/src/VirtualFluidsBasics) - -#glob files and save in MY_SRCS -include(CMakePackage.cmake) - -buildExe(${targetName} "${MY_SRCS}" "${linkDirectories}" "${libsToLink}" "${includeDirectories}") -groupTarget(${targetName} ${testFolder}) - -#Specify the linking to 3rdParty libs -include(3rdPartyLinking.cmake) \ No newline at end of file diff --git a/targets/tests/VirtualFluidsBasicsTest/CMakePackage.cmake b/targets/tests/VirtualFluidsBasicsTest/CMakePackage.cmake deleted file mode 100644 index fef3527c9..000000000 --- a/targets/tests/VirtualFluidsBasicsTest/CMakePackage.cmake +++ /dev/null @@ -1,8 +0,0 @@ -#FILE ENDINGS -resetFileEndingsToCollect() -addCAndCPPFileTypes() - -#GLOB SOURCE FILES IN MY_SRCS -unset(MY_SRCS) -includeRecursiveAllFilesFrom(${targetName} ${CMAKE_CURRENT_LIST_DIR}) -includeRecursiveTestFilesFrom(VirtualFluidsBasics ${CMAKE_SOURCE_DIR}/src/VirtualFluidsBasics) diff --git a/targets/tests/VirtualFluidsBasicsTest/main.cpp b/targets/tests/VirtualFluidsBasicsTest/main.cpp deleted file mode 100644 index 545836090..000000000 --- a/targets/tests/VirtualFluidsBasicsTest/main.cpp +++ /dev/null @@ -1,7 +0,0 @@ -#include "gmock/gmock.h" - -int main(int argc, char **argv) -{ - ::testing::InitGoogleTest(&argc, argv); - return RUN_ALL_TESTS(); -} \ No newline at end of file diff --git a/targets/tests/VirtualFluidsBasicsTest/package.include b/targets/tests/VirtualFluidsBasicsTest/package.include deleted file mode 100644 index e69de29bb..000000000 diff --git a/targets/tests/VirtualFluidsTest/3rdPartyLinking.cmake b/targets/tests/VirtualFluidsTest/3rdPartyLinking.cmake deleted file mode 100644 index aeadaaeaa..000000000 --- a/targets/tests/VirtualFluidsTest/3rdPartyLinking.cmake +++ /dev/null @@ -1,4 +0,0 @@ -include (${CMAKE_SOURCE_DIR}/${cmakeMacroPath}/GMock/Link.cmake) -linkGMock(${targetName}) -include (${CMAKE_SOURCE_DIR}/${cmakeMacroPath}/Boost/Link.cmake) -linkBoost(${targetName} "signals;thread;serialization;filesystem") \ No newline at end of file diff --git a/targets/tests/VirtualFluidsTest/CMakeLists.txt b/targets/tests/VirtualFluidsTest/CMakeLists.txt deleted file mode 100644 index c40271f30..000000000 --- a/targets/tests/VirtualFluidsTest/CMakeLists.txt +++ /dev/null @@ -1,14 +0,0 @@ -setTargetNameToFolderName(${CMAKE_CURRENT_LIST_DIR}) - -set(linkDirectories "") -set(libsToLink "VirtualFluids" "VirtualFluidsBasics") -set(includeDirectories ${CMAKE_SOURCE_DIR}/src/VirtualFluids ${CMAKE_SOURCE_DIR}/src) - -#glob files and save in MY_SRCS -include(CMakePackage.cmake) - -buildExe(${targetName} "${MY_SRCS}" "${linkDirectories}" "${libsToLink}" "${includeDirectories}") -groupTarget(${targetName} ${testFolder}) - -#Specify the linking to 3rdParty libs -include(3rdPartyLinking.cmake) \ No newline at end of file diff --git a/targets/tests/VirtualFluidsTest/CMakePackage.cmake b/targets/tests/VirtualFluidsTest/CMakePackage.cmake deleted file mode 100644 index 8be8ab54b..000000000 --- a/targets/tests/VirtualFluidsTest/CMakePackage.cmake +++ /dev/null @@ -1,8 +0,0 @@ -#FILE ENDINGS -resetFileEndingsToCollect() -addCAndCPPFileTypes() - -#GLOB SOURCE FILES IN MY_SRCS -unset(MY_SRCS) -includeRecursiveAllFilesFrom(${targetName} ${CMAKE_CURRENT_LIST_DIR}) -includeRecursiveTestFilesFrom(VirtualFluids ${CMAKE_SOURCE_DIR}/src/VirtualFluids) diff --git a/targets/tests/VirtualFluidsTest/main.cpp b/targets/tests/VirtualFluidsTest/main.cpp deleted file mode 100644 index 545836090..000000000 --- a/targets/tests/VirtualFluidsTest/main.cpp +++ /dev/null @@ -1,7 +0,0 @@ -#include "gmock/gmock.h" - -int main(int argc, char **argv) -{ - ::testing::InitGoogleTest(&argc, argv); - return RUN_ALL_TESTS(); -} \ No newline at end of file diff --git a/targets/tests/VirtualFluidsTest/package.include b/targets/tests/VirtualFluidsTest/package.include deleted file mode 100644 index e69de29bb..000000000 diff --git a/targets/tests/VirtualFluids_GPUTest/3rdPartyLinking.cmake b/targets/tests/VirtualFluids_GPUTest/3rdPartyLinking.cmake deleted file mode 100644 index c44aa3c00..000000000 --- a/targets/tests/VirtualFluids_GPUTest/3rdPartyLinking.cmake +++ /dev/null @@ -1,6 +0,0 @@ -include (${CMAKE_SOURCE_DIR}/${cmakeMacroPath}/GMock/Link.cmake) -linkGMock(${targetName}) -include (${CMAKE_SOURCE_DIR}/${cmakeMacroPath}/MPI/Link.cmake) -linkMPI(${targetName}) -include (${CMAKE_SOURCE_DIR}/${cmakeMacroPath}/Cuda/Link.cmake) -linkCuda(${targetName}) \ No newline at end of file diff --git a/targets/tests/VirtualFluids_GPUTest/CMakeLists.txt b/targets/tests/VirtualFluids_GPUTest/CMakeLists.txt deleted file mode 100644 index 3db1182c1..000000000 --- a/targets/tests/VirtualFluids_GPUTest/CMakeLists.txt +++ /dev/null @@ -1,14 +0,0 @@ -setTargetNameToFolderName(${CMAKE_CURRENT_LIST_DIR}) - -set(linkDirectories "") -set(libsToLink VirtualFluids_GPU) -set(includeDirectories ${CMAKE_SOURCE_DIR}/src/VirtualFluids_GPU) - -#glob files and save in MY_SRCS -include(CMakePackage.cmake) - -buildExe(${targetName} "${MY_SRCS}" "${linkDirectories}" "${libsToLink}" "${includeDirectories}") -groupTarget(${targetName} ${testFolder}) - -#Specify the linking to 3rdParty libs -include(3rdPartyLinking.cmake) diff --git a/targets/tests/VirtualFluids_GPUTest/CMakePackage.cmake b/targets/tests/VirtualFluids_GPUTest/CMakePackage.cmake deleted file mode 100644 index f09ba0e6f..000000000 --- a/targets/tests/VirtualFluids_GPUTest/CMakePackage.cmake +++ /dev/null @@ -1,8 +0,0 @@ -#FILE ENDINGS -resetFileEndingsToCollect() -addCAndCPPFileTypes() - -#GLOB SOURCE FILES IN MY_SRCS -unset(MY_SRCS) -includeRecursiveAllFilesFrom(${targetName} ${CMAKE_CURRENT_LIST_DIR}) -includeRecursiveTestFilesFrom(VirtualFluids_GPU ${CMAKE_SOURCE_DIR}/src/VirtualFluids_GPU) diff --git a/targets/tests/VirtualFluids_GPUTest/main.cpp b/targets/tests/VirtualFluids_GPUTest/main.cpp deleted file mode 100644 index d6c10da9b..000000000 --- a/targets/tests/VirtualFluids_GPUTest/main.cpp +++ /dev/null @@ -1,15 +0,0 @@ -#include "gmock/gmock.h" -#include "mpi.h" - - -int main(int argc, char **argv) -{ - MPI_Init(&argc, &argv); - - - - ::testing::InitGoogleTest(&argc, argv); - return RUN_ALL_TESTS(); - - MPI_Finalize(); -} diff --git a/targets/tests/VirtualFluids_GPUTest/package.include b/targets/tests/VirtualFluids_GPUTest/package.include deleted file mode 100644 index e69de29bb..000000000 diff --git a/targets/tests/coreTest/3rdPartyLinking.cmake b/targets/tests/coreTest/3rdPartyLinking.cmake deleted file mode 100644 index 7e1651174..000000000 --- a/targets/tests/coreTest/3rdPartyLinking.cmake +++ /dev/null @@ -1,2 +0,0 @@ -include (${CMAKE_SOURCE_DIR}/${cmakeMacroPath}/GMock/Link.cmake) -linkGMock(${targetName}) \ No newline at end of file diff --git a/targets/tests/coreTest/CMakeLists.txt b/targets/tests/coreTest/CMakeLists.txt deleted file mode 100644 index 1e0c13e96..000000000 --- a/targets/tests/coreTest/CMakeLists.txt +++ /dev/null @@ -1,14 +0,0 @@ -setTargetNameToFolderName(${CMAKE_CURRENT_LIST_DIR}) - -set(linkDirectories "") -set(libsToLink "core") -set(includeDirectories ${CMAKE_SOURCE_DIR}/src/core) - -#glob files and save in MY_SRCS -include(CMakePackage.cmake) - -buildExe(${targetName} "${MY_SRCS}" "${linkDirectories}" "${libsToLink}" "${includeDirectories}") -groupTarget(${targetName} ${testFolder}) - -#Specify the linking to 3rdParty libs -include(3rdPartyLinking.cmake) \ No newline at end of file diff --git a/targets/tests/coreTest/CMakePackage.cmake b/targets/tests/coreTest/CMakePackage.cmake deleted file mode 100644 index 21deb0fbd..000000000 --- a/targets/tests/coreTest/CMakePackage.cmake +++ /dev/null @@ -1,8 +0,0 @@ -#FILE ENDINGS -resetFileEndingsToCollect() -addCAndCPPFileTypes() - -#GLOB SOURCE FILES IN MY_SRCS -unset(MY_SRCS) -includeRecursiveAllFilesFrom(${targetName} ${CMAKE_CURRENT_LIST_DIR}) -includeRecursiveTestFilesFrom(VirtualFluidsBasics ${CMAKE_SOURCE_DIR}/src/core) diff --git a/targets/tests/coreTest/main.cpp b/targets/tests/coreTest/main.cpp deleted file mode 100644 index 545836090..000000000 --- a/targets/tests/coreTest/main.cpp +++ /dev/null @@ -1,7 +0,0 @@ -#include "gmock/gmock.h" - -int main(int argc, char **argv) -{ - ::testing::InitGoogleTest(&argc, argv); - return RUN_ALL_TESTS(); -} \ No newline at end of file diff --git a/targets/tests/coreTest/package.include b/targets/tests/coreTest/package.include deleted file mode 100644 index e69de29bb..000000000 -- GitLab