Merge pull request #156 from PhasicFlow/develop

Develop
This commit is contained in:
PhasicFlow 2025-02-03 19:17:08 +03:30 committed by GitHub
commit f4f5f29e3c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
16 changed files with 222 additions and 164 deletions

View File

@ -1,17 +1,55 @@
PF_cFlags="--description --help --version" PF_cFlags="--description --help --version"
AllTimeFolders=
__getAllTime(){
files=( $(ls) )
deleteFiles=(settings caseSetup cleanThisCase VTK runThisCase stl postprocess postProcess)
declare -A delk
for del in "${deleteFiles[@]}" ; do delk[$del]=1 ; done
# Tag items to remove, based on
for k in "${!files[@]}" ; do
[ "${delk[${files[$k]}]-}" ] && unset 'files[k]'
done
# Compaction
COMPREPLY=("${files[@]}")
AllTimeFolders="${files[@]}"
}
__getFields(){
__getAllTime
local -A unique_files=()
for dir in $AllTimeFolders; do
# Check if the directory exists
if [ ! -d "$dir" ]; then
continue # Skip to the next directory
fi
files_in_dir=$(find "$dir" -maxdepth 1 -type f -printf '%f\n' | sort -u)
# Add filenames to the associative array (duplicates will be overwritten)
while IFS= read -r filename; do
unique_files["$filename"]=1 # Just the key is important, value can be anything
done <<< "$files_in_dir"
done
COMPREPLY=("${!unique_files[@]}")
AllTimeFolders=
}
_pFlowToVTK(){ _pFlowToVTK(){
if [ "$3" == "--time" ]; then if [ "$3" == "--time" ] ; then
COMPREPLY=( $(ls) ) __getAllTime
elif [ "$3" == "--fields" ]; then
__getFields
else else
COMPREPLY=( $(compgen -W "$PF_cFlags --binary --no-geometry --no-particles --out-folder --time --separate-surfaces --fields" -- "$2") ) COMPREPLY=( $(compgen -W "$PF_cFlags --binary --no-geometry --no-particles --out-folder --time --separate-surfaces --fields" -- "$2") )
fi fi
} }
complete -F _pFlowToVTK pFlowToVTK complete -F _pFlowToVTK pFlowToVTK
_postprocessPhasicFlow(){ _postprocessPhasicFlow(){
if [ "$3" == "--time" ]; then if [ "$3" == "--time" ]; then
COMPREPLY=( $(ls) ) __getAllTime
else else
COMPREPLY=( $(compgen -W "$PF_cFlags --out-folder --time --zeroFolder" -- "$2") ) COMPREPLY=( $(compgen -W "$PF_cFlags --out-folder --time --zeroFolder" -- "$2") )
fi fi

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

@ -93,7 +93,7 @@ bool pFlow::contactSearch::boundaryBroadSearch
bTimer_.start(); bTimer_.start();
for(uint32 i=0u; i<6u; i++) for(uint32 i=0u; i<6u; i++)
{ {
output<<" boundarySearch "<< i <<" for iter "<< ti.iter()<<endl; //output<<" boundarySearch "<< i <<" for iter "<< ti.iter()<<endl;
if(!BoundaryBroadSearch( if(!BoundaryBroadSearch(
i, i,
ti, ti,

View File

@ -10,8 +10,8 @@ pFlow::boundarySphereInteractionList<CFModel, gMModel>::boundarySphereInteractio
boundaryListPtr<boundarySphereInteraction<CFModel,gMModel>>(), boundaryListPtr<boundarySphereInteraction<CFModel,gMModel>>(),
boundaries_(sphPrtcls.pStruct().boundaries()) boundaries_(sphPrtcls.pStruct().boundaries())
{ {
output<<boundaries_.size()<<endl;
ForAllActiveBoundariesPtr(i, this) ForAllBoundariesPtr(i, this)
{ {
this->set( this->set(
i, i,

View File

@ -145,6 +145,11 @@ pFlow::sphereInteraction<cFM,gMM, cLT>::sphereInteraction
{ {
fatalExit; fatalExit;
} }
for(uint32 i=0; i<6; i++)
{
activeBoundaries_[i] = boundaryInteraction_[i].ppPairsAllocated();
}
} }
template<typename cFM,typename gMM,template <class, class, class> class cLT> template<typename cFM,typename gMM,template <class, class, class> class cLT>
@ -190,10 +195,14 @@ bool pFlow::sphereInteraction<cFM,gMM, cLT>::iterate()
ComputationTimer().start(); ComputationTimer().start();
ForAllActiveBoundaries(i, boundaryInteraction_) ForAllActiveBoundaries(i, boundaryInteraction_)
//for(size_t i=0; i<6; i++)
{ {
auto& BI = boundaryInteraction_[i]; if(activeBoundaries_[i])
BI.ppPairs().beforeBroadSearch(); {
BI.pwPairs().beforeBroadSearch(); auto& BI = boundaryInteraction_[i];
BI.ppPairs().beforeBroadSearch();
BI.pwPairs().beforeBroadSearch();
}
} }
ComputationTimer().end(); ComputationTimer().end();
@ -214,18 +223,22 @@ bool pFlow::sphereInteraction<cFM,gMM, cLT>::iterate()
} }
ForAllActiveBoundaries(i, boundaryInteraction_) ForAllActiveBoundaries(i, boundaryInteraction_)
//for(size_t i=0; i<6; i++)
{ {
auto& BI = boundaryInteraction_[i]; if(activeBoundaries_[i])
if(!contactSearchRef.boundaryBroadSearch(
i,
ti,
BI.ppPairs(),
BI.pwPairs())
)
{ {
fatalErrorInFunction<< auto& BI = boundaryInteraction_[i];
"failed to perform broadSearch for boundary index "<<i<<endl; if(!contactSearchRef.boundaryBroadSearch(
return false; i,
ti,
BI.ppPairs(),
BI.pwPairs())
)
{
fatalErrorInFunction<<
"failed to perform broadSearch for boundary index "<<i<<endl;
return false;
}
} }
} }
ComputationTimer().end(); ComputationTimer().end();
@ -245,11 +258,15 @@ bool pFlow::sphereInteraction<cFM,gMM, cLT>::iterate()
contactListMangementBoundaryTimer_.resume(); contactListMangementBoundaryTimer_.resume();
ComputationTimer().start(); ComputationTimer().start();
ForAllActiveBoundaries(i, boundaryInteraction_ ) ForAllActiveBoundaries(i, boundaryInteraction_)
//for(size_t i=0; i<6; i++)
{ {
auto& BI = boundaryInteraction_[i]; if(activeBoundaries_[i])
BI.ppPairs().afterBroadSearch(); {
BI.pwPairs().afterBroadSearch(); auto& BI = boundaryInteraction_[i];
BI.ppPairs().afterBroadSearch();
BI.pwPairs().afterBroadSearch();
}
} }
ComputationTimer().end(); ComputationTimer().end();
@ -265,6 +282,7 @@ bool pFlow::sphereInteraction<cFM,gMM, cLT>::iterate()
while(requireStep.anyElement(true) && step <= 10) while(requireStep.anyElement(true) && step <= 10)
{ {
ForAllBoundaries(i, boundaryInteraction_) ForAllBoundaries(i, boundaryInteraction_)
//for(size_t i=0; i<6; i++)
{ {
if(requireStep[i] ) if(requireStep[i] )
{ {
@ -304,6 +322,7 @@ bool pFlow::sphereInteraction<cFM,gMM, cLT>::iterate()
while( requireStep.anyElement(true) && step < 20 ) while( requireStep.anyElement(true) && step < 20 )
{ {
ForAllBoundaries(i, boundaryInteraction_) ForAllBoundaries(i, boundaryInteraction_)
//for(size_t i=0; i<6; i++)
{ {
if(requireStep[i]) if(requireStep[i])
{ {

View File

@ -53,7 +53,7 @@ public:
boundaryListPtr<BoundaryFieldType>(), boundaryListPtr<BoundaryFieldType>(),
boundaries_(boundaries) boundaries_(boundaries)
{ {
ForAllBoundaries(i, *this) ForAllBoundariesPtr(i, this)
{ {
this->set this->set
( (
@ -69,13 +69,13 @@ public:
&& slaveToMasterUpdateIter_ == iter) return; && slaveToMasterUpdateIter_ == iter) return;
// first step // first step
ForAllBoundaries(i,*this) ForAllBoundariesPtr(i,this)
{ {
this->boundaryPtr(i)->updateBoundary(1, direction); this->boundaryPtr(i)->updateBoundary(1, direction);
} }
// second step // second step
ForAllBoundaries(i,*this) ForAllBoundariesPtr(i,this)
{ {
this->boundaryPtr(i)->updateBoundary(1, direction); this->boundaryPtr(i)->updateBoundary(1, direction);
} }
@ -88,7 +88,7 @@ public:
void fill(const T& val) void fill(const T& val)
{ {
ForAllBoundaries(i, *this) ForAllBoundariesPtr(i, this)
{ {
this->boundaryPtr(i)->fill(val); this->boundaryPtr(i)->fill(val);
} }

View File

@ -24,6 +24,11 @@ Licence:
#include "observer.hpp" #include "observer.hpp"
#include "message.hpp" #include "message.hpp"
pFlow::subscriber::subscriber(const word& name)
:
observerList_(message::numEvents())
{}
pFlow::subscriber::subscriber(const subscriber & src) pFlow::subscriber::subscriber(const subscriber & src)
{ {
} }

View File

@ -39,14 +39,14 @@ class subscriber
private: private:
// - list of subsribed objectd that recieve updage messages // - list of subsribed objectd that recieve updage messages
mutable std::vector<List<observer*>> observerList_{message::numEvents()}; mutable std::vector<List<observer*>> observerList_;
//word subName_; //word subName_;
public: public:
subscriber(const word& name) subscriber(const word& name);
{}
/// Copy constructor, only copies the name, not the list /// Copy constructor, only copies the name, not the list
subscriber(const subscriber&); subscriber(const subscriber&);

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

@ -144,7 +144,7 @@ pFlow::boundaryList::createBoundaries()
if (listSet_) if (listSet_)
return true; return true;
ForAllBoundaries(i, *this) ForAllBoundariesPtr(i, this)
{ {
this->set( this->set(
i, i,
@ -200,7 +200,7 @@ pFlow::boundaryList::beforeIteration(const timeInfo& ti, bool force)
while(callAgain.anyElement(true) && step <= 10u) while(callAgain.anyElement(true) && step <= 10u)
{ {
ForAllBoundaries(i,*this) ForAllBoundariesPtr(i,this)
{ {
if(callAgain[i]) if(callAgain[i])
{ {
@ -239,7 +239,7 @@ pFlow::boundaryList::beforeIteration(const timeInfo& ti, bool force)
step++; step++;
} }
ForAllBoundaries(i,*this) ForAllBoundariesPtr(i,this)
{ {
boundary(i).updataBoundaryData(1); boundary(i).updataBoundaryData(1);
} }
@ -248,7 +248,7 @@ pFlow::boundaryList::beforeIteration(const timeInfo& ti, bool force)
bdry->updataBoundaryData(1); bdry->updataBoundaryData(1);
}*/ }*/
ForAllBoundaries(i,*this) ForAllBoundariesPtr(i,this)
{ {
boundary(i).updataBoundaryData(2); boundary(i).updataBoundaryData(2);
} }
@ -263,7 +263,7 @@ pFlow::boundaryList::beforeIteration(const timeInfo& ti, bool force)
bool bool
pFlow::boundaryList::iterate(const timeInfo& ti, bool force) pFlow::boundaryList::iterate(const timeInfo& ti, bool force)
{ {
ForAllBoundaries(i, *this) ForAllBoundariesPtr(i, this)
{ {
if (!boundary(i).iterate(ti)) if (!boundary(i).iterate(ti))
{ {
@ -293,7 +293,7 @@ pFlow::boundaryList::afterIteration(const timeInfo& ti, bool force)
int step = 1; int step = 1;
while(callAgain.anyElement(true)&& step <=10) while(callAgain.anyElement(true)&& step <=10)
{ {
ForAllBoundaries(i,*this) ForAllBoundariesPtr(i,this)
{ {
if(callAgain[i]) if(callAgain[i])
{ {

View File

@ -34,35 +34,19 @@ template<typename BoundaryType>
class boundaryListPtr class boundaryListPtr
{ {
private: private:
std::array<BoundaryType*,6> boundaries_; std::array<BoundaryType*,6> baseBoundaries_;
std::bitset<6> activeBoundaries_=0B000000; std::bitset<6> activeBoundaries_=0B000000;
public: public:
boundaryListPtr(): boundaryListPtr():
boundaries_({nullptr, nullptr, nullptr, nullptr, nullptr, nullptr}) baseBoundaries_({nullptr, nullptr, nullptr, nullptr, nullptr, nullptr})
{} {}
void set(size_t i, uniquePtr<BoundaryType>&& ptr ) boundaryListPtr(const boundaryListPtr&)=delete;
{
if( i > boundaries_.size() )
{
fatalErrorInFunction<<
"Out of range access of boundaryListPtr members. List size is "<<
size() << "and you are accessing "<< i << "\n";
fatalExit;
}
if(boundaries_[i]) delete boundaries_[i]; boundaryListPtr(boundaryListPtr&&)=default;
boundaries_[i] = ptr.release();
if(boundaries_[i])
{
// query if this boundary active or not
activeBoundaries_.set(i,boundaries_[i]->isActive());
}
}
~boundaryListPtr() ~boundaryListPtr()
{ {
@ -71,7 +55,7 @@ public:
void clear() void clear()
{ {
for(auto& bndry:boundaries_) for(auto& bndry:baseBoundaries_)
{ {
if(bndry != nullptr) if(bndry != nullptr)
{ {
@ -82,16 +66,36 @@ public:
activeBoundaries_.reset(); activeBoundaries_.reset();
} }
void set(size_t i, uniquePtr<BoundaryType>&& ptr )
{
if( i > baseBoundaries_.size() )
{
fatalErrorInFunction<<
"Out of range access of boundaryListPtr members. List size is "<<
size() << "and you are accessing "<< i << "\n";
fatalExit;
}
if(baseBoundaries_[i]) delete baseBoundaries_[i];
baseBoundaries_[i] = ptr.release();
if(baseBoundaries_[i])
{
// query if this boundary active or not
activeBoundaries_.set(i,baseBoundaries_[i]->isActive());
}
}
// - access to ith element // - access to ith element
inline inline
BoundaryType& operator[](size_t i) BoundaryType& operator[](size_t i)
{ {
if(boundaries_[i]== nullptr) if(baseBoundaries_[i]== nullptr)
{ {
fatalErrorInFunction<<"Accessing nullptr element"<<endl; fatalErrorInFunction<<"Accessing nullptr element"<<endl;
fatalExit; fatalExit;
} }
return *boundaries_[i]; return *(baseBoundaries_[i]);
} }
// - const access to ith element // - const access to ith element
@ -99,34 +103,34 @@ public:
inline inline
const BoundaryType& operator[](size_t i) const const BoundaryType& operator[](size_t i) const
{ {
if(boundaries_[i]== nullptr) if(baseBoundaries_[i]== nullptr)
{ {
fatalErrorInFunction<<"Accessing nullptr element"<<endl; fatalErrorInFunction<<"Accessing nullptr element"<<endl;
fatalExit; fatalExit;
} }
return *boundaries_[i]; return *(baseBoundaries_[i]);
} }
inline inline
BoundaryType* boundaryPtr(size_t i) BoundaryType* boundaryPtr(size_t i)
{ {
if(boundaries_[i]== nullptr) if(baseBoundaries_[i]== nullptr)
{ {
fatalErrorInFunction<<"Accessing nullptr element"<<endl; fatalErrorInFunction<<"Accessing nullptr element"<<endl;
fatalExit; fatalExit;
} }
return boundaries_[i]; return baseBoundaries_[i];
} }
inline inline
const BoundaryType* boundaryPtr(size_t i)const const BoundaryType* boundaryPtr(size_t i)const
{ {
if(boundaries_[i]== nullptr) if(baseBoundaries_[i]== nullptr)
{ {
fatalErrorInFunction<<"Accessing nullptr element"<<endl; fatalErrorInFunction<<"Accessing nullptr element"<<endl;
fatalExit; fatalExit;
} }
return boundaries_[i]; return baseBoundaries_[i];
} }
inline constexpr inline constexpr
@ -178,7 +182,7 @@ public:
} }
#define ForAllBoundaries(i,bndryList) for(size_t i = 0ul; i<(bndryList).size(); i++) #define ForAllBoundaries(i,bndryList) for(size_t i = 0ul; i<bndryList.size(); i++)
#define ForAllBoundariesPtr(i,bndryList) for(size_t i = 0ul; i<bndryList->size(); i++) #define ForAllBoundariesPtr(i,bndryList) for(size_t i = 0ul; i<bndryList->size(); i++)
#define ForAllActiveBoundaries(i,bndryList) for(size_t i = bndryList.firstActive(); i<bndryList.size(); i=bndryList.nextActive(i)) #define ForAllActiveBoundaries(i,bndryList) for(size_t i = bndryList.firstActive(); i<bndryList.size(); i=bndryList.nextActive(i))
#define ForAllActiveBoundariesPtr(i,bndryList) for(size_t i = bndryList->firstActive(); i<bndryList->size(); i=bndryList->nextActive(i)) #define ForAllActiveBoundariesPtr(i,bndryList) for(size_t i = bndryList->firstActive(); i<bndryList->size(); i=bndryList->nextActive(i))

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,
@ -59,67 +47,70 @@ bool pFlow::boundaryPeriodic::beforeIteration(
{ {
if(step==1) if(step==1)
{ {
boundaryBase::beforeIteration(step, ti, updateIter, iterBeforeUpdate, callAgain);
callAgain = true; callAgain = true;
return true;
} }
else
callAgain = false;
// nothing have to be done
if(empty())
{ {
callAgain = false; return true;
// nothing have to be done
if(empty())
{
return true;
}
if(!performBoundarytUpdate())
{
return true;
}
uint32 s = size();
uint32Vector_D transferFlags("transferFlags",s+1, s+1, RESERVE());
transferFlags.fill(0u);
auto points = thisPoints();
auto p = boundaryPlane().infPlane();
const auto & transferD = transferFlags.deviceViewAll();
uint32 numTransfered = 0;
Kokkos::parallel_reduce
(
"boundaryPeriodic::beforeIteration",
deviceRPolicyStatic(0u,s),
LAMBDA_HD(uint32 i, uint32& trnasToUpdate)
{
if(p.pointInNegativeSide(points(i)))
{
transferD(i)=1;
trnasToUpdate++;
}
},
numTransfered
);
// no point to be transfered
if(numTransfered == 0 )
{
return true;
}
// to obtain the transfer vector
realx3 transferVec = displacementVectroToMirror();
return transferPointsToMirror
(
numTransfered,
transferFlags,
mirrorBoundaryIndex(),
transferVec
);
} }
//output<<this->thisBoundaryIndex()<<" ->"<<ti.iter()<<" update called\n";
if(!performBoundarytUpdate())
{
return true;
}
//output<<this->thisBoundaryIndex()<<" ->"<< ti.iter()<<" update is being performed \n";
uint32 s = size();
uint32Vector_D transferFlags("transferFlags",s+1, s+1, RESERVE());
transferFlags.fill(0u);
auto points = thisPoints();
auto p = boundaryPlane().infPlane();
const auto & transferD = transferFlags.deviceViewAll();
uint32 numTransfered = 0;
Kokkos::parallel_reduce
(
"boundaryPeriodic::beforeIteration",
deviceRPolicyStatic(0u,s),
LAMBDA_HD(uint32 i, uint32& trnasToUpdate)
{
if(p.pointInNegativeSide(points(i)))
{
transferD(i)=1;
trnasToUpdate++;
}
},
numTransfered
);
// no point to be transfered
if(numTransfered == 0 )
{
return true;
}
// to obtain the transfer vector
realx3 transferVec = displacementVectroToMirror();
return transferPointsToMirror
(
numTransfered,
transferFlags,
mirrorBoundaryIndex(),
transferVec
);
return true; return true;
} }
bool pFlow::boundaryPeriodic::iterate(const timeInfo& ti) bool pFlow::boundaryPeriodic::iterate(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:

View File

@ -75,7 +75,7 @@ bool pFlow::simulationDomain::prepareBoundaryDicts()
return false; return false;
} }
bDict.addOrReplace("boundaryExtntionLengthRatio", boundaryExtntionLengthRatio); bDict.addOrKeep("boundaryExtntionLengthRatio", boundaryExtntionLengthRatio);
} }