periodict boundary condition ->DEBUG and some minor changes boundaries
This commit is contained in:
parent
f5ba30b901
commit
fac5576df1
|
@ -93,7 +93,7 @@ bool pFlow::contactSearch::boundaryBroadSearch
|
|||
bTimer_.start();
|
||||
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(
|
||||
i,
|
||||
ti,
|
||||
|
|
|
@ -10,8 +10,8 @@ pFlow::boundarySphereInteractionList<CFModel, gMModel>::boundarySphereInteractio
|
|||
boundaryListPtr<boundarySphereInteraction<CFModel,gMModel>>(),
|
||||
boundaries_(sphPrtcls.pStruct().boundaries())
|
||||
{
|
||||
|
||||
ForAllActiveBoundariesPtr(i, this)
|
||||
output<<boundaries_.size()<<endl;
|
||||
ForAllBoundariesPtr(i, this)
|
||||
{
|
||||
this->set(
|
||||
i,
|
||||
|
|
|
@ -145,6 +145,11 @@ pFlow::sphereInteraction<cFM,gMM, cLT>::sphereInteraction
|
|||
{
|
||||
fatalExit;
|
||||
}
|
||||
|
||||
for(uint32 i=0; i<6; i++)
|
||||
{
|
||||
activeBoundaries_[i] = boundaryInteraction_[i].ppPairsAllocated();
|
||||
}
|
||||
}
|
||||
|
||||
template<typename cFM,typename gMM,template <class, class, class> class cLT>
|
||||
|
@ -190,10 +195,14 @@ bool pFlow::sphereInteraction<cFM,gMM, cLT>::iterate()
|
|||
ComputationTimer().start();
|
||||
|
||||
ForAllActiveBoundaries(i, boundaryInteraction_)
|
||||
//for(size_t i=0; i<6; i++)
|
||||
{
|
||||
auto& BI = boundaryInteraction_[i];
|
||||
BI.ppPairs().beforeBroadSearch();
|
||||
BI.pwPairs().beforeBroadSearch();
|
||||
if(activeBoundaries_[i])
|
||||
{
|
||||
auto& BI = boundaryInteraction_[i];
|
||||
BI.ppPairs().beforeBroadSearch();
|
||||
BI.pwPairs().beforeBroadSearch();
|
||||
}
|
||||
}
|
||||
|
||||
ComputationTimer().end();
|
||||
|
@ -214,18 +223,22 @@ bool pFlow::sphereInteraction<cFM,gMM, cLT>::iterate()
|
|||
}
|
||||
|
||||
ForAllActiveBoundaries(i, boundaryInteraction_)
|
||||
//for(size_t i=0; i<6; i++)
|
||||
{
|
||||
auto& BI = boundaryInteraction_[i];
|
||||
if(!contactSearchRef.boundaryBroadSearch(
|
||||
i,
|
||||
ti,
|
||||
BI.ppPairs(),
|
||||
BI.pwPairs())
|
||||
)
|
||||
if(activeBoundaries_[i])
|
||||
{
|
||||
fatalErrorInFunction<<
|
||||
"failed to perform broadSearch for boundary index "<<i<<endl;
|
||||
return false;
|
||||
auto& BI = boundaryInteraction_[i];
|
||||
if(!contactSearchRef.boundaryBroadSearch(
|
||||
i,
|
||||
ti,
|
||||
BI.ppPairs(),
|
||||
BI.pwPairs())
|
||||
)
|
||||
{
|
||||
fatalErrorInFunction<<
|
||||
"failed to perform broadSearch for boundary index "<<i<<endl;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
ComputationTimer().end();
|
||||
|
@ -245,11 +258,15 @@ bool pFlow::sphereInteraction<cFM,gMM, cLT>::iterate()
|
|||
contactListMangementBoundaryTimer_.resume();
|
||||
ComputationTimer().start();
|
||||
|
||||
ForAllActiveBoundaries(i, boundaryInteraction_ )
|
||||
ForAllActiveBoundaries(i, boundaryInteraction_)
|
||||
//for(size_t i=0; i<6; i++)
|
||||
{
|
||||
auto& BI = boundaryInteraction_[i];
|
||||
BI.ppPairs().afterBroadSearch();
|
||||
BI.pwPairs().afterBroadSearch();
|
||||
if(activeBoundaries_[i])
|
||||
{
|
||||
auto& BI = boundaryInteraction_[i];
|
||||
BI.ppPairs().afterBroadSearch();
|
||||
BI.pwPairs().afterBroadSearch();
|
||||
}
|
||||
}
|
||||
|
||||
ComputationTimer().end();
|
||||
|
@ -265,6 +282,7 @@ bool pFlow::sphereInteraction<cFM,gMM, cLT>::iterate()
|
|||
while(requireStep.anyElement(true) && step <= 10)
|
||||
{
|
||||
ForAllBoundaries(i, boundaryInteraction_)
|
||||
//for(size_t i=0; i<6; i++)
|
||||
{
|
||||
if(requireStep[i] )
|
||||
{
|
||||
|
@ -304,6 +322,7 @@ bool pFlow::sphereInteraction<cFM,gMM, cLT>::iterate()
|
|||
while( requireStep.anyElement(true) && step < 20 )
|
||||
{
|
||||
ForAllBoundaries(i, boundaryInteraction_)
|
||||
//for(size_t i=0; i<6; i++)
|
||||
{
|
||||
if(requireStep[i])
|
||||
{
|
||||
|
|
|
@ -53,7 +53,7 @@ public:
|
|||
boundaryListPtr<BoundaryFieldType>(),
|
||||
boundaries_(boundaries)
|
||||
{
|
||||
ForAllBoundaries(i, *this)
|
||||
ForAllBoundariesPtr(i, this)
|
||||
{
|
||||
this->set
|
||||
(
|
||||
|
@ -69,13 +69,13 @@ public:
|
|||
&& slaveToMasterUpdateIter_ == iter) return;
|
||||
|
||||
// first step
|
||||
ForAllBoundaries(i,*this)
|
||||
ForAllBoundariesPtr(i,this)
|
||||
{
|
||||
this->boundaryPtr(i)->updateBoundary(1, direction);
|
||||
}
|
||||
|
||||
// second step
|
||||
ForAllBoundaries(i,*this)
|
||||
ForAllBoundariesPtr(i,this)
|
||||
{
|
||||
this->boundaryPtr(i)->updateBoundary(1, direction);
|
||||
}
|
||||
|
@ -88,7 +88,7 @@ public:
|
|||
|
||||
void fill(const T& val)
|
||||
{
|
||||
ForAllBoundaries(i, *this)
|
||||
ForAllBoundariesPtr(i, this)
|
||||
{
|
||||
this->boundaryPtr(i)->fill(val);
|
||||
}
|
||||
|
|
|
@ -24,6 +24,11 @@ Licence:
|
|||
#include "observer.hpp"
|
||||
#include "message.hpp"
|
||||
|
||||
pFlow::subscriber::subscriber(const word& name)
|
||||
:
|
||||
observerList_(message::numEvents())
|
||||
{}
|
||||
|
||||
pFlow::subscriber::subscriber(const subscriber & src)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -39,14 +39,14 @@ class subscriber
|
|||
private:
|
||||
|
||||
// - list of subsribed objectd that recieve updage messages
|
||||
mutable std::vector<List<observer*>> observerList_{message::numEvents()};
|
||||
mutable std::vector<List<observer*>> observerList_;
|
||||
|
||||
//word subName_;
|
||||
|
||||
public:
|
||||
|
||||
subscriber(const word& name)
|
||||
{}
|
||||
subscriber(const word& name);
|
||||
|
||||
|
||||
/// Copy constructor, only copies the name, not the list
|
||||
subscriber(const subscriber&);
|
||||
|
|
|
@ -144,7 +144,7 @@ pFlow::boundaryList::createBoundaries()
|
|||
if (listSet_)
|
||||
return true;
|
||||
|
||||
ForAllBoundaries(i, *this)
|
||||
ForAllBoundariesPtr(i, this)
|
||||
{
|
||||
this->set(
|
||||
i,
|
||||
|
@ -200,7 +200,7 @@ pFlow::boundaryList::beforeIteration(const timeInfo& ti, bool force)
|
|||
|
||||
while(callAgain.anyElement(true) && step <= 10u)
|
||||
{
|
||||
ForAllBoundaries(i,*this)
|
||||
ForAllBoundariesPtr(i,this)
|
||||
{
|
||||
if(callAgain[i])
|
||||
{
|
||||
|
@ -239,7 +239,7 @@ pFlow::boundaryList::beforeIteration(const timeInfo& ti, bool force)
|
|||
step++;
|
||||
}
|
||||
|
||||
ForAllBoundaries(i,*this)
|
||||
ForAllBoundariesPtr(i,this)
|
||||
{
|
||||
boundary(i).updataBoundaryData(1);
|
||||
}
|
||||
|
@ -248,7 +248,7 @@ pFlow::boundaryList::beforeIteration(const timeInfo& ti, bool force)
|
|||
bdry->updataBoundaryData(1);
|
||||
}*/
|
||||
|
||||
ForAllBoundaries(i,*this)
|
||||
ForAllBoundariesPtr(i,this)
|
||||
{
|
||||
boundary(i).updataBoundaryData(2);
|
||||
}
|
||||
|
@ -263,7 +263,7 @@ pFlow::boundaryList::beforeIteration(const timeInfo& ti, bool force)
|
|||
bool
|
||||
pFlow::boundaryList::iterate(const timeInfo& ti, bool force)
|
||||
{
|
||||
ForAllBoundaries(i, *this)
|
||||
ForAllBoundariesPtr(i, this)
|
||||
{
|
||||
if (!boundary(i).iterate(ti))
|
||||
{
|
||||
|
@ -293,7 +293,7 @@ pFlow::boundaryList::afterIteration(const timeInfo& ti, bool force)
|
|||
int step = 1;
|
||||
while(callAgain.anyElement(true)&& step <=10)
|
||||
{
|
||||
ForAllBoundaries(i,*this)
|
||||
ForAllBoundariesPtr(i,this)
|
||||
{
|
||||
if(callAgain[i])
|
||||
{
|
||||
|
|
|
@ -34,35 +34,19 @@ template<typename BoundaryType>
|
|||
class boundaryListPtr
|
||||
{
|
||||
private:
|
||||
std::array<BoundaryType*,6> boundaries_;
|
||||
std::array<BoundaryType*,6> baseBoundaries_;
|
||||
|
||||
std::bitset<6> activeBoundaries_=0B000000;
|
||||
|
||||
public:
|
||||
|
||||
boundaryListPtr():
|
||||
boundaries_({nullptr, nullptr, nullptr, nullptr, nullptr, nullptr})
|
||||
baseBoundaries_({nullptr, nullptr, nullptr, nullptr, nullptr, nullptr})
|
||||
{}
|
||||
|
||||
void set(size_t i, uniquePtr<BoundaryType>&& ptr )
|
||||
{
|
||||
if( i > boundaries_.size() )
|
||||
{
|
||||
fatalErrorInFunction<<
|
||||
"Out of range access of boundaryListPtr members. List size is "<<
|
||||
size() << "and you are accessing "<< i << "\n";
|
||||
fatalExit;
|
||||
}
|
||||
boundaryListPtr(const boundaryListPtr&)=delete;
|
||||
|
||||
if(boundaries_[i]) delete boundaries_[i];
|
||||
boundaries_[i] = ptr.release();
|
||||
|
||||
if(boundaries_[i])
|
||||
{
|
||||
// query if this boundary active or not
|
||||
activeBoundaries_.set(i,boundaries_[i]->isActive());
|
||||
}
|
||||
}
|
||||
boundaryListPtr(boundaryListPtr&&)=default;
|
||||
|
||||
~boundaryListPtr()
|
||||
{
|
||||
|
@ -71,7 +55,7 @@ public:
|
|||
|
||||
void clear()
|
||||
{
|
||||
for(auto& bndry:boundaries_)
|
||||
for(auto& bndry:baseBoundaries_)
|
||||
{
|
||||
if(bndry != nullptr)
|
||||
{
|
||||
|
@ -82,16 +66,36 @@ public:
|
|||
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
|
||||
inline
|
||||
BoundaryType& operator[](size_t i)
|
||||
{
|
||||
if(boundaries_[i]== nullptr)
|
||||
if(baseBoundaries_[i]== nullptr)
|
||||
{
|
||||
fatalErrorInFunction<<"Accessing nullptr element"<<endl;
|
||||
fatalExit;
|
||||
}
|
||||
return *boundaries_[i];
|
||||
return *(baseBoundaries_[i]);
|
||||
}
|
||||
|
||||
// - const access to ith element
|
||||
|
@ -99,34 +103,34 @@ public:
|
|||
inline
|
||||
const BoundaryType& operator[](size_t i) const
|
||||
{
|
||||
if(boundaries_[i]== nullptr)
|
||||
if(baseBoundaries_[i]== nullptr)
|
||||
{
|
||||
fatalErrorInFunction<<"Accessing nullptr element"<<endl;
|
||||
fatalExit;
|
||||
}
|
||||
return *boundaries_[i];
|
||||
return *(baseBoundaries_[i]);
|
||||
}
|
||||
|
||||
inline
|
||||
BoundaryType* boundaryPtr(size_t i)
|
||||
{
|
||||
if(boundaries_[i]== nullptr)
|
||||
if(baseBoundaries_[i]== nullptr)
|
||||
{
|
||||
fatalErrorInFunction<<"Accessing nullptr element"<<endl;
|
||||
fatalExit;
|
||||
}
|
||||
return boundaries_[i];
|
||||
return baseBoundaries_[i];
|
||||
}
|
||||
|
||||
inline
|
||||
const BoundaryType* boundaryPtr(size_t i)const
|
||||
{
|
||||
if(boundaries_[i]== nullptr)
|
||||
if(baseBoundaries_[i]== nullptr)
|
||||
{
|
||||
fatalErrorInFunction<<"Accessing nullptr element"<<endl;
|
||||
fatalExit;
|
||||
}
|
||||
return boundaries_[i];
|
||||
return baseBoundaries_[i];
|
||||
}
|
||||
|
||||
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 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))
|
||||
|
|
|
@ -47,67 +47,70 @@ bool pFlow::boundaryPeriodic::beforeIteration(
|
|||
{
|
||||
if(step==1)
|
||||
{
|
||||
boundaryBase::beforeIteration(step, ti, updateIter, iterBeforeUpdate, callAgain);
|
||||
callAgain = true;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
|
||||
|
||||
callAgain = false;
|
||||
// nothing have to be done
|
||||
if(empty())
|
||||
{
|
||||
callAgain = false;
|
||||
// nothing have to be done
|
||||
if(empty())
|
||||
return true;
|
||||
}
|
||||
//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)
|
||||
{
|
||||
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)))
|
||||
{
|
||||
if(p.pointInNegativeSide(points(i)))
|
||||
{
|
||||
transferD(i)=1;
|
||||
trnasToUpdate++;
|
||||
}
|
||||
},
|
||||
numTransfered
|
||||
);
|
||||
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
|
||||
);
|
||||
// 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;
|
||||
|
||||
|
||||
}
|
||||
|
||||
bool pFlow::boundaryPeriodic::iterate(const timeInfo& ti)
|
||||
|
|
|
@ -75,7 +75,7 @@ bool pFlow::simulationDomain::prepareBoundaryDicts()
|
|||
return false;
|
||||
}
|
||||
|
||||
bDict.addOrReplace("boundaryExtntionLengthRatio", boundaryExtntionLengthRatio);
|
||||
bDict.addOrKeep("boundaryExtntionLengthRatio", boundaryExtntionLengthRatio);
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue