From 65c9e869b2769c87fa8e2be89b3e69c616f481cb Mon Sep 17 00:00:00 2001 From: Soeren Peters <peters.soeren@gmx.net> Date: Fri, 12 Feb 2021 12:29:19 +0000 Subject: [PATCH] Small clean ups. --- CMake/compilerflags/GNU.cmake | 2 +- .../BoundaryConditions/BCArray3D.cpp | 6 +++--- .../DensityAndThixotropyBCAlgorithm.cpp | 13 ++++++------- .../BoundaryConditions/SimpleSlipBCAlgorithm.cpp | 4 +--- .../SimpleVelocityBCAlgorithm.cpp | 4 +--- .../VelocityAndThixotropyBCAlgorithm.cpp | 13 ++++++------- .../VelocityWithDensityAndThixotropyBCAlgorithm.cpp | 13 ++++++------- .../CoProcessors/CalculateTorqueCoProcessor.cpp | 2 +- 8 files changed, 25 insertions(+), 32 deletions(-) diff --git a/CMake/compilerflags/GNU.cmake b/CMake/compilerflags/GNU.cmake index 63eeeb9b0..a196d5d0b 100644 --- a/CMake/compilerflags/GNU.cmake +++ b/CMake/compilerflags/GNU.cmake @@ -33,7 +33,7 @@ list(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS "-Wno-unused-function") list(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS "-Wno-unused-parameter") list(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS "-Wno-reorder") list(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS "-Wno-unknown-pragmas") - +list(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS "-Wno-cast-function-type") ############################################################################################################# # linker options diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/BCArray3D.cpp b/src/cpu/VirtualFluidsCore/BoundaryConditions/BCArray3D.cpp index 87606eecf..88f4a52b2 100644 --- a/src/cpu/VirtualFluidsCore/BoundaryConditions/BCArray3D.cpp +++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/BCArray3D.cpp @@ -63,11 +63,11 @@ void BCArray3D::resize(std::size_t nx1, std::size_t nx2, std::size_t nx3, int va ////////////////////////////////////////////////////////////////////////// bool BCArray3D::validIndices(std::size_t x1, std::size_t x2, std::size_t x3) const { - if (x1 < 0 || x1 >= this->bcindexmatrix.getNX1()) + if (x1 >= this->bcindexmatrix.getNX1()) return false; - if (x2 < 0 || x2 >= this->bcindexmatrix.getNX2()) + if (x2 >= this->bcindexmatrix.getNX2()) return false; - if (x3 < 0 || x3 >= this->bcindexmatrix.getNX3()) + if (x3 >= this->bcindexmatrix.getNX3()) return false; return true; } diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/DensityAndThixotropyBCAlgorithm.cpp b/src/cpu/VirtualFluidsCore/BoundaryConditions/DensityAndThixotropyBCAlgorithm.cpp index 45b467596..33af827c6 100644 --- a/src/cpu/VirtualFluidsCore/BoundaryConditions/DensityAndThixotropyBCAlgorithm.cpp +++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/DensityAndThixotropyBCAlgorithm.cpp @@ -60,15 +60,14 @@ void DensityAndThixotropyBCAlgorithm::applyBC() 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; } + if (bcPtr->hasDensityBoundaryFlag(D3Q27System::E)) { nx1 -= 1; } + else if (bcPtr->hasDensityBoundaryFlag(D3Q27System::W)) { nx1 += 1; } + else if (bcPtr->hasDensityBoundaryFlag(D3Q27System::N)) { nx2 -= 1; } + else if (bcPtr->hasDensityBoundaryFlag(D3Q27System::S)) { nx2 += 1; } + else if (bcPtr->hasDensityBoundaryFlag(D3Q27System::T)) { nx3 -= 1; } + else if (bcPtr->hasDensityBoundaryFlag(D3Q27System::B)) { nx3 += 1; } else UB_THROW(UbException(UB_EXARGS, "Danger...no orthogonal BC-Flag on density boundary...")); LBMReal rhoBC = bcPtr->getBoundaryDensity(); diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/SimpleSlipBCAlgorithm.cpp b/src/cpu/VirtualFluidsCore/BoundaryConditions/SimpleSlipBCAlgorithm.cpp index 380167005..213b58877 100644 --- a/src/cpu/VirtualFluidsCore/BoundaryConditions/SimpleSlipBCAlgorithm.cpp +++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/SimpleSlipBCAlgorithm.cpp @@ -29,7 +29,7 @@ void SimpleSlipBCAlgorithm::applyBC() LBMReal f[D3Q27System::ENDF+1]; LBMReal feq[D3Q27System::ENDF+1]; distributions->getDistributionInv(f, x1, x2, x3); - LBMReal rho, vx1, vx2, vx3, drho; + LBMReal vx1, vx2, vx3, drho; calcMacrosFct(f, drho, vx1, vx2, vx3); calcFeqFct(feq, drho, vx1, vx2, vx3); @@ -40,8 +40,6 @@ void SimpleSlipBCAlgorithm::applyBC() vx2 = vx2 - amp * val<2>(normale); //normale zeigt von struktur weg! vx3 = vx3 - amp * val<3>(normale); //normale zeigt von struktur weg! - rho = 1.0+drho*compressibleFactor; - for (int fdir = D3Q27System::FSTARTDIR; fdir<=D3Q27System::FENDDIR; fdir++) { if (bcPtr->hasSlipBoundaryFlag(fdir)) diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/SimpleVelocityBCAlgorithm.cpp b/src/cpu/VirtualFluidsCore/BoundaryConditions/SimpleVelocityBCAlgorithm.cpp index 9e136e015..6529ea851 100644 --- a/src/cpu/VirtualFluidsCore/BoundaryConditions/SimpleVelocityBCAlgorithm.cpp +++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/SimpleVelocityBCAlgorithm.cpp @@ -61,12 +61,10 @@ void SimpleVelocityBCAlgorithm::applyBC() LBMReal f[D3Q27System::ENDF+1]; LBMReal feq[D3Q27System::ENDF+1]; distributions->getDistributionInv(f, x1, x2, x3); - LBMReal rho, vx1, vx2, vx3, drho; + LBMReal 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)) diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/VelocityAndThixotropyBCAlgorithm.cpp b/src/cpu/VirtualFluidsCore/BoundaryConditions/VelocityAndThixotropyBCAlgorithm.cpp index 575521827..e6a50917f 100644 --- a/src/cpu/VirtualFluidsCore/BoundaryConditions/VelocityAndThixotropyBCAlgorithm.cpp +++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/VelocityAndThixotropyBCAlgorithm.cpp @@ -58,15 +58,14 @@ void VelocityAndThixotropyBCAlgorithm::applyBC() int nx1 = x1; int nx2 = x2; int nx3 = x3; - int direction = -1; //flag points in direction of fluid - if (bcPtr->hasVelocityBoundaryFlag(D3Q27System::E)) { nx1 -= 1; direction = D3Q27System::E; } - else if (bcPtr->hasVelocityBoundaryFlag(D3Q27System::W)) { nx1 += 1; direction = D3Q27System::W; } - else if (bcPtr->hasVelocityBoundaryFlag(D3Q27System::N)) { nx2 -= 1; direction = D3Q27System::N; } - else if (bcPtr->hasVelocityBoundaryFlag(D3Q27System::S)) { nx2 += 1; direction = D3Q27System::S; } - else if (bcPtr->hasVelocityBoundaryFlag(D3Q27System::T)) { nx3 -= 1; direction = D3Q27System::T; } - else if (bcPtr->hasVelocityBoundaryFlag(D3Q27System::B)) { nx3 += 1; direction = D3Q27System::B; } + if (bcPtr->hasVelocityBoundaryFlag(D3Q27System::E)) { nx1 -= 1; } + else if (bcPtr->hasVelocityBoundaryFlag(D3Q27System::W)) { nx1 += 1; } + else if (bcPtr->hasVelocityBoundaryFlag(D3Q27System::N)) { nx2 -= 1; } + else if (bcPtr->hasVelocityBoundaryFlag(D3Q27System::S)) { nx2 += 1; } + else if (bcPtr->hasVelocityBoundaryFlag(D3Q27System::T)) { nx3 -= 1; } + else if (bcPtr->hasVelocityBoundaryFlag(D3Q27System::B)) { nx3 += 1; } else UB_THROW(UbException(UB_EXARGS, "Danger...no orthogonal BC-Flag on velocity boundary...")); //lambdaBC = bcPtr->getBoundaryThixotropy(); diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/VelocityWithDensityAndThixotropyBCAlgorithm.cpp b/src/cpu/VirtualFluidsCore/BoundaryConditions/VelocityWithDensityAndThixotropyBCAlgorithm.cpp index 8f2436b38..f72f9bc7f 100644 --- a/src/cpu/VirtualFluidsCore/BoundaryConditions/VelocityWithDensityAndThixotropyBCAlgorithm.cpp +++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/VelocityWithDensityAndThixotropyBCAlgorithm.cpp @@ -51,15 +51,14 @@ void VelocityWithDensityAndThixotropyBCAlgorithm::applyBC() int nx1 = x1; int nx2 = x2; int nx3 = x3; - int direction = -1; //flag points in direction of fluid - if (bcPtr->hasVelocityBoundaryFlag(D3Q27System::E)) { nx1 -= 1; direction = D3Q27System::E; } - else if (bcPtr->hasVelocityBoundaryFlag(D3Q27System::W)) { nx1 += 1; direction = D3Q27System::W; } - else if (bcPtr->hasVelocityBoundaryFlag(D3Q27System::N)) { nx2 -= 1; direction = D3Q27System::N; } - else if (bcPtr->hasVelocityBoundaryFlag(D3Q27System::S)) { nx2 += 1; direction = D3Q27System::S; } - else if (bcPtr->hasVelocityBoundaryFlag(D3Q27System::T)) { nx3 -= 1; direction = D3Q27System::T; } - else if (bcPtr->hasVelocityBoundaryFlag(D3Q27System::B)) { nx3 += 1; direction = D3Q27System::B; } + if (bcPtr->hasVelocityBoundaryFlag(D3Q27System::E)) { nx1 -= 1; } + else if (bcPtr->hasVelocityBoundaryFlag(D3Q27System::W)) { nx1 += 1; } + else if (bcPtr->hasVelocityBoundaryFlag(D3Q27System::N)) { nx2 -= 1; } + else if (bcPtr->hasVelocityBoundaryFlag(D3Q27System::S)) { nx2 += 1; } + else if (bcPtr->hasVelocityBoundaryFlag(D3Q27System::T)) { nx3 -= 1; } + else if (bcPtr->hasVelocityBoundaryFlag(D3Q27System::B)) { nx3 += 1; } else UB_THROW(UbException(UB_EXARGS, "Danger...no orthogonal BC-Flag on velocity boundary...")); for (int fdir = D3Q27System::FSTARTDIR; fdir <= D3Q27System::FENDDIR; fdir++) diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/CalculateTorqueCoProcessor.cpp b/src/cpu/VirtualFluidsCore/CoProcessors/CalculateTorqueCoProcessor.cpp index 2272fe270..37e593d86 100644 --- a/src/cpu/VirtualFluidsCore/CoProcessors/CalculateTorqueCoProcessor.cpp +++ b/src/cpu/VirtualFluidsCore/CoProcessors/CalculateTorqueCoProcessor.cpp @@ -13,7 +13,7 @@ #include "EsoTwist3D.h" #include "DistributionArray3D.h" -CalculateTorqueCoProcessor::CalculateTorqueCoProcessor( SPtr<Grid3D> grid, SPtr<UbScheduler> s, const std::string &path_, SPtr<Communicator> comm) : CoProcessor(grid, s), path(path), comm(comm), forceX1global(0), forceX2global(0), forceX3global(0) +CalculateTorqueCoProcessor::CalculateTorqueCoProcessor( SPtr<Grid3D> grid, SPtr<UbScheduler> s, const std::string &path_, SPtr<Communicator> comm) : CoProcessor(grid, s), path(path_), comm(comm), forceX1global(0), forceX2global(0), forceX3global(0) { if (comm->getProcessID() == comm->getRoot()) { -- GitLab