From 0f9a19d6ee9447ae0aeea730f8af5ef21b44b30c Mon Sep 17 00:00:00 2001 From: HRN Date: Sat, 1 Feb 2025 23:33:19 +0330 Subject: [PATCH] reduction in boundary class size --- .../Models/grainContactForceModels.hpp | 3 -- .../boundaries/boundaryBase/boundaryBase.cpp | 14 +++++--- .../boundaries/boundaryBase/boundaryBase.hpp | 35 ++++++++++--------- .../boundaryPeriodic/boundaryPeriodic.cpp | 16 ++------- .../boundaryPeriodic/boundaryPeriodic.hpp | 5 --- .../boundaryReflective/boundaryReflective.hpp | 6 ++-- 6 files changed, 34 insertions(+), 45 deletions(-) diff --git a/src/Interaction/Models/grainContactForceModels.hpp b/src/Interaction/Models/grainContactForceModels.hpp index 50f8f05e..b6248238 100755 --- a/src/Interaction/Models/grainContactForceModels.hpp +++ b/src/Interaction/Models/grainContactForceModels.hpp @@ -24,7 +24,6 @@ Licence: #include "cGAbsoluteLinearCF.hpp" #include "cGRelativeLinearCF.hpp" #include "cGNonLinearCF.hpp" -#include "cGNonLinearCF2.hpp" #include "grainRolling.hpp" @@ -43,8 +42,6 @@ using nonLimitedCGRelativeLinearGrainRolling = grainRolling>; using nonLimitedCGNonLinearGrainRolling = grainRolling>; -using limitedCGNonLinear2GrainRolling = grainRolling>; -using nonLimitedCGNonLinear2GrainRolling = grainRolling>; } diff --git a/src/phasicFlow/structuredData/boundaries/boundaryBase/boundaryBase.cpp b/src/phasicFlow/structuredData/boundaries/boundaryBase/boundaryBase.cpp index 6192eeb5..14ed5c5b 100644 --- a/src/phasicFlow/structuredData/boundaries/boundaryBase/boundaryBase.cpp +++ b/src/phasicFlow/structuredData/boundaries/boundaryBase/boundaryBase.cpp @@ -27,6 +27,10 @@ Licence: #include "pointStructure.hpp" #include "boundaryBaseKernels.hpp" +std::array pFlow::boundaryBase::types_={"none","none","none","none","none","none"}; +std::array pFlow::boundaryBase::neighborLengths_={0.01,0.01,0.01,0.01,0.01,0.01}; +std::array pFlow::boundaryBase::boundaryExtntionLengthRatios_ = {0.1,0.1,0.1,0.1,0.1,0.1}; + void pFlow::boundaryBase::setSize(uint32 newSize) { indexList_.resize(newSize); @@ -232,14 +236,16 @@ pFlow::boundaryBase::boundaryBase( boundaryPlane_(bplane), indexList_(groupNames("indexList", dict.name())), indexListHost_(groupNames("hostIndexList", dict.name())), - neighborLength_(dict.getVal("neighborLength")), - boundaryExtntionLengthRatio_(dict.getVal("boundaryExtntionLengthRatio")), internal_(internal), boundaries_(bndrs), thisBoundaryIndex_(thisIndex), - neighborProcessorNo_(dict.getVal("neighborProcessorNo")), - type_(makeUnique(dict.getVal("type"))) + neighborProcessorNo_(dict.getVal("neighborProcessorNo")) { + types_[thisBoundaryIndex_] = dict.getVal("type"); + + neighborLengths_[thisBoundaryIndex_] = dict.getValMax("neighborLength",0.0); + + boundaryExtntionLengthRatios_[thisBoundaryIndex_] = dict.getValMax("boundaryExtntionLengthRatio",0.1); isBoundaryMaster_ = thisProcessorNo() >= neighborProcessorNo(); diff --git a/src/phasicFlow/structuredData/boundaries/boundaryBase/boundaryBase.hpp b/src/phasicFlow/structuredData/boundaries/boundaryBase/boundaryBase.hpp index 2f363d10..4684d0b0 100644 --- a/src/phasicFlow/structuredData/boundaries/boundaryBase/boundaryBase.hpp +++ b/src/phasicFlow/structuredData/boundaries/boundaryBase/boundaryBase.hpp @@ -69,9 +69,6 @@ private: /// list of particles indieces on host mutable uint32Vector_H indexListHost_; - /// The length defined for creating neighbor list - real neighborLength_; - /// device and host list are sync mutable bool listsSync_ = false; @@ -81,9 +78,6 @@ private: bool isBoundaryMaster_; - /// the extra boundary extension beyound actual limits of boundary - real boundaryExtntionLengthRatio_; - /// a reference to internal points internalPoints& internal_; @@ -95,10 +89,21 @@ private: int neighborProcessorNo_; - uniquePtr type_; + /// The length defined for creating neighbor list + static std::array neighborLengths_; + + static std::array types_; protected: + /// the extra boundary extension beyound actual limits of the physical domain + static std::array boundaryExtntionLengthRatios_; + + real boundaryExtntionLengthRatio()const + { + return boundaryExtntionLengthRatios_[thisBoundaryIndex_]; + } + /// @brief Set the size of indexList. /// It is virtual to let derived classed to be aware of /// the fact that the size of boundary points has been changed. @@ -212,33 +217,31 @@ public: /// The length from boundary plane into the domain /// where beyond that distance internal points exist. - /// By conventions is it always equal to neighborLength_ + /// By conventions is it always equal to neighborLengths_[i] inline real neighborLengthIntoInternal()const { - return neighborLength_; + return neighborLengths_[thisBoundaryIndex_]; } /// The distance length from boundary plane /// where neighbor particles still exist in that distance. /// This length may be modified in each boundary type /// as required. In this case the boundaryExtensionLength - /// method should also be modified accordingly. - virtual + /// method should also be modified accordingly. real neighborLength()const { - return (1+boundaryExtntionLengthRatio_)*neighborLength_; + return (1+boundaryExtntionLengthRatio())*neighborLengthIntoInternal(); } /// The extention length (in vector form) for the boundary /// as required by each boundary type. It is allowed for /// each boundary type to be extended outward to allow /// particles to stay more in its list before being removed - /// from its list. - virtual + /// from its list. realx3 boundaryExtensionLength()const { - return -boundaryExtntionLengthRatio_*neighborLength_ * boundaryPlane_.normal(); + return -boundaryExtntionLengthRatio()*neighborLengthIntoInternal() * boundaryPlane_.normal(); } /// Is this iter the right time for updating bounday list @@ -257,7 +260,7 @@ public: inline const word& type()const { - return type_(); + return types_[thisBoundaryIndex_]; } inline diff --git a/src/phasicFlow/structuredData/boundaries/boundaryPeriodic/boundaryPeriodic.cpp b/src/phasicFlow/structuredData/boundaries/boundaryPeriodic/boundaryPeriodic.cpp index 0abf337d..f7a29898 100644 --- a/src/phasicFlow/structuredData/boundaries/boundaryPeriodic/boundaryPeriodic.cpp +++ b/src/phasicFlow/structuredData/boundaries/boundaryPeriodic/boundaryPeriodic.cpp @@ -33,23 +33,11 @@ pFlow::boundaryPeriodic::boundaryPeriodic ) : boundaryBase(dict, bplane, internal, bndrs, thisIndex), - mirrorBoundaryIndex_(dict.getVal("mirrorBoundaryIndex")), - extensionLength_(dict.getVal("boundaryExtntionLengthRatio")) + mirrorBoundaryIndex_(dict.getVal("mirrorBoundaryIndex")) { - extensionLength_ = max(extensionLength_, static_cast(0.1)); + } -pFlow::real pFlow::boundaryPeriodic::neighborLength() const -{ - return (1+extensionLength_)*neighborLengthIntoInternal(); -} - -pFlow::realx3 pFlow::boundaryPeriodic::boundaryExtensionLength() const -{ - return -extensionLength_*neighborLengthIntoInternal()*boundaryBase::boundaryPlane().normal(); -} - - bool pFlow::boundaryPeriodic::beforeIteration( uint32 step, const timeInfo& ti, diff --git a/src/phasicFlow/structuredData/boundaries/boundaryPeriodic/boundaryPeriodic.hpp b/src/phasicFlow/structuredData/boundaries/boundaryPeriodic/boundaryPeriodic.hpp index 87f86033..9ea8492f 100644 --- a/src/phasicFlow/structuredData/boundaries/boundaryPeriodic/boundaryPeriodic.hpp +++ b/src/phasicFlow/structuredData/boundaries/boundaryPeriodic/boundaryPeriodic.hpp @@ -35,8 +35,6 @@ private: uint32 mirrorBoundaryIndex_; - real extensionLength_ = 0.1; - public: TypeInfo("boundary"); @@ -58,9 +56,6 @@ public: dictionary ); - real neighborLength()const override; - - realx3 boundaryExtensionLength()const override; bool beforeIteration( uint32 step, diff --git a/src/phasicFlow/structuredData/boundaries/boundaryReflective/boundaryReflective.hpp b/src/phasicFlow/structuredData/boundaries/boundaryReflective/boundaryReflective.hpp index 161b2004..e864873c 100644 --- a/src/phasicFlow/structuredData/boundaries/boundaryReflective/boundaryReflective.hpp +++ b/src/phasicFlow/structuredData/boundaries/boundaryReflective/boundaryReflective.hpp @@ -32,11 +32,11 @@ class boundaryReflective { private: - real restitution_ = 0.95; + real restitution_ = 0.95; - word velocityName_{"velocity"}; + inline static word velocityName_{"velocity"}; - word diameterName_{"diameter"}; + inline static word diameterName_{"diameter"}; public: