commit
7eb707f950
|
@ -0,0 +1,63 @@
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef __AB2Kernels_hpp__
|
||||||
|
#define __AB2Kernels_hpp__
|
||||||
|
|
||||||
|
#include "KokkosTypes.hpp"
|
||||||
|
#include "types.hpp"
|
||||||
|
|
||||||
|
namespace pFlow::AB2Kernels
|
||||||
|
{
|
||||||
|
inline
|
||||||
|
bool intAllActive(
|
||||||
|
const word& name,
|
||||||
|
real dt,
|
||||||
|
rangeU32 activeRng,
|
||||||
|
const deviceViewType1D<realx3>& y,
|
||||||
|
const deviceViewType1D<realx3>& dy,
|
||||||
|
const deviceViewType1D<realx3>& dy1
|
||||||
|
)
|
||||||
|
{
|
||||||
|
Kokkos::parallel_for(
|
||||||
|
name,
|
||||||
|
deviceRPolicyStatic (activeRng.start(), activeRng.end()),
|
||||||
|
LAMBDA_HD(uint32 i){
|
||||||
|
y[i] += dt*(static_cast<real>(1.5) * dy[i] - static_cast<real>(0.5) * dy1[i]);
|
||||||
|
dy1[i] = dy[i];
|
||||||
|
});
|
||||||
|
Kokkos::fence();
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline
|
||||||
|
bool intScattered
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
real dt,
|
||||||
|
const pFlagTypeDevice& activePoints,
|
||||||
|
const deviceViewType1D<realx3>& y,
|
||||||
|
const deviceViewType1D<realx3>& dy,
|
||||||
|
const deviceViewType1D<realx3>& dy1
|
||||||
|
)
|
||||||
|
{
|
||||||
|
|
||||||
|
Kokkos::parallel_for(
|
||||||
|
name,
|
||||||
|
deviceRPolicyStatic (activePoints.activeRange().start(), activePoints.activeRange().end()),
|
||||||
|
LAMBDA_HD(uint32 i){
|
||||||
|
if( activePoints(i))
|
||||||
|
{
|
||||||
|
y[i] += dt*(static_cast<real>(1.5) * dy[i] - static_cast<real>(0.5) * dy1[i]);
|
||||||
|
dy1[i] = dy[i];
|
||||||
|
}
|
||||||
|
});
|
||||||
|
Kokkos::fence();
|
||||||
|
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
|
@ -90,8 +90,6 @@ bool intScattered
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
pFlow::AdamsBashforth2::AdamsBashforth2
|
pFlow::AdamsBashforth2::AdamsBashforth2
|
||||||
(
|
(
|
||||||
const word& baseName,
|
const word& baseName,
|
||||||
|
@ -113,15 +111,19 @@ pFlow::AdamsBashforth2::AdamsBashforth2
|
||||||
pStruct,
|
pStruct,
|
||||||
zero3,
|
zero3,
|
||||||
zero3
|
zero3
|
||||||
)
|
),
|
||||||
|
boundaryList_(pStruct, method, *this)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
bool pFlow::AdamsBashforth2::predict
|
void pFlow::AdamsBashforth2::updateBoundariesSlaveToMasterIfRequested()
|
||||||
(
|
{
|
||||||
|
realx3PointField_D::updateBoundariesSlaveToMasterIfRequested();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool pFlow::AdamsBashforth2::predict(
|
||||||
real UNUSED(dt),
|
real UNUSED(dt),
|
||||||
realx3PointField_D& UNUSED(y),
|
realx3PointField_D &UNUSED(y),
|
||||||
realx3PointField_D& UNUSED(dy)
|
realx3PointField_D &UNUSED(dy))
|
||||||
)
|
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -142,25 +144,46 @@ bool pFlow::AdamsBashforth2::correct
|
||||||
realx3PointField_D& y,
|
realx3PointField_D& y,
|
||||||
realx3PointField_D& dy
|
realx3PointField_D& dy
|
||||||
)
|
)
|
||||||
{
|
|
||||||
return correct(dt, y.field(), dy);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool pFlow::AdamsBashforth2::correct(real dt, realx3Field_D &y, realx3PointField_D &dy)
|
|
||||||
{
|
{
|
||||||
auto& dy1l = dy1();
|
auto& dy1l = dy1();
|
||||||
|
bool success = false;
|
||||||
if(dy1l.isAllActive())
|
if(dy1l.isAllActive())
|
||||||
{
|
{
|
||||||
return intAllActive(dt, y, dy, dy1l);
|
success = intAllActive(dt, y.field(), dy, dy1l);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return intScattered(dt, y, dy, dy1l);
|
success = intScattered(dt, y.field(), dy, dy1l);
|
||||||
}
|
}
|
||||||
return false;
|
|
||||||
|
success = success && boundaryList_.correct(dt, y, dy);
|
||||||
|
|
||||||
|
return success;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool pFlow::AdamsBashforth2::correctPStruct(
|
||||||
|
real dt,
|
||||||
|
pointStructure &pStruct,
|
||||||
|
realx3PointField_D &vel)
|
||||||
|
{
|
||||||
|
auto& dy1l = dy1();
|
||||||
|
bool success = false;
|
||||||
|
if(dy1l.isAllActive())
|
||||||
|
{
|
||||||
|
success = intAllActive(dt, pStruct.pointPosition(), vel, dy1l);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
success = intScattered(dt, pStruct.pointPosition(), vel, dy1l);
|
||||||
|
}
|
||||||
|
|
||||||
|
success = success && boundaryList_.correctPStruct(dt, pStruct, vel);
|
||||||
|
|
||||||
|
return success;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bool pFlow::AdamsBashforth2::setInitialVals(
|
bool pFlow::AdamsBashforth2::setInitialVals(
|
||||||
const int32IndexContainer& newIndices,
|
const int32IndexContainer& newIndices,
|
||||||
const realx3Vector& y)
|
const realx3Vector& y)
|
||||||
|
|
|
@ -17,13 +17,13 @@ Licence:
|
||||||
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
|
||||||
-----------------------------------------------------------------------------*/
|
-----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef __AdamsBashforth2_hpp__
|
#ifndef __AdamsBashforth2_hpp__
|
||||||
#define __AdamsBashforth2_hpp__
|
#define __AdamsBashforth2_hpp__
|
||||||
|
|
||||||
|
|
||||||
#include "integration.hpp"
|
#include "integration.hpp"
|
||||||
#include "pointFields.hpp"
|
#include "pointFields.hpp"
|
||||||
|
#include "boundaryIntegrationList.hpp"
|
||||||
|
|
||||||
namespace pFlow
|
namespace pFlow
|
||||||
{
|
{
|
||||||
|
@ -41,6 +41,15 @@ class AdamsBashforth2
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
boundaryIntegrationList boundaryList_;
|
||||||
|
|
||||||
|
friend class processorAB2BoundaryIntegration;
|
||||||
|
|
||||||
|
const auto& dy1()const
|
||||||
|
{
|
||||||
|
return static_cast<const realx3PointField_D&>(*this);
|
||||||
|
}
|
||||||
|
|
||||||
auto& dy1()
|
auto& dy1()
|
||||||
{
|
{
|
||||||
return static_cast<realx3PointField_D&>(*this);
|
return static_cast<realx3PointField_D&>(*this);
|
||||||
|
@ -71,6 +80,9 @@ public:
|
||||||
|
|
||||||
|
|
||||||
// - Methods
|
// - Methods
|
||||||
|
|
||||||
|
void updateBoundariesSlaveToMasterIfRequested()override;
|
||||||
|
|
||||||
/// return integration method
|
/// return integration method
|
||||||
word method()const override
|
word method()const override
|
||||||
{
|
{
|
||||||
|
@ -92,10 +104,11 @@ public:
|
||||||
realx3PointField_D& y,
|
realx3PointField_D& y,
|
||||||
realx3PointField_D& dy) final;
|
realx3PointField_D& dy) final;
|
||||||
|
|
||||||
bool correct(
|
bool correctPStruct(
|
||||||
real dt,
|
real dt,
|
||||||
realx3Field_D& y,
|
pointStructure& pStruct,
|
||||||
realx3PointField_D& dy) final;
|
realx3PointField_D& vel) final;
|
||||||
|
|
||||||
|
|
||||||
/*bool hearChanges
|
/*bool hearChanges
|
||||||
(
|
(
|
||||||
|
|
|
@ -1,7 +1,10 @@
|
||||||
|
|
||||||
list(APPEND SourceFiles
|
list(APPEND SourceFiles
|
||||||
integration/integration.cpp
|
integration/integration.cpp
|
||||||
|
boundaries/boundaryIntegration.cpp
|
||||||
|
boundaries/boundaryIntegrationList.cpp
|
||||||
AdamsBashforth2/AdamsBashforth2.cpp
|
AdamsBashforth2/AdamsBashforth2.cpp
|
||||||
|
AdamsBashforth2/processorAB2BoundaryIntegration.cpp
|
||||||
#AdamsBashforth5/AdamsBashforth5.cpp
|
#AdamsBashforth5/AdamsBashforth5.cpp
|
||||||
#AdamsBashforth4/AdamsBashforth4.cpp
|
#AdamsBashforth4/AdamsBashforth4.cpp
|
||||||
#AdamsBashforth3/AdamsBashforth3.cpp
|
#AdamsBashforth3/AdamsBashforth3.cpp
|
||||||
|
|
|
@ -0,0 +1,55 @@
|
||||||
|
#include "boundaryIntegration.hpp"
|
||||||
|
#include "pointStructure.hpp"
|
||||||
|
|
||||||
|
|
||||||
|
pFlow::boundaryIntegration::boundaryIntegration(
|
||||||
|
const boundaryBase &boundary,
|
||||||
|
const pointStructure &pStruct,
|
||||||
|
const word &method,
|
||||||
|
integration& intgrtn
|
||||||
|
)
|
||||||
|
:
|
||||||
|
generalBoundary(boundary, pStruct, "", method),
|
||||||
|
integration_(intgrtn)
|
||||||
|
{}
|
||||||
|
|
||||||
|
pFlow::uniquePtr<pFlow::boundaryIntegration> pFlow::boundaryIntegration::create(
|
||||||
|
const boundaryBase &boundary,
|
||||||
|
const pointStructure &pStruct,
|
||||||
|
const word &method,
|
||||||
|
integration& intgrtn
|
||||||
|
)
|
||||||
|
{
|
||||||
|
|
||||||
|
word bType = angleBracketsNames2(
|
||||||
|
"boundaryIntegration",
|
||||||
|
boundary.type(),
|
||||||
|
method);
|
||||||
|
|
||||||
|
word altBType{"boundaryIntegration<none>"};
|
||||||
|
|
||||||
|
if( boundaryBasevCtorSelector_.search(bType) )
|
||||||
|
{
|
||||||
|
pOutput.space(4)<<"Creating boundary "<< Green_Text(bType)<<
|
||||||
|
" for "<<boundary.name()<<endl;
|
||||||
|
return boundaryBasevCtorSelector_[bType](boundary, pStruct, method, intgrtn);
|
||||||
|
}
|
||||||
|
else if(boundaryBasevCtorSelector_.search(altBType))
|
||||||
|
{
|
||||||
|
pOutput.space(4)<<"Creating boundary "<< Green_Text(altBType)<<
|
||||||
|
" for "<<boundary.name()<<endl;
|
||||||
|
return boundaryBasevCtorSelector_[altBType](boundary, pStruct, method, intgrtn);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
printKeys(
|
||||||
|
fatalError << "Ctor Selector "<< bType<<
|
||||||
|
" and "<< altBType << " do not exist. \n"
|
||||||
|
<<"Avaiable ones are: \n",
|
||||||
|
boundaryBasevCtorSelector_
|
||||||
|
);
|
||||||
|
fatalExit;
|
||||||
|
}
|
||||||
|
|
||||||
|
return nullptr;
|
||||||
|
}
|
|
@ -0,0 +1,91 @@
|
||||||
|
|
||||||
|
#ifndef __boundaryIntegration_hpp__
|
||||||
|
#define __boundaryIntegration_hpp__
|
||||||
|
|
||||||
|
|
||||||
|
#include "generalBoundary.hpp"
|
||||||
|
#include "virtualConstructor.hpp"
|
||||||
|
#include "pointFields.hpp"
|
||||||
|
|
||||||
|
namespace pFlow
|
||||||
|
{
|
||||||
|
|
||||||
|
class integration;
|
||||||
|
|
||||||
|
class boundaryIntegration
|
||||||
|
:
|
||||||
|
public generalBoundary
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
|
||||||
|
const integration& integration_;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
TypeInfo("boundaryIntegration<none>");
|
||||||
|
|
||||||
|
boundaryIntegration(
|
||||||
|
const boundaryBase& boundary,
|
||||||
|
const pointStructure& pStruct,
|
||||||
|
const word& method,
|
||||||
|
integration& intgrtn);
|
||||||
|
|
||||||
|
~boundaryIntegration()override = default;
|
||||||
|
|
||||||
|
create_vCtor(
|
||||||
|
boundaryIntegration,
|
||||||
|
boundaryBase,
|
||||||
|
(
|
||||||
|
const boundaryBase& boundary,
|
||||||
|
const pointStructure& pStruct,
|
||||||
|
const word& method,
|
||||||
|
integration& intgrtn
|
||||||
|
),
|
||||||
|
(boundary, pStruct, method, intgrtn)
|
||||||
|
);
|
||||||
|
|
||||||
|
add_vCtor(
|
||||||
|
boundaryIntegration,
|
||||||
|
boundaryIntegration,
|
||||||
|
boundaryBase
|
||||||
|
);
|
||||||
|
|
||||||
|
bool hearChanges(
|
||||||
|
real t,
|
||||||
|
real dt,
|
||||||
|
uint32 iter,
|
||||||
|
const message &msg,
|
||||||
|
const anyList &varList) override
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
const integration& Integration()const
|
||||||
|
{
|
||||||
|
return integration_;
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual
|
||||||
|
bool correct(real dt, const realx3PointField_D& y, const realx3PointField_D& dy)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual
|
||||||
|
bool correctPStruct(real dt, const realx3PointField_D& vel)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
static
|
||||||
|
uniquePtr<boundaryIntegration> create(
|
||||||
|
const boundaryBase& boundary,
|
||||||
|
const pointStructure& pStruct,
|
||||||
|
const word& method,
|
||||||
|
integration& intgrtn);
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1,59 @@
|
||||||
|
#include "boundaryIntegrationList.hpp"
|
||||||
|
#include "integration.hpp"
|
||||||
|
|
||||||
|
pFlow::boundaryIntegrationList::boundaryIntegrationList(
|
||||||
|
const pointStructure &pStruct,
|
||||||
|
const word &method,
|
||||||
|
integration &intgrtn
|
||||||
|
)
|
||||||
|
:
|
||||||
|
ListPtr<boundaryIntegration>(6),
|
||||||
|
boundaries_(pStruct.boundaries())
|
||||||
|
{
|
||||||
|
|
||||||
|
for(uint32 i=0; i<6; i++)
|
||||||
|
{
|
||||||
|
this->set(
|
||||||
|
i,
|
||||||
|
boundaryIntegration::create(
|
||||||
|
boundaries_[i],
|
||||||
|
pStruct,
|
||||||
|
method,
|
||||||
|
intgrtn
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool pFlow::boundaryIntegrationList::correct(real dt, realx3PointField_D &y, realx3PointField_D &dy)
|
||||||
|
{
|
||||||
|
for(auto& bndry:*this)
|
||||||
|
{
|
||||||
|
if(!bndry->correct(dt, y, dy))
|
||||||
|
{
|
||||||
|
fatalErrorInFunction<<"Error in correcting boundary "<<
|
||||||
|
bndry->boundaryName()<<endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool pFlow::boundaryIntegrationList::correctPStruct(
|
||||||
|
real dt,
|
||||||
|
pointStructure &pStruct,
|
||||||
|
const realx3PointField_D &vel)
|
||||||
|
{
|
||||||
|
for(auto& bndry:*this)
|
||||||
|
{
|
||||||
|
if(!bndry->correctPStruct(dt, vel))
|
||||||
|
{
|
||||||
|
fatalErrorInFunction<<"Error in correcting boundary "<<
|
||||||
|
bndry->boundaryName()<<" in pointStructure."<<endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
|
@ -0,0 +1,51 @@
|
||||||
|
|
||||||
|
#ifndef __boundaryIntegrationList_hpp__
|
||||||
|
#define __boundaryIntegrationList_hpp__
|
||||||
|
|
||||||
|
|
||||||
|
#include "boundaryList.hpp"
|
||||||
|
#include "ListPtr.hpp"
|
||||||
|
#include "boundaryIntegration.hpp"
|
||||||
|
|
||||||
|
|
||||||
|
namespace pFlow
|
||||||
|
{
|
||||||
|
|
||||||
|
class integration;
|
||||||
|
|
||||||
|
class boundaryIntegrationList
|
||||||
|
:
|
||||||
|
public ListPtr<boundaryIntegration>
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
|
||||||
|
const boundaryList& boundaries_;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
boundaryIntegrationList(
|
||||||
|
const pointStructure& pStruct,
|
||||||
|
const word& method,
|
||||||
|
integration& intgrtn
|
||||||
|
);
|
||||||
|
|
||||||
|
~boundaryIntegrationList()=default;
|
||||||
|
|
||||||
|
bool correct(
|
||||||
|
real dt,
|
||||||
|
realx3PointField_D& y,
|
||||||
|
realx3PointField_D& dy);
|
||||||
|
|
||||||
|
bool correctPStruct(
|
||||||
|
real dt,
|
||||||
|
pointStructure& pStruct,
|
||||||
|
const realx3PointField_D& vel);
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#endif //__boundaryIntegrationList_hpp__
|
|
@ -131,6 +131,8 @@ public:
|
||||||
return owner_;
|
return owner_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virtual
|
||||||
|
void updateBoundariesSlaveToMasterIfRequested() = 0;
|
||||||
/// return integration method
|
/// return integration method
|
||||||
virtual
|
virtual
|
||||||
word method()const = 0 ;
|
word method()const = 0 ;
|
||||||
|
@ -147,7 +149,7 @@ public:
|
||||||
bool correct(real dt, realx3PointField_D& y, realx3PointField_D& dy) = 0;
|
bool correct(real dt, realx3PointField_D& y, realx3PointField_D& dy) = 0;
|
||||||
|
|
||||||
virtual
|
virtual
|
||||||
bool correct(real dt, realx3Field_D& y, realx3PointField_D& dy) = 0;
|
bool correctPStruct(real dt, pointStructure& pStruct, realx3PointField_D& vel) = 0;
|
||||||
|
|
||||||
/// Set the initial values for new indices
|
/// Set the initial values for new indices
|
||||||
virtual
|
virtual
|
||||||
|
|
|
@ -7,8 +7,7 @@ contactSearch/methods/cellBased/NBS/NBS.cpp
|
||||||
contactSearch/methods/cellBased/NBS/cellsWallLevel0.cpp
|
contactSearch/methods/cellBased/NBS/cellsWallLevel0.cpp
|
||||||
|
|
||||||
contactSearch/boundaries/boundaryContactSearch/boundaryContactSearch.cpp
|
contactSearch/boundaries/boundaryContactSearch/boundaryContactSearch.cpp
|
||||||
contactSearch/boundaries/twoPartContactSearch/twoPartContactSearchKernels.cpp
|
|
||||||
contactSearch/boundaries/twoPartContactSearch/twoPartContactSearch.cpp
|
|
||||||
contactSearch/boundaries/periodicBoundaryContactSearch/ppwBndryContactSearchKernels.cpp
|
contactSearch/boundaries/periodicBoundaryContactSearch/ppwBndryContactSearchKernels.cpp
|
||||||
contactSearch/boundaries/periodicBoundaryContactSearch/ppwBndryContactSearch.cpp
|
contactSearch/boundaries/periodicBoundaryContactSearch/ppwBndryContactSearch.cpp
|
||||||
contactSearch/boundaries/periodicBoundaryContactSearch/wallBoundaryContactSearch.cpp
|
contactSearch/boundaries/periodicBoundaryContactSearch/wallBoundaryContactSearch.cpp
|
||||||
|
@ -28,6 +27,8 @@ if(pFlow_Build_MPI)
|
||||||
list(APPEND SourceFiles
|
list(APPEND SourceFiles
|
||||||
contactSearch/boundaries/processorBoundaryContactSearch/processorBoundaryContactSearch.cpp
|
contactSearch/boundaries/processorBoundaryContactSearch/processorBoundaryContactSearch.cpp
|
||||||
sphereInteraction/boundaries/processorBoundarySphereInteraction/processorBoundarySphereInteractions.cpp
|
sphereInteraction/boundaries/processorBoundarySphereInteraction/processorBoundarySphereInteractions.cpp
|
||||||
|
contactSearch/boundaries/twoPartContactSearch/twoPartContactSearchKernels.cpp
|
||||||
|
contactSearch/boundaries/twoPartContactSearch/twoPartContactSearch.cpp
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
|
@ -53,6 +53,47 @@ private:
|
||||||
|
|
||||||
boundaryContactSearchList csBoundaries_;
|
boundaryContactSearchList csBoundaries_;
|
||||||
|
|
||||||
|
bool BroadSearch(
|
||||||
|
const timeInfo& ti,
|
||||||
|
csPairContainerType& ppPairs,
|
||||||
|
csPairContainerType& pwPairs,
|
||||||
|
bool force = false) override
|
||||||
|
{
|
||||||
|
|
||||||
|
const auto& position = Particles().pointPosition().deviceViewAll();
|
||||||
|
const auto& flags = Particles().dynPointStruct().activePointsMaskDevice();
|
||||||
|
const auto& diam = Particles().boundingSphere().deviceViewAll();
|
||||||
|
|
||||||
|
return ppwContactSearch_().broadSearch(
|
||||||
|
ti.iter(),
|
||||||
|
ti.t(),
|
||||||
|
ti.dt(),
|
||||||
|
ppPairs,
|
||||||
|
pwPairs,
|
||||||
|
position,
|
||||||
|
flags,
|
||||||
|
diam,
|
||||||
|
force
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool BoundaryBroadSearch(
|
||||||
|
uint32 bndryIndex,
|
||||||
|
const timeInfo& ti,
|
||||||
|
csPairContainerType& ppPairs,
|
||||||
|
csPairContainerType& pwPairs,
|
||||||
|
bool force = false)override
|
||||||
|
{
|
||||||
|
return csBoundaries_[bndryIndex].broadSearch(
|
||||||
|
ti.iter(),
|
||||||
|
ti.t(),
|
||||||
|
ti.dt(),
|
||||||
|
ppPairs,
|
||||||
|
pwPairs,
|
||||||
|
force
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
TypeInfoTemplate11("ContactSearch", SearchMethodType);
|
TypeInfoTemplate11("ContactSearch", SearchMethodType);
|
||||||
|
@ -108,87 +149,14 @@ public:
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
add_vCtor(
|
add_vCtor(
|
||||||
contactSearch,
|
contactSearch,
|
||||||
ContactSearch,
|
ContactSearch,
|
||||||
dictionary);
|
dictionary);
|
||||||
|
|
||||||
|
bool enterBroadSearchBoundary(const timeInfo& ti, bool force=false)const override
|
||||||
bool broadSearch(
|
|
||||||
uint32 iter,
|
|
||||||
real t,
|
|
||||||
real dt,
|
|
||||||
csPairContainerType& ppPairs,
|
|
||||||
csPairContainerType& pwPairs,
|
|
||||||
bool force = false) override
|
|
||||||
{
|
{
|
||||||
|
return enterBroadSearch(ti, force) || csBoundaries_.boundariesUpdated();
|
||||||
|
|
||||||
ppTimer().start();
|
|
||||||
|
|
||||||
const auto& position = Particles().pointPosition().deviceViewAll();
|
|
||||||
const auto& flags = Particles().dynPointStruct().activePointsMaskDevice();
|
|
||||||
const auto& diam = Particles().boundingSphere().deviceViewAll();
|
|
||||||
|
|
||||||
|
|
||||||
if( !ppwContactSearch_().broadSearch(
|
|
||||||
iter,
|
|
||||||
t,
|
|
||||||
dt,
|
|
||||||
ppPairs,
|
|
||||||
pwPairs,
|
|
||||||
position,
|
|
||||||
flags,
|
|
||||||
diam,
|
|
||||||
force) )
|
|
||||||
{
|
|
||||||
fatalErrorInFunction;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
ppTimer().end();
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool boundaryBroadSearch(
|
|
||||||
uint32 i,
|
|
||||||
uint32 iter,
|
|
||||||
real t,
|
|
||||||
real dt,
|
|
||||||
csPairContainerType& ppPairs,
|
|
||||||
csPairContainerType& pwPairs,
|
|
||||||
bool force = false)override
|
|
||||||
{
|
|
||||||
if(i==0u)
|
|
||||||
Particles().boundingSphere().updateBoundaries(DataDirection::SlaveToMaster);
|
|
||||||
return csBoundaries_[i].broadSearch(
|
|
||||||
iter,
|
|
||||||
t,
|
|
||||||
dt,
|
|
||||||
ppPairs,
|
|
||||||
pwPairs,
|
|
||||||
force);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool enterBroadSearch(uint32 iter, real t, real dt)const override
|
|
||||||
{
|
|
||||||
if(ppwContactSearch_)
|
|
||||||
{
|
|
||||||
return ppwContactSearch_().performSearch(iter);
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool performedBroadSearch()const override
|
|
||||||
{
|
|
||||||
return ppwContactSearch_().performedSearch();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
uint32 updateInterval()const override
|
|
||||||
{
|
|
||||||
return ppwContactSearch_().updateInterval();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
real sizeRatio()const override
|
real sizeRatio()const override
|
||||||
|
@ -196,7 +164,6 @@ public:
|
||||||
return ppwContactSearch_().sizeRatio();
|
return ppwContactSearch_().sizeRatio();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
real cellExtent()const override
|
real cellExtent()const override
|
||||||
{
|
{
|
||||||
return ppwContactSearch_().cellExtent();
|
return ppwContactSearch_().cellExtent();
|
||||||
|
|
|
@ -26,4 +26,7 @@ pFlow::boundaryContactSearchList::boundaryContactSearchList(
|
||||||
setList(dict, cSearch);
|
setList(dict, cSearch);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool pFlow::boundaryContactSearchList::boundariesUpdated() const
|
||||||
|
{
|
||||||
|
return boundaries_.boundariesUpdated();
|
||||||
|
}
|
||||||
|
|
|
@ -29,6 +29,14 @@ public:
|
||||||
|
|
||||||
~boundaryContactSearchList()=default;
|
~boundaryContactSearchList()=default;
|
||||||
|
|
||||||
|
inline
|
||||||
|
const boundaryList& boundaries()const
|
||||||
|
{
|
||||||
|
return boundaries_;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool boundariesUpdated()const;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -33,8 +33,8 @@ pFlow::contactSearch::contactSearch(
|
||||||
extendedDomainBox_(extDomain),
|
extendedDomainBox_(extDomain),
|
||||||
particles_(prtcl),
|
particles_(prtcl),
|
||||||
geometry_(geom),
|
geometry_(geom),
|
||||||
ppTimer_("particle-particle contact search", &timers),
|
bTimer_("Boundary particles contact search", &timers),
|
||||||
pwTimer_("particle-wall contact search", &timers),
|
ppTimer_("Internal particles contact search", &timers),
|
||||||
dict_(dict)
|
dict_(dict)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -45,6 +45,76 @@ const pFlow::pointStructure &pFlow::contactSearch::pStruct() const
|
||||||
return particles_.pStruct();
|
return particles_.pStruct();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool pFlow::contactSearch::broadSearch
|
||||||
|
(
|
||||||
|
const timeInfo &ti,
|
||||||
|
csPairContainerType &ppPairs,
|
||||||
|
csPairContainerType &pwPairs,
|
||||||
|
bool force
|
||||||
|
)
|
||||||
|
{
|
||||||
|
|
||||||
|
if(enterBroadSearch(ti, force))
|
||||||
|
{
|
||||||
|
ppTimer_.start();
|
||||||
|
if( !BroadSearch(
|
||||||
|
ti,
|
||||||
|
ppPairs,
|
||||||
|
pwPairs,
|
||||||
|
force ) )
|
||||||
|
{
|
||||||
|
fatalErrorInFunction;
|
||||||
|
performedSearch_ = false;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
ppTimer_.end();
|
||||||
|
performedSearch_ = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
performedSearch_ = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool pFlow::contactSearch::boundaryBroadSearch
|
||||||
|
(
|
||||||
|
uint32 bndryIndex,
|
||||||
|
const timeInfo &ti,
|
||||||
|
csPairContainerType &ppPairs,
|
||||||
|
csPairContainerType &pwPairs,
|
||||||
|
bool force
|
||||||
|
)
|
||||||
|
{
|
||||||
|
if(enterBroadSearchBoundary(ti, force))
|
||||||
|
{
|
||||||
|
bTimer_.start();
|
||||||
|
for(uint32 i=0u; i<6u; i++)
|
||||||
|
{
|
||||||
|
if(!BoundaryBroadSearch(
|
||||||
|
i,
|
||||||
|
ti,
|
||||||
|
ppPairs,
|
||||||
|
pwPairs,
|
||||||
|
force))
|
||||||
|
{
|
||||||
|
performedSearchBoundary_ = false;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
bTimer_.end();
|
||||||
|
performedSearchBoundary_ = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
|
||||||
|
performedSearchBoundary_ = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
pFlow::uniquePtr<pFlow::contactSearch> pFlow::contactSearch::create(
|
pFlow::uniquePtr<pFlow::contactSearch> pFlow::contactSearch::create(
|
||||||
const dictionary &dict,
|
const dictionary &dict,
|
||||||
const box &extDomain,
|
const box &extDomain,
|
||||||
|
|
|
@ -26,6 +26,7 @@ Licence:
|
||||||
#include "contactSearchGlobals.hpp"
|
#include "contactSearchGlobals.hpp"
|
||||||
#include "dictionary.hpp"
|
#include "dictionary.hpp"
|
||||||
#include "virtualConstructor.hpp"
|
#include "virtualConstructor.hpp"
|
||||||
|
#include "timeInfo.hpp"
|
||||||
#include "Timer.hpp"
|
#include "Timer.hpp"
|
||||||
|
|
||||||
namespace pFlow
|
namespace pFlow
|
||||||
|
@ -44,16 +45,47 @@ private:
|
||||||
|
|
||||||
const box& extendedDomainBox_;
|
const box& extendedDomainBox_;
|
||||||
|
|
||||||
|
/// @brief update interval in terms of iteration numebr
|
||||||
|
uint32 updateInterval_= 1;
|
||||||
|
|
||||||
|
/// @brief last iteration number which contact search has been performed
|
||||||
|
uint32 lastUpdated_ = 0;
|
||||||
|
|
||||||
|
/// @brief performed search?
|
||||||
|
bool performedSearch_ = false;
|
||||||
|
|
||||||
|
/// @brief performed search in boundaries
|
||||||
|
bool performedSearchBoundary_ = false;
|
||||||
|
|
||||||
|
/// const ref to particles
|
||||||
const particles& particles_;
|
const particles& particles_;
|
||||||
|
|
||||||
|
/// const ref to geometry
|
||||||
const geometry& geometry_;
|
const geometry& geometry_;
|
||||||
|
|
||||||
|
Timer bTimer_;
|
||||||
|
|
||||||
Timer ppTimer_;
|
Timer ppTimer_;
|
||||||
|
|
||||||
Timer pwTimer_;
|
|
||||||
|
|
||||||
dictionary dict_;
|
dictionary dict_;
|
||||||
|
|
||||||
|
virtual
|
||||||
|
bool BroadSearch(
|
||||||
|
const timeInfo& ti,
|
||||||
|
csPairContainerType& ppPairs,
|
||||||
|
csPairContainerType& pwPairs,
|
||||||
|
bool force
|
||||||
|
)=0;
|
||||||
|
|
||||||
|
virtual
|
||||||
|
bool BoundaryBroadSearch(
|
||||||
|
uint32 bndryIndex,
|
||||||
|
const timeInfo& ti,
|
||||||
|
csPairContainerType& ppPairs,
|
||||||
|
csPairContainerType& pwPairs,
|
||||||
|
bool force = false
|
||||||
|
)=0;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
TypeInfo("contactSearch");
|
TypeInfo("contactSearch");
|
||||||
|
@ -82,66 +114,92 @@ public:
|
||||||
(dict, domain, prtcl, geom, timers)
|
(dict, domain, prtcl, geom, timers)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
inline
|
||||||
|
bool performedSearch()const
|
||||||
|
{
|
||||||
|
return performedSearch_;
|
||||||
|
}
|
||||||
|
|
||||||
const auto& dict()const
|
inline
|
||||||
|
bool performedSearchBoundary()const
|
||||||
|
{
|
||||||
|
return performedSearchBoundary_;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline
|
||||||
|
bool performSearch(uint32 iter, bool force = false)const
|
||||||
|
{
|
||||||
|
if((iter-lastUpdated_) % updateInterval_ == 0 || iter == 0 || force )
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool enterBroadSearch(const timeInfo& ti, bool force = false)const
|
||||||
|
{
|
||||||
|
return performSearch(ti.iter(), force);
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual
|
||||||
|
bool enterBroadSearchBoundary(const timeInfo& ti, bool force=false)const = 0;
|
||||||
|
|
||||||
|
inline
|
||||||
|
uint32 updateInterval()const
|
||||||
|
{
|
||||||
|
return updateInterval_;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline
|
||||||
|
const dictionary& dict()const
|
||||||
{
|
{
|
||||||
return dict_;
|
return dict_;
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto& extendedDomainBox()const
|
inline
|
||||||
|
const box& extendedDomainBox()const
|
||||||
{
|
{
|
||||||
return extendedDomainBox_;
|
return extendedDomainBox_;
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto& Particles()const
|
inline
|
||||||
|
const particles& Particles()const
|
||||||
{
|
{
|
||||||
return particles_;
|
return particles_;
|
||||||
}
|
}
|
||||||
|
|
||||||
const pointStructure& pStruct()const;
|
const pointStructure& pStruct()const;
|
||||||
|
|
||||||
const auto& Geometry()const
|
inline
|
||||||
|
const geometry& Geometry()const
|
||||||
{
|
{
|
||||||
return geometry_;
|
return geometry_;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto& ppTimer()
|
inline
|
||||||
|
Timer& ppTimer()
|
||||||
{
|
{
|
||||||
return ppTimer_;
|
return ppTimer_;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto& pwTimer()
|
inline
|
||||||
|
Timer& bTimer()
|
||||||
{
|
{
|
||||||
return pwTimer_;
|
return bTimer_;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual
|
|
||||||
bool broadSearch(
|
bool broadSearch(
|
||||||
uint32 iter,
|
const timeInfo& ti,
|
||||||
real t,
|
|
||||||
real dt,
|
|
||||||
csPairContainerType& ppPairs,
|
csPairContainerType& ppPairs,
|
||||||
csPairContainerType& pwPairs,
|
csPairContainerType& pwPairs,
|
||||||
bool force = false) = 0;
|
bool force = false);
|
||||||
|
|
||||||
virtual
|
|
||||||
bool boundaryBroadSearch(
|
bool boundaryBroadSearch(
|
||||||
uint32 i,
|
uint32 bndryIndex,
|
||||||
uint32 iter,
|
const timeInfo& ti,
|
||||||
real t,
|
|
||||||
real dt,
|
|
||||||
csPairContainerType& ppPairs,
|
csPairContainerType& ppPairs,
|
||||||
csPairContainerType& pwPairs,
|
csPairContainerType& pwPairs,
|
||||||
bool force = false)=0;
|
bool force = false);
|
||||||
|
|
||||||
virtual
|
|
||||||
bool enterBroadSearch(uint32 iter, real t, real dt)const = 0;
|
|
||||||
|
|
||||||
virtual
|
|
||||||
bool performedBroadSearch()const = 0;
|
|
||||||
|
|
||||||
virtual
|
|
||||||
uint32 updateInterval()const = 0;
|
|
||||||
|
|
||||||
virtual
|
virtual
|
||||||
real sizeRatio()const = 0;
|
real sizeRatio()const = 0;
|
||||||
|
|
|
@ -31,18 +31,12 @@ pFlow::particleWallContactSearchs<method>::particleWallContactSearchs
|
||||||
const ViewType1D<real, memory_space> &diam
|
const ViewType1D<real, memory_space> &diam
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
domainBox_(domain),
|
domainBox_(domain)
|
||||||
updateInterval_
|
{}
|
||||||
(
|
|
||||||
max(dict.getValOrSet<uint32>("updateInterval", 1),1u)
|
|
||||||
)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename method>
|
template <typename method>
|
||||||
bool pFlow::particleWallContactSearchs<method>::broadSearch
|
bool pFlow::particleWallContactSearchs<method>::broadSearch
|
||||||
(
|
(
|
||||||
uint32 iter,
|
uint32 iter,
|
||||||
real t,
|
real t,
|
||||||
real dt,
|
real dt,
|
||||||
|
@ -52,11 +46,8 @@ bool pFlow::particleWallContactSearchs<method>::broadSearch
|
||||||
const pFlagTypeDevice& flags,
|
const pFlagTypeDevice& flags,
|
||||||
const deviceViewType1D<real>& diameter,
|
const deviceViewType1D<real>& diameter,
|
||||||
bool force
|
bool force
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
|
||||||
performedSearch_ = false;
|
|
||||||
if( !performSearch(iter, force) ) return true;
|
|
||||||
|
|
||||||
if(!getMethod().impl_broadSearch(
|
if(!getMethod().impl_broadSearch(
|
||||||
ppPairs,
|
ppPairs,
|
||||||
|
@ -71,8 +62,5 @@ bool pFlow::particleWallContactSearchs<method>::broadSearch
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
lastUpdated_ = iter;
|
|
||||||
|
|
||||||
performedSearch_ = true;
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
|
@ -48,18 +48,6 @@ private:
|
||||||
/// @brief box enclosing the simulation domain (local to processor)
|
/// @brief box enclosing the simulation domain (local to processor)
|
||||||
box domainBox_;
|
box domainBox_;
|
||||||
|
|
||||||
/*/// @brief box enclosing the area for contact search (region with points)
|
|
||||||
box searchBox_;*/
|
|
||||||
|
|
||||||
/// @brief update interval in terms of iteration numebr
|
|
||||||
uint32 updateInterval_= 1;
|
|
||||||
|
|
||||||
/// @brief last iteration number which contact search has been performed
|
|
||||||
uint32 lastUpdated_ = 0;
|
|
||||||
|
|
||||||
/// @brief performed search?
|
|
||||||
bool performedSearch_ = false;
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
inline
|
inline
|
||||||
|
@ -99,25 +87,6 @@ public:
|
||||||
bool force = false
|
bool force = false
|
||||||
);
|
);
|
||||||
|
|
||||||
bool performedSearch()const
|
|
||||||
{
|
|
||||||
return performedSearch_;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool performSearch(uint32 iter, bool force = false)const
|
|
||||||
{
|
|
||||||
if((iter-lastUpdated_) % updateInterval_ == 0 || iter == 0 || force )
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32 updateInterval()const
|
|
||||||
{
|
|
||||||
return updateInterval_;
|
|
||||||
}
|
|
||||||
|
|
||||||
real sizeRatio()const
|
real sizeRatio()const
|
||||||
{
|
{
|
||||||
return getMethod().sizeRatio();
|
return getMethod().sizeRatio();
|
||||||
|
|
|
@ -165,7 +165,7 @@ public:
|
||||||
{
|
{
|
||||||
|
|
||||||
pOutput<<"Function (hearChanges in boundarySphereInteractions)is not implmented Message "<<
|
pOutput<<"Function (hearChanges in boundarySphereInteractions)is not implmented Message "<<
|
||||||
msg <<endl<<" name "<< this->name() <<" type "<< this->type()<<endl;;
|
msg <<endl<<" name "<< this->boundaryName() <<" type "<< this->type()<<endl;;
|
||||||
//notImplementedFunction;
|
//notImplementedFunction;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -134,18 +134,22 @@ pFlow::sphereInteraction<cFM,gMM, cLT>::sphereInteraction
|
||||||
geometryMotion_(dynamic_cast<const GeometryMotionModel&>(geom)),
|
geometryMotion_(dynamic_cast<const GeometryMotionModel&>(geom)),
|
||||||
sphParticles_(dynamic_cast<const sphereParticles&>(prtcl)),
|
sphParticles_(dynamic_cast<const sphereParticles&>(prtcl)),
|
||||||
boundaryInteraction_(sphParticles_,geometryMotion_),
|
boundaryInteraction_(sphParticles_,geometryMotion_),
|
||||||
ppInteractionTimer_("sphere-sphere interaction", &this->timers()),
|
ppInteractionTimer_("sphere-sphere interaction (internal)", &this->timers()),
|
||||||
pwInteractionTimer_("sphere-wall interaction", &this->timers()),
|
pwInteractionTimer_("sphere-wall interaction (internal)", &this->timers()),
|
||||||
contactListMangementTimer_("contact-list management", &this->timers()),
|
boundaryInteractionTimer_("sphere-sphere interaction (boundary)",&this->timers()),
|
||||||
boundaryContactSearchTimer_("contact search for boundary", &this->timers()),
|
contactListMangementTimer_("list management (interal)", &this->timers()),
|
||||||
boundaryInteractionTimer_("interaction for boundary", &this->timers()),
|
contactListMangementBoundaryTimer_("list management (boundary)", &this->timers())
|
||||||
contactListBoundaryTimer_("contact-list management for boundary", &this->timers())
|
|
||||||
{
|
{
|
||||||
|
|
||||||
if(!createSphereInteraction())
|
if(!createSphereInteraction())
|
||||||
{
|
{
|
||||||
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>
|
||||||
|
@ -158,45 +162,55 @@ template<typename cFM,typename gMM,template <class, class, class> class cLT>
|
||||||
bool pFlow::sphereInteraction<cFM,gMM, cLT>::iterate()
|
bool pFlow::sphereInteraction<cFM,gMM, cLT>::iterate()
|
||||||
{
|
{
|
||||||
|
|
||||||
auto iter = this->currentIter();
|
timeInfo ti = this->TimeInfo();
|
||||||
auto t = this->currentTime();
|
auto iter = ti.iter();
|
||||||
auto dt = this->dt();
|
auto t = ti.t();
|
||||||
|
auto dt = ti.dt();
|
||||||
|
|
||||||
|
auto& contactSearchRef = contactSearch_();
|
||||||
|
|
||||||
bool broadSearch = contactSearch_().enterBroadSearch(iter, t, dt);
|
bool broadSearch = contactSearchRef.enterBroadSearch(ti);
|
||||||
|
bool broadSearchBoundary = contactSearchRef.enterBroadSearchBoundary(ti);
|
||||||
|
|
||||||
|
/// update boundaries of the fields that are being used by inreaction
|
||||||
sphParticles_.diameter().updateBoundaries(DataDirection::SlaveToMaster);
|
sphParticles_.diameter().updateBoundaries(DataDirection::SlaveToMaster);
|
||||||
sphParticles_.velocity().updateBoundaries(DataDirection::SlaveToMaster);
|
sphParticles_.velocity().updateBoundaries(DataDirection::SlaveToMaster);
|
||||||
sphParticles_.rVelocity().updateBoundaries(DataDirection::SlaveToMaster);
|
sphParticles_.rVelocity().updateBoundaries(DataDirection::SlaveToMaster);
|
||||||
sphParticles_.mass().updateBoundaries(DataDirection::SlaveToMaster);
|
|
||||||
sphParticles_.I().updateBoundaries(DataDirection::SlaveToMaster);
|
|
||||||
sphParticles_.propertyId().updateBoundaries(DataDirection::SlaveToMaster);
|
sphParticles_.propertyId().updateBoundaries(DataDirection::SlaveToMaster);
|
||||||
|
|
||||||
|
/// lists
|
||||||
if(broadSearch)
|
if(broadSearch)
|
||||||
{
|
{
|
||||||
contactListMangementTimer_.start();
|
contactListMangementTimer_.start();
|
||||||
|
ComputationTimer().start();
|
||||||
ppContactList_().beforeBroadSearch();
|
ppContactList_().beforeBroadSearch();
|
||||||
pwContactList_().beforeBroadSearch();
|
pwContactList_().beforeBroadSearch();
|
||||||
|
ComputationTimer().end();
|
||||||
contactListMangementTimer_.pause();
|
contactListMangementTimer_.pause();
|
||||||
}
|
}
|
||||||
|
|
||||||
contactListBoundaryTimer_.start();
|
if(broadSearchBoundary)
|
||||||
|
{
|
||||||
|
contactListMangementBoundaryTimer_.start();
|
||||||
|
ComputationTimer().start();
|
||||||
for(uint32 i=0; i<6u; i++)
|
for(uint32 i=0; i<6u; i++)
|
||||||
|
{
|
||||||
|
if(activeBoundaries_[i])
|
||||||
{
|
{
|
||||||
auto& BI = boundaryInteraction_[i];
|
auto& BI = boundaryInteraction_[i];
|
||||||
if(BI.ppPairsAllocated()) BI.ppPairs().beforeBroadSearch();
|
BI.ppPairs().beforeBroadSearch();
|
||||||
if(BI.pwPairsAllocated()) BI.pwPairs().beforeBroadSearch();
|
BI.pwPairs().beforeBroadSearch();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ComputationTimer().end();
|
||||||
|
contactListMangementBoundaryTimer_.pause();
|
||||||
}
|
}
|
||||||
contactListBoundaryTimer_.pause();
|
|
||||||
|
|
||||||
if( sphParticles_.numActive()<=0)return true;
|
if( sphParticles_.numActive()<=0)return true;
|
||||||
|
|
||||||
|
ComputationTimer().start();
|
||||||
if( !contactSearch_().broadSearch(
|
if( !contactSearchRef.broadSearch(
|
||||||
iter,
|
ti,
|
||||||
t,
|
|
||||||
dt,
|
|
||||||
ppContactList_(),
|
ppContactList_(),
|
||||||
pwContactList_()) )
|
pwContactList_()) )
|
||||||
{
|
{
|
||||||
|
@ -205,19 +219,17 @@ bool pFlow::sphereInteraction<cFM,gMM, cLT>::iterate()
|
||||||
fatalExit;
|
fatalExit;
|
||||||
}
|
}
|
||||||
|
|
||||||
boundaryContactSearchTimer_.start();
|
|
||||||
for(uint32 i=0; i<6u; i++)
|
for(uint32 i=0; i<6u; i++)
|
||||||
{
|
{
|
||||||
auto& BI =boundaryInteraction_[i];
|
if(activeBoundaries_[i])
|
||||||
if(BI.ppPairsAllocated())
|
|
||||||
{
|
{
|
||||||
if( !contactSearch_().boundaryBroadSearch(
|
auto& BI = boundaryInteraction_[i];
|
||||||
|
if(!contactSearchRef.boundaryBroadSearch(
|
||||||
i,
|
i,
|
||||||
iter,
|
ti,
|
||||||
t,
|
|
||||||
dt,
|
|
||||||
BI.ppPairs(),
|
BI.ppPairs(),
|
||||||
BI.pwPairs()))
|
BI.pwPairs())
|
||||||
|
)
|
||||||
{
|
{
|
||||||
fatalErrorInFunction<<
|
fatalErrorInFunction<<
|
||||||
"failed to perform broadSearch for boundary index "<<i<<endl;
|
"failed to perform broadSearch for boundary index "<<i<<endl;
|
||||||
|
@ -225,42 +237,46 @@ bool pFlow::sphereInteraction<cFM,gMM, cLT>::iterate()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
boundaryContactSearchTimer_.end();
|
ComputationTimer().end();
|
||||||
|
|
||||||
if(broadSearch && contactSearch_().performedBroadSearch())
|
if(broadSearch && contactSearchRef.performedSearch())
|
||||||
{
|
{
|
||||||
contactListMangementTimer_.resume();
|
contactListMangementTimer_.resume();
|
||||||
|
ComputationTimer().start();
|
||||||
ppContactList_().afterBroadSearch();
|
ppContactList_().afterBroadSearch();
|
||||||
pwContactList_().afterBroadSearch();
|
pwContactList_().afterBroadSearch();
|
||||||
|
ComputationTimer().end();
|
||||||
contactListMangementTimer_.end();
|
contactListMangementTimer_.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
contactListBoundaryTimer_.resume();
|
if(broadSearchBoundary && contactSearchRef.performedSearchBoundary())
|
||||||
|
{
|
||||||
|
contactListMangementBoundaryTimer_.resume();
|
||||||
|
ComputationTimer().start();
|
||||||
for(uint32 i=0; i<6u; i++)
|
for(uint32 i=0; i<6u; i++)
|
||||||
|
{
|
||||||
|
if(activeBoundaries_[i])
|
||||||
{
|
{
|
||||||
auto& BI = boundaryInteraction_[i];
|
auto& BI = boundaryInteraction_[i];
|
||||||
if(BI.ppPairsAllocated()) BI.ppPairs().afterBroadSearch();
|
BI.ppPairs().afterBroadSearch();
|
||||||
if(BI.pwPairsAllocated()) BI.pwPairs().afterBroadSearch();
|
BI.pwPairs().afterBroadSearch();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ComputationTimer().end();
|
||||||
|
contactListMangementBoundaryTimer_.end();
|
||||||
}
|
}
|
||||||
contactListBoundaryTimer_.end();
|
|
||||||
|
|
||||||
|
/// peform contact search on boundareis with active contact search (master boundaries)
|
||||||
{
|
auto requireStep = boundariesMask<6>(true);
|
||||||
boundaryInteractionTimer_.start();
|
|
||||||
std::array<bool,6> requireStep{
|
|
||||||
boundaryInteraction_[0].isBoundaryMaster(),
|
|
||||||
boundaryInteraction_[1].isBoundaryMaster(),
|
|
||||||
boundaryInteraction_[2].isBoundaryMaster(),
|
|
||||||
boundaryInteraction_[3].isBoundaryMaster(),
|
|
||||||
boundaryInteraction_[4].isBoundaryMaster(),
|
|
||||||
boundaryInteraction_[5].isBoundaryMaster()};
|
|
||||||
int step = 1;
|
|
||||||
const auto& cfModel = this->forceModel_();
|
const auto& cfModel = this->forceModel_();
|
||||||
while( std::any_of(requireStep.begin(), requireStep.end(), [](bool v) { return v==true; }))
|
uint32 step=1;
|
||||||
|
boundaryInteractionTimer_.start();
|
||||||
|
ComputationTimer().start();
|
||||||
|
while(requireStep.anyElement(true) && step <= 10)
|
||||||
{
|
{
|
||||||
for(uint32 i=0; i<6u; i++)
|
for(uint32 i=0; i<6u; i++)
|
||||||
{
|
{
|
||||||
if(step==1u || requireStep[i] )
|
if(requireStep[i] )
|
||||||
{
|
{
|
||||||
requireStep[i] = boundaryInteraction_[i].sphereSphereInteraction(
|
requireStep[i] = boundaryInteraction_[i].sphereSphereInteraction(
|
||||||
dt,
|
dt,
|
||||||
|
@ -271,30 +287,31 @@ bool pFlow::sphereInteraction<cFM,gMM, cLT>::iterate()
|
||||||
}
|
}
|
||||||
step++;
|
step++;
|
||||||
}
|
}
|
||||||
|
ComputationTimer().end();
|
||||||
boundaryInteractionTimer_.pause();
|
boundaryInteractionTimer_.pause();
|
||||||
}
|
|
||||||
|
|
||||||
ppInteractionTimer_.start();
|
ppInteractionTimer_.start();
|
||||||
|
ComputationTimer().start();
|
||||||
sphereSphereInteraction();
|
sphereSphereInteraction();
|
||||||
|
ComputationTimer().end();
|
||||||
ppInteractionTimer_.end();
|
ppInteractionTimer_.end();
|
||||||
|
|
||||||
|
|
||||||
pwInteractionTimer_.start();
|
pwInteractionTimer_.start();
|
||||||
|
ComputationTimer().start();
|
||||||
sphereWallInteraction();
|
sphereWallInteraction();
|
||||||
|
ComputationTimer().start();
|
||||||
pwInteractionTimer_.end();
|
pwInteractionTimer_.end();
|
||||||
|
|
||||||
{
|
{
|
||||||
boundaryInteractionTimer_.resume();
|
boundaryInteractionTimer_.resume();
|
||||||
std::array<bool,6> requireStep{
|
ComputationTimer().start();
|
||||||
!boundaryInteraction_[0].isBoundaryMaster(),
|
auto requireStep = boundariesMask<6>(true);
|
||||||
!boundaryInteraction_[1].isBoundaryMaster(),
|
|
||||||
!boundaryInteraction_[2].isBoundaryMaster(),
|
|
||||||
!boundaryInteraction_[3].isBoundaryMaster(),
|
|
||||||
!boundaryInteraction_[4].isBoundaryMaster(),
|
|
||||||
!boundaryInteraction_[5].isBoundaryMaster()};
|
|
||||||
|
|
||||||
int step = 2;
|
uint32 step = 11;
|
||||||
const auto& cfModel = this->forceModel_();
|
const auto& cfModel = this->forceModel_();
|
||||||
while(std::any_of(requireStep.begin(), requireStep.end(), [](bool v) { return v==true; }))
|
while( requireStep.anyElement(true) && step < 20 )
|
||||||
{
|
{
|
||||||
for(uint32 i=0; i<6u; i++)
|
for(uint32 i=0; i<6u; i++)
|
||||||
{
|
{
|
||||||
|
@ -302,13 +319,14 @@ bool pFlow::sphereInteraction<cFM,gMM, cLT>::iterate()
|
||||||
{
|
{
|
||||||
requireStep[i] = boundaryInteraction_[i].sphereSphereInteraction(
|
requireStep[i] = boundaryInteraction_[i].sphereSphereInteraction(
|
||||||
dt,
|
dt,
|
||||||
this->forceModel_(),
|
cfModel,
|
||||||
step
|
step
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
step++;
|
step++;
|
||||||
}
|
}
|
||||||
|
ComputationTimer().end();
|
||||||
boundaryInteractionTimer_.end();
|
boundaryInteractionTimer_.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -337,4 +355,3 @@ bool pFlow::sphereInteraction<cFM,gMM, cLT>::hearChanges
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,6 +25,8 @@ Licence:
|
||||||
#include "sphereParticles.hpp"
|
#include "sphereParticles.hpp"
|
||||||
#include "boundarySphereInteractionList.hpp"
|
#include "boundarySphereInteractionList.hpp"
|
||||||
#include "sphereInteractionKernels.hpp"
|
#include "sphereInteractionKernels.hpp"
|
||||||
|
#include "boundariesMask.hpp"
|
||||||
|
#include "MPITimer.hpp"
|
||||||
//#include "unsortedContactList.hpp"
|
//#include "unsortedContactList.hpp"
|
||||||
|
|
||||||
|
|
||||||
|
@ -74,6 +76,9 @@ private:
|
||||||
/// particle-particle and particle-wall interactions at boundaries
|
/// particle-particle and particle-wall interactions at boundaries
|
||||||
BoundaryListType boundaryInteraction_;
|
BoundaryListType boundaryInteraction_;
|
||||||
|
|
||||||
|
/// a mask for active boundaries (boundaries with intreaction)
|
||||||
|
boundariesMask<6> activeBoundaries_;
|
||||||
|
|
||||||
/// contact search object for pp and pw interactions
|
/// contact search object for pp and pw interactions
|
||||||
uniquePtr<contactSearch> contactSearch_ = nullptr;
|
uniquePtr<contactSearch> contactSearch_ = nullptr;
|
||||||
|
|
||||||
|
@ -93,14 +98,13 @@ private:
|
||||||
/// timer for particle-wall interaction computations
|
/// timer for particle-wall interaction computations
|
||||||
Timer pwInteractionTimer_;
|
Timer pwInteractionTimer_;
|
||||||
|
|
||||||
/// timer for managing contact lists (only inernal points)
|
|
||||||
Timer contactListMangementTimer_;
|
|
||||||
|
|
||||||
Timer boundaryContactSearchTimer_;
|
|
||||||
/// timer for boundary interaction time
|
/// timer for boundary interaction time
|
||||||
Timer boundaryInteractionTimer_;
|
Timer boundaryInteractionTimer_;
|
||||||
|
|
||||||
Timer contactListBoundaryTimer_;
|
/// timer for managing contact lists (only inernal points)
|
||||||
|
Timer contactListMangementTimer_;
|
||||||
|
|
||||||
|
Timer contactListMangementBoundaryTimer_;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -110,10 +114,6 @@ private:
|
||||||
|
|
||||||
bool sphereWallInteraction();
|
bool sphereWallInteraction();
|
||||||
|
|
||||||
//bool managePPContactLists();
|
|
||||||
|
|
||||||
//bool managePWContactLists();
|
|
||||||
|
|
||||||
/// range policy for p-p interaction execution
|
/// range policy for p-p interaction execution
|
||||||
using rpPPInteraction =
|
using rpPPInteraction =
|
||||||
Kokkos::RangePolicy<Kokkos::IndexType<uint32>, Kokkos::Schedule<Kokkos::Dynamic>>;
|
Kokkos::RangePolicy<Kokkos::IndexType<uint32>, Kokkos::Schedule<Kokkos::Dynamic>>;
|
||||||
|
|
|
@ -9,6 +9,8 @@ particles/regularParticleIdHandler/regularParticleIdHandler.cpp
|
||||||
SphereParticles/sphereShape/sphereShape.cpp
|
SphereParticles/sphereShape/sphereShape.cpp
|
||||||
SphereParticles/sphereParticles/sphereParticles.cpp
|
SphereParticles/sphereParticles/sphereParticles.cpp
|
||||||
SphereParticles/sphereParticles/sphereParticlesKernels.cpp
|
SphereParticles/sphereParticles/sphereParticlesKernels.cpp
|
||||||
|
SphereParticles/boundarySphereParticles.cpp
|
||||||
|
SphereParticles/boundarySphereParticlesList.cpp
|
||||||
Insertion/collisionCheck/collisionCheck.cpp
|
Insertion/collisionCheck/collisionCheck.cpp
|
||||||
Insertion/insertionRegion/insertionRegion.cpp
|
Insertion/insertionRegion/insertionRegion.cpp
|
||||||
Insertion/insertion/insertion.cpp
|
Insertion/insertion/insertion.cpp
|
||||||
|
@ -18,7 +20,8 @@ Insertion/Insertion/Insertions.cpp
|
||||||
|
|
||||||
if(pFlow_Build_MPI)
|
if(pFlow_Build_MPI)
|
||||||
list(APPEND SourceFiles
|
list(APPEND SourceFiles
|
||||||
particles/MPIParticleIdHandler/MPIParticleIdHandler.cpp)
|
particles/MPIParticleIdHandler/MPIParticleIdHandler.cpp
|
||||||
|
SphereParticles/processorBoundarySphereParticles.cpp)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(link_libs Kokkos::kokkos phasicFlow Integration Property)
|
set(link_libs Kokkos::kokkos phasicFlow Integration Property)
|
||||||
|
|
|
@ -0,0 +1,64 @@
|
||||||
|
#include "boundarySphereParticles.hpp"
|
||||||
|
#include "boundaryBase.hpp"
|
||||||
|
#include "sphereParticles.hpp"
|
||||||
|
|
||||||
|
|
||||||
|
pFlow::boundarySphereParticles::boundarySphereParticles(
|
||||||
|
const boundaryBase &boundary,
|
||||||
|
sphereParticles &prtcls
|
||||||
|
)
|
||||||
|
:
|
||||||
|
generalBoundary(boundary, prtcls.pStruct(), "", ""),
|
||||||
|
particles_(prtcls)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
pFlow::sphereParticles &pFlow::boundarySphereParticles::Particles()
|
||||||
|
{
|
||||||
|
return particles_;
|
||||||
|
}
|
||||||
|
|
||||||
|
const pFlow::sphereParticles &pFlow::boundarySphereParticles::Particles() const
|
||||||
|
{
|
||||||
|
return particles_;
|
||||||
|
}
|
||||||
|
|
||||||
|
pFlow::uniquePtr<pFlow::boundarySphereParticles> pFlow::boundarySphereParticles::create(
|
||||||
|
const boundaryBase &boundary,
|
||||||
|
sphereParticles &prtcls
|
||||||
|
)
|
||||||
|
{
|
||||||
|
|
||||||
|
word bType = angleBracketsNames2(
|
||||||
|
"boundarySphereParticles",
|
||||||
|
pFlowProcessors().localRunTypeName(),
|
||||||
|
boundary.type());
|
||||||
|
|
||||||
|
word altBType{"boundarySphereParticles<none>"};
|
||||||
|
|
||||||
|
if( boundaryBasevCtorSelector_.search(bType) )
|
||||||
|
{
|
||||||
|
pOutput.space(4)<<"Creating boundary "<< Green_Text(bType)<<
|
||||||
|
" for "<<boundary.name()<<endl;
|
||||||
|
return boundaryBasevCtorSelector_[bType](boundary, prtcls);
|
||||||
|
}
|
||||||
|
else if(boundaryBasevCtorSelector_.search(altBType))
|
||||||
|
{
|
||||||
|
pOutput.space(4)<<"Creating boundary "<< Green_Text(altBType)<<
|
||||||
|
" for "<<boundary.name()<<endl;
|
||||||
|
return boundaryBasevCtorSelector_[altBType](boundary, prtcls);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
printKeys(
|
||||||
|
fatalError << "Ctor Selector "<< bType<<
|
||||||
|
" and "<< altBType << " do not exist. \n"
|
||||||
|
<<"Avaiable ones are: \n",
|
||||||
|
boundaryBasevCtorSelector_
|
||||||
|
);
|
||||||
|
fatalExit;
|
||||||
|
}
|
||||||
|
|
||||||
|
return nullptr;
|
||||||
|
}
|
|
@ -0,0 +1,80 @@
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef __boundarySphereParticles_hpp__
|
||||||
|
#define __boundarySphereParticles_hpp__
|
||||||
|
|
||||||
|
#include "generalBoundary.hpp"
|
||||||
|
#include "virtualConstructor.hpp"
|
||||||
|
#include "timeInfo.hpp"
|
||||||
|
|
||||||
|
namespace pFlow
|
||||||
|
{
|
||||||
|
|
||||||
|
class sphereParticles;
|
||||||
|
|
||||||
|
class boundarySphereParticles
|
||||||
|
: public generalBoundary
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
|
||||||
|
sphereParticles& particles_;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
/// type info
|
||||||
|
TypeInfo("boundarySphereParticles<none>");
|
||||||
|
|
||||||
|
boundarySphereParticles(
|
||||||
|
const boundaryBase &boundary,
|
||||||
|
sphereParticles& prtcls
|
||||||
|
);
|
||||||
|
|
||||||
|
create_vCtor(
|
||||||
|
boundarySphereParticles,
|
||||||
|
boundaryBase,
|
||||||
|
(
|
||||||
|
const boundaryBase &boundary,
|
||||||
|
sphereParticles& prtcls
|
||||||
|
),
|
||||||
|
(boundary, prtcls)
|
||||||
|
);
|
||||||
|
|
||||||
|
add_vCtor(
|
||||||
|
boundarySphereParticles,
|
||||||
|
boundarySphereParticles,
|
||||||
|
boundaryBase
|
||||||
|
);
|
||||||
|
|
||||||
|
sphereParticles& Particles();
|
||||||
|
|
||||||
|
const sphereParticles& Particles()const;
|
||||||
|
|
||||||
|
bool hearChanges(
|
||||||
|
real t,
|
||||||
|
real dt,
|
||||||
|
uint32 iter,
|
||||||
|
const message &msg,
|
||||||
|
const anyList &varList) override
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual
|
||||||
|
bool acceleration(const timeInfo& ti, const realx3& g)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
static
|
||||||
|
uniquePtr<boundarySphereParticles> create(
|
||||||
|
const boundaryBase &boundary,
|
||||||
|
sphereParticles& prtcls);
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1,19 @@
|
||||||
|
#include "boundarySphereParticlesList.hpp"
|
||||||
|
|
||||||
|
pFlow::boundarySphereParticlesList::boundarySphereParticlesList(
|
||||||
|
const boundaryList &bndrs,
|
||||||
|
sphereParticles &prtcls
|
||||||
|
)
|
||||||
|
:
|
||||||
|
ListPtr(bndrs.size()),
|
||||||
|
boundaries_(bndrs)
|
||||||
|
{
|
||||||
|
for(auto i=0; i<boundaries_.size(); i++)
|
||||||
|
{
|
||||||
|
this->set
|
||||||
|
(
|
||||||
|
i,
|
||||||
|
boundarySphereParticles::create(boundaries_[i], prtcls)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,36 @@
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef __boundarySphereParticlesList_hpp__
|
||||||
|
#define __boundarySphereParticlesList_hpp__
|
||||||
|
|
||||||
|
#include "ListPtr.hpp"
|
||||||
|
#include "boundaryList.hpp"
|
||||||
|
#include "boundarySphereParticles.hpp"
|
||||||
|
|
||||||
|
namespace pFlow
|
||||||
|
{
|
||||||
|
|
||||||
|
class boundarySphereParticlesList
|
||||||
|
:
|
||||||
|
public ListPtr<boundarySphereParticles>
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
|
||||||
|
const boundaryList& boundaries_;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
boundarySphereParticlesList(
|
||||||
|
const boundaryList& bndrs,
|
||||||
|
sphereParticles& prtcls
|
||||||
|
);
|
||||||
|
|
||||||
|
~boundarySphereParticlesList()=default;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
|
@ -384,6 +384,11 @@ pFlow::sphereParticles::sphereParticles(
|
||||||
dynPointStruct(),
|
dynPointStruct(),
|
||||||
zero3
|
zero3
|
||||||
),
|
),
|
||||||
|
boundarySphereParticles_
|
||||||
|
(
|
||||||
|
dynPointStruct().boundaries(),
|
||||||
|
*this
|
||||||
|
),
|
||||||
accelerationTimer_(
|
accelerationTimer_(
|
||||||
"Acceleration", &this->timers() ),
|
"Acceleration", &this->timers() ),
|
||||||
intPredictTimer_(
|
intPredictTimer_(
|
||||||
|
@ -523,6 +528,7 @@ bool pFlow::sphereParticles::beforeIteration()
|
||||||
I_.updateBoundariesSlaveToMasterIfRequested();
|
I_.updateBoundariesSlaveToMasterIfRequested();
|
||||||
rVelocity_.updateBoundariesSlaveToMasterIfRequested();
|
rVelocity_.updateBoundariesSlaveToMasterIfRequested();
|
||||||
rAcceleration_.updateBoundariesSlaveToMasterIfRequested();
|
rAcceleration_.updateBoundariesSlaveToMasterIfRequested();
|
||||||
|
rVelIntegration_().updateBoundariesSlaveToMasterIfRequested();
|
||||||
fieldUpdateTimer_.end();
|
fieldUpdateTimer_.end();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -531,10 +537,13 @@ bool pFlow::sphereParticles::beforeIteration()
|
||||||
bool pFlow::sphereParticles::iterate()
|
bool pFlow::sphereParticles::iterate()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
timeInfo ti = TimeInfo();
|
||||||
|
realx3 g = control().g();
|
||||||
|
|
||||||
particles::iterate();
|
particles::iterate();
|
||||||
accelerationTimer_.start();
|
accelerationTimer_.start();
|
||||||
pFlow::sphereParticlesKernels::acceleration(
|
pFlow::sphereParticlesKernels::acceleration(
|
||||||
control().g(),
|
g,
|
||||||
mass().deviceViewAll(),
|
mass().deviceViewAll(),
|
||||||
contactForce().deviceViewAll(),
|
contactForce().deviceViewAll(),
|
||||||
I().deviceViewAll(),
|
I().deviceViewAll(),
|
||||||
|
@ -543,6 +552,10 @@ bool pFlow::sphereParticles::iterate()
|
||||||
accelertion().deviceViewAll(),
|
accelertion().deviceViewAll(),
|
||||||
rAcceleration().deviceViewAll()
|
rAcceleration().deviceViewAll()
|
||||||
);
|
);
|
||||||
|
for(auto& bndry:boundarySphereParticles_)
|
||||||
|
{
|
||||||
|
bndry->acceleration(ti, g);
|
||||||
|
}
|
||||||
accelerationTimer_.end();
|
accelerationTimer_.end();
|
||||||
|
|
||||||
intCorrectTimer_.start();
|
intCorrectTimer_.start();
|
||||||
|
|
|
@ -33,6 +33,7 @@ Licence:
|
||||||
#include "particles.hpp"
|
#include "particles.hpp"
|
||||||
#include "property.hpp"
|
#include "property.hpp"
|
||||||
#include "sphereShape.hpp"
|
#include "sphereShape.hpp"
|
||||||
|
#include "boundarySphereParticlesList.hpp"
|
||||||
#include "systemControl.hpp"
|
#include "systemControl.hpp"
|
||||||
|
|
||||||
namespace pFlow
|
namespace pFlow
|
||||||
|
@ -67,6 +68,9 @@ private:
|
||||||
/// pointField of rotational acceleration of particles on device
|
/// pointField of rotational acceleration of particles on device
|
||||||
realx3PointField_D rAcceleration_;
|
realx3PointField_D rAcceleration_;
|
||||||
|
|
||||||
|
/// boundaries
|
||||||
|
boundarySphereParticlesList boundarySphereParticles_;
|
||||||
|
|
||||||
/// rotational velocity integrator
|
/// rotational velocity integrator
|
||||||
uniquePtr<integration> rVelIntegration_ = nullptr;
|
uniquePtr<integration> rVelIntegration_ = nullptr;
|
||||||
|
|
||||||
|
|
|
@ -85,6 +85,8 @@ bool pFlow::dynamicPointStructure::beforeIteration()
|
||||||
if(!pointStructure::beforeIteration())return false;
|
if(!pointStructure::beforeIteration())return false;
|
||||||
velocityUpdateTimer_.start();
|
velocityUpdateTimer_.start();
|
||||||
velocity_.updateBoundariesSlaveToMasterIfRequested();
|
velocity_.updateBoundariesSlaveToMasterIfRequested();
|
||||||
|
integrationPos_->updateBoundariesSlaveToMasterIfRequested();
|
||||||
|
integrationVel_->updateBoundariesSlaveToMasterIfRequested();
|
||||||
velocityUpdateTimer_.end();
|
velocityUpdateTimer_.end();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -118,7 +120,7 @@ bool pFlow::dynamicPointStructure::correct
|
||||||
{
|
{
|
||||||
//auto& pos = pStruct().pointPosition();
|
//auto& pos = pStruct().pointPosition();
|
||||||
|
|
||||||
if(!integrationPos_().correct(dt, pointPosition(), velocity_) )return false;
|
if(!integrationPos_().correctPStruct(dt, *this, velocity_) )return false;
|
||||||
|
|
||||||
if(!integrationVel_().correct(dt, velocity_, acceleration))return false;
|
if(!integrationVel_().correct(dt, velocity_, acceleration))return false;
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,8 @@ globals/globalSettings.cpp
|
||||||
processors/processors.cpp
|
processors/processors.cpp
|
||||||
processors/localProcessors.cpp
|
processors/localProcessors.cpp
|
||||||
processors/pFlowProcessors.cpp
|
processors/pFlowProcessors.cpp
|
||||||
|
processors/MPITimer.cpp
|
||||||
|
|
||||||
|
|
||||||
streams/token/tokenIO.cpp
|
streams/token/tokenIO.cpp
|
||||||
streams/token/token.cpp
|
streams/token/token.cpp
|
||||||
|
|
|
@ -22,7 +22,17 @@ Licence:
|
||||||
#include "Timers.hpp"
|
#include "Timers.hpp"
|
||||||
#include "streams.hpp"
|
#include "streams.hpp"
|
||||||
|
|
||||||
pFlow::Timer::Timer(const word& name, Timers* parrent)
|
pFlow::real pFlow::Timer::averageTimeMax() const
|
||||||
|
{
|
||||||
|
return 0.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
pFlow::real pFlow::Timer::accTimersTotalMax() const
|
||||||
|
{
|
||||||
|
return 0.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
pFlow::Timer::Timer(const word &name, Timers *parrent)
|
||||||
: name_(name),
|
: name_(name),
|
||||||
parrent_(parrent)
|
parrent_(parrent)
|
||||||
{
|
{
|
||||||
|
|
|
@ -22,7 +22,6 @@ Licence:
|
||||||
#define __Timerr_hpp__
|
#define __Timerr_hpp__
|
||||||
|
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
|
|
||||||
#include "types.hpp"
|
#include "types.hpp"
|
||||||
|
|
||||||
namespace pFlow
|
namespace pFlow
|
||||||
|
@ -33,7 +32,7 @@ class Timers;
|
||||||
|
|
||||||
class Timer
|
class Timer
|
||||||
{
|
{
|
||||||
protected:
|
private:
|
||||||
|
|
||||||
using timer = std::chrono::high_resolution_clock;
|
using timer = std::chrono::high_resolution_clock;
|
||||||
|
|
||||||
|
@ -59,6 +58,12 @@ protected:
|
||||||
/// @brief parrent of timer
|
/// @brief parrent of timer
|
||||||
Timers* parrent_ = nullptr;
|
Timers* parrent_ = nullptr;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
real averageTimeMax()const;
|
||||||
|
|
||||||
|
real accTimersTotalMax()const;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
TypeInfo("Timer");
|
TypeInfo("Timer");
|
||||||
|
@ -91,12 +96,19 @@ public:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Timers* parrent()const
|
||||||
|
{
|
||||||
|
return parrent_;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline
|
||||||
void start()
|
void start()
|
||||||
{
|
{
|
||||||
start_ = timer::now();
|
start_ = timer::now();
|
||||||
stepAccTime_ = 0;
|
stepAccTime_ = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline
|
||||||
void pause()
|
void pause()
|
||||||
{
|
{
|
||||||
auto end = timer::now();
|
auto end = timer::now();
|
||||||
|
@ -107,11 +119,13 @@ public:
|
||||||
.count();
|
.count();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline
|
||||||
void resume()
|
void resume()
|
||||||
{
|
{
|
||||||
start_ = timer::now();
|
start_ = timer::now();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline
|
||||||
void end()
|
void end()
|
||||||
{
|
{
|
||||||
pause();
|
pause();
|
||||||
|
@ -121,27 +135,32 @@ public:
|
||||||
accTime_ += lastTime_;
|
accTime_ += lastTime_;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool timerActive() const
|
inline
|
||||||
|
bool timerActive() const
|
||||||
{
|
{
|
||||||
return numIteration_ != 0;
|
return numIteration_ != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline real lastTime() const
|
inline
|
||||||
|
real lastTime() const
|
||||||
{
|
{
|
||||||
return lastTime_;
|
return lastTime_;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline real totalTime() const
|
inline
|
||||||
|
real totalTime() const
|
||||||
{
|
{
|
||||||
return accTime_;
|
return accTime_;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline real averageTime() const
|
inline
|
||||||
|
real averageTime() const
|
||||||
{
|
{
|
||||||
return accTime_ / max(numIteration_, 1);
|
return accTime_ / max(numIteration_, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual real accTimersTotal() const
|
virtual
|
||||||
|
real accTimersTotal() const
|
||||||
{
|
{
|
||||||
return totalTime();
|
return totalTime();
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,6 @@ Licence:
|
||||||
#define __Timerss_hpp__
|
#define __Timerss_hpp__
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#include "List.hpp"
|
#include "List.hpp"
|
||||||
#include "Timer.hpp"
|
#include "Timer.hpp"
|
||||||
|
|
||||||
|
@ -54,9 +53,9 @@ public:
|
||||||
:
|
:
|
||||||
Timer(name, parrent)
|
Timer(name, parrent)
|
||||||
{
|
{
|
||||||
if(parrent_)
|
if(parrent)
|
||||||
{
|
{
|
||||||
level_ = parrent_->level()+1;
|
level_ = parrent->level()+1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,16 +21,12 @@ Licence:
|
||||||
template<class T, class MemorySpace>
|
template<class T, class MemorySpace>
|
||||||
bool pFlow::Field<T, MemorySpace>::read
|
bool pFlow::Field<T, MemorySpace>::read
|
||||||
(
|
(
|
||||||
iIstream& is,
|
iIstream& is
|
||||||
bool resume
|
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
|
||||||
bool tokenFound = true;
|
bool tokenFound = true;
|
||||||
|
|
||||||
if(resume)
|
|
||||||
tokenFound = is.findTokenResume(fieldKey_);
|
|
||||||
else
|
|
||||||
tokenFound = is.findToken(fieldKey_);
|
tokenFound = is.findToken(fieldKey_);
|
||||||
|
|
||||||
if( !tokenFound )
|
if( !tokenFound )
|
||||||
|
@ -63,16 +59,17 @@ bool pFlow::Field<T, MemorySpace>::read
|
||||||
{
|
{
|
||||||
|
|
||||||
bool tokenFound = true;
|
bool tokenFound = true;
|
||||||
|
|
||||||
if(iop.thisProcReadData())
|
|
||||||
{
|
|
||||||
if(resume)
|
if(resume)
|
||||||
|
{
|
||||||
|
if(iop.thisProcReadData())
|
||||||
tokenFound = is.findTokenResume(fieldKey_);
|
tokenFound = is.findTokenResume(fieldKey_);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
if(iop.thisProcReadData())
|
||||||
tokenFound = is.findToken(fieldKey_);
|
tokenFound = is.findToken(fieldKey_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if( !tokenFound )
|
if( !tokenFound )
|
||||||
{
|
{
|
||||||
ioErrorInFile( is.name(), is.lineNumber() ) <<
|
ioErrorInFile( is.name(), is.lineNumber() ) <<
|
||||||
|
@ -86,6 +83,7 @@ bool pFlow::Field<T, MemorySpace>::read
|
||||||
"error in reading field data from field "<< this->name()<<endl;
|
"error in reading field data from field "<< this->name()<<endl;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(iop.thisProcReadData())
|
if(iop.thisProcReadData())
|
||||||
is.readEndStatement("Field::read");
|
is.readEndStatement("Field::read");
|
||||||
|
|
||||||
|
|
|
@ -197,7 +197,7 @@ public:
|
||||||
|
|
||||||
//// - IO operations
|
//// - IO operations
|
||||||
|
|
||||||
bool read(iIstream& is, bool resume = false);
|
bool read(iIstream& is);
|
||||||
|
|
||||||
bool write(iOstream& os)const;
|
bool write(iOstream& os)const;
|
||||||
|
|
||||||
|
|
|
@ -41,8 +41,8 @@ typename pFlow::boundaryField<T, MemorySpace>::ProcVectorType&
|
||||||
pFlow::boundaryField<T, MemorySpace>::neighborProcField()
|
pFlow::boundaryField<T, MemorySpace>::neighborProcField()
|
||||||
{
|
{
|
||||||
static ProcVectorType dummyVector{"dummyVector"};
|
static ProcVectorType dummyVector{"dummyVector"};
|
||||||
notImplementedFunction;
|
//notImplementedFunction;
|
||||||
fatalExit;
|
//fatalExit;
|
||||||
return dummyVector;
|
return dummyVector;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,8 +51,8 @@ const typename pFlow::boundaryField<T, MemorySpace>::ProcVectorType&
|
||||||
pFlow::boundaryField<T, MemorySpace>::neighborProcField() const
|
pFlow::boundaryField<T, MemorySpace>::neighborProcField() const
|
||||||
{
|
{
|
||||||
static ProcVectorType dummyVector{"dummyVector"};
|
static ProcVectorType dummyVector{"dummyVector"};
|
||||||
notImplementedFunction;
|
//notImplementedFunction;
|
||||||
fatalExit;
|
//fatalExit;
|
||||||
return dummyVector;
|
return dummyVector;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -133,6 +133,16 @@ public:
|
||||||
return internal_;
|
return internal_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
word fieldName()const
|
||||||
|
{
|
||||||
|
return internal_.name();
|
||||||
|
}
|
||||||
|
|
||||||
|
word name()const
|
||||||
|
{
|
||||||
|
return groupNames(fieldName(),boundaryName());
|
||||||
|
}
|
||||||
|
|
||||||
FieldAccessType thisField()const
|
FieldAccessType thisField()const
|
||||||
{
|
{
|
||||||
if constexpr(isDeviceAccessible<execution_space>())
|
if constexpr(isDeviceAccessible<execution_space>())
|
||||||
|
|
|
@ -24,6 +24,7 @@ Licence:
|
||||||
#include "boundaryList.hpp"
|
#include "boundaryList.hpp"
|
||||||
#include "ListPtr.hpp"
|
#include "ListPtr.hpp"
|
||||||
|
|
||||||
|
|
||||||
namespace pFlow
|
namespace pFlow
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -67,9 +68,17 @@ public:
|
||||||
if( direction == DataDirection::SlaveToMaster
|
if( direction == DataDirection::SlaveToMaster
|
||||||
&& slaveToMasterUpdateIter_ == iter) return;
|
&& slaveToMasterUpdateIter_ == iter) return;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// first step
|
// first step
|
||||||
|
uint32 i=0;
|
||||||
for(auto b:*this)
|
for(auto b:*this)
|
||||||
{
|
{
|
||||||
|
if(i==0 )
|
||||||
|
{
|
||||||
|
//pOutput<<"request for update boundaries for field "<< b->name()<<endl;
|
||||||
|
i++;
|
||||||
|
}
|
||||||
b->updateBoundary(1, direction);
|
b->updateBoundary(1, direction);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -123,7 +123,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
inline
|
inline
|
||||||
const word& name()const
|
const word& boundaryName()const
|
||||||
{
|
{
|
||||||
return boundary_.name();
|
return boundary_.name();
|
||||||
}
|
}
|
||||||
|
|
|
@ -160,7 +160,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
inline
|
inline
|
||||||
auto activeRange()const
|
rangeU32 activeRange()const
|
||||||
{
|
{
|
||||||
return internalPoints_.activeRange();
|
return internalPoints_.activeRange();
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,3 +44,8 @@ pFlow::uint32 pFlow::demComponent::currentIter() const
|
||||||
{
|
{
|
||||||
return time_.currentIter();
|
return time_.currentIter();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pFlow::timeInfo pFlow::demComponent::TimeInfo() const
|
||||||
|
{
|
||||||
|
return time_.TimeInfo();
|
||||||
|
}
|
||||||
|
|
|
@ -23,6 +23,7 @@ Licence:
|
||||||
|
|
||||||
#include "types.hpp"
|
#include "types.hpp"
|
||||||
#include "typeInfo.hpp"
|
#include "typeInfo.hpp"
|
||||||
|
#include "timeInfo.hpp"
|
||||||
#include "Timers.hpp"
|
#include "Timers.hpp"
|
||||||
|
|
||||||
namespace pFlow
|
namespace pFlow
|
||||||
|
@ -102,8 +103,12 @@ public:
|
||||||
/// Current simulation time
|
/// Current simulation time
|
||||||
real currentTime()const;
|
real currentTime()const;
|
||||||
|
|
||||||
|
/// @brief return current iteration number
|
||||||
uint32 currentIter()const;
|
uint32 currentIter()const;
|
||||||
|
|
||||||
|
/// return time info of the simulaiton
|
||||||
|
timeInfo TimeInfo()const;
|
||||||
|
|
||||||
inline
|
inline
|
||||||
const auto& time()const
|
const auto& time()const
|
||||||
{
|
{
|
||||||
|
|
|
@ -259,11 +259,29 @@ public:
|
||||||
template<typename T>
|
template<typename T>
|
||||||
T getVal(const word& keyword) const;
|
T getVal(const word& keyword) const;
|
||||||
|
|
||||||
|
/// get the value of data entry and return max(value, maxVal)
|
||||||
|
template<typename T>
|
||||||
|
T getValMax(const word& keyword, const T& maxVal)const;
|
||||||
|
|
||||||
|
/// get the value of data entry and return min(value, minVal)
|
||||||
|
template<typename T>
|
||||||
|
T getValMin(const word& keyword, const T& minVal)const;
|
||||||
|
|
||||||
/// get the value of data entry or
|
/// get the value of data entry or
|
||||||
/// if not found, set the value to setVal
|
/// if not found, set the value to setVal
|
||||||
template<typename T>
|
template<typename T>
|
||||||
T getValOrSet(const word& keyword, const T& setVal)const;
|
T getValOrSet(const word& keyword, const T& setVal)const;
|
||||||
|
|
||||||
|
/// get the value of data entry anf return max(setMaxVal, value)
|
||||||
|
/// if not found, set the value to setMaxVal
|
||||||
|
template<typename T>
|
||||||
|
T getValOrSetMax(const word& keyword, const T& setMaxVal)const;
|
||||||
|
|
||||||
|
/// get the value of data entry anf return max(setMinVal, value)
|
||||||
|
/// if not found, set the value to setMinVal
|
||||||
|
template<typename T>
|
||||||
|
T getValOrSetMin(const word& keyword, const T& setMinVal)const;
|
||||||
|
|
||||||
/// return number of entris in this dictionary
|
/// return number of entris in this dictionary
|
||||||
size_t numEntries()const;
|
size_t numEntries()const;
|
||||||
|
|
||||||
|
@ -372,6 +390,26 @@ T dictionary::getVal
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
T dictionary::getValMax
|
||||||
|
(
|
||||||
|
const word& keyword,
|
||||||
|
const T& maxVal
|
||||||
|
)const
|
||||||
|
{
|
||||||
|
return max(getVal<T>(keyword), maxVal);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
T dictionary::getValMin
|
||||||
|
(
|
||||||
|
const word& keyword,
|
||||||
|
const T& minVal
|
||||||
|
)const
|
||||||
|
{
|
||||||
|
return min(getVal<T>(keyword), minVal);
|
||||||
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
T dictionary::getValOrSet
|
T dictionary::getValOrSet
|
||||||
(
|
(
|
||||||
|
@ -390,6 +428,18 @@ T dictionary::getValOrSet
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
T dictionary::getValOrSetMax(const word& keyword, const T& setMaxVal)const
|
||||||
|
{
|
||||||
|
return max(getValOrSet(keyword, setMaxVal), setMaxVal);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
T dictionary::getValOrSetMin(const word& keyword, const T& setMinVal)const
|
||||||
|
{
|
||||||
|
return min(getValOrSet(keyword, setMinVal), setMinVal);
|
||||||
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
inline bool dictionary::addOrReplace
|
inline bool dictionary::addOrReplace
|
||||||
(
|
(
|
||||||
|
@ -402,8 +452,6 @@ inline bool dictionary::addOrReplace
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
} // pFlow
|
} // pFlow
|
||||||
|
|
||||||
#endif // __dictionary_hpp__
|
#endif // __dictionary_hpp__
|
||||||
|
|
|
@ -153,35 +153,7 @@ bool pFlow::subscriber::notify
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*bool pFlow::subscriber::notify
|
bool pFlow::subscriber::notify(const timeInfo &ti, const message msg, const anyList &varList)
|
||||||
(
|
|
||||||
const eventMessage &msg
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
for ( auto& observer:observerList_ )
|
return notify(ti.iter(), ti.t(), ti.dt(), msg, varList);
|
||||||
{
|
|
||||||
if(observer)
|
|
||||||
if( !observer->update(msg) ) return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool pFlow::eventSubscriber::notify
|
|
||||||
(
|
|
||||||
const eventMessage& msg,
|
|
||||||
const List<eventObserver*>& exclutionList
|
|
||||||
)
|
|
||||||
{
|
|
||||||
Set<eventObserver*> sortedExcList(exclutionList.begin(),exclutionList.end());
|
|
||||||
|
|
||||||
for(auto& observer:observerList_)
|
|
||||||
{
|
|
||||||
if( observer && sortedExcList.count(observer) == 0 )
|
|
||||||
{
|
|
||||||
if(!observer->update(msg)) return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}*/
|
|
|
@ -26,6 +26,7 @@ Licence:
|
||||||
|
|
||||||
#include "List.hpp"
|
#include "List.hpp"
|
||||||
#include "message.hpp"
|
#include "message.hpp"
|
||||||
|
#include "timeInfo.hpp"
|
||||||
|
|
||||||
namespace pFlow
|
namespace pFlow
|
||||||
{
|
{
|
||||||
|
@ -76,6 +77,11 @@ public:
|
||||||
const message msg,
|
const message msg,
|
||||||
const anyList& varList);
|
const anyList& varList);
|
||||||
|
|
||||||
|
bool notify(
|
||||||
|
const timeInfo& ti,
|
||||||
|
const message msg,
|
||||||
|
const anyList& varList);
|
||||||
|
|
||||||
const word& subscriberName()const
|
const word& subscriberName()const
|
||||||
{
|
{
|
||||||
return subName_;
|
return subName_;
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
#ifndef __boundaryConfigs_hpp__
|
||||||
|
#define __boundaryConfigs_hpp__
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef BoundaryModel1
|
||||||
|
//#define BoundaryModel1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#endif //__boundaryConfigs_hpp__
|
|
@ -0,0 +1,88 @@
|
||||||
|
#include "MPITimer.hpp"
|
||||||
|
|
||||||
|
#ifdef pFlow_Build_MPI
|
||||||
|
#include "pFlowProcessors.hpp"
|
||||||
|
#include "procCommunication.hpp"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
pFlow::real pFlow::MPITimer::totalTimeMax() const
|
||||||
|
{
|
||||||
|
return accTimersTotalMax();
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<pFlow::real> pFlow::MPITimer::totalTimeAllToAll() const
|
||||||
|
{
|
||||||
|
#ifdef pFlow_Build_MPI
|
||||||
|
MPI::procCommunication comm(pFlowProcessors());
|
||||||
|
auto [totTime, succs] = comm.collectAllToAll(totalTime());
|
||||||
|
return totTime;
|
||||||
|
#else
|
||||||
|
return std::vector<real>(1, totalTime());
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<pFlow::real> pFlow::MPITimer::totalTimeAllToMaster() const
|
||||||
|
{
|
||||||
|
#ifdef pFlow_Build_MPI
|
||||||
|
MPI::procCommunication comm(pFlowProcessors());
|
||||||
|
auto [totTime, succs] = comm.collectAllToMaster(totalTime());
|
||||||
|
return totTime;
|
||||||
|
#else
|
||||||
|
return std::vector<real>(1, totalTime());
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
pFlow::real pFlow::MPITimer::averageTimeMax() const
|
||||||
|
{
|
||||||
|
return Timer::averageTimeMax();
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<pFlow::real> pFlow::MPITimer::averageTimeAllToAll() const
|
||||||
|
{
|
||||||
|
#ifdef pFlow_Build_MPI
|
||||||
|
MPI::procCommunication comm(pFlowProcessors());
|
||||||
|
auto [totTime, succs] = comm.collectAllToAll(averageTime());
|
||||||
|
return totTime;
|
||||||
|
#else
|
||||||
|
return std::vector<real>(1, averageTime());
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<pFlow::real> pFlow::MPITimer::averageTimeAllAtoMaster() const
|
||||||
|
{
|
||||||
|
#ifdef pFlow_Build_MPI
|
||||||
|
MPI::procCommunication comm(pFlowProcessors());
|
||||||
|
auto [totTime, succs] = comm.collectAllToMaster(averageTime());
|
||||||
|
return totTime;
|
||||||
|
#else
|
||||||
|
return std::vector<real>(1, averageTime());
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
bool pFlow::MPITimer::write(iOstream &os) const
|
||||||
|
{
|
||||||
|
const auto ts = totalTimeAllToAll();
|
||||||
|
auto maxloc = std::distance(ts.begin(), std::max_element(ts.begin(), ts.end()));
|
||||||
|
os<<'(';
|
||||||
|
for(auto i=0; i<ts.size(); i++)
|
||||||
|
{
|
||||||
|
if(maxloc == i)
|
||||||
|
os<<Red_Text(ts[i]);
|
||||||
|
else
|
||||||
|
os<<ts[i];
|
||||||
|
|
||||||
|
if(i != ts.size()-1)
|
||||||
|
os<<' ';
|
||||||
|
else
|
||||||
|
os<<')'<<endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
static pFlow::MPITimer ComputationTimer__{"ComputationTimer"};
|
||||||
|
|
||||||
|
pFlow::MPITimer &pFlow::ComputationTimer()
|
||||||
|
{
|
||||||
|
return ComputationTimer__;
|
||||||
|
}
|
|
@ -0,0 +1,55 @@
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef __MPITimer_hpp__
|
||||||
|
#define __MPITimer_hpp__
|
||||||
|
|
||||||
|
#include "Timer.hpp"
|
||||||
|
|
||||||
|
|
||||||
|
namespace pFlow
|
||||||
|
{
|
||||||
|
|
||||||
|
class MPITimer
|
||||||
|
:
|
||||||
|
public Timer
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
|
||||||
|
// hiding methods
|
||||||
|
using Timer::accTimersTotal;
|
||||||
|
using Timer::averageTime;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
TypeInfo("MPITimer");
|
||||||
|
|
||||||
|
explicit MPITimer(const word& name)
|
||||||
|
:
|
||||||
|
Timer(name)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
real totalTimeMax()const;
|
||||||
|
|
||||||
|
std::vector<real> totalTimeAllToAll()const;
|
||||||
|
|
||||||
|
std::vector<real> totalTimeAllToMaster()const;
|
||||||
|
|
||||||
|
real averageTimeMax()const;
|
||||||
|
|
||||||
|
std::vector<real> averageTimeAllToAll()const;
|
||||||
|
|
||||||
|
std::vector<real> averageTimeAllAtoMaster()const;
|
||||||
|
|
||||||
|
// call this from all processors in pFlowProcessors
|
||||||
|
bool write(iOstream& os)const;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
MPITimer& ComputationTimer();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
|
@ -35,6 +35,7 @@ Licence:
|
||||||
pFlow::MPI::DataType pFlow::MPI::realx3Type__;
|
pFlow::MPI::DataType pFlow::MPI::realx3Type__;
|
||||||
pFlow::MPI::DataType pFlow::MPI::realx4Type__;
|
pFlow::MPI::DataType pFlow::MPI::realx4Type__;
|
||||||
pFlow::MPI::DataType pFlow::MPI::int32x3Type__;
|
pFlow::MPI::DataType pFlow::MPI::int32x3Type__;
|
||||||
|
pFlow::MPI::DataType pFlow::MPI::uint32x3Type__;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -74,6 +75,9 @@ void pFlow::processors::initProcessors(int argc, char *argv[])
|
||||||
MPI_Type_contiguous(3, pFlow::MPI::Type<int32>(), &pFlow::MPI::int32x3Type__);
|
MPI_Type_contiguous(3, pFlow::MPI::Type<int32>(), &pFlow::MPI::int32x3Type__);
|
||||||
MPI_Type_commit(&pFlow::MPI::int32x3Type__);
|
MPI_Type_commit(&pFlow::MPI::int32x3Type__);
|
||||||
|
|
||||||
|
MPI_Type_contiguous(3, pFlow::MPI::Type<uint32>(), &pFlow::MPI::uint32x3Type__);
|
||||||
|
MPI_Type_commit(&pFlow::MPI::uint32x3Type__);
|
||||||
|
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
|
||||||
|
@ -90,6 +94,7 @@ void pFlow::processors::finalizeProcessors()
|
||||||
MPI::TypeFree(&pFlow::MPI::realx3Type__);
|
MPI::TypeFree(&pFlow::MPI::realx3Type__);
|
||||||
MPI::TypeFree(&pFlow::MPI::realx4Type__);
|
MPI::TypeFree(&pFlow::MPI::realx4Type__);
|
||||||
MPI::TypeFree(&pFlow::MPI::int32x3Type__);
|
MPI::TypeFree(&pFlow::MPI::int32x3Type__);
|
||||||
|
MPI::TypeFree(&pFlow::MPI::uint32x3Type__);
|
||||||
CheckMPI(MPI_Finalize(), true);
|
CheckMPI(MPI_Finalize(), true);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -0,0 +1,50 @@
|
||||||
|
|
||||||
|
#ifndef __boundariesMask_hpp__
|
||||||
|
#define __boundariesMask_hpp__
|
||||||
|
|
||||||
|
#include <array>
|
||||||
|
|
||||||
|
namespace pFlow
|
||||||
|
{
|
||||||
|
|
||||||
|
template<size_t N>
|
||||||
|
class boundariesMask
|
||||||
|
:
|
||||||
|
public std::array<bool,N>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
boundariesMask()=default;
|
||||||
|
|
||||||
|
boundariesMask(bool val)
|
||||||
|
{
|
||||||
|
this->fill(val);
|
||||||
|
}
|
||||||
|
|
||||||
|
boundariesMask(std::initializer_list<bool> l)
|
||||||
|
:
|
||||||
|
std::array<bool,N>(l)
|
||||||
|
{}
|
||||||
|
|
||||||
|
inline
|
||||||
|
bool allElements(bool val)
|
||||||
|
{
|
||||||
|
return std::all_of(this->begin(), this->end(), [val](bool v) { return v==val;} );
|
||||||
|
}
|
||||||
|
|
||||||
|
inline
|
||||||
|
bool anyElement(bool val)
|
||||||
|
{
|
||||||
|
return std::any_of(this->begin(), this->end(), [val](bool v) { return v==val;} );
|
||||||
|
}
|
||||||
|
|
||||||
|
inline
|
||||||
|
bool noElement(bool val)
|
||||||
|
{
|
||||||
|
return std::none_of(this->begin(), this->end(), [val](bool v) { return v==val;} );
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif //__boundariesMask_hpp__
|
|
@ -190,27 +190,56 @@ bool pFlow::boundaryBase::transferPointsToMirror
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pFlow::boundaryBase::boundaryBase
|
pFlow::uint32 pFlow::boundaryBase::markInNegativeSide(const word &name, uint32Vector_D &markedIndices) const
|
||||||
(
|
{
|
||||||
|
|
||||||
|
uint32 s = size();
|
||||||
|
|
||||||
|
markedIndices.reallocate(s+1, s+1);
|
||||||
|
markedIndices.fill(0u);
|
||||||
|
|
||||||
|
const auto& markedIndicesD = markedIndices.deviceViewAll();
|
||||||
|
pointFieldAccessType points = thisPoints();
|
||||||
|
infinitePlane p = boundaryPlane().infPlane();
|
||||||
|
|
||||||
|
uint32 numMark = 0;
|
||||||
|
|
||||||
|
Kokkos::parallel_reduce
|
||||||
|
(
|
||||||
|
"boundaryProcessor::afterIteration",
|
||||||
|
deviceRPolicyStatic(0,s),
|
||||||
|
LAMBDA_HD(uint32 i, uint32& markToUpdate)
|
||||||
|
{
|
||||||
|
if(p.pointInNegativeSide(points(i)))
|
||||||
|
{
|
||||||
|
markedIndicesD(i)=1;
|
||||||
|
markToUpdate++;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
numMark
|
||||||
|
);
|
||||||
|
|
||||||
|
return numMark;
|
||||||
|
}
|
||||||
|
|
||||||
|
pFlow::boundaryBase::boundaryBase(
|
||||||
const dictionary &dict,
|
const dictionary &dict,
|
||||||
const plane &bplane,
|
const plane &bplane,
|
||||||
internalPoints &internal,
|
internalPoints &internal,
|
||||||
boundaryList &bndrs,
|
boundaryList &bndrs,
|
||||||
uint32 thisIndex
|
uint32 thisIndex)
|
||||||
)
|
: subscriber(dict.name()),
|
||||||
:
|
|
||||||
subscriber(dict.name()),
|
|
||||||
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")),
|
neighborLength_(dict.getVal<real>("neighborLength")),
|
||||||
updateInetrval_(dict.getVal<uint32>("updateInterval")),
|
// updateInetrval_(dict.getVal<uint32>("updateInterval")),
|
||||||
boundaryExtntionLengthRatio_(dict.getVal<real>("boundaryExtntionLengthRatio")),
|
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")),
|
||||||
isBoundaryMaster_(thisProcessorNo()>=neighborProcessorNo()),
|
isBoundaryMaster_(thisProcessorNo() >= neighborProcessorNo()),
|
||||||
name_(dict.name()),
|
name_(dict.name()),
|
||||||
type_(dict.getVal<word>("type"))
|
type_(dict.getVal<word>("type"))
|
||||||
{
|
{
|
||||||
|
|
|
@ -17,7 +17,6 @@ Licence:
|
||||||
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
|
||||||
-----------------------------------------------------------------------------*/
|
-----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef __boundaryBase_hpp__
|
#ifndef __boundaryBase_hpp__
|
||||||
#define __boundaryBase_hpp__
|
#define __boundaryBase_hpp__
|
||||||
|
|
||||||
|
@ -26,8 +25,8 @@ Licence:
|
||||||
#include "VectorSingles.hpp"
|
#include "VectorSingles.hpp"
|
||||||
#include "plane.hpp"
|
#include "plane.hpp"
|
||||||
#include "scatteredFieldAccess.hpp"
|
#include "scatteredFieldAccess.hpp"
|
||||||
|
#include "timeInfo.hpp"
|
||||||
|
|
||||||
#include "streams.hpp"
|
|
||||||
|
|
||||||
namespace pFlow
|
namespace pFlow
|
||||||
{
|
{
|
||||||
|
@ -68,8 +67,9 @@ private:
|
||||||
/// The length defined for creating neighbor list
|
/// The length defined for creating neighbor list
|
||||||
real neighborLength_;
|
real neighborLength_;
|
||||||
|
|
||||||
/// time steps between successive update of boundary lists
|
bool updateTime_ = false;
|
||||||
uint32 updateInetrval_;
|
|
||||||
|
bool iterBeforeUpdate_ = false;
|
||||||
|
|
||||||
/// the extra boundary extension beyound actual limits of boundary
|
/// the extra boundary extension beyound actual limits of boundary
|
||||||
real boundaryExtntionLengthRatio_;
|
real boundaryExtntionLengthRatio_;
|
||||||
|
@ -100,6 +100,12 @@ protected:
|
||||||
/// boundaryBase::setSize(newSize) too.
|
/// boundaryBase::setSize(newSize) too.
|
||||||
virtual void setSize(uint32 newSize);
|
virtual void setSize(uint32 newSize);
|
||||||
|
|
||||||
|
|
||||||
|
void setUpdateTime(bool val)
|
||||||
|
{
|
||||||
|
updateTime_ = val;
|
||||||
|
}
|
||||||
|
|
||||||
void setNewIndices(const uint32Vector_D& newIndices);
|
void setNewIndices(const uint32Vector_D& newIndices);
|
||||||
|
|
||||||
bool appendNewIndices(const uint32Vector_D& newIndices);
|
bool appendNewIndices(const uint32Vector_D& newIndices);
|
||||||
|
@ -132,12 +138,6 @@ protected:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Is this iter the right time for updating bounday list
|
|
||||||
bool boundaryListUpdate(uint32 iter)const
|
|
||||||
{
|
|
||||||
return iter%updateInetrval_ == 0u || iter == 0u;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Update this boundary data in two steps (1 and 2).
|
/// Update this boundary data in two steps (1 and 2).
|
||||||
/// This is called after calling beforeIteration for
|
/// This is called after calling beforeIteration for
|
||||||
/// all boundaries, so any particle addition, deletion,
|
/// all boundaries, so any particle addition, deletion,
|
||||||
|
@ -153,16 +153,18 @@ protected:
|
||||||
/// @brief This method is called when a transfer of data
|
/// @brief This method is called when a transfer of data
|
||||||
/// is to be performed between processors (in afterIteration).
|
/// is to be performed between processors (in afterIteration).
|
||||||
/// @param step is the step in the transfer of data.
|
/// @param step is the step in the transfer of data.
|
||||||
/// @return true: if operation requires at least one additional step
|
/// @param callAgain if operation requires at least one additional step
|
||||||
/// to complete. false: if the operation is complete and no need for
|
/// to complete it should be set to true and if the operation is complete and no need for
|
||||||
/// additional step in operation.
|
/// additional step, it should be set to false;
|
||||||
|
/// @return true: succesful, false: fail
|
||||||
virtual
|
virtual
|
||||||
bool transferData(uint32 iter, int step)
|
bool transferData(uint32 iter, int step, bool& callAgain)
|
||||||
{
|
{
|
||||||
return false;
|
callAgain = false;
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint32 markInNegativeSide(const word& name, uint32Vector_D& markedIndices )const;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
@ -231,6 +233,19 @@ public:
|
||||||
return -boundaryExtntionLengthRatio_*neighborLength_ * boundaryPlane_.normal();
|
return -boundaryExtntionLengthRatio_*neighborLength_ * boundaryPlane_.normal();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Is this iter the right time for updating bounday list
|
||||||
|
inline
|
||||||
|
bool performBoundarytUpdate()const
|
||||||
|
{
|
||||||
|
return updateTime_;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline
|
||||||
|
bool iterBeforeBoundaryUpdate()const
|
||||||
|
{
|
||||||
|
return iterBeforeUpdate_;
|
||||||
|
}
|
||||||
|
|
||||||
inline
|
inline
|
||||||
const word& type()const
|
const word& type()const
|
||||||
{
|
{
|
||||||
|
@ -339,13 +354,24 @@ public:
|
||||||
|
|
||||||
|
|
||||||
virtual
|
virtual
|
||||||
bool beforeIteration(uint32 step, uint32 iterNum, real t, real dt) = 0 ;
|
bool beforeIteration(
|
||||||
|
uint32 step,
|
||||||
|
const timeInfo& ti,
|
||||||
|
bool updateIter,
|
||||||
|
bool iterBeforeUpdate ,
|
||||||
|
bool& callAgain
|
||||||
|
)
|
||||||
|
{
|
||||||
|
updateTime_ = updateIter;
|
||||||
|
iterBeforeUpdate_ = iterBeforeUpdate;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
virtual
|
virtual
|
||||||
bool iterate(uint32 iterNum, real t, real dt) = 0;
|
bool iterate(const timeInfo& ti) = 0;
|
||||||
|
|
||||||
virtual
|
virtual
|
||||||
bool afterIteration(uint32 iterNum, real t, real dt) = 0;
|
bool afterIteration(const timeInfo& ti) = 0;
|
||||||
|
|
||||||
pointFieldAccessType thisPoints()const;
|
pointFieldAccessType thisPoints()const;
|
||||||
|
|
||||||
|
|
|
@ -43,14 +43,27 @@ pFlow::boundaryExit::boundaryExit
|
||||||
bool pFlow::boundaryExit::beforeIteration
|
bool pFlow::boundaryExit::beforeIteration
|
||||||
(
|
(
|
||||||
uint32 step,
|
uint32 step,
|
||||||
uint32 iterNum,
|
const timeInfo& ti,
|
||||||
real t,
|
bool updateIter,
|
||||||
real dt
|
bool iterBeforeUpdate ,
|
||||||
|
bool& callAgain
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if(step!= 2 )return true;
|
|
||||||
|
|
||||||
if( !boundaryListUpdate(iterNum))return true;
|
if(step == 1)
|
||||||
|
{
|
||||||
|
boundaryBase::beforeIteration(step, ti, updateIter, iterBeforeUpdate, callAgain);
|
||||||
|
callAgain = true;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else if(step == 2 )
|
||||||
|
{
|
||||||
|
callAgain = false;
|
||||||
|
|
||||||
|
if( !performBoundarytUpdate())
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
// nothing have to be done
|
// nothing have to be done
|
||||||
if(empty())
|
if(empty())
|
||||||
|
@ -90,24 +103,19 @@ bool pFlow::boundaryExit::beforeIteration
|
||||||
}
|
}
|
||||||
|
|
||||||
return this->removeIndices(numDeleted, deleteFlags);
|
return this->removeIndices(numDeleted, deleteFlags);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool pFlow::boundaryExit::iterate
|
bool pFlow::boundaryExit::iterate(const timeInfo& ti)
|
||||||
(
|
|
||||||
uint32 iterNum,
|
|
||||||
real t,
|
|
||||||
real dt
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool pFlow::boundaryExit::afterIteration
|
bool pFlow::boundaryExit::afterIteration(const timeInfo& ti)
|
||||||
(
|
|
||||||
uint32 iterNum,
|
|
||||||
real t,
|
|
||||||
real dt
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
|
@ -63,11 +63,17 @@ public:
|
||||||
dictionary
|
dictionary
|
||||||
);
|
);
|
||||||
|
|
||||||
bool beforeIteration(uint32 step, uint32 iterNum, real t, real dt) override;
|
bool beforeIteration(
|
||||||
|
uint32 step,
|
||||||
|
const timeInfo& ti,
|
||||||
|
bool updateIter,
|
||||||
|
bool iterBeforeUpdate ,
|
||||||
|
bool& callAgain
|
||||||
|
) final;
|
||||||
|
|
||||||
bool iterate(uint32 iterNum, real t, real dt) override;
|
bool iterate(const timeInfo& ti) final;
|
||||||
|
|
||||||
bool afterIteration(uint32 iterNum, real t, real dt) override;
|
bool afterIteration(const timeInfo& ti)final;
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -90,25 +90,50 @@ pFlow::boundaryList::updateNeighborLists()
|
||||||
|
|
||||||
pFlow::boundaryList::boundaryList(pointStructure& pStruct)
|
pFlow::boundaryList::boundaryList(pointStructure& pStruct)
|
||||||
: ListPtr<boundaryBase>(pStruct.simDomain().sizeOfBoundaries()),
|
: ListPtr<boundaryBase>(pStruct.simDomain().sizeOfBoundaries()),
|
||||||
pStruct_(pStruct),
|
pStruct_(pStruct)
|
||||||
neighborListUpdateInterval_(
|
|
||||||
max(
|
|
||||||
pStruct.simDomain().subDict("boundaries").getVal<uint32>(
|
|
||||||
"neighborListUpdateInterval"
|
|
||||||
),
|
|
||||||
1u
|
|
||||||
)
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
|
const dictionary& dict= pStruct_.simDomain().thisBoundariesDict();
|
||||||
|
|
||||||
|
neighborListUpdateInterval_ = dict.getValMax(
|
||||||
|
"neighborListUpdateInterval",
|
||||||
|
1u
|
||||||
|
);
|
||||||
|
|
||||||
|
updateInterval_ = dict.getVal<uint32>("updateInterval");
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
pFlow::boundaryList::updateNeighborLists(uint32 iter, bool force)
|
pFlow::boundaryList::updateNeighborLists(uint32 iter, bool force)
|
||||||
{
|
{
|
||||||
|
neighborListUpdate_ = false;
|
||||||
|
boundaryUpdate_ = false;
|
||||||
|
iterBeforeBoundaryUpdate_ = false;
|
||||||
|
|
||||||
if(iter%neighborListUpdateInterval_==0u || iter == 0u || force)
|
if(iter%neighborListUpdateInterval_==0u || iter == 0u || force)
|
||||||
{
|
{
|
||||||
return updateNeighborLists();
|
if(updateNeighborLists())
|
||||||
|
{
|
||||||
|
neighborListUpdate_ = true;
|
||||||
|
lastNeighborUpdated_ = iter;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
fatalErrorInFunction<<"error in updating neighbor lists of boundaries"<<endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if( iter%updateInterval_ == 0u || iter == 0u || force )
|
||||||
|
{
|
||||||
|
boundaryUpdate_ = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if((iter+1)%updateInterval_ == 0u)
|
||||||
|
{
|
||||||
|
iterBeforeBoundaryUpdate_ = true;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -158,38 +183,43 @@ pFlow::boundaryList::internalDomainBox() const
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
pFlow::boundaryList::beforeIteration(uint32 iter, real t, real dt, bool force)
|
pFlow::boundaryList::beforeIteration(const timeInfo& ti, bool force)
|
||||||
{
|
{
|
||||||
// it is time to update lists
|
// it is time to update lists
|
||||||
if(!updateNeighborLists(iter , force) )
|
if(!updateNeighborLists(ti.iter() , force) )
|
||||||
{
|
{
|
||||||
fatalErrorInFunction;
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// this forces performing updating the list on each boundary
|
auto callAgain = boundariesMask<6>(true);
|
||||||
if(force) iter = 0;
|
|
||||||
|
|
||||||
for (auto bdry : *this)
|
uint32 step = 1;
|
||||||
|
|
||||||
|
while(callAgain.anyElement(true) && step <= 10u)
|
||||||
{
|
{
|
||||||
if (!bdry->beforeIteration(1, iter, t, dt))
|
for(size_t i=0; i<6ul; i++)
|
||||||
{
|
{
|
||||||
fatalErrorInFunction << "Error in beforeIteration in boundary "
|
|
||||||
<< bdry->name() << endl;
|
if(callAgain[i])
|
||||||
|
{
|
||||||
|
if(! boundary(i).beforeIteration(
|
||||||
|
step,
|
||||||
|
ti,
|
||||||
|
boundaryUpdate_,
|
||||||
|
iterBeforeBoundaryUpdate_,
|
||||||
|
callAgain[i]))
|
||||||
|
{
|
||||||
|
fatalErrorInFunction<<"error in performing beforeIteration for boundary"<<
|
||||||
|
boundary(i).name()<<" at step "<< step<<endl;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for (auto bdry : *this)
|
step++;
|
||||||
{
|
|
||||||
if (!bdry->beforeIteration(2, iter, t, dt))
|
|
||||||
{
|
|
||||||
fatalErrorInFunction << "Error in beforeIteration in boundary "
|
|
||||||
<< bdry->name() << endl;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
for (auto bdry : *this)
|
for (auto bdry : *this)
|
||||||
{
|
{
|
||||||
bdry->updataBoundaryData(1);
|
bdry->updataBoundaryData(1);
|
||||||
|
@ -204,11 +234,11 @@ pFlow::boundaryList::beforeIteration(uint32 iter, real t, real dt, bool force)
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
pFlow::boundaryList::iterate(uint32 iter, real t, real dt)
|
pFlow::boundaryList::iterate(const timeInfo& ti, bool force)
|
||||||
{
|
{
|
||||||
for (auto& bdry : *this)
|
for (auto& bdry : *this)
|
||||||
{
|
{
|
||||||
if (!bdry->iterate(iter, t, dt))
|
if (!bdry->iterate(ti))
|
||||||
{
|
{
|
||||||
fatalErrorInFunction << "Error in iterate in boundary "
|
fatalErrorInFunction << "Error in iterate in boundary "
|
||||||
<< bdry->name() << endl;
|
<< bdry->name() << endl;
|
||||||
|
@ -219,19 +249,24 @@ pFlow::boundaryList::iterate(uint32 iter, real t, real dt)
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
pFlow::boundaryList::afterIteration(uint32 iter, real t, real dt)
|
pFlow::boundaryList::afterIteration(const timeInfo& ti, bool force)
|
||||||
{
|
{
|
||||||
|
|
||||||
std::array<bool,6> requireStep{true, true, true, true, true, true};
|
auto callAgain = boundariesMask<6>(true);
|
||||||
|
|
||||||
int step = 1;
|
int step = 1;
|
||||||
while(std::any_of(requireStep.begin(), requireStep.end(), [](bool v) { return v==true; }))
|
while(callAgain.anyElement(true)&& step <=10)
|
||||||
{
|
{
|
||||||
for(auto i=0uL; i<6; i++)
|
for(size_t i=0; i<6; i++)
|
||||||
{
|
{
|
||||||
if(requireStep[i])
|
if(callAgain[i])
|
||||||
{
|
{
|
||||||
requireStep[i] = this->operator[](i).transferData(iter, step);
|
if( !boundary(i).transferData(ti.iter(), step, callAgain[i]))
|
||||||
|
{
|
||||||
|
fatalErrorInFunction<<"Error in transfering data for boundary "<<
|
||||||
|
boundary(i).name()<<endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
step++;
|
step++;
|
||||||
|
|
|
@ -23,6 +23,8 @@ Licence:
|
||||||
#include "domain.hpp"
|
#include "domain.hpp"
|
||||||
#include "boundaryBase.hpp"
|
#include "boundaryBase.hpp"
|
||||||
#include "ListPtr.hpp"
|
#include "ListPtr.hpp"
|
||||||
|
#include "timeInfo.hpp"
|
||||||
|
#include "boundariesMask.hpp"
|
||||||
|
|
||||||
|
|
||||||
namespace pFlow
|
namespace pFlow
|
||||||
|
@ -41,6 +43,16 @@ private:
|
||||||
|
|
||||||
uint32 neighborListUpdateInterval_;
|
uint32 neighborListUpdateInterval_;
|
||||||
|
|
||||||
|
uint32 updateInterval_;
|
||||||
|
|
||||||
|
uint32 lastNeighborUpdated_ = 0;
|
||||||
|
|
||||||
|
bool neighborListUpdate_;
|
||||||
|
|
||||||
|
bool boundaryUpdate_;
|
||||||
|
|
||||||
|
bool iterBeforeBoundaryUpdate_;
|
||||||
|
|
||||||
domain extendedDomain_;
|
domain extendedDomain_;
|
||||||
|
|
||||||
box internalDomainBox_;
|
box internalDomainBox_;
|
||||||
|
@ -91,6 +103,11 @@ public:
|
||||||
return ListPtr<boundaryBase>::operator[](i);
|
return ListPtr<boundaryBase>::operator[](i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline
|
||||||
|
bool boundariesUpdated()const
|
||||||
|
{
|
||||||
|
return boundaryUpdate_;
|
||||||
|
}
|
||||||
|
|
||||||
inline
|
inline
|
||||||
const auto& extendedDomain()const
|
const auto& extendedDomain()const
|
||||||
|
@ -106,11 +123,11 @@ public:
|
||||||
|
|
||||||
box internalDomainBox()const;
|
box internalDomainBox()const;
|
||||||
|
|
||||||
bool beforeIteration(uint32 iter, real t, real dt, bool force = false);
|
bool beforeIteration(const timeInfo& tf, bool force = false);
|
||||||
|
|
||||||
bool iterate(uint32 iter, real t, real dt);
|
bool iterate(const timeInfo& tf, bool force = false);
|
||||||
|
|
||||||
bool afterIteration(uint32 iter, real t, real dt);
|
bool afterIteration(const timeInfo& tf, bool force = false);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -32,33 +32,24 @@ pFlow::boundaryNone::boundaryNone
|
||||||
boundaryBase(dict, bplane, internal, bndrs, thisIndex)
|
boundaryBase(dict, bplane, internal, bndrs, thisIndex)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
bool pFlow::boundaryNone::beforeIteration
|
bool pFlow::boundaryNone::beforeIteration(
|
||||||
(
|
|
||||||
uint32 step,
|
uint32 step,
|
||||||
uint32 iterNum,
|
const timeInfo &ti,
|
||||||
real t,
|
bool updateIter,
|
||||||
real dt
|
bool iterBeforeUpdate,
|
||||||
)
|
bool &callAgain)
|
||||||
|
{
|
||||||
|
boundaryBase::beforeIteration(step, ti, updateIter, iterBeforeUpdate, callAgain);
|
||||||
|
callAgain = false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool pFlow::boundaryNone::iterate(const timeInfo &ti)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool pFlow::boundaryNone::iterate
|
bool pFlow::boundaryNone::afterIteration(const timeInfo& ti)
|
||||||
(
|
|
||||||
uint32 iterNum,
|
|
||||||
real t,
|
|
||||||
real dt
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool pFlow::boundaryNone::afterIteration
|
|
||||||
(
|
|
||||||
uint32 iterNum,
|
|
||||||
real t,
|
|
||||||
real dt
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
|
@ -52,12 +52,17 @@ public:
|
||||||
dictionary
|
dictionary
|
||||||
);
|
);
|
||||||
|
|
||||||
bool beforeIteration(uint32 step, uint32 iterNum, real t, real dt) final;
|
bool beforeIteration(
|
||||||
|
uint32 step,
|
||||||
|
const timeInfo& ti,
|
||||||
|
bool updateIter,
|
||||||
|
bool iterBeforeUpdate ,
|
||||||
|
bool& callAgain
|
||||||
|
)final;
|
||||||
|
|
||||||
bool iterate(uint32 iterNum, real t, real dt) final;
|
bool iterate(const timeInfo& ti) final;
|
||||||
|
|
||||||
bool afterIteration(uint32 iterNum, real t, real dt) final;
|
|
||||||
|
|
||||||
|
bool afterIteration(const timeInfo& ti) final;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -52,18 +52,28 @@ pFlow::realx3 pFlow::boundaryPeriodic::boundaryExtensionLength() const
|
||||||
|
|
||||||
bool pFlow::boundaryPeriodic::beforeIteration(
|
bool pFlow::boundaryPeriodic::beforeIteration(
|
||||||
uint32 step,
|
uint32 step,
|
||||||
uint32 iterNum,
|
const timeInfo& ti,
|
||||||
real t,
|
bool updateIter,
|
||||||
real dt)
|
bool iterBeforeUpdate ,
|
||||||
|
bool& callAgain)
|
||||||
{
|
{
|
||||||
if(step!=2)return true;
|
if(step==1)
|
||||||
|
{
|
||||||
|
callAgain = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
callAgain = false;
|
||||||
// nothing have to be done
|
// nothing have to be done
|
||||||
if(empty())
|
if(empty())
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !boundaryListUpdate(iterNum))return true;
|
if(!performBoundarytUpdate())
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
uint32 s = size();
|
uint32 s = size();
|
||||||
uint32Vector_D transferFlags("transferFlags",s+1, s+1, RESERVE());
|
uint32Vector_D transferFlags("transferFlags",s+1, s+1, RESERVE());
|
||||||
|
@ -106,24 +116,18 @@ bool pFlow::boundaryPeriodic::beforeIteration(
|
||||||
mirrorBoundaryIndex(),
|
mirrorBoundaryIndex(),
|
||||||
transferVec
|
transferVec
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool pFlow::boundaryPeriodic::iterate
|
bool pFlow::boundaryPeriodic::iterate(const timeInfo& ti)
|
||||||
(
|
|
||||||
uint32 iterNum,
|
|
||||||
real t,
|
|
||||||
real dt
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool pFlow::boundaryPeriodic::afterIteration
|
bool pFlow::boundaryPeriodic::afterIteration(const timeInfo& ti)
|
||||||
(
|
|
||||||
uint32 iterNum,
|
|
||||||
real t,
|
|
||||||
real dt
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
|
@ -62,14 +62,17 @@ public:
|
||||||
|
|
||||||
realx3 boundaryExtensionLength()const override;
|
realx3 boundaryExtensionLength()const override;
|
||||||
|
|
||||||
//const plane& boundaryPlane()const override;*/
|
bool beforeIteration(
|
||||||
|
uint32 step,
|
||||||
|
const timeInfo& ti,
|
||||||
|
bool updateIter,
|
||||||
|
bool iterBeforeUpdate ,
|
||||||
|
bool& callAgain
|
||||||
|
) final ;
|
||||||
|
|
||||||
bool beforeIteration(uint32 step, uint32 iterNum, real t, real dt) override;
|
bool iterate(const timeInfo& ti) final;
|
||||||
|
|
||||||
bool iterate(uint32 iterNum, real t, real dt) override;
|
|
||||||
|
|
||||||
bool afterIteration(uint32 iterNum, real t, real dt) override;
|
|
||||||
|
|
||||||
|
bool afterIteration(const timeInfo& ti)final;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -47,18 +47,19 @@ pFlow::boundaryReflective::boundaryReflective
|
||||||
|
|
||||||
bool pFlow::boundaryReflective::beforeIteration(
|
bool pFlow::boundaryReflective::beforeIteration(
|
||||||
uint32 step,
|
uint32 step,
|
||||||
uint32 iterNum,
|
const timeInfo& ti,
|
||||||
real t,
|
bool updateIter,
|
||||||
real dt)
|
bool iterBeforeUpdate ,
|
||||||
|
bool& callAgain)
|
||||||
{
|
{
|
||||||
|
boundaryBase::beforeIteration(step, ti, updateIter, iterBeforeUpdate, callAgain);
|
||||||
|
callAgain = false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool pFlow::boundaryReflective::iterate
|
bool pFlow::boundaryReflective::iterate
|
||||||
(
|
(
|
||||||
uint32 iterNum,
|
const timeInfo& ti
|
||||||
real t,
|
|
||||||
real dt
|
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
|
@ -66,9 +67,7 @@ bool pFlow::boundaryReflective::iterate
|
||||||
|
|
||||||
bool pFlow::boundaryReflective::afterIteration
|
bool pFlow::boundaryReflective::afterIteration
|
||||||
(
|
(
|
||||||
uint32 iterNum,
|
const timeInfo& ti
|
||||||
real t,
|
|
||||||
real dt
|
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if(empty())return true;
|
if(empty())return true;
|
||||||
|
|
|
@ -59,11 +59,17 @@ public:
|
||||||
dictionary
|
dictionary
|
||||||
);
|
);
|
||||||
|
|
||||||
bool beforeIteration(uint32 step, uint32 iterNum, real t, real dt) override;
|
bool beforeIteration(
|
||||||
|
uint32 step,
|
||||||
|
const timeInfo& ti,
|
||||||
|
bool updateIter,
|
||||||
|
bool iterBeforeUpdate ,
|
||||||
|
bool& callAgain
|
||||||
|
) final ;
|
||||||
|
|
||||||
bool iterate(uint32 iterNum, real t, real dt) override;
|
bool iterate(const timeInfo& ti) final;
|
||||||
|
|
||||||
bool afterIteration(uint32 iterNum, real t, real dt) override;
|
bool afterIteration(const timeInfo& ti)final;
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -18,61 +18,30 @@ Licence:
|
||||||
|
|
||||||
-----------------------------------------------------------------------------*/
|
-----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include <cstring>
|
|
||||||
|
|
||||||
#include "regularSimulationDomain.hpp"
|
#include "regularSimulationDomain.hpp"
|
||||||
#include "processors.hpp"
|
#include "processors.hpp"
|
||||||
#include "streams.hpp"
|
#include "streams.hpp"
|
||||||
|
|
||||||
bool pFlow::regularSimulationDomain::createBoundaryDicts()
|
bool pFlow::regularSimulationDomain::createBoundaryDicts()
|
||||||
{
|
{
|
||||||
auto& boundaries = this->subDict("boundaries");
|
|
||||||
|
|
||||||
this->addDict("regularBoundaries", boundaries);
|
dictionary& thisBoundaries = this->subDict(thisBoundariesDictName());
|
||||||
auto& rbBoundaries = this->subDict("regularBoundaries");
|
|
||||||
|
|
||||||
auto neighborLength = boundaries.getVal<real>("neighborLength");
|
|
||||||
auto boundaryExtntionLengthRatio = max(
|
|
||||||
boundaries.getValOrSet<real>("boundaryExtntionLengthRatio", 0.1),
|
|
||||||
0.0);
|
|
||||||
auto updateIntercal = max(
|
|
||||||
boundaries.getValOrSet<uint32>("updateInterval", 1u),
|
|
||||||
1u);
|
|
||||||
|
|
||||||
for(uint32 i=0; i<sizeOfBoundaries(); i++)
|
for(uint32 i=0; i<sizeOfBoundaries(); i++)
|
||||||
{
|
{
|
||||||
word bName = bundaryName(i);
|
word bName = bundaryName(i);
|
||||||
if( !boundaries.containsDictionay(bName) )
|
dictionary& bDict = thisBoundaries.subDict(bName);
|
||||||
{
|
|
||||||
fatalErrorInFunction<<"dictionary "<< bName<<
|
|
||||||
"does not exist in "<< boundaries.globalName()<<endl;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
auto& bDict = rbBoundaries.subDict(bName);
|
|
||||||
|
|
||||||
if(!bDict.addOrKeep("neighborLength", neighborLength))
|
|
||||||
{
|
|
||||||
fatalErrorInFunction<<"error in adding neighborLength to "<< bName <<
|
|
||||||
"in dictionary "<< boundaries.globalName()<<endl;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!bDict.addOrReplace("updateInterval", updateIntercal))
|
|
||||||
{
|
|
||||||
fatalErrorInFunction<<"error in adding updateIntercal to "<< bName <<
|
|
||||||
"in dictionary "<< boundaries.globalName()<<endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
bDict.addOrReplace("boundaryExtntionLengthRatio", boundaryExtntionLengthRatio);
|
|
||||||
|
|
||||||
if(!bDict.add("neighborProcessorNo",(uint32) processors::globalRank()))
|
if(!bDict.add("neighborProcessorNo",(uint32) processors::globalRank()))
|
||||||
{
|
{
|
||||||
fatalErrorInFunction<<"error in adding neighborProcessorNo to "<< bName <<
|
fatalErrorInFunction<<"error in adding neighborProcessorNo to "<< bName <<
|
||||||
" in dictionary "<< boundaries.globalName()<<endl;
|
" in dictionary "<< thisBoundaries.globalName()<<endl;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto bType = bDict.getVal<word>("type");
|
auto bType = bDict.getVal<word>("type");
|
||||||
uint32 mirrorIndex = 0;
|
uint32 mirrorIndex = 0;
|
||||||
|
|
||||||
if(bType == "periodic")
|
if(bType == "periodic")
|
||||||
{
|
{
|
||||||
if(bName == bundaryName(0)) mirrorIndex = 1;
|
if(bName == bundaryName(0)) mirrorIndex = 1;
|
||||||
|
@ -92,7 +61,6 @@ bool pFlow::regularSimulationDomain::createBoundaryDicts()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -229,9 +197,3 @@ bool pFlow::regularSimulationDomain::initialTransferBlockData
|
||||||
charSpan(dst),
|
charSpan(dst),
|
||||||
sizeof(int32));
|
sizeof(int32));
|
||||||
}
|
}
|
||||||
|
|
||||||
const pFlow::dictionary &pFlow::regularSimulationDomain::thisBoundaryDict() const
|
|
||||||
{
|
|
||||||
return this->subDict("regularBoundaries");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
|
@ -88,8 +88,6 @@ public:
|
||||||
bool initialTransferBlockData(span<int32> src, span<int32> dst)
|
bool initialTransferBlockData(span<int32> src, span<int32> dst)
|
||||||
const final;
|
const final;
|
||||||
|
|
||||||
const dictionary& thisBoundaryDict() const final;
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,22 +23,81 @@ Licence:
|
||||||
#include "systemControl.hpp"
|
#include "systemControl.hpp"
|
||||||
#include "vocabs.hpp"
|
#include "vocabs.hpp"
|
||||||
|
|
||||||
pFlow::simulationDomain::simulationDomain(systemControl& control)
|
bool pFlow::simulationDomain::prepareBoundaryDicts()
|
||||||
:
|
{
|
||||||
fileDictionary
|
|
||||||
(
|
dictionary& boundaries = this->subDict("boundaries");
|
||||||
objectFile
|
|
||||||
(
|
real neighborLength = boundaries.getVal<real>("neighborLength");
|
||||||
|
|
||||||
|
real boundaryExtntionLengthRatio =
|
||||||
|
boundaries.getValOrSetMax("boundaryExtntionLengthRatio", 0.1);
|
||||||
|
|
||||||
|
uint32 updateInterval =
|
||||||
|
boundaries.getValOrSetMax<uint32>("updateInterval", 1u);
|
||||||
|
|
||||||
|
uint32 neighborListUpdateInterval =
|
||||||
|
boundaries.getValMax("neighborListUpdateInterval", updateInterval);
|
||||||
|
|
||||||
|
boundaries.addOrReplace("neighborListUpdateInterval", neighborListUpdateInterval);
|
||||||
|
|
||||||
|
// create this boundaries dictionary
|
||||||
|
this->addDict(thisBoundariesDictName(), boundaries);
|
||||||
|
dictionary& thisBDict = this->subDict(thisBoundariesDictName());
|
||||||
|
thisBDict.addOrReplace("neighborLength", neighborLength);
|
||||||
|
thisBDict.addOrReplace("boundaryExtntionLengthRatio", boundaryExtntionLengthRatio);
|
||||||
|
thisBDict.addOrReplace("updateInterval", updateInterval);
|
||||||
|
thisBDict.addOrReplace("neighborListUpdateInterval", neighborListUpdateInterval);
|
||||||
|
|
||||||
|
|
||||||
|
for(uint32 i=0; i<sizeOfBoundaries(); i++)
|
||||||
|
{
|
||||||
|
word bName = bundaryName(i);
|
||||||
|
if( !boundaries.containsDictionay(bName) )
|
||||||
|
{
|
||||||
|
fatalErrorInFunction<<"dictionary "<< bName<<
|
||||||
|
"does not exist in "<< boundaries.globalName()<<endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
auto& bDict = thisBDict.subDict(bName);
|
||||||
|
|
||||||
|
if(!bDict.addOrKeep("neighborLength", neighborLength))
|
||||||
|
{
|
||||||
|
fatalErrorInFunction<<"error in adding neighborLength to "<< bName <<
|
||||||
|
"in dictionary "<< boundaries.globalName()<<endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!bDict.addOrReplace("updateInterval", updateInterval))
|
||||||
|
{
|
||||||
|
fatalErrorInFunction<<"error in adding updateInterval to "<< bName <<
|
||||||
|
"in dictionary "<< boundaries.globalName()<<endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bDict.addOrReplace("boundaryExtntionLengthRatio", boundaryExtntionLengthRatio);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
pFlow::simulationDomain::simulationDomain(systemControl &control)
|
||||||
|
: fileDictionary(
|
||||||
|
objectFile(
|
||||||
domainFile__,
|
domainFile__,
|
||||||
"",
|
"",
|
||||||
objectFile::READ_ALWAYS,
|
objectFile::READ_ALWAYS,
|
||||||
objectFile::WRITE_NEVER
|
objectFile::WRITE_NEVER),
|
||||||
),
|
&control.settings()),
|
||||||
&control.settings()
|
|
||||||
),
|
|
||||||
globalBox_(subDict("globalBox"))
|
globalBox_(subDict("globalBox"))
|
||||||
{
|
{
|
||||||
|
if( !prepareBoundaryDicts() )
|
||||||
|
{
|
||||||
|
fatalErrorInFunction<<
|
||||||
|
"Error in preparing dictionaries for boundaries"<<endl;
|
||||||
|
fatalExit;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pFlow::domain pFlow::simulationDomain::extendThisDomain
|
pFlow::domain pFlow::simulationDomain::extendThisDomain
|
||||||
|
|
|
@ -44,7 +44,6 @@ private:
|
||||||
/// @brief acutal limits of the global box of simulation
|
/// @brief acutal limits of the global box of simulation
|
||||||
box globalBox_;
|
box globalBox_;
|
||||||
|
|
||||||
|
|
||||||
static constexpr uint32 sizeOfBoundaries_ = 6;
|
static constexpr uint32 sizeOfBoundaries_ = 6;
|
||||||
|
|
||||||
static
|
static
|
||||||
|
@ -55,6 +54,10 @@ private:
|
||||||
"rear", "front"
|
"rear", "front"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
bool prepareBoundaryDicts();
|
||||||
|
|
||||||
virtual
|
virtual
|
||||||
bool createBoundaryDicts() = 0;
|
bool createBoundaryDicts() = 0;
|
||||||
|
|
||||||
|
@ -86,8 +89,30 @@ public:
|
||||||
return globalBox_;
|
return globalBox_;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual
|
/// @brief The original dictionary supplied by the user as input
|
||||||
const dictionary& thisBoundaryDict()const = 0;
|
inline
|
||||||
|
const auto& globalBoundariesDict()const
|
||||||
|
{
|
||||||
|
return static_cast<const fileDictionary&>(*this);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @brief The generated dictionary generated by code which is used
|
||||||
|
const dictionary& thisBoundariesDict()const
|
||||||
|
{
|
||||||
|
return this->subDict(thisBoundariesDictName());
|
||||||
|
}
|
||||||
|
|
||||||
|
word thisBoundariesDictName()const
|
||||||
|
{
|
||||||
|
return "thsiDomainBoundaries";
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @brief return a const ref to dicrionary of boundary i of this processor
|
||||||
|
inline
|
||||||
|
const dictionary& boundaryDict(uint32 i)const
|
||||||
|
{
|
||||||
|
return thisBoundariesDict().subDict(bundaryName(i));
|
||||||
|
}
|
||||||
|
|
||||||
virtual
|
virtual
|
||||||
bool initialUpdateDomains(span<realx3> pointPos) = 0;
|
bool initialUpdateDomains(span<realx3> pointPos) = 0;
|
||||||
|
@ -160,24 +185,9 @@ public:
|
||||||
const realx3& lowerPointExtension,
|
const realx3& lowerPointExtension,
|
||||||
const realx3& upperPointExtension)const;
|
const realx3& upperPointExtension)const;
|
||||||
|
|
||||||
/// @brief The original dictionary supplied by the user as input
|
|
||||||
inline
|
|
||||||
const auto& globalBoundaryDict()const
|
|
||||||
{
|
|
||||||
return static_cast<const fileDictionary&>(*this);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// @brief return a const ref to dicrionary of boundary i of this processor
|
|
||||||
inline
|
|
||||||
const dictionary& boundaryDict(uint32 i)const
|
|
||||||
{
|
|
||||||
return thisBoundaryDict().subDict(bundaryName(i));
|
|
||||||
}
|
|
||||||
|
|
||||||
/// @brief return a const ref to the plane of boundary i of this processor
|
/// @brief return a const ref to the plane of boundary i of this processor
|
||||||
const plane& boundaryPlane(uint32 i)const;
|
const plane& boundaryPlane(uint32 i)const;
|
||||||
|
|
||||||
|
|
||||||
static
|
static
|
||||||
uniquePtr<simulationDomain> create(systemControl& control);
|
uniquePtr<simulationDomain> create(systemControl& control);
|
||||||
|
|
||||||
|
|
|
@ -171,11 +171,9 @@ pFlow::pointStructure::pointStructure(
|
||||||
|
|
||||||
bool pFlow::pointStructure::beforeIteration()
|
bool pFlow::pointStructure::beforeIteration()
|
||||||
{
|
{
|
||||||
uint32 iter = currentIter();
|
const timeInfo ti = TimeInfo();
|
||||||
real t = currentTime();
|
|
||||||
real deltat = dt();
|
|
||||||
|
|
||||||
if(pointSorting_.sortTime(iter, t, deltat))
|
if(pointSorting_.sortTime(ti.iter(), ti.t(), ti.dt()))
|
||||||
{
|
{
|
||||||
auto sortedIndices = pointSorting_.getSortedIndices(
|
auto sortedIndices = pointSorting_.getSortedIndices(
|
||||||
simulationDomain_().globalBox(),
|
simulationDomain_().globalBox(),
|
||||||
|
@ -190,11 +188,13 @@ bool pFlow::pointStructure::beforeIteration()
|
||||||
}
|
}
|
||||||
|
|
||||||
boundaryUpdateTimer_.start();
|
boundaryUpdateTimer_.start();
|
||||||
boundaries_.beforeIteration(iter, t, deltat, true);
|
boundaries_.beforeIteration(ti, true);
|
||||||
boundaryUpdateTimer_.end();
|
boundaryUpdateTimer_.end();
|
||||||
|
|
||||||
INFORMATION<<"Reordering of particles has been done. New active range for particles is "<<
|
INFORMATION<<"Reordering of particles has been done. New active range for particles is "<<
|
||||||
activeRange()<<END_INFO;
|
activeRange()<<END_INFO;
|
||||||
|
|
||||||
|
|
||||||
message msg;
|
message msg;
|
||||||
anyList varList;
|
anyList varList;
|
||||||
|
|
||||||
|
@ -202,7 +202,7 @@ bool pFlow::pointStructure::beforeIteration()
|
||||||
msg.addAndName(message::ITEM_REARRANGE),
|
msg.addAndName(message::ITEM_REARRANGE),
|
||||||
sortedIndices);
|
sortedIndices);
|
||||||
|
|
||||||
if(!notify(iter, t, deltat, msg, varList))
|
if(!notify(ti, msg, varList))
|
||||||
{
|
{
|
||||||
fatalErrorInFunction<<
|
fatalErrorInFunction<<
|
||||||
"cannot notify for reordering items."<<endl;
|
"cannot notify for reordering items."<<endl;
|
||||||
|
@ -214,7 +214,7 @@ bool pFlow::pointStructure::beforeIteration()
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
boundaryUpdateTimer_.start();
|
boundaryUpdateTimer_.start();
|
||||||
if( !boundaries_.beforeIteration(iter, t, deltat) )
|
if( !boundaries_.beforeIteration(ti) )
|
||||||
{
|
{
|
||||||
fatalErrorInFunction<<
|
fatalErrorInFunction<<
|
||||||
"Unable to perform beforeIteration for boundaries"<<endl;
|
"Unable to perform beforeIteration for boundaries"<<endl;
|
||||||
|
@ -228,7 +228,7 @@ bool pFlow::pointStructure::beforeIteration()
|
||||||
|
|
||||||
bool pFlow::pointStructure::iterate()
|
bool pFlow::pointStructure::iterate()
|
||||||
{
|
{
|
||||||
if( !boundaries_.iterate(currentIter(), currentTime(), dt()) )
|
if( !boundaries_.iterate(TimeInfo()) )
|
||||||
{
|
{
|
||||||
fatalErrorInFunction<<
|
fatalErrorInFunction<<
|
||||||
"Unable to perform iterate for boundaries"<<endl;
|
"Unable to perform iterate for boundaries"<<endl;
|
||||||
|
@ -241,7 +241,7 @@ bool pFlow::pointStructure::iterate()
|
||||||
bool pFlow::pointStructure::afterIteration()
|
bool pFlow::pointStructure::afterIteration()
|
||||||
{
|
{
|
||||||
boundaryDataTransferTimer_.start();
|
boundaryDataTransferTimer_.start();
|
||||||
if( !boundaries_.afterIteration(currentIter(), currentTime(), dt()) )
|
if( !boundaries_.afterIteration(TimeInfo()) )
|
||||||
{
|
{
|
||||||
fatalErrorInFunction<<
|
fatalErrorInFunction<<
|
||||||
"Unable to perform afterIteration for boundaries"<<endl;
|
"Unable to perform afterIteration for boundaries"<<endl;
|
||||||
|
|
Loading…
Reference in New Issue