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 "cGRelativeLinearCF.hpp"
#include "cGNonLinearCF.hpp"
#include "cGNonLinearCF2.hpp"
#include "grainRolling.hpp"
@ -43,8 +42,6 @@ using nonLimitedCGRelativeLinearGrainRolling = grainRolling<cGRelativeLinear<fal
using limitedCGNonLinearGrainRolling = grainRolling<cGNonLinear<true>>;
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 "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)
{
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<real>("neighborLength")),
boundaryExtntionLengthRatio_(dict.getVal<real>("boundaryExtntionLengthRatio")),
internal_(internal),
boundaries_(bndrs),
thisBoundaryIndex_(thisIndex),
neighborProcessorNo_(dict.getVal<int32>("neighborProcessorNo")),
type_(makeUnique<word>(dict.getVal<word>("type")))
neighborProcessorNo_(dict.getVal<int32>("neighborProcessorNo"))
{
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();

View File

@ -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<word> type_;
/// The length defined for creating neighbor list
static std::array<real, 6> neighborLengths_;
static std::array<word, 6> types_;
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.
/// It is virtual to let derived classed to be aware of
/// the fact that the size of boundary points has been changed.
@ -212,11 +217,11 @@ 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
@ -224,10 +229,9 @@ public:
/// This length may be modified in each boundary type
/// as required. In this case the boundaryExtensionLength
/// method should also be modified accordingly.
virtual
real neighborLength()const
{
return (1+boundaryExtntionLengthRatio_)*neighborLength_;
return (1+boundaryExtntionLengthRatio())*neighborLengthIntoInternal();
}
/// The extention length (in vector form) for the boundary
@ -235,10 +239,9 @@ public:
/// each boundary type to be extended outward to allow
/// particles to stay more in its list before being removed
/// from its list.
virtual
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

View File

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

View File

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

View File

@ -34,9 +34,9 @@ private:
real restitution_ = 0.95;
word velocityName_{"velocity"};
inline static word velocityName_{"velocity"};
word diameterName_{"diameter"};
inline static word diameterName_{"diameter"};
public: