reduction in boundary class size

This commit is contained in:
HRN 2025-02-01 23:33:19 +03:30
parent 3b88b6156d
commit 0f9a19d6ee
6 changed files with 34 additions and 45 deletions

View File

@ -24,7 +24,6 @@ Licence:
#include "cGAbsoluteLinearCF.hpp" #include "cGAbsoluteLinearCF.hpp"
#include "cGRelativeLinearCF.hpp" #include "cGRelativeLinearCF.hpp"
#include "cGNonLinearCF.hpp" #include "cGNonLinearCF.hpp"
#include "cGNonLinearCF2.hpp"
#include "grainRolling.hpp" #include "grainRolling.hpp"
@ -43,8 +42,6 @@ using nonLimitedCGRelativeLinearGrainRolling = grainRolling<cGRelativeLinear<fal
using limitedCGNonLinearGrainRolling = grainRolling<cGNonLinear<true>>; using limitedCGNonLinearGrainRolling = grainRolling<cGNonLinear<true>>;
using nonLimitedCGNonLinearGrainRolling = grainRolling<cGNonLinear<false>>; using nonLimitedCGNonLinearGrainRolling = grainRolling<cGNonLinear<false>>;
using limitedCGNonLinear2GrainRolling = grainRolling<cGNonLinear2<true>>;
using nonLimitedCGNonLinear2GrainRolling = grainRolling<cGNonLinear2<false>>;
} }

View File

@ -27,6 +27,10 @@ Licence:
#include "pointStructure.hpp" #include "pointStructure.hpp"
#include "boundaryBaseKernels.hpp" #include "boundaryBaseKernels.hpp"
std::array<pFlow::word,6> pFlow::boundaryBase::types_={"none","none","none","none","none","none"};
std::array<pFlow::real, 6> pFlow::boundaryBase::neighborLengths_={0.01,0.01,0.01,0.01,0.01,0.01};
std::array<pFlow::real, 6> pFlow::boundaryBase::boundaryExtntionLengthRatios_ = {0.1,0.1,0.1,0.1,0.1,0.1};
void pFlow::boundaryBase::setSize(uint32 newSize) void pFlow::boundaryBase::setSize(uint32 newSize)
{ {
indexList_.resize(newSize); indexList_.resize(newSize);
@ -232,14 +236,16 @@ pFlow::boundaryBase::boundaryBase(
boundaryPlane_(bplane), boundaryPlane_(bplane),
indexList_(groupNames("indexList", dict.name())), indexList_(groupNames("indexList", dict.name())),
indexListHost_(groupNames("hostIndexList", dict.name())), indexListHost_(groupNames("hostIndexList", dict.name())),
neighborLength_(dict.getVal<real>("neighborLength")),
boundaryExtntionLengthRatio_(dict.getVal<real>("boundaryExtntionLengthRatio")),
internal_(internal), internal_(internal),
boundaries_(bndrs), boundaries_(bndrs),
thisBoundaryIndex_(thisIndex), thisBoundaryIndex_(thisIndex),
neighborProcessorNo_(dict.getVal<int32>("neighborProcessorNo")), neighborProcessorNo_(dict.getVal<int32>("neighborProcessorNo"))
type_(makeUnique<word>(dict.getVal<word>("type")))
{ {
types_[thisBoundaryIndex_] = dict.getVal<word>("type");
neighborLengths_[thisBoundaryIndex_] = dict.getValMax<real>("neighborLength",0.0);
boundaryExtntionLengthRatios_[thisBoundaryIndex_] = dict.getValMax<real>("boundaryExtntionLengthRatio",0.1);
isBoundaryMaster_ = thisProcessorNo() >= neighborProcessorNo(); isBoundaryMaster_ = thisProcessorNo() >= neighborProcessorNo();

View File

@ -69,9 +69,6 @@ private:
/// list of particles indieces on host /// list of particles indieces on host
mutable uint32Vector_H indexListHost_; mutable uint32Vector_H indexListHost_;
/// The length defined for creating neighbor list
real neighborLength_;
/// device and host list are sync /// device and host list are sync
mutable bool listsSync_ = false; mutable bool listsSync_ = false;
@ -81,9 +78,6 @@ private:
bool isBoundaryMaster_; bool isBoundaryMaster_;
/// the extra boundary extension beyound actual limits of boundary
real boundaryExtntionLengthRatio_;
/// a reference to internal points /// a reference to internal points
internalPoints& internal_; internalPoints& internal_;
@ -95,10 +89,21 @@ private:
int neighborProcessorNo_; int neighborProcessorNo_;
uniquePtr<word> type_; /// The length defined for creating neighbor list
static std::array<real, 6> neighborLengths_;
static std::array<word, 6> types_;
protected: protected:
/// the extra boundary extension beyound actual limits of the physical domain
static std::array<real, 6> boundaryExtntionLengthRatios_;
real boundaryExtntionLengthRatio()const
{
return boundaryExtntionLengthRatios_[thisBoundaryIndex_];
}
/// @brief Set the size of indexList. /// @brief Set the size of indexList.
/// It is virtual to let derived classed to be aware of /// It is virtual to let derived classed to be aware of
/// the fact that the size of boundary points has been changed. /// the fact that the size of boundary points has been changed.
@ -212,11 +217,11 @@ public:
/// The length from boundary plane into the domain /// The length from boundary plane into the domain
/// where beyond that distance internal points exist. /// 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 inline
real neighborLengthIntoInternal()const real neighborLengthIntoInternal()const
{ {
return neighborLength_; return neighborLengths_[thisBoundaryIndex_];
} }
/// The distance length from boundary plane /// The distance length from boundary plane
@ -224,10 +229,9 @@ public:
/// This length may be modified in each boundary type /// This length may be modified in each boundary type
/// as required. In this case the boundaryExtensionLength /// as required. In this case the boundaryExtensionLength
/// method should also be modified accordingly. /// method should also be modified accordingly.
virtual
real neighborLength()const real neighborLength()const
{ {
return (1+boundaryExtntionLengthRatio_)*neighborLength_; return (1+boundaryExtntionLengthRatio())*neighborLengthIntoInternal();
} }
/// The extention length (in vector form) for the boundary /// The extention length (in vector form) for the boundary
@ -235,10 +239,9 @@ public:
/// each boundary type to be extended outward to allow /// each boundary type to be extended outward to allow
/// particles to stay more in its list before being removed /// particles to stay more in its list before being removed
/// from its list. /// from its list.
virtual
realx3 boundaryExtensionLength()const realx3 boundaryExtensionLength()const
{ {
return -boundaryExtntionLengthRatio_*neighborLength_ * boundaryPlane_.normal(); return -boundaryExtntionLengthRatio()*neighborLengthIntoInternal() * boundaryPlane_.normal();
} }
/// Is this iter the right time for updating bounday list /// Is this iter the right time for updating bounday list
@ -257,7 +260,7 @@ public:
inline inline
const word& type()const const word& type()const
{ {
return type_(); return types_[thisBoundaryIndex_];
} }
inline inline

View File

@ -33,23 +33,11 @@ pFlow::boundaryPeriodic::boundaryPeriodic
) )
: :
boundaryBase(dict, bplane, internal, bndrs, thisIndex), boundaryBase(dict, bplane, internal, bndrs, thisIndex),
mirrorBoundaryIndex_(dict.getVal<uint32>("mirrorBoundaryIndex")), mirrorBoundaryIndex_(dict.getVal<uint32>("mirrorBoundaryIndex"))
extensionLength_(dict.getVal<real>("boundaryExtntionLengthRatio"))
{ {
extensionLength_ = max(extensionLength_, static_cast<real>(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( bool pFlow::boundaryPeriodic::beforeIteration(
uint32 step, uint32 step,
const timeInfo& ti, const timeInfo& ti,

View File

@ -35,8 +35,6 @@ private:
uint32 mirrorBoundaryIndex_; uint32 mirrorBoundaryIndex_;
real extensionLength_ = 0.1;
public: public:
TypeInfo("boundary<periodic>"); TypeInfo("boundary<periodic>");
@ -58,9 +56,6 @@ public:
dictionary dictionary
); );
real neighborLength()const override;
realx3 boundaryExtensionLength()const override;
bool beforeIteration( bool beforeIteration(
uint32 step, uint32 step,

View File

@ -32,11 +32,11 @@ class boundaryReflective
{ {
private: 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: public: