diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/NonReflectingOutflowBCAlgorithm.cpp b/src/cpu/VirtualFluidsCore/BoundaryConditions/NonReflectingOutflowBCAlgorithm.cpp index 149824f17c7d4472152571e617d9e766fe61a166..d02daf91e9c9c967a08b4d7839a781f828b55d81 100644 --- a/src/cpu/VirtualFluidsCore/BoundaryConditions/NonReflectingOutflowBCAlgorithm.cpp +++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/NonReflectingOutflowBCAlgorithm.cpp @@ -29,6 +29,8 @@ void NonReflectingOutflowBCAlgorithm::addDistributions(SPtr<DistributionArray3D> void NonReflectingOutflowBCAlgorithm::applyBC() { using namespace D3Q27System; + using namespace UbMath; + LBMReal f[ENDF+1]; LBMReal ftemp[ENDF+1]; diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/PressureCoefficientCoProcessor.h b/src/cpu/VirtualFluidsCore/CoProcessors/PressureCoefficientCoProcessor.h index 5738ec6424b8360a61b95ed0e2f131dad5015f0c..c1d5685c59b6d769fe006eb2dcd32e3b63cc3f78 100644 --- a/src/cpu/VirtualFluidsCore/CoProcessors/PressureCoefficientCoProcessor.h +++ b/src/cpu/VirtualFluidsCore/CoProcessors/PressureCoefficientCoProcessor.h @@ -7,6 +7,7 @@ #include "CoProcessor.h" #include "LBMSystem.h" +#include "UbTuple.h" class GbCuboid3D; diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/QCriterionCoProcessor.h b/src/cpu/VirtualFluidsCore/CoProcessors/QCriterionCoProcessor.h index 1a1f53d9ad0c2391fc43ab08117ea2a2a95ac0b4..1a817601c6269189bffba1855ed5907542b3489c 100644 --- a/src/cpu/VirtualFluidsCore/CoProcessors/QCriterionCoProcessor.h +++ b/src/cpu/VirtualFluidsCore/CoProcessors/QCriterionCoProcessor.h @@ -12,6 +12,7 @@ #include "CoProcessor.h" #include "LBMSystem.h" +#include "UbTuple.h" class Communicator; class Grid3D; diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/WriteMQFromSelectionCoProcessor.h b/src/cpu/VirtualFluidsCore/CoProcessors/WriteMQFromSelectionCoProcessor.h index 886fed0f89512a656cf93e904b526ba55d805f80..12b8f6cafa3eae4781e5550c4d12babf963fa79c 100644 --- a/src/cpu/VirtualFluidsCore/CoProcessors/WriteMQFromSelectionCoProcessor.h +++ b/src/cpu/VirtualFluidsCore/CoProcessors/WriteMQFromSelectionCoProcessor.h @@ -8,6 +8,8 @@ #include "CoProcessor.h" #include "LBMSystem.h" +#include "UbTuple.h" + class Communicator; class Grid3D; diff --git a/src/cpu/VirtualFluidsCore/LBM/BGKLBMKernel.cpp b/src/cpu/VirtualFluidsCore/LBM/BGKLBMKernel.cpp index f91a4197a82e11ec1a328e60bb97bc8b4632b88b..5735fa5d4122128a0853decebf6e37ce816e8dd1 100644 --- a/src/cpu/VirtualFluidsCore/LBM/BGKLBMKernel.cpp +++ b/src/cpu/VirtualFluidsCore/LBM/BGKLBMKernel.cpp @@ -42,6 +42,7 @@ SPtr<LBMKernel> BGKLBMKernel::clone() void BGKLBMKernel::calculate(int step) { using namespace D3Q27System; + using namespace UbMath; //initializing of forcing stuff if (withForcing) diff --git a/src/cpu/VirtualFluidsCore/LBM/CompressibleCumulant4thOrderViscosityLBMKernel.cpp b/src/cpu/VirtualFluidsCore/LBM/CompressibleCumulant4thOrderViscosityLBMKernel.cpp index dfcec6ec28376ce147d56a2d147c4056384d660c..897793c94e5efd8d6ff4b8b3cc9481cc9fe63f5f 100644 --- a/src/cpu/VirtualFluidsCore/LBM/CompressibleCumulant4thOrderViscosityLBMKernel.cpp +++ b/src/cpu/VirtualFluidsCore/LBM/CompressibleCumulant4thOrderViscosityLBMKernel.cpp @@ -9,6 +9,8 @@ #define PROOF_CORRECTNESS +using namespace UbMath; + ////////////////////////////////////////////////////////////////////////// CompressibleCumulant4thOrderViscosityLBMKernel::CompressibleCumulant4thOrderViscosityLBMKernel() { diff --git a/src/cpu/VirtualFluidsCore/LBM/CompressibleCumulantLBMKernel.cpp b/src/cpu/VirtualFluidsCore/LBM/CompressibleCumulantLBMKernel.cpp index dd9725b1e6e6e4c8e010319f02c7c756c833286e..d6c0d827927b2cfcc0f775415900a16c3f80fe2f 100644 --- a/src/cpu/VirtualFluidsCore/LBM/CompressibleCumulantLBMKernel.cpp +++ b/src/cpu/VirtualFluidsCore/LBM/CompressibleCumulantLBMKernel.cpp @@ -8,6 +8,8 @@ #define PROOF_CORRECTNESS +using namespace UbMath; + ////////////////////////////////////////////////////////////////////////// CompressibleCumulantLBMKernel::CompressibleCumulantLBMKernel() { diff --git a/src/cpu/VirtualFluidsCore/LBM/CompressibleOffsetInterpolationProcessor.cpp b/src/cpu/VirtualFluidsCore/LBM/CompressibleOffsetInterpolationProcessor.cpp index 36910694c37ad9c05d3f4b7963553573bd2e2bf8..7716a246eb7998df47c35666f46a61bd86293082 100644 --- a/src/cpu/VirtualFluidsCore/LBM/CompressibleOffsetInterpolationProcessor.cpp +++ b/src/cpu/VirtualFluidsCore/LBM/CompressibleOffsetInterpolationProcessor.cpp @@ -1,7 +1,7 @@ #include "CompressibleOffsetInterpolationProcessor.h" #include "D3Q27System.h" - +using namespace UbMath; CompressibleOffsetInterpolationProcessor::CompressibleOffsetInterpolationProcessor() : omegaC(0.0), omegaF(0.0) diff --git a/src/cpu/VirtualFluidsCore/LBM/CompressibleOffsetMomentsInterpolationProcessor.cpp b/src/cpu/VirtualFluidsCore/LBM/CompressibleOffsetMomentsInterpolationProcessor.cpp index d9d986851a9d9aa3dc4880d1ffdc2cca7e7f8aa7..a6823042e25bc635176d5105670a9884aee7a3f2 100644 --- a/src/cpu/VirtualFluidsCore/LBM/CompressibleOffsetMomentsInterpolationProcessor.cpp +++ b/src/cpu/VirtualFluidsCore/LBM/CompressibleOffsetMomentsInterpolationProcessor.cpp @@ -1,7 +1,7 @@ #include "CompressibleOffsetMomentsInterpolationProcessor.h" #include "D3Q27System.h" - +using namespace UbMath; CompressibleOffsetMomentsInterpolationProcessor::CompressibleOffsetMomentsInterpolationProcessor() : omegaC(0.0), omegaF(0.0) diff --git a/src/cpu/VirtualFluidsCore/LBM/CompressibleOffsetSquarePressureInterpolationProcessor.cpp b/src/cpu/VirtualFluidsCore/LBM/CompressibleOffsetSquarePressureInterpolationProcessor.cpp index 44be4234f4b1162dff221eebb1bb3e698b367f80..4f3822b2be713db219bc5d68cfb1578ad9652343 100644 --- a/src/cpu/VirtualFluidsCore/LBM/CompressibleOffsetSquarePressureInterpolationProcessor.cpp +++ b/src/cpu/VirtualFluidsCore/LBM/CompressibleOffsetSquarePressureInterpolationProcessor.cpp @@ -1,7 +1,7 @@ #include "CompressibleOffsetSquarePressureInterpolationProcessor.h" #include "D3Q27System.h" - +using namespace UbMath; CompressibleOffsetSquarePressureInterpolationProcessor::CompressibleOffsetSquarePressureInterpolationProcessor() : omegaC(0.0), omegaF(0.0) diff --git a/src/cpu/VirtualFluidsCore/LBM/D3Q27System.cpp b/src/cpu/VirtualFluidsCore/LBM/D3Q27System.cpp index c56164ab3835ec0489e477681689948552a495f0..07a4528b71eac350ee0b1ece54e3934ba28fae1f 100644 --- a/src/cpu/VirtualFluidsCore/LBM/D3Q27System.cpp +++ b/src/cpu/VirtualFluidsCore/LBM/D3Q27System.cpp @@ -1,6 +1,8 @@ #include "D3Q27System.h" namespace D3Q27System { + using namespace UbMath; + //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 }; diff --git a/src/cpu/VirtualFluidsCore/LBM/D3Q27System.h b/src/cpu/VirtualFluidsCore/LBM/D3Q27System.h index 6ae3bf70e177e317c21fc61166abfdbbc973e8d1..921ee65a8cbd23abe347a2878271a41b902466a6 100644 --- a/src/cpu/VirtualFluidsCore/LBM/D3Q27System.h +++ b/src/cpu/VirtualFluidsCore/LBM/D3Q27System.h @@ -1,3 +1,36 @@ +//======================================================================================= +// ____ ____ __ ______ __________ __ __ __ __ +// \ \ | | | | | _ \ |___ ___| | | | | / \ | | +// \ \ | | | | | |_) | | | | | | | / \ | | +// \ \ | | | | | _ / | | | | | | / /\ \ | | +// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ +// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| +// \ \ | | ________________________________________________________________ +// \ \ | | | ______________________________________________________________| +// \ \| | | | __ __ __ __ ______ _______ +// \ | | |_____ | | | | | | | | | _ \ / _____) +// \ | | _____| | | | | | | | | | | \ \ \_______ +// \ | | | | |_____ | \_/ | | | | |_/ / _____ | +// \ _____| |__| |________| \_______/ |__| |______/ (_______/ +// +// This file is part of VirtualFluids. VirtualFluids is free software: you can +// redistribute it and/or modify it under the terms of the GNU General Public +// License as published by the Free Software Foundation, either version 3 of +// the License, or (at your option) any later version. +// +// VirtualFluids is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. +// +//! \file D3Q27System.h +//! \ingroup LBM +//! \author Konstantin Kutscher, Sebastian Geller, Soeren Freudiger +//======================================================================================= + #ifndef D3Q27SYSTEM_H #define D3Q27SYSTEM_H @@ -5,135 +38,23 @@ #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 "UbException.h" +#include "UbMath.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 +//! \brief namespace for global system-functions 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 + static const int ENDDIR = 26; extern const int DX1[ENDDIR+1]; extern const int DX2[ENDDIR+1]; @@ -290,10 +211,10 @@ namespace D3Q27System +(f[T] + f[B]))+f[ZERO]; } /*=====================================================================*/ - //ACHTUNG: gilt nicht fuer alle modelle -> praedikat verwenden anstelle static! toDo + //ATTENTION: does not apply to all models -> use certificate instead of static! to do static LBMReal getPressure(const LBMReal* const& f/*[27]*/) { - return REAL_CAST( c1o3 )*getDensity(f); + return REAL_CAST( UbMath::c1o3 )*getDensity(f); } /*=====================================================================*/ static LBMReal getIncompVelocityX1(const LBMReal* const& f/*[27]*/) @@ -404,7 +325,7 @@ namespace D3Q27System D3Q27System::calcIncompVelocityX1(f, vx1); D3Q27System::calcIncompVelocityX2(f, vx2); D3Q27System::calcIncompVelocityX3(f, vx3); - LBMReal rho = drho+one; + LBMReal rho = drho+UbMath::c1; vx1/=rho; vx2/=rho; vx3/=rho; @@ -412,43 +333,11 @@ namespace D3Q27System ////////////////////////////////////////////////////////////////////////// static LBMReal getCompFeqForDirection(const int& direction, const LBMReal& drho,const LBMReal& vx1,const LBMReal& vx2,const LBMReal& vx3) { + using namespace UbMath; 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; + LBMReal rho = drho+c1; switch (direction) { case ZERO: return REAL_CAST(c8o27*(drho+rho*(-cu_sq))); @@ -485,40 +374,10 @@ namespace D3Q27System ////////////////////////////////////////////////////////////////////////// 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); - - ////////////////////////////////////////////////////////////////////////// + using namespace UbMath; LBMReal cu_sq = 1.5*(vx1*vx1+vx2*vx2+vx3*vx3); - LBMReal rho = drho+one; + LBMReal rho = drho+c1; feq[ZERO] = c8o27*(drho+rho*(-cu_sq)); feq[E] = c2o27*(drho+rho*(3.0*(vx1)+c9o2*(vx1)*(vx1)-cu_sq)); @@ -550,7 +409,9 @@ namespace D3Q27System } ////////////////////////////////////////////////////////////////////////// static LBMReal getIncompFeqForDirection(const int& direction,const LBMReal& drho, const LBMReal& vx1,const LBMReal& vx2,const LBMReal& vx3) - { + { + using namespace UbMath; + LBMReal cu_sq=1.5f*(vx1*vx1+vx2*vx2+vx3*vx3); switch(direction) @@ -588,6 +449,8 @@ namespace D3Q27System ////////////////////////////////////////////////////////////////////////// static void calcIncompFeq(LBMReal* const& feq/*[27]*/,const LBMReal& drho,const LBMReal& vx1,const LBMReal& vx2,const LBMReal& vx3) { + using namespace UbMath; + LBMReal cu_sq=1.5*(vx1*vx1+vx2*vx2+vx3*vx3); feq[ZERO] = c8o27*(drho-cu_sq); @@ -621,6 +484,8 @@ namespace D3Q27System ////////////////////////////////////////////////////////////////////////// static inline float getBoundaryVelocityForDirection(const int& direction, const float& bcVelocityX1,const float& bcVelocityX2,const float& bcVelocityX3) { + using namespace UbMath; + switch(direction) { case E: return (float)( UbMath::c4o9*(+bcVelocityX1) ); @@ -732,6 +597,8 @@ namespace D3Q27System ////////////////////////////////////////////////////////////////////////// static inline void initRayVectors(double* const& rayX1, double* const& rayX2, double* const& rayX3) { + using namespace UbMath; + int fdir; double c1oS2 = UbMath::one_over_sqrt2; double c1oS3 = UbMath::one_over_sqrt3; @@ -765,10 +632,10 @@ namespace D3Q27System ////////////////////////////////////////////////////////////////////////// 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; - + using namespace UbMath; + LBMReal OxxPyyPzz = c1; + return ((f[E]+f[W]+f[N]+f[S]+f[T]+f[B]+c2*(f[NE]+f[SW]+f[SE]+f[NW]+f[TE]+f[BW]+f[BE]+f[TW]+f[TN]+f[BS]+f[BN]+f[TS])+ + c3*(f[TNE]+f[TSW]+f[TSE]+f[TNW]+f[BNE]+f[BSW]+f[BSE]+f[BNW])-(vx1*vx1+vx2*vx2+vx3*vx3))*(c1-c1o2*OxxPyyPzz)+OxxPyyPzz*c1o2*(rho))*c1o3; } } diff --git a/src/cpu/VirtualFluidsCore/LBM/ILBMKernel.h b/src/cpu/VirtualFluidsCore/LBM/ILBMKernel.h index dcd47af5289beb1ba7a4ab7d3b13f9a5eb848e3b..89e68accd55e89dac0736075202250dd31c6aa14 100644 --- a/src/cpu/VirtualFluidsCore/LBM/ILBMKernel.h +++ b/src/cpu/VirtualFluidsCore/LBM/ILBMKernel.h @@ -1,12 +1,45 @@ +//======================================================================================= +// ____ ____ __ ______ __________ __ __ __ __ +// \ \ | | | | | _ \ |___ ___| | | | | / \ | | +// \ \ | | | | | |_) | | | | | | | / \ | | +// \ \ | | | | | _ / | | | | | | / /\ \ | | +// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ +// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| +// \ \ | | ________________________________________________________________ +// \ \ | | | ______________________________________________________________| +// \ \| | | | __ __ __ __ ______ _______ +// \ | | |_____ | | | | | | | | | _ \ / _____) +// \ | | _____| | | | | | | | | | | \ \ \_______ +// \ | | | | |_____ | \_/ | | | | |_/ / _____ | +// \ _____| |__| |________| \_______/ |__| |______/ (_______/ +// +// This file is part of VirtualFluids. VirtualFluids is free software: you can +// redistribute it and/or modify it under the terms of the GNU General Public +// License as published by the Free Software Foundation, either version 3 of +// the License, or (at your option) any later version. +// +// VirtualFluids is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. +// +//! \file ILBMKernel.h +//! \ingroup LBM +//! \author Konstantin Kutscher +//======================================================================================= + #ifndef I_LBMKERNEL_H #define I_LBMKERNEL_H #include <PointerDefinitions.h> - class BCProcessor; class DataSet3D; +//! Abstract class provides interface for LBM kernel class ILBMKernel { public: diff --git a/src/cpu/VirtualFluidsCore/LBM/IncompressibleCumulantLBMKernel.cpp b/src/cpu/VirtualFluidsCore/LBM/IncompressibleCumulantLBMKernel.cpp index a5e082a2c3372abd09cfc3187dc2445f233b971e..1620dc6563adc30561cff46ab447539af415d750 100644 --- a/src/cpu/VirtualFluidsCore/LBM/IncompressibleCumulantLBMKernel.cpp +++ b/src/cpu/VirtualFluidsCore/LBM/IncompressibleCumulantLBMKernel.cpp @@ -8,6 +8,8 @@ #define PROOF_CORRECTNESS +using namespace UbMath; + ////////////////////////////////////////////////////////////////////////// IncompressibleCumulantLBMKernel::IncompressibleCumulantLBMKernel() { diff --git a/src/cpu/VirtualFluidsCore/LBM/IncompressibleCumulantWithSpongeLayerLBMKernel.cpp b/src/cpu/VirtualFluidsCore/LBM/IncompressibleCumulantWithSpongeLayerLBMKernel.cpp index 7c8c2d94e17cd2b64ec24d21bfae91d93722f47a..c84776771f7eb6e7d14ce085cba6244f47269317 100644 --- a/src/cpu/VirtualFluidsCore/LBM/IncompressibleCumulantWithSpongeLayerLBMKernel.cpp +++ b/src/cpu/VirtualFluidsCore/LBM/IncompressibleCumulantWithSpongeLayerLBMKernel.cpp @@ -8,6 +8,8 @@ #define PROOF_CORRECTNESS +using namespace UbMath; + ////////////////////////////////////////////////////////////////////////// IncompressibleCumulantWithSpongeLayerLBMKernel::IncompressibleCumulantWithSpongeLayerLBMKernel() { @@ -306,7 +308,7 @@ void IncompressibleCumulantWithSpongeLayerLBMKernel::calculate(int step) //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); + //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) diff --git a/src/cpu/VirtualFluidsCore/LBM/InitDensityLBMKernel.cpp b/src/cpu/VirtualFluidsCore/LBM/InitDensityLBMKernel.cpp index 53b5335089fec79bbbd032caa2613fef6ec5a471..addba756e066ab1d5af3fed45f3526b0f0248103 100644 --- a/src/cpu/VirtualFluidsCore/LBM/InitDensityLBMKernel.cpp +++ b/src/cpu/VirtualFluidsCore/LBM/InitDensityLBMKernel.cpp @@ -4,6 +4,8 @@ #include "DataSet3D.h" #include "BCArray3D.h" +using namespace UbMath; + InitDensityLBMKernel::InitDensityLBMKernel() { this->compressible = false; diff --git a/src/cpu/VirtualFluidsCore/LBM/LBMKernel.cpp b/src/cpu/VirtualFluidsCore/LBM/LBMKernel.cpp index 256443790170d8431699d55e79c7c455a04cf396..7be2e79a54e42db046c70020196389b8065c51dd 100644 --- a/src/cpu/VirtualFluidsCore/LBM/LBMKernel.cpp +++ b/src/cpu/VirtualFluidsCore/LBM/LBMKernel.cpp @@ -1,3 +1,36 @@ +//======================================================================================= +// ____ ____ __ ______ __________ __ __ __ __ +// \ \ | | | | | _ \ |___ ___| | | | | / \ | | +// \ \ | | | | | |_) | | | | | | | / \ | | +// \ \ | | | | | _ / | | | | | | / /\ \ | | +// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ +// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| +// \ \ | | ________________________________________________________________ +// \ \ | | | ______________________________________________________________| +// \ \| | | | __ __ __ __ ______ _______ +// \ | | |_____ | | | | | | | | | _ \ / _____) +// \ | | _____| | | | | | | | | | | \ \ \_______ +// \ | | | | |_____ | \_/ | | | | |_/ / _____ | +// \ _____| |__| |________| \_______/ |__| |______/ (_______/ +// +// This file is part of VirtualFluids. VirtualFluids is free software: you can +// redistribute it and/or modify it under the terms of the GNU General Public +// License as published by the Free Software Foundation, either version 3 of +// the License, or (at your option) any later version. +// +// VirtualFluids is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. +// +//! \file LBMKernel.cpp +//! \ingroup LBM +//! \author Konstantin Kutscher +//======================================================================================= + #include "LBMKernel.h" #include "DataSet3D.h" #include "BCProcessor.h" diff --git a/src/cpu/VirtualFluidsCore/LBM/LBMKernel.h b/src/cpu/VirtualFluidsCore/LBM/LBMKernel.h index a4578a00a9f3dd9eead3457a3124eb1919aa043a..d07e5031b945b60d719acc749ff9717f3d116c77 100644 --- a/src/cpu/VirtualFluidsCore/LBM/LBMKernel.h +++ b/src/cpu/VirtualFluidsCore/LBM/LBMKernel.h @@ -1,3 +1,36 @@ +//======================================================================================= +// ____ ____ __ ______ __________ __ __ __ __ +// \ \ | | | | | _ \ |___ ___| | | | | / \ | | +// \ \ | | | | | |_) | | | | | | | / \ | | +// \ \ | | | | | _ / | | | | | | / /\ \ | | +// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ +// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| +// \ \ | | ________________________________________________________________ +// \ \ | | | ______________________________________________________________| +// \ \| | | | __ __ __ __ ______ _______ +// \ | | |_____ | | | | | | | | | _ \ / _____) +// \ | | _____| | | | | | | | | | | \ \ \_______ +// \ | | | | |_____ | \_/ | | | | |_/ / _____ | +// \ _____| |__| |________| \_______/ |__| |______/ (_______/ +// +// This file is part of VirtualFluids. VirtualFluids is free software: you can +// redistribute it and/or modify it under the terms of the GNU General Public +// License as published by the Free Software Foundation, either version 3 of +// the License, or (at your option) any later version. +// +// VirtualFluids is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. +// +//! \file LBMKernel.h +//! \ingroup LBM +//! \author Konstantin Kutscher +//======================================================================================= + #ifndef LBMKERNEL_H #define LBMKERNEL_H @@ -5,12 +38,14 @@ #include "LBMSystem.h" #include "ILBMKernel.h" #include <array> +#include <limits> #include <muParser.h> class BCProcessor; class DataSet3D; class Block3D; +//! \brief A base class provides basic functionality for LBM kernel class LBMKernel : public ILBMKernel, public enableSharedFromThis<LBMKernel> { public: @@ -70,7 +105,7 @@ public: bool isInsideOfDomain(const int &x1, const int &x2, const int &x3) const; - void swapDistributions(); + void swapDistributions() override; void setNX(std::array<int, 3> nx); std::array<int, 3> getNX(); diff --git a/src/cpu/VirtualFluidsCore/LBM/LBMKernelETD3Q27BGK.cpp b/src/cpu/VirtualFluidsCore/LBM/LBMKernelETD3Q27BGK.cpp index 55c370e83cce5a4b7c8472d7919259f59e079f3f..3560fd8336c36aae87c2bfa8acf92777089bf93c 100644 --- a/src/cpu/VirtualFluidsCore/LBM/LBMKernelETD3Q27BGK.cpp +++ b/src/cpu/VirtualFluidsCore/LBM/LBMKernelETD3Q27BGK.cpp @@ -8,6 +8,8 @@ //#define PROOF_CORRECTNESS +using namespace UbMath; + ////////////////////////////////////////////////////////////////////////// LBMKernelETD3Q27BGK::LBMKernelETD3Q27BGK() { diff --git a/src/cpu/VirtualFluidsCore/LBM/LBMSystem.cpp b/src/cpu/VirtualFluidsCore/LBM/LBMSystem.cpp index ccb9838072e9a5e30c6d78e127ade7b6e9c01f44..34a9d7818246eb239eb238972627607a05dcde2b 100644 --- a/src/cpu/VirtualFluidsCore/LBM/LBMSystem.cpp +++ b/src/cpu/VirtualFluidsCore/LBM/LBMSystem.cpp @@ -1,3 +1,36 @@ +//======================================================================================= +// ____ ____ __ ______ __________ __ __ __ __ +// \ \ | | | | | _ \ |___ ___| | | | | / \ | | +// \ \ | | | | | |_) | | | | | | | / \ | | +// \ \ | | | | | _ / | | | | | | / /\ \ | | +// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ +// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| +// \ \ | | ________________________________________________________________ +// \ \ | | | ______________________________________________________________| +// \ \| | | | __ __ __ __ ______ _______ +// \ | | |_____ | | | | | | | | | _ \ / _____) +// \ | | _____| | | | | | | | | | | \ \ \_______ +// \ | | | | |_____ | \_/ | | | | |_/ / _____ | +// \ _____| |__| |________| \_______/ |__| |______/ (_______/ +// +// This file is part of VirtualFluids. VirtualFluids is free software: you can +// redistribute it and/or modify it under the terms of the GNU General Public +// License as published by the Free Software Foundation, either version 3 of +// the License, or (at your option) any later version. +// +// VirtualFluids is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. +// +//! \file LBMSystem.cpp +//! \ingroup LBM +//! \author Sebastian Geller +//======================================================================================= + #include "LBMSystem.h" namespace LBMSystem diff --git a/src/cpu/VirtualFluidsCore/LBM/LBMSystem.h b/src/cpu/VirtualFluidsCore/LBM/LBMSystem.h index 6aae5304069901d9910f5338509c050586d0531a..84037637fa11eed0e84a266f84d1e996abb501e0 100644 --- a/src/cpu/VirtualFluidsCore/LBM/LBMSystem.h +++ b/src/cpu/VirtualFluidsCore/LBM/LBMSystem.h @@ -1,3 +1,35 @@ +//======================================================================================= +// ____ ____ __ ______ __________ __ __ __ __ +// \ \ | | | | | _ \ |___ ___| | | | | / \ | | +// \ \ | | | | | |_) | | | | | | | / \ | | +// \ \ | | | | | _ / | | | | | | / /\ \ | | +// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ +// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| +// \ \ | | ________________________________________________________________ +// \ \ | | | ______________________________________________________________| +// \ \| | | | __ __ __ __ ______ _______ +// \ | | |_____ | | | | | | | | | _ \ / _____) +// \ | | _____| | | | | | | | | | | \ \ \_______ +// \ | | | | |_____ | \_/ | | | | |_/ / _____ | +// \ _____| |__| |________| \_______/ |__| |______/ (_______/ +// +// This file is part of VirtualFluids. VirtualFluids is free software: you can +// redistribute it and/or modify it under the terms of the GNU General Public +// License as published by the Free Software Foundation, either version 3 of +// the License, or (at your option) any later version. +// +// VirtualFluids is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. +// +//! \file LBMSystem.h +//! \ingroup LBM +//! \author Sebastian Geller +//======================================================================================= #ifndef LBMSYSTEM_H #define LBMSYSTEM_H @@ -5,38 +37,11 @@ #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: ... -*/ +//! \brief namespace for global system-functions namespace LBMSystem { -#ifndef SWIG - using namespace UbMath; -#endif //#define SINGLEPRECISION @@ -71,12 +76,12 @@ namespace LBMSystem return REAL_CAST(1.0/(3.0*viscosity/(1.0/REAL_CAST(1<<level))+0.5)); } - //bulk viscosity + //!bulk viscosity static real calcOmega2(real viscosity, int level) { return REAL_CAST(1.0/(4.5*viscosity/(1.0/REAL_CAST(1<<level))+0.5)); } - + //!bulk viscosity static real calcOmega2(real viscosity, real deltaT) { return REAL_CAST(1.0/(4.5*viscosity/deltaT+0.5)); @@ -86,9 +91,5 @@ namespace LBMSystem //some typedefs for global namespace typedef LBMSystem::real LBMReal; -//#define LBMSystem::real LBMReal - - - #endif diff --git a/src/cpu/VirtualFluidsCore/Parallel/Communicator.cpp b/src/cpu/VirtualFluidsCore/Parallel/Communicator.cpp index 72f8bc07690e55b68f1422f792dd7248cc0e65cf..34146b347e1fc86aed905b134896b05421ba2b41 100644 --- a/src/cpu/VirtualFluidsCore/Parallel/Communicator.cpp +++ b/src/cpu/VirtualFluidsCore/Parallel/Communicator.cpp @@ -1,3 +1,36 @@ +//======================================================================================= +// ____ ____ __ ______ __________ __ __ __ __ +// \ \ | | | | | _ \ |___ ___| | | | | / \ | | +// \ \ | | | | | |_) | | | | | | | / \ | | +// \ \ | | | | | _ / | | | | | | / /\ \ | | +// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ +// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| +// \ \ | | ________________________________________________________________ +// \ \ | | | ______________________________________________________________| +// \ \| | | | __ __ __ __ ______ _______ +// \ | | |_____ | | | | | | | | | _ \ / _____) +// \ | | _____| | | | | | | | | | | \ \ \_______ +// \ | | | | |_____ | \_/ | | | | |_/ / _____ | +// \ _____| |__| |________| \_______/ |__| |______/ (_______/ +// +// This file is part of VirtualFluids. VirtualFluids is free software: you can +// redistribute it and/or modify it under the terms of the GNU General Public +// License as published by the Free Software Foundation, either version 3 of +// the License, or (at your option) any later version. +// +// VirtualFluids is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. +// +//! \file Communicator.cpp +//! \ingroup Parallel +//! \author Konstantin Kutscher +//======================================================================================= + #include "Communicator.h" #include <basics/utilities/UbException.h> diff --git a/src/cpu/VirtualFluidsCore/Parallel/Communicator.h b/src/cpu/VirtualFluidsCore/Parallel/Communicator.h index d75ae2241084ea4588fe89c735f277ce99e1d81c..347b211f7864409f21a67fbf8bdd4ccd23739e6c 100644 --- a/src/cpu/VirtualFluidsCore/Parallel/Communicator.h +++ b/src/cpu/VirtualFluidsCore/Parallel/Communicator.h @@ -1,3 +1,36 @@ +//======================================================================================= +// ____ ____ __ ______ __________ __ __ __ __ +// \ \ | | | | | _ \ |___ ___| | | | | / \ | | +// \ \ | | | | | |_) | | | | | | | / \ | | +// \ \ | | | | | _ / | | | | | | / /\ \ | | +// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ +// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| +// \ \ | | ________________________________________________________________ +// \ \ | | | ______________________________________________________________| +// \ \| | | | __ __ __ __ ______ _______ +// \ | | |_____ | | | | | | | | | _ \ / _____) +// \ | | _____| | | | | | | | | | | \ \ \_______ +// \ | | | | |_____ | \_/ | | | | |_/ / _____ | +// \ _____| |__| |________| \_______/ |__| |______/ (_______/ +// +// This file is part of VirtualFluids. VirtualFluids is free software: you can +// redistribute it and/or modify it under the terms of the GNU General Public +// License as published by the Free Software Foundation, either version 3 of +// the License, or (at your option) any later version. +// +// VirtualFluids is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. +// +//! \file Communicator.h +//! \ingroup Parallel +//! \author Konstantin Kutscher +//======================================================================================= + #ifndef COMMUNICATOR_H #define COMMUNICATOR_H @@ -6,6 +39,7 @@ #include <PointerDefinitions.h> +//! \brief An abstract class for communication between processes in parallel computation class Communicator { public: diff --git a/src/cpu/VirtualFluidsCore/Parallel/NullCommunicator.cpp b/src/cpu/VirtualFluidsCore/Parallel/NullCommunicator.cpp index 527dc8753bf57c7ddfb4039c61b66aab96a75889..e21bddc45a4bf97b7f00a574498538b216cf40c2 100644 --- a/src/cpu/VirtualFluidsCore/Parallel/NullCommunicator.cpp +++ b/src/cpu/VirtualFluidsCore/Parallel/NullCommunicator.cpp @@ -1,5 +1,39 @@ +//======================================================================================= +// ____ ____ __ ______ __________ __ __ __ __ +// \ \ | | | | | _ \ |___ ___| | | | | / \ | | +// \ \ | | | | | |_) | | | | | | | / \ | | +// \ \ | | | | | _ / | | | | | | / /\ \ | | +// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ +// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| +// \ \ | | ________________________________________________________________ +// \ \ | | | ______________________________________________________________| +// \ \| | | | __ __ __ __ ______ _______ +// \ | | |_____ | | | | | | | | | _ \ / _____) +// \ | | _____| | | | | | | | | | | \ \ \_______ +// \ | | | | |_____ | \_/ | | | | |_/ / _____ | +// \ _____| |__| |________| \_______/ |__| |______/ (_______/ +// +// This file is part of VirtualFluids. VirtualFluids is free software: you can +// redistribute it and/or modify it under the terms of the GNU General Public +// License as published by the Free Software Foundation, either version 3 of +// the License, or (at your option) any later version. +// +// VirtualFluids is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. +// +//! \file NullCommunicator.cpp +//! \ingroup Parallel +//! \author Konstantin Kutscher +//======================================================================================= + #include "NullCommunicator.h" + NullCommunicator::NullCommunicator() { } diff --git a/src/cpu/VirtualFluidsCore/Parallel/NullCommunicator.h b/src/cpu/VirtualFluidsCore/Parallel/NullCommunicator.h index ada19144d3fa6f0779f0d0cb575b7ff9080368fd..bea39e6036f592f52ee04fc246c233de5aefafae 100644 --- a/src/cpu/VirtualFluidsCore/Parallel/NullCommunicator.h +++ b/src/cpu/VirtualFluidsCore/Parallel/NullCommunicator.h @@ -1,3 +1,36 @@ +//======================================================================================= +// ____ ____ __ ______ __________ __ __ __ __ +// \ \ | | | | | _ \ |___ ___| | | | | / \ | | +// \ \ | | | | | |_) | | | | | | | / \ | | +// \ \ | | | | | _ / | | | | | | / /\ \ | | +// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ +// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| +// \ \ | | ________________________________________________________________ +// \ \ | | | ______________________________________________________________| +// \ \| | | | __ __ __ __ ______ _______ +// \ | | |_____ | | | | | | | | | _ \ / _____) +// \ | | _____| | | | | | | | | | | \ \ \_______ +// \ | | | | |_____ | \_/ | | | | |_/ / _____ | +// \ _____| |__| |________| \_______/ |__| |______/ (_______/ +// +// This file is part of VirtualFluids. VirtualFluids is free software: you can +// redistribute it and/or modify it under the terms of the GNU General Public +// License as published by the Free Software Foundation, either version 3 of +// the License, or (at your option) any later version. +// +// VirtualFluids is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. +// +//! \file NullCommunicator.h +//! \ingroup Parallel +//! \author Konstantin Kutscher +//======================================================================================= + #ifndef NullCommunicator_H #define NullCommunicator_H @@ -5,6 +38,8 @@ #include <PointerDefinitions.h> +//! \brief A class implements Communicator for shared memory. +//! \details NullCommunicator is only a place-holder. It is only one process in shared memory. class NullCommunicator : public Communicator { public: diff --git a/src/cpu/VirtualFluidsCore/Utilities/MemoryUtil.h b/src/cpu/VirtualFluidsCore/Utilities/MemoryUtil.h index b1dd85885f30a4ed3dd61c835e7732d779633b0f..1102acac0d6c0fc761204ebb5e2463d00299e145 100644 --- a/src/cpu/VirtualFluidsCore/Utilities/MemoryUtil.h +++ b/src/cpu/VirtualFluidsCore/Utilities/MemoryUtil.h @@ -1,3 +1,36 @@ +//======================================================================================= +// ____ ____ __ ______ __________ __ __ __ __ +// \ \ | | | | | _ \ |___ ___| | | | | / \ | | +// \ \ | | | | | |_) | | | | | | | / \ | | +// \ \ | | | | | _ / | | | | | | / /\ \ | | +// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ +// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| +// \ \ | | ________________________________________________________________ +// \ \ | | | ______________________________________________________________| +// \ \| | | | __ __ __ __ ______ _______ +// \ | | |_____ | | | | | | | | | _ \ / _____) +// \ | | _____| | | | | | | | | | | \ \ \_______ +// \ | | | | |_____ | \_/ | | | | |_/ / _____ | +// \ _____| |__| |________| \_______/ |__| |______/ (_______/ +// +// This file is part of VirtualFluids. VirtualFluids is free software: you can +// redistribute it and/or modify it under the terms of the GNU General Public +// License as published by the Free Software Foundation, either version 3 of +// the License, or (at your option) any later version. +// +// VirtualFluids is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. +// +//! \file MemoryUtil.h +//! \ingroup Utilities +//! \author Konstantin Kutscher +//======================================================================================= + #ifndef _MEMORYUTIL_H_ #define _MEMORYUTIL_H_ @@ -13,7 +46,7 @@ #include "stdlib.h" #include "stdio.h" #include "string.h" -#elif (defined(__amd64) || defined(__amd64__) || defined(__unix__) || defined(__CYGWIN__)) && !defined(__AIX__) +#elif (defined(__amd64) || defined(__amd64__) || defined(__unix__) || defined(__CYGWIN__)) && !defined(__AIX__) #define MEMORYUTIL_LINUX #include "sys/types.h" #include "sys/sysinfo.h" @@ -23,6 +56,10 @@ #else #error "MemoryUtil::UnknownMachine" #endif + +#if defined(__CYGWIN__) + #define MEMORYUTIL_CYGWIN +#endif ////////////////////////////////////////////////////////////////////////// //MemoryUtil ////////////////////////////////////////////////////////////////////////// @@ -31,7 +68,7 @@ namespace Utilities ////////////////////////////////////////////////////////////////////////// static long long getTotalPhysMem() { - #if defined MEMORYUTIL_WINDOWS + #if defined(MEMORYUTIL_WINDOWS) MEMORYSTATUSEX memInfo; memInfo.dwLength = sizeof(MEMORYSTATUSEX); GlobalMemoryStatusEx(&memInfo); @@ -50,7 +87,7 @@ namespace Utilities if(sysctl(mib, 2, &totalPhysMem, &length, nullptr, 0) == -1) return 0; #else - #error "MemoryUtil::getTotalPhysMem - UnknownMachine" + #error "MemoryUtil::getTotalPhysMem - UnknownMachine" #endif return (long long)totalPhysMem; @@ -58,7 +95,7 @@ namespace Utilities ////////////////////////////////////////////////////////////////////////// static long long getPhysMemUsed() { - #if defined MEMORYUTIL_WINDOWS + #if defined(MEMORYUTIL_WINDOWS) MEMORYSTATUSEX memInfo; memInfo.dwLength = sizeof(MEMORYSTATUSEX); GlobalMemoryStatusEx(&memInfo); @@ -69,16 +106,16 @@ namespace Utilities 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) + #elif defined(MEMORYUTIL_APPLE) long long physMemUsed = 0; #else - #error "MemoryUtil::getPhysMemUsed - UnknownMachine" + #error "MemoryUtil::getPhysMemUsed - UnknownMachine" #endif return (long long)physMemUsed; } ////////////////////////////////////////////////////////////////////////// -#if defined(MEMORYUTIL_LINUX) || defined(MEMORYUTIL_APPLE) +#if defined(MEMORYUTIL_LINUX) || defined(MEMORYUTIL_APPLE) || defined(MEMORYUTIL_CYGWIN) static int parseLine(char* line){ int i = strlen(line); while (*line < '0' || *line > '9') line++; @@ -106,11 +143,11 @@ namespace Utilities ////////////////////////////////////////////////////////////////////////// static long long getPhysMemUsedByMe() { - #if defined MEMORYUTIL_WINDOWS + #if defined(MEMORYUTIL_WINDOWS) && !defined(__CYGWIN__) PROCESS_MEMORY_COUNTERS pmc; GetProcessMemoryInfo(GetCurrentProcess(), &pmc, sizeof(pmc)); SIZE_T physMemUsedByMe = pmc.WorkingSetSize; - #elif defined(MEMORYUTIL_LINUX) || defined(MEMORYUTIL_APPLE) + #elif defined(MEMORYUTIL_LINUX) || defined(MEMORYUTIL_APPLE) || defined(MEMORYUTIL_CYGWIN) long long physMemUsedByMe = (long long)getValue() * (long long)1024; #else #error "MemoryUtil::getPhysMemUsedByMe - UnknownMachine"