Merge pull request #96 from PhasicFlow/develop

Develop - Boundary conditions are created and tested
This commit is contained in:
PhasicFlow
2024-04-04 23:07:16 +03:30
committed by GitHub
100 changed files with 2404 additions and 647 deletions

View File

@ -6,7 +6,7 @@ project(phasicFlow VERSION 1.0 )
set(CMAKE_CXX_STANDARD 17 CACHE STRING "" FORCE)
set(CMAKE_CXX_STANDARD_REQUIRED True)
set(CMAKE_INSTALL_PREFIX ${phasicFlow_SOURCE_DIR} CACHE PATH "Install path of phasicFlow" FORCE)
set(CMAKE_BUILD_TYPE Release CACHE STRING "build type" FORCE)
set(CMAKE_BUILD_TYPE Relase CACHE STRING "build type" FORCE)
set(BUILD_SHARED_LIBS ON CACHE BOOL "Build using shared libraries" FORCE)
mark_as_advanced(FORCE var BUILD_SHARED_LIBS)

View File

@ -88,7 +88,7 @@ initialize_pFlowProcessors();
"particle insertion failed in sphereDFlow solver.\n";
return 1;
}*/
// set force to zero
surfGeometry.beforeIteration();

View File

@ -5,11 +5,21 @@ contactSearch/methods/cellBased/NBS/mapperNBSKernels.cpp
contactSearch/methods/cellBased/NBS/NBSLevel0.cpp
contactSearch/methods/cellBased/NBS/NBS.cpp
contactSearch/methods/cellBased/NBS/cellsWallLevel0.cpp
contactSearch/boundaries/boundaryContactSearch/boundaryContactSearch.cpp
contactSearch/boundaries/periodicBoundaryContactSearch/ppwBndryContactSearchKernels.cpp
contactSearch/boundaries/periodicBoundaryContactSearch/ppwBndryContactSearch.cpp
contactSearch/boundaries/periodicBoundaryContactSearch/wallBoundaryContactSearch.cpp
contactSearch/boundaries/periodicBoundaryContactSearch/periodicBoundaryContactSearch.cpp
contactSearch/boundaries/boundaryContactSearchList.cpp
contactSearch/contactSearch/contactSearch.cpp
contactSearch/boundaries/searchBoundary.cpp
contactSearch/ContactSearch/ContactSearchs.cpp
interaction/interaction.cpp
sphereInteraction/sphereInteractions.cpp
sphereInteraction/sphereInteractionsLinearModels.cpp
sphereInteraction/sphereInteractionsNonLinearModels.cpp
sphereInteraction/sphereInteractionsNonLinearModModels.cpp
)
set(link_libs Kokkos::kokkos phasicFlow Property Particles Geometry)

View File

@ -17,10 +17,11 @@ Licence:
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-----------------------------------------------------------------------------*/
#ifndef __unsortedContactList_hpp__
#define __unsortedContactList_hpp__
#include "unsortedPairs.hpp"
namespace pFlow
{

View File

@ -27,6 +27,7 @@ Licence:
#include "box.hpp"
#include "particles.hpp"
#include "geometry.hpp"
#include "boundaryContactSearchList.hpp"
namespace pFlow
{
@ -50,6 +51,8 @@ private:
uniquePtr<SearchMethodType> ppwContactSearch_ = nullptr;
boundaryContactSearchList csBoundaries_;
public:
TypeInfoTemplate11("ContactSearch", SearchMethodType);
@ -61,14 +64,24 @@ public:
const geometry& geom,
Timers& timers)
:
contactSearch(csDict, extDomain, prtcl, geom, timers)
contactSearch(
csDict,
extDomain,
prtcl,
geom,
timers),
csBoundaries_(
csDict,
Particles().pStruct().boundaries(),
*this)
{
auto method = dict().getVal<word>("method");
/*auto method = dict().getVal<word>("method");
auto nbDict = dict().subDict(method+"Info");
auto nbDict = dict().subDict(method+"Info");*/
real minD, maxD;
real minD;
real maxD;
this->Particles().boundingSphereMinMax(minD, maxD);
const auto& position = this->Particles().pointPosition().deviceViewAll();
@ -84,7 +97,7 @@ public:
ppwContactSearch_ =
makeUnique<SearchMethodType>
(
nbDict,
dict(),
this->extendedDomainBox(),
minD,
maxD,
@ -141,11 +154,27 @@ public:
}
ppTimer().end();
return true;
}
bool boundaryBroadSearch(
uint32 i,
uint32 iter,
real t,
real dt,
csPairContainerType& ppPairs,
csPairContainerType& pwPairs,
bool force = false)override
{
return csBoundaries_[i].broadSearch(
iter,
t,
dt,
ppPairs,
pwPairs,
force);
}
bool enterBroadSearch(uint32 iter, real t, real dt)const override
{

View File

@ -0,0 +1,77 @@
/*------------------------------- phasicFlow ---------------------------------
O C enter of
O O E ngineering and
O O M ultiscale modeling of
OOOOOOO F luid flow
------------------------------------------------------------------------------
Copyright (C): www.cemf.ir
email: hamid.r.norouzi AT gmail.com
------------------------------------------------------------------------------
Licence:
This file is part of phasicFlow code. It is a free software for simulating
granular and multiphase flows. You can redistribute it and/or modify it under
the terms of GNU General Public License v3 or any other later versions.
phasicFlow is distributed to help others in their research in the field of
granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-----------------------------------------------------------------------------*/
#include "boundaryContactSearch.hpp"
#include "contactSearch.hpp"
pFlow::boundaryContactSearch::boundaryContactSearch(
const dictionary &dict,
const boundaryBase &boundary,
const contactSearch &cSearch)
: generalBoundary(
boundary,
cSearch.pStruct(),
"",
""),
contactSearch_(cSearch),
updateInterval_(dict.getVal<uint32>("updateInterval"))
{
}
pFlow::uniquePtr<pFlow::boundaryContactSearch>
pFlow::boundaryContactSearch::create(
const dictionary &dict,
const boundaryBase &boundary,
const contactSearch &cSearch)
{
word bType = angleBracketsNames2(
"boundaryContactSearch",
pFlowProcessors().localRunTypeName(),
boundary.type());
word altBType{"boundaryContactSearch<none>"};
if( boundaryBasevCtorSelector_.search(bType) )
{
REPORT(2)<<"Creating contact search boundary "<< Green_Text(bType)<<
" for "<<boundary.name()<<endl;
return boundaryBasevCtorSelector_[bType](dict, boundary, cSearch);
}
else if(boundaryBasevCtorSelector_.search(altBType))
{
REPORT(2)<<"Creating contact search boundary "<< Green_Text(altBType)<<
" for "<<boundary.name()<<endl;
return boundaryBasevCtorSelector_[altBType](dict, boundary, cSearch);
}
else
{
printKeys
(
fatalError << "Ctor Selector "<< bType<<
" and "<< altBType << " do not exist. \n"
<<"Avaiable ones are: \n"
,
boundaryBasevCtorSelector_
);
fatalExit;
}
return nullptr;
}

View File

@ -0,0 +1,114 @@
/*------------------------------- phasicFlow ---------------------------------
O C enter of
O O E ngineering and
O O M ultiscale modeling of
OOOOOOO F luid flow
------------------------------------------------------------------------------
Copyright (C): www.cemf.ir
email: hamid.r.norouzi AT gmail.com
------------------------------------------------------------------------------
Licence:
This file is part of phasicFlow code. It is a free software for simulating
granular and multiphase flows. You can redistribute it and/or modify it under
the terms of GNU General Public License v3 or any other later versions.
phasicFlow is distributed to help others in their research in the field of
granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-----------------------------------------------------------------------------*/
#ifndef __boundaryContactSearch_hpp__
#define __boundaryContactSearch_hpp__
#include "generalBoundary.hpp"
#include "contactSearchGlobals.hpp"
#include "virtualConstructor.hpp"
namespace pFlow
{
class contactSearch;
class boundaryContactSearch
: public generalBoundary
{
private:
const contactSearch &contactSearch_;
/// @brief update interval in terms of iteration numebr
uint32 updateInterval_;
/// @brief last iteration number which contact search has been performed
uint32 lastUpdated_ = 0;
/// @brief performed search?
bool performedSearch_ = false;
public:
// type info
TypeInfo("boundaryContactSearch<none>");
boundaryContactSearch(
const dictionary &dict,
const boundaryBase &boundary,
const contactSearch &cSearch);
create_vCtor(
boundaryContactSearch,
boundaryBase,
(
const dictionary &dict,
const boundaryBase &boundary,
const contactSearch &cSearch),
(dict, boundary, cSearch));
add_vCtor(
boundaryContactSearch,
boundaryContactSearch,
boundaryBase);
const contactSearch &cSearch() const
{
return contactSearch_;
}
void fill(const std::any &val) override
{
return;
}
bool hearChanges(
real t,
real dt,
uint32 iter,
const message &msg,
const anyList &varList) override
{
if (msg.equivalentTo(message::BNDR_RESET))
{
// do nothing
}
return true;
}
virtual bool broadSearch(
uint32 iter,
real t,
real dt,
csPairContainerType &ppPairs,
csPairContainerType &pwPairs,
bool force = false)
{
return true;
}
static uniquePtr<boundaryContactSearch> create(
const dictionary &dict,
const boundaryBase &boundary,
const contactSearch &cSearch);
};
}
#endif //__boundaryContactSearch_hpp__

View File

@ -0,0 +1,29 @@
#include "boundaryContactSearchList.hpp"
#include "boundaryList.hpp"
void pFlow::boundaryContactSearchList::setList(
const dictionary &dict,
const contactSearch &cSearch)
{
for(auto i=0; i<boundaries_.size(); i++)
{
this->set
(
i,
boundaryContactSearch::create(dict, boundaries_[i], cSearch)
);
}
}
pFlow::boundaryContactSearchList::boundaryContactSearchList(
const dictionary &dict,
const boundaryList& bndrs,
const contactSearch &cSearch)
:
ListPtr(bndrs.size()),
boundaries_(bndrs)
{
setList(dict, cSearch);
}

View File

@ -0,0 +1,35 @@
#include "ListPtr.hpp"
#include "boundaryContactSearch.hpp"
namespace pFlow
{
class boundaryList;
class contactSearch;
class boundaryContactSearchList
:
public ListPtr<boundaryContactSearch>
{
private:
const boundaryList& boundaries_;
void setList(
const dictionary& dict,
const contactSearch& cSearch);
public:
TypeInfoNV("boundaryContactSearchList");
boundaryContactSearchList(
const dictionary& dict,
const boundaryList& bndrs,
const contactSearch& cSearch);
~boundaryContactSearchList()=default;
};
}

View File

@ -0,0 +1,131 @@
/*------------------------------- phasicFlow ---------------------------------
O C enter of
O O E ngineering and
O O M ultiscale modeling of
OOOOOOO F luid flow
------------------------------------------------------------------------------
Copyright (C): www.cemf.ir
email: hamid.r.norouzi AT gmail.com
------------------------------------------------------------------------------
Licence:
This file is part of phasicFlow code. It is a free software for simulating
granular and multiphase flows. You can redistribute it and/or modify it under
the terms of GNU General Public License v3 or any other later versions.
phasicFlow is distributed to help others in their research in the field of
granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-----------------------------------------------------------------------------*/
#include "periodicBoundaryContactSearch.hpp"
#include "contactSearch.hpp"
#include "particles.hpp"
#include "pointStructure.hpp"
#include "geometry.hpp"
void pFlow::periodicBoundaryContactSearch::setSearchBox()
{
auto db = pStruct().thisDomain().domainBox();
auto n1 = boundary().mirrorBoundary().boundaryPlane().normal();
auto l1 = boundary().mirrorBoundary().neighborLength();
auto n2 = boundary().boundaryPlane().normal();
auto l2 = boundary().neighborLength();
realx3 minP = db.minPoint() + (db.maxPoint()-db.minPoint())* n1+(n2*l2);
realx3 maxP = db.maxPoint() + (n1*l1);
searchBox_={minP, maxP};
}
pFlow::periodicBoundaryContactSearch::periodicBoundaryContactSearch(
const dictionary &dict,
const boundaryBase &boundary,
const contactSearch &cSearch)
:
boundaryContactSearch(dict, boundary, cSearch),
transferVec_(boundary.mirrorBoundary().displacementVectroToMirror()),
thisIndex_(thisBoundaryIndex()),
mirrorIndex_(mirrorBoundaryindex()),
diameter_(cSearch.Particles().boundingSphere())
{
if(thisIndex_%2==1)
{
masterSearch_ = true;
setSearchBox();
real minD;
real maxD;
cSearch.Particles().boundingSphereMinMax(minD, maxD);
ppContactSearch_ = makeUnique<ppwBndryContactSearch>(
searchBox_,
maxD);
const auto& geom = cSearch.Geometry();
pwContactSearch_ = makeUnique<wallBoundaryContactSearch>(
0.5,
geom.numPoints(),
geom.size(),
geom.points().deviceViewAll(),
geom.vertices().deviceViewAll(),
geom.normals().deviceViewAll());
}
else
{
masterSearch_ = false;
searchBox_={{0,0,0},{0,0,0}};
}
}
bool pFlow::periodicBoundaryContactSearch::broadSearch
(
uint32 iter,
real t,
real dt,
csPairContainerType &ppPairs,
csPairContainerType &pwPairs,
bool force
)
{
if(masterSearch_)
{
auto thisP = boundary().thisPoints();
auto thisDiams = diameter_.BoundaryField(thisIndex_).thisField();
auto mirrorP = mirrorBoundary().thisPoints();
auto mirrorDiams = diameter_.BoundaryField(mirrorIndex_).thisField();
ppContactSearch_().broadSearchPP(
ppPairs,
thisP,
thisDiams,
mirrorP,
mirrorDiams,
transferVec_);
/*pwContactSearch_().broadSearch(
pwPairs,
ppContactSearch_().searchCells(),
thisP,
thisDiams,
mirrorP,
mirrorDiams,
transferVec_,
ppContactSearch_().sizeRatio());*/
//output<<t<<" boundary pp size "<< ppPairs.size()<<endl;
//output<<t<<" boundary pw size "<< pwPairs.size()<<endl;
return true;
}else
{
return true;
}
}

View File

@ -0,0 +1,81 @@
/*------------------------------- phasicFlow ---------------------------------
O C enter of
O O E ngineering and
O O M ultiscale modeling of
OOOOOOO F luid flow
------------------------------------------------------------------------------
Copyright (C): www.cemf.ir
email: hamid.r.norouzi AT gmail.com
------------------------------------------------------------------------------
Licence:
This file is part of phasicFlow code. It is a free software for simulating
granular and multiphase flows. You can redistribute it and/or modify it under
the terms of GNU General Public License v3 or any other later versions.
phasicFlow is distributed to help others in their research in the field of
granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-----------------------------------------------------------------------------*/
#ifndef __periodicBoundaryContactSearch_hpp__
#define __periodicBoundaryContactSearch_hpp__
#include "boundaryContactSearch.hpp"
#include "box.hpp"
#include "ppwBndryContactSearch.hpp"
#include "pointFields.hpp"
#include "wallBoundaryContactSearch.hpp"
namespace pFlow
{
class periodicBoundaryContactSearch
: public boundaryContactSearch
{
private:
box searchBox_;
realx3 transferVec_;
uint32 thisIndex_;
uint32 mirrorIndex_;
uniquePtr<ppwBndryContactSearch> ppContactSearch_ = nullptr;
uniquePtr<wallBoundaryContactSearch> pwContactSearch_ = nullptr;
const realPointField_D &diameter_;
bool masterSearch_ = false;
void setSearchBox();
public:
TypeInfo("boundaryContactSearch<regular,periodic>")
periodicBoundaryContactSearch(
const dictionary &dict,
const boundaryBase &boundary,
const contactSearch &cSearch);
~periodicBoundaryContactSearch() override = default;
add_vCtor(
boundaryContactSearch,
periodicBoundaryContactSearch,
boundaryBase);
bool broadSearch(
uint32 iter,
real t,
real dt,
csPairContainerType &ppPairs,
csPairContainerType &pwPairs,
bool force = false) override;
};
}
#endif //__periodicBoundaryContactSearch_hpp__

View File

@ -0,0 +1,109 @@
#include "ppwBndryContactSearch.hpp"
#include "ppwBndryContactSearchKernels.hpp"
#include "phasicFlowKokkos.hpp"
#include "streams.hpp"
void pFlow::ppwBndryContactSearch::checkAllocateNext(uint32 n)
{
if( nextCapacity_ < n)
{
nextCapacity_ = n;
reallocNoInit(next_, n);
}
}
void pFlow::ppwBndryContactSearch::nullifyHead()
{
fill(head_, static_cast<uint32>(-1));
}
void pFlow::ppwBndryContactSearch::nullifyNext(uint32 n)
{
fill(next_, 0u, n, static_cast<uint32>(-1));
}
void pFlow::ppwBndryContactSearch::buildList(
const deviceScatteredFieldAccess<realx3> &points)
{
if(points.empty())return;
uint32 n = points.size();
checkAllocateNext(n);
nullifyNext(n);
nullifyHead();
pFlow::pweBndryContactSearchKernels::buildNextHead(
points,
searchCells_,
head_,
next_
);
}
pFlow::ppwBndryContactSearch::ppwBndryContactSearch
(
const box &domain,
real cellSize,
real sizeRatio
)
:
searchCells_(domain, cellSize),
head_("periodic:head",searchCells_.nx(), searchCells_.ny(), searchCells_.nz()),
sizeRatio_(sizeRatio)
{
}
bool pFlow::ppwBndryContactSearch::broadSearchPP
(
csPairContainerType &ppPairs,
const deviceScatteredFieldAccess<realx3> &points,
const deviceScatteredFieldAccess<real>& diams,
const deviceScatteredFieldAccess<realx3> &mirrorPoints,
const deviceScatteredFieldAccess<real>& mirrorDiams,
const realx3& transferVec
)
{
buildList(points);
uint32 nNotInserted = 1;
// loop until the container size fits the numebr of contact pairs
while (nNotInserted > 0)
{
nNotInserted = pFlow::pweBndryContactSearchKernels::broadSearchPP
(
ppPairs,
points,
diams,
mirrorPoints,
mirrorDiams,
transferVec,
head_,
next_,
searchCells_,
sizeRatio_
);
if(nNotInserted)
{
// - resize the container
// note that getFull now shows the number of failed insertions.
uint32 len = max(nNotInserted,100u) ;
auto oldCap = ppPairs.capacity();
ppPairs.increaseCapacityBy(len);
INFORMATION<< "Particle-particle contact pair container capacity increased from "<<
oldCap << " to "<<ppPairs.capacity()<<" in peiodicBoundaryContactSearch."<<END_INFO;
}
}
return true;
}

View File

@ -0,0 +1,85 @@
/*------------------------------- phasicFlow ---------------------------------
O C enter of
O O E ngineering and
O O M ultiscale modeling of
OOOOOOO F luid flow
------------------------------------------------------------------------------
Copyright (C): www.cemf.ir
email: hamid.r.norouzi AT gmail.com
------------------------------------------------------------------------------
Licence:
This file is part of phasicFlow code. It is a free software for simulating
granular and multiphase flows. You can redistribute it and/or modify it under
the terms of GNU General Public License v3 or any other later versions.
phasicFlow is distributed to help others in their research in the field of
granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-----------------------------------------------------------------------------*/
#ifndef __ppwBndryContactSearch_hpp__
#define __ppwBndryContactSearch_hpp__
#include "contactSearchGlobals.hpp"
#include "scatteredFieldAccess.hpp"
#include "cells.hpp"
namespace pFlow
{
class ppwBndryContactSearch
{
public:
using HeadType = deviceViewType3D<uint32>;
using NextType = deviceViewType1D<uint32>;
private:
cells searchCells_;
HeadType head_{"periodic::head", 1, 1, 1};
NextType next_{"periodic::next", 1};
real sizeRatio_ = 1.0;
uint32 nextCapacity_ = 0;
void checkAllocateNext(uint32 n);
void nullifyHead();
void nullifyNext(uint32 n);
void buildList(
const deviceScatteredFieldAccess<realx3> &points);
public:
ppwBndryContactSearch(
const box &domain,
real cellSize,
real sizeRatio = 1.0);
bool broadSearchPP(
csPairContainerType &ppPairs,
const deviceScatteredFieldAccess<realx3> &points,
const deviceScatteredFieldAccess<real> &diams,
const deviceScatteredFieldAccess<realx3> &mirrorPoints,
const deviceScatteredFieldAccess<real> &mirrorDiams,
const realx3 &transferVec);
const auto& searchCells()const
{
return searchCells_;
}
real sizeRatio()const
{
return sizeRatio_;
}
};
}
#endif //__ppwBndryContactSearch_hpp__

View File

@ -0,0 +1,105 @@
#include "ppwBndryContactSearchKernels.hpp"
INLINE_FUNCTION_HD
bool sphereSphereCheckB(const pFlow::realx3& p1, const pFlow::realx3 p2, pFlow::real d1, pFlow::real d2)
{
return pFlow::length(p2-p1) < 0.5*(d2+d1);
}
void pFlow::pweBndryContactSearchKernels::buildNextHead
(
const deviceScatteredFieldAccess<realx3> &points,
const cells &searchCells,
deviceViewType3D<uint32> &head,
deviceViewType1D<uint32> &next
)
{
if(points.empty())return;
uint32 n= points.size();
Kokkos::parallel_for(
"pFlow::ppwBndryContactSearch::buildList",
deviceRPolicyStatic(0,n),
LAMBDA_HD(uint32 i)
{
int32x3 ind;
if( searchCells.pointIndexInDomain(points[i], ind) )
{
// discards points out of searchCell
uint32 old = Kokkos::atomic_exchange(&head(ind.x(), ind.y(), ind.z()), i);
next[i] = old;
}
}
);
Kokkos::fence();
}
pFlow::uint32 pFlow::pweBndryContactSearchKernels::broadSearchPP
(
csPairContainerType &ppPairs,
const deviceScatteredFieldAccess<realx3> &points,
const deviceScatteredFieldAccess<real> &diams,
const deviceScatteredFieldAccess<realx3> &mirrorPoints,
const deviceScatteredFieldAccess<real> &mirrorDiams,
const realx3 &transferVec,
const deviceViewType3D<uint32> &head,
const deviceViewType1D<uint32> &next,
const cells &searchCells,
const real sizeRatio
)
{
if(points.empty()) return 0;
if(mirrorPoints.empty())return 0;
auto nMirror = mirrorPoints.size();
uint32 getFull = 0;
Kokkos::parallel_reduce(
"pFlow::pweBndryContactSearchKernels::broadSearchPP",
deviceRPolicyStatic(0, nMirror),
LAMBDA_HD(const uint32 mrrI, uint32 &getFullUpdate)
{
realx3 p_m = mirrorPoints(mrrI) + transferVec;
int32x3 ind_m;
if( !searchCells.pointIndexInDomain(p_m, ind_m))return;
real d_m = sizeRatio*mirrorDiams[mrrI];
for(int ii=-1; ii<2; ii++)
{
for(int jj=-1; jj<2; jj++)
{
for(int kk =-1; kk<2; kk++)
{
auto ind = ind_m + int32x3{ii,jj,kk};
if(!searchCells.inCellRange(ind))continue;
uint32 thisI = head(ind.x(),ind.y(),ind.z());
while (thisI!=-1)
{
auto d_n = sizeRatio*diams[thisI];
// first item is for this boundary and second itme, for mirror
if(sphereSphereCheckB(p_m, points[thisI], d_m, d_n)&&
ppPairs.insert(thisI,mrrI) == -1)
{
getFullUpdate++;
}
thisI = next(thisI);
}
}
}
}
},
getFull
);
return getFull;
}

View File

@ -0,0 +1,31 @@
#include "contactSearchGlobals.hpp"
#include "cells.hpp"
#include "contactSearchFunctions.hpp"
#include "scatteredFieldAccess.hpp"
namespace pFlow::pweBndryContactSearchKernels
{
void buildNextHead(
const deviceScatteredFieldAccess<realx3> &points,
const cells &searchCells,
deviceViewType3D<uint32> &head,
deviceViewType1D<uint32> &next );
uint32 broadSearchPP
(
csPairContainerType &ppPairs,
const deviceScatteredFieldAccess<realx3> &points,
const deviceScatteredFieldAccess<real> &diams,
const deviceScatteredFieldAccess<realx3> &mirrorPoints,
const deviceScatteredFieldAccess<real> &mirrorDiams,
const realx3 &transferVec,
const deviceViewType3D<uint32> &head,
const deviceViewType1D<uint32> &next,
const cells &searchCells,
real sizeRatio
);
}

View File

@ -0,0 +1,141 @@
#include "wallBoundaryContactSearch.hpp"
#include "streams.hpp"
pFlow::wallBoundaryContactSearch::wallBoundaryContactSearch
(
real cellExtent,
uint32 numPoints,
uint32 numElements,
const ViewType1D<realx3, memory_space> &points,
const ViewType1D<uint32x3, memory_space> &vertices,
const ViewType1D<realx3, memory_space> &normals
)
:
cellExtent_( max(cellExtent, 0.5 ) ),
numElements_(numElements),
numPoints_(numPoints),
vertices_(vertices),
points_(points),
normals_(normals)
{
allocateArrays();
}
bool pFlow::wallBoundaryContactSearch::build(const cells &searchBox, const realx3& transferVec)
{
Kokkos::parallel_for(
"pFlow::cellsWallLevel0::build",
deviceRPolicyStatic(0,numElements_),
CLASS_LAMBDA_HD(uint32 i)
{
auto v = vertices_[i];
auto p1 = points_[v.x()]+transferVec;
auto p2 = points_[v.y()]+transferVec;
auto p3 = points_[v.z()]+transferVec;
realx3 minP;
realx3 maxP;
searchBox.extendBox(p1, p2, p3, cellExtent_, minP, maxP);
elementBox_[i] = iBoxType(searchBox.pointIndex(minP), searchBox.pointIndex(maxP));
auto d = elementBox_[i].maxPoint()-elementBox_[i].minPoint();
validBox_[i] = (d.x()*d.y()*d.z())==0? 0:1;
});
Kokkos::fence();
return true;
}
bool pFlow::wallBoundaryContactSearch::broadSearch
(
csPairContainerType &pairs,
const cells &searchCells,
const deviceScatteredFieldAccess<realx3> &thisPoints,
const deviceScatteredFieldAccess<real> &thisDiams,
const deviceScatteredFieldAccess<realx3> &mirrorPoints,
const deviceScatteredFieldAccess<real> &mirroDiams,
const realx3 &transferVec,
real sizeRatio
)
{
uint32 nNotInserted = 1;
while (nNotInserted>0u)
{
build(searchCells,{0,0,0});
nNotInserted = findPairsElementRangeCount(
pairs,
searchCells,
thisPoints,
thisDiams,
{0,0,0},
0
);
build(searchCells, transferVec);
nNotInserted += findPairsElementRangeCount(
pairs,
searchCells,
mirrorPoints,
mirroDiams,
transferVec,
BASE_MIRROR_WALL_INDEX
);
if(nNotInserted>0u)
{
// note that getFull now shows the number of failed insertions.
uint32 incCap = max(nNotInserted,50u) ;
auto oldCap = pairs.capacity();
pairs.increaseCapacityBy(incCap);
INFORMATION<< "The contact pair container capacity increased from "<<
oldCap << " to "<<pairs.capacity()<<" in wallBoundaryContactSearch."<<END_INFO;
}
}
return true;
}
pFlow::uint32 pFlow::wallBoundaryContactSearch::findPairsElementRangeCount
(
csPairContainerType &pairs,
const cells &searchCells,
const deviceScatteredFieldAccess<realx3> &pPoints,
const deviceScatteredFieldAccess<real> &pDiams,
const realx3 &transferVec,
uint baseTriIndex
)
{
if(pPoints.empty())return 0u;
uint32 nNotInserted = 0;
uint32 nThis = pPoints.size();
Kokkos::parallel_reduce(
"pFlow::wallBoundaryContactSearch::findPairsElementRangeCount",
deviceRPolicyDynamic(0,nThis),
LAMBDA_HD(uint32 i, uint32 &notInsertedUpdate)
{
auto p = pPoints[i]+transferVec;
int32x3 ind;
if( searchCells.pointIndexInDomain(p, ind) )
{
for(uint32 nTri=0; nTri<numElements_; nTri++)
{
if( validBox_[nTri]== 0)continue;
if( elementBox_[nTri].isInside(ind)&&
pairs.insert(i,nTri+baseTriIndex) == -1)
{
notInsertedUpdate++;
}
}
}
},
nNotInserted
);
return nNotInserted;
}

View File

@ -0,0 +1,131 @@
/*------------------------------- phasicFlow ---------------------------------
O C enter of
O O E ngineering and
O O M ultiscale modeling of
OOOOOOO F luid flow
------------------------------------------------------------------------------
Copyright (C): www.cemf.ir
email: hamid.r.norouzi AT gmail.com
------------------------------------------------------------------------------
Licence:
This file is part of phasicFlow code. It is a free software for simulating
granular and multiphase flows. You can redistribute it and/or modify it under
the terms of GNU General Public License v3 or any other later versions.
phasicFlow is distributed to help others in their research in the field of
granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-----------------------------------------------------------------------------*/
#ifndef __wallBoundaryContactSearch_hpp__
#define __wallBoundaryContactSearch_hpp__
#include "contactSearchGlobals.hpp"
#include "contactSearchFunctions.hpp"
#include "scatteredFieldAccess.hpp"
#include "iBox.hpp"
#include "cells.hpp"
namespace pFlow
{
class wallBoundaryContactSearch
{
public:
using execution_space = csExecutionSpace;
using memory_space = typename execution_space::memory_space;
using iBoxType = iBox<int32>;
private:
// - box extent
real cellExtent_ = 0.5;
// - number of triangle elements
uint32 numElements_ = 0;
// - number of points
uint32 numPoints_ = 0;
// - ref to vectices (borrowed)
ViewType1D<uint32x3, memory_space> vertices_;
// - ref to points in the trisurface (borrowed)
ViewType1D<realx3, memory_space> points_;
// - ref to normal vectors of triangles (borrowed)
ViewType1D<realx3, memory_space> normals_;
// cell range of element/triangle bounding box
ViewType1D<iBoxType, memory_space> elementBox_;
ViewType1D<uint8, memory_space> validBox_;
FUNCTION_H
void allocateArrays()
{
reallocNoInit( elementBox_, numElements_);
reallocNoInit( validBox_, numElements_);
}
public:
TypeInfoNV("wallBoundaryContactSearch");
INLINE_FUNCTION_HD
wallBoundaryContactSearch()=default;
FUNCTION_H
wallBoundaryContactSearch(
real cellExtent,
uint32 numPoints,
uint32 numElements,
const ViewType1D<realx3,memory_space>& points,
const ViewType1D<uint32x3,memory_space>& vertices,
const ViewType1D<realx3, memory_space>& normals);
INLINE_FUNCTION_HD
uint32 numElements()const
{
return numElements_;
}
bool build(const cells& searchBox, const realx3& transferVec);
bool broadSearch(
csPairContainerType& pairs,
const cells &searchCells,
const deviceScatteredFieldAccess<realx3>& thisPoints,
const deviceScatteredFieldAccess<real>& thisDiams,
const deviceScatteredFieldAccess<realx3>& mirrorPoints,
const deviceScatteredFieldAccess<real>& mirroDiams,
const realx3& transferVec,
real sizeRatio);
uint32 findPairsElementRangeCount(
csPairContainerType &pairs,
const cells &searchCells,
const deviceScatteredFieldAccess<realx3> &pPoints,
const deviceScatteredFieldAccess<real> &pDiams,
const realx3 &transferVec,
uint baseTriIndex);
}; // wallBoundaryContactSearch
} // pFlow
#endif // __wallBoundaryContactSearch_hpp__

View File

@ -1,36 +0,0 @@
#include "searchBoundary.hpp"
#include "contactSearch.hpp"
pFlow::searchBoundary::searchBoundary
(
const dictionary& dict,
const boundaryBase& boundary,
const contactSearch& cSearch
)
:
generalBoundary
(
boundary,
cSearch.pStruct(),
"",
""
),
contactSearch_(cSearch),
updateInterval_(dict.getVal<uint32>("updateInterval"))
{
}
pFlow::uniquePtr<pFlow::searchBoundary>
pFlow::searchBoundary::create
(
const dictionary &dict,
const boundaryBase &boundary,
const contactSearch &cSearch
)
{
return nullptr;
}

View File

@ -1,113 +0,0 @@
/*------------------------------- phasicFlow ---------------------------------
O C enter of
O O E ngineering and
O O M ultiscale modeling of
OOOOOOO F luid flow
------------------------------------------------------------------------------
Copyright (C): www.cemf.ir
email: hamid.r.norouzi AT gmail.com
------------------------------------------------------------------------------
Licence:
This file is part of phasicFlow code. It is a free software for simulating
granular and multiphase flows. You can redistribute it and/or modify it under
the terms of GNU General Public License v3 or any other later versions.
phasicFlow is distributed to help others in their research in the field of
granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-----------------------------------------------------------------------------*/
#ifndef __searchBoundary_hpp__
#define __searchBoundary_hpp__
#include "generalBoundary.hpp"
#include "virtualConstructor.hpp"
namespace pFlow
{
class contactSearch;
class searchBoundary
:
public generalBoundary
{
private:
const contactSearch& contactSearch_;
/// @brief update interval in terms of iteration numebr
uint32 updateInterval_;
/// @brief last iteration number which contact search has been performed
uint32 lastUpdated_ = 0;
/// @brief performed search?
bool performedSearch_ = false;
public:
// type info
TypeInfo("searchBoundary<regular,none>");
searchBoundary(
const dictionary& dict,
const boundaryBase& boundary,
const contactSearch& cSearch);
create_vCtor
(
searchBoundary,
boundaryBase,
(
const dictionary& dict,
const boundaryBase& boundary,
const contactSearch& cSearch
),
(dict, boundary, cSearch)
);
add_vCtor
(
searchBoundary,
searchBoundary,
boundaryBase
);
void fill(const std::any& val)override
{
return;
}
bool hearChanges
(
real t,
real dt,
uint32 iter,
const message& msg,
const anyList& varList
) override
{
if(msg.equivalentTo(message::BNDR_RESET))
{
//do nothing
}
return true;
}
static
uniquePtr<searchBoundary> create(
const dictionary& dict,
const boundaryBase& boundary,
const contactSearch& cSearch);
};
}
#endif //__searchBoundary_hpp__

View File

@ -68,7 +68,7 @@ pFlow::uniquePtr<pFlow::contactSearch> pFlow::contactSearch::create(
{
printKeys
(
fatalError << "Ctor Selector "<< model << " dose not exist. \n"
fatalError << "Ctor Selector "<< model << " does not exist. \n"
<<"Avaiable ones are: \n\n"
,
dictionaryvCtorSelector_

View File

@ -123,6 +123,16 @@ public:
csPairContainerType& ppPairs,
csPairContainerType& pwPairs,
bool force = false) = 0;
virtual
bool boundaryBroadSearch(
uint32 i,
uint32 iter,
real t,
real dt,
csPairContainerType& ppPairs,
csPairContainerType& pwPairs,
bool force = false)=0;
virtual
bool enterBroadSearch(uint32 iter, real t, real dt)const = 0;

View File

@ -33,6 +33,9 @@ using csIdType = uint32;
using csPairContainerType = unsortedPairs<DefaultExecutionSpace, uint32>;
inline
const uint32 BASE_MIRROR_WALL_INDEX = 1000000;
}
#endif

View File

@ -71,14 +71,15 @@ pFlow::uniquePtr<pFlow::interaction> pFlow::interaction::create
clType);
REPORT(1)<< "Selecting interaction model..."<<END_REPORT;
REPORT(1)<<"Creating interaction "<<Green_Text(interactionModel)<<" . . ."<<END_REPORT;
if( systemControlvCtorSelector_.search(interactionModel) )
{
auto objPtr =
systemControlvCtorSelector_[interactionModel]
(control, prtcl, geom);
REPORT(2)<<"Model "<<Green_Text(interactionModel)<<" is created."<<END_REPORT;
return objPtr;
}
else

View File

@ -79,6 +79,17 @@ public:
(control, prtcl, geom)
);
inline
const auto& Particles()const
{
return particles_;
}
inline
const auto& Geometry()const
{
return geometry_;
}
static
uniquePtr<interaction> create(

View File

@ -0,0 +1,91 @@
/*------------------------------- phasicFlow ---------------------------------
O C enter of
O O E ngineering and
O O M ultiscale modeling of
OOOOOOO F luid flow
------------------------------------------------------------------------------
Copyright (C): www.cemf.ir
email: hamid.r.norouzi AT gmail.com
------------------------------------------------------------------------------
Licence:
This file is part of phasicFlow code. It is a free software for simulating
granular and multiphase flows. You can redistribute it and/or modify it under
the terms of GNU General Public License v3 or any other later versions.
phasicFlow is distributed to help others in their research in the field of
granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-----------------------------------------------------------------------------*/
template <typename cFM, typename gMM>
pFlow::boundarySphereInteraction<cFM, gMM>::boundarySphereInteraction(
const boundaryBase &boundary,
const sphereParticles &sphPrtcls,
const GeometryMotionModel &geomMotion)
: generalBoundary(boundary, sphPrtcls.pStruct(), "", ""),
geometryMotion_(geomMotion),
sphParticles_(sphPrtcls)
{
ppPairs_ = makeUnique<ContactListType>(1);
pwPairs_ = makeUnique<ContactListType>(1);
}
template <typename cFM, typename gMM>
pFlow::uniquePtr<pFlow::boundarySphereInteraction<cFM, gMM>>
pFlow::boundarySphereInteraction<cFM, gMM>::create(
const boundaryBase &boundary,
const sphereParticles &sphPrtcls,
const GeometryMotionModel &geomMotion)
{
word cfTypeName = ContactForceModel::TYPENAME();
word gmTypeName = MotionModel::TYPENAME();
word bType = boundary.type();
word boundaryTypeName = angleBracketsNames3(
"boundarySphereInteraction",
bType,
cfTypeName,
gmTypeName);
word altBTypeName = angleBracketsNames2(
"boundarySphereInteraction",
cfTypeName,
gmTypeName);
if (boundaryBasevCtorSelector_.search(boundaryTypeName))
{
REPORT(2) << "Creating boundry type " << Green_Text(boundaryTypeName) <<
" for boundary " << boundary.name() << " . . ." << END_REPORT;
return boundaryBasevCtorSelector_[boundaryTypeName](
boundary,
sphPrtcls,
geomMotion);
}
else if(boundaryBasevCtorSelector_[altBTypeName])
{
// if boundary condition is not implemented, the default is used
REPORT(2) << "Creating boundry type " << Green_Text(altBTypeName) <<
" for boundary " << boundary.name() << " . . ." << END_REPORT;
return boundaryBasevCtorSelector_[altBTypeName](
boundary,
sphPrtcls,
geomMotion);
}
else
{
printKeys
(
fatalError << "Ctor Selector "<< boundaryTypeName<<
" and "<< altBTypeName << " do not exist. \n"
<<"Avaiable ones are: \n\n"
,
boundaryBasevCtorSelector_
);
fatalExit;
}
return nullptr;
}

View File

@ -0,0 +1,168 @@
/*------------------------------- phasicFlow ---------------------------------
O C enter of
O O E ngineering and
O O M ultiscale modeling of
OOOOOOO F luid flow
------------------------------------------------------------------------------
Copyright (C): www.cemf.ir
email: hamid.r.norouzi AT gmail.com
------------------------------------------------------------------------------
Licence:
This file is part of phasicFlow code. It is a free software for simulating
granular and multiphase flows. You can redistribute it and/or modify it under
the terms of GNU General Public License v3 or any other later versions.
phasicFlow is distributed to help others in their research in the field of
granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-----------------------------------------------------------------------------*/
#ifndef __boundarySphereInteraction_hpp__
#define __boundarySphereInteraction_hpp__
#include "virtualConstructor.hpp"
#include "generalBoundary.hpp"
#include "unsortedContactList.hpp"
#include "sphereParticles.hpp"
namespace pFlow
{
template<typename contactForceModel,typename geometryMotionModel>
class boundarySphereInteraction
:
public generalBoundary
{
public:
using BoundarySphereInteractionType
= boundarySphereInteraction<contactForceModel, geometryMotionModel>;
using GeometryMotionModel = geometryMotionModel;
using ContactForceModel = contactForceModel;
using MotionModel = typename geometryMotionModel::MotionModel;
using ModelStorage = typename ContactForceModel::contactForceStorage;
using IdType = uint32;
using IndexType = uint32;
using ContactListType =
unsortedContactList<ModelStorage, DefaultExecutionSpace, IdType>;
private:
const GeometryMotionModel& geometryMotion_;
/// const reference to sphere particles
const sphereParticles& sphParticles_;
uniquePtr<ContactListType> ppPairs_;
uniquePtr<ContactListType> pwPairs_;
public:
TypeInfoTemplate12("boundarySphereInteraction", ContactForceModel, MotionModel);
boundarySphereInteraction(
const boundaryBase& boundary,
const sphereParticles& sphPrtcls,
const GeometryMotionModel& geomMotion);
create_vCtor
(
BoundarySphereInteractionType,
boundaryBase,
(
const boundaryBase& boundary,
const sphereParticles& sphPrtcls,
const GeometryMotionModel& geomMotion
),
(boundary, sphPrtcls, geomMotion)
);
add_vCtor
(
BoundarySphereInteractionType,
BoundarySphereInteractionType,
boundaryBase
);
~boundarySphereInteraction()override=default;
const auto& sphParticles()const
{
return sphParticles_;
}
const auto& geometryMotion()const
{
return geometryMotion_;
}
ContactListType& ppPairs()
{
return ppPairs_();
}
const ContactListType& ppPairs()const
{
return ppPairs_();
}
ContactListType& pwPairs()
{
return pwPairs_();
}
const ContactListType& pwPairs()const
{
return pwPairs_();
}
virtual
bool sphereSphereInteraction(
real dt,
const ContactForceModel& cfModel)
{
// for default boundary, no thing to be done
return true;
}
bool hearChanges
(
real t,
real dt,
uint32 iter,
const message& msg,
const anyList& varList
) override
{
notImplementedFunction;
return true;
}
void fill(const std::any& val)override
{
notImplementedFunction;
}
static
uniquePtr<BoundarySphereInteractionType> create(
const boundaryBase& boundary,
const sphereParticles& sphPrtcls,
const GeometryMotionModel& geomMotion
);
};
}
#include "boundarySphereInteraction.cpp"
#endif //__boundarySphereInteraction_hpp__

View File

@ -0,0 +1,23 @@
template <typename CFModel, typename gMModel>
pFlow::boundarySphereInteractionList<CFModel, gMModel>::boundarySphereInteractionList
(
const sphereParticles &sphPrtcls,
const gMModel &geomMotion
)
:
ListPtr<boundarySphereInteraction<CFModel,gMModel>>(6),
boundaries_(sphPrtcls.pStruct().boundaries())
{
for(uint32 i=0; i<6; i++)
{
this->set(
i,
boundarySphereInteraction<CFModel, gMModel>::create(
boundaries_[i],
sphPrtcls,
geomMotion));
}
}

View File

@ -0,0 +1,40 @@
#ifndef __boundarySphereInteractionList_hpp__
#define __boundarySphereInteractionList_hpp__
#include "boundaryList.hpp"
#include "ListPtr.hpp"
#include "boundarySphereInteraction.hpp"
namespace pFlow
{
template<typename contactForceModel,typename geometryMotionModel>
class boundarySphereInteractionList
:
public ListPtr<boundarySphereInteraction<contactForceModel,geometryMotionModel>>
{
private:
const boundaryList& boundaries_;
public:
boundarySphereInteractionList(
const sphereParticles& sphPrtcls,
const geometryMotionModel& geomMotion
);
~boundarySphereInteractionList()=default;
};
}
#include "boundarySphereInteractionList.cpp"
#endif //__boundarySphereInteractionList_hpp__

View File

@ -0,0 +1,31 @@
/*------------------------------- phasicFlow ---------------------------------
O C enter of
O O E ngineering and
O O M ultiscale modeling of
OOOOOOO F luid flow
------------------------------------------------------------------------------
Copyright (C): www.cemf.ir
email: hamid.r.norouzi AT gmail.com
------------------------------------------------------------------------------
Licence:
This file is part of phasicFlow code. It is a free software for simulating
granular and multiphase flows. You can redistribute it and/or modify it under
the terms of GNU General Public License v3 or any other later versions.
phasicFlow is distributed to help others in their research in the field of
granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-----------------------------------------------------------------------------*/
#include "boundarySphereInteraction.hpp"
#include "periodicBoundarySphereInteraction.hpp"
#define createBoundarySphereInteraction(ForceModel,GeomModel) \
template class pFlow::boundarySphereInteraction< \
ForceModel, \
GeomModel>; \
\
template class pFlow::periodicBoundarySphereInteraction< \
ForceModel, \
GeomModel>;

View File

@ -0,0 +1,125 @@
namespace pFlow::periodicBoundarySIKernels
{
template<typename ContactListType, typename ContactForceModel>
void sphereSphereInteraction
(
real dt,
const ContactListType& cntctList,
const ContactForceModel& forceModel,
const realx3& transferVec,
const deviceScatteredFieldAccess<realx3>& thisPoints,
const deviceScatteredFieldAccess<realx3>& mirrorPoints,
const deviceViewType1D<real>& diam,
const deviceViewType1D<uint32>& propId,
const deviceViewType1D<realx3>& vel,
const deviceViewType1D<realx3>& rVel,
const deviceViewType1D<realx3>& cForce,
const deviceViewType1D<realx3>& cTorque
)
{
using ValueType = typename ContactListType::ValueType;
uint32 ss = cntctList.size();
uint32 lastItem = cntctList.loopCount();
if(lastItem == 0u)return;
Kokkos::parallel_for(
"pFlow::periodicBoundarySIKernels::sphereSphereInteraction",
deviceRPolicyDynamic(0,lastItem),
LAMBDA_HD(uint32 n)
{
if(!cntctList.isValid(n))return;
auto [i,j] = cntctList.getPair(n);
uint32 ind_i = thisPoints.index(i);
uint32 ind_j = mirrorPoints.index(j);
real Ri = 0.5*diam[ind_i];
real Rj = 0.5*diam[ind_j];
realx3 xi = thisPoints.field()[ind_i];
realx3 xj = mirrorPoints.field()[ind_j]+transferVec;
real dist = length(xj-xi);
real ovrlp = (Ri+Rj) - dist;
if( ovrlp >0.0 )
{
/*auto Vi = thisVel[i];
auto Vj = mirrorVel[j];
auto wi = thisRVel[i];
auto wj = mirrorRVel[j];
auto Nij = (xj-xi)/dist;
auto Vr = Vi - Vj + cross((Ri*wi+Rj*wj), Nij);*/
auto Nij = (xj-xi)/dist;
auto wi = rVel[ind_i];
auto wj = rVel[ind_j];
auto Vr = vel[ind_i] - vel[ind_j] + cross((Ri*wi+Rj*wj), Nij);
auto history = cntctList.getValue(n);
int32 propId_i = propId[ind_i];
int32 propId_j = propId[ind_j];
realx3 FCn, FCt, Mri, Mrj, Mij, Mji;
// calculates contact force
forceModel.contactForce(
dt, i, j,
propId_i, propId_j,
Ri, Rj,
ovrlp,
Vr, Nij,
history,
FCn, FCt);
forceModel.rollingFriction(
dt, i, j,
propId_i, propId_j,
Ri, Rj,
wi, wj,
Nij,
FCn,
Mri, Mrj);
auto M = cross(Nij,FCt);
Mij = Ri*M+Mri;
Mji = Rj*M+Mrj;
auto FC = FCn + FCt;
Kokkos::atomic_add(&cForce[ind_i].x_,FC.x_);
Kokkos::atomic_add(&cForce[ind_i].y_,FC.y_);
Kokkos::atomic_add(&cForce[ind_i].z_,FC.z_);
Kokkos::atomic_add(&cForce[ind_j].x_,-FC.x_);
Kokkos::atomic_add(&cForce[ind_j].y_,-FC.y_);
Kokkos::atomic_add(&cForce[ind_j].z_,-FC.z_);
Kokkos::atomic_add(&cTorque[ind_i].x_, Mij.x_);
Kokkos::atomic_add(&cTorque[ind_i].y_, Mij.y_);
Kokkos::atomic_add(&cTorque[ind_i].z_, Mij.z_);
Kokkos::atomic_add(&cTorque[ind_j].x_, Mji.x_);
Kokkos::atomic_add(&cTorque[ind_j].y_, Mji.y_);
Kokkos::atomic_add(&cTorque[ind_j].z_, Mji.z_);
cntctList.setValue(n,history);
}
else
{
cntctList.setValue(n, ValueType());
}
});
Kokkos::fence();
}
} //pFlow::periodicBoundarySIKernels

View File

@ -0,0 +1,65 @@
/*------------------------------- phasicFlow ---------------------------------
O C enter of
O O E ngineering and
O O M ultiscale modeling of
OOOOOOO F luid flow
------------------------------------------------------------------------------
Copyright (C): www.cemf.ir
email: hamid.r.norouzi AT gmail.com
------------------------------------------------------------------------------
Licence:
This file is part of phasicFlow code. It is a free software for simulating
granular and multiphase flows. You can redistribute it and/or modify it under
the terms of GNU General Public License v3 or any other later versions.
phasicFlow is distributed to help others in their research in the field of
granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-----------------------------------------------------------------------------*/
#include "periodicBoundarySIKernels.hpp"
template <typename cFM, typename gMM>
pFlow::periodicBoundarySphereInteraction<cFM, gMM>::periodicBoundarySphereInteraction(
const boundaryBase &boundary,
const sphereParticles &sphPrtcls,
const GeometryMotionModel &geomMotion)
: boundarySphereInteraction<cFM,gMM>(boundary, sphPrtcls, geomMotion),
transferVec_(boundary.mirrorBoundary().displacementVectroToMirror())
{
if(boundary.thisBoundaryIndex()%2==1)
{
masterInteraction_ = true;
}
else
{
masterInteraction_ = false;
}
}
template <typename cFM, typename gMM>
bool pFlow::periodicBoundarySphereInteraction<cFM, gMM>::sphereSphereInteraction
(
real dt,
const ContactForceModel &cfModel
)
{
if(!masterInteraction_) return true;
pFlow::periodicBoundarySIKernels::sphereSphereInteraction(
dt,
this->ppPairs(),
cfModel,
transferVec_,
this->boundary().thisPoints(),
this->mirrorBoundary().thisPoints(),
this->sphParticles().diameter().deviceViewAll(),
this->sphParticles().propertyId().deviceViewAll(),
this->sphParticles().velocity().deviceViewAll(),
this->sphParticles().rVelocity().deviceViewAll(),
this->sphParticles().contactForce().deviceViewAll(),
this->sphParticles().contactTorque().deviceViewAll());
return true;
}

View File

@ -0,0 +1,95 @@
/*------------------------------- phasicFlow ---------------------------------
O C enter of
O O E ngineering and
O O M ultiscale modeling of
OOOOOOO F luid flow
------------------------------------------------------------------------------
Copyright (C): www.cemf.ir
email: hamid.r.norouzi AT gmail.com
------------------------------------------------------------------------------
Licence:
This file is part of phasicFlow code. It is a free software for simulating
granular and multiphase flows. You can redistribute it and/or modify it under
the terms of GNU General Public License v3 or any other later versions.
phasicFlow is distributed to help others in their research in the field of
granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-----------------------------------------------------------------------------*/
#ifndef __periodicBoundarySphereInteraction_hpp__
#define __periodicBoundarySphereInteraction_hpp__
#include "boundarySphereInteraction.hpp"
namespace pFlow
{
template<typename contactForceModel,typename geometryMotionModel>
class periodicBoundarySphereInteraction
:
public boundarySphereInteraction<contactForceModel, geometryMotionModel>
{
public:
using PBSInteractionType =
periodicBoundarySphereInteraction<contactForceModel,geometryMotionModel>;
using BSInteractionType =
boundarySphereInteraction<contactForceModel, geometryMotionModel>;
using GeometryMotionModel = typename BSInteractionType::GeometryMotionModel;
using ContactForceModel = typename BSInteractionType::ContactForceModel;
using MotionModel = typename geometryMotionModel::MotionModel;
using ModelStorage = typename ContactForceModel::contactForceStorage;
using IdType = typename BSInteractionType::IdType;
using IndexType = typename BSInteractionType::IndexType;
using ContactListType = typename BSInteractionType::ContactListType;
private:
realx3 transferVec_;
bool masterInteraction_;
public:
TypeInfoTemplate22("boundarySphereInteraction", "periodic",ContactForceModel, MotionModel);
periodicBoundarySphereInteraction(
const boundaryBase& boundary,
const sphereParticles& sphPrtcls,
const GeometryMotionModel& geomMotion
);
add_vCtor
(
BSInteractionType,
PBSInteractionType,
boundaryBase
);
~periodicBoundarySphereInteraction()override = default;
bool sphereSphereInteraction(
real dt,
const ContactForceModel& cfModel)override;
};
}
#include "periodicBoundarySphereInteraction.cpp"
#endif //__periodicBoundarySphereInteraction_hpp__

View File

@ -35,9 +35,18 @@ bool pFlow::sphereInteraction<cFM,gMM, cLT>::createSphereInteraction()
uint32 nPrtcl = sphParticles_.size();
contactSearch_ = contactSearch::create(
subDict("contactSearch"),
sphParticles_.extendedDomain().domainBox(),
sphParticles_,
geometryMotion_,
timers());
ppContactList_ = makeUnique<ContactListType>(nPrtcl+1);
pwContactList_ = makeUnique<ContactListType>(nPrtcl/4+1);
pwContactList_ = makeUnique<ContactListType>(nPrtcl/5+1);
return true;
}
@ -127,19 +136,13 @@ pFlow::sphereInteraction<cFM,gMM, cLT>::sphereInteraction
interaction(control, prtcl, geom),
geometryMotion_(dynamic_cast<const GeometryMotionModel&>(geom)),
sphParticles_(dynamic_cast<const sphereParticles&>(prtcl)),
boundaryInteraction_(sphParticles_,geometryMotion_),
ppInteractionTimer_("sphere-sphere interaction", &this->timers()),
pwInteractionTimer_("sphere-wall interaction", &this->timers()),
contactListTimer_("contact list management", &this->timers()),
contactListTimer0_("contact list clear", &this->timers())
contactListMangementTimer_("contact-list management", &this->timers()),
boundaryInteractionTimer_("interaction for boundary", &this->timers())
{
contactSearch_ = contactSearch::create(
subDict("contactSearch"),
prtcl.extendedDomain().domainBox(),
prtcl,
geom,
timers());
if(!createSphereInteraction())
{
fatalExit;
@ -163,14 +166,20 @@ bool pFlow::sphereInteraction<cFM,gMM, cLT>::iterate()
//output<<"iter, t, dt "<< iter<<" "<< t << " "<<dt<<endl;
bool broadSearch = contactSearch_().enterBroadSearch(iter, t, dt);
if(broadSearch)
{
contactListTimer0_.start();
contactListMangementTimer_.start();
ppContactList_().beforeBroadSearch();
pwContactList_().beforeBroadSearch();
contactListTimer0_.end();
contactListMangementTimer_.pause();
}
for(uint32 i=0; i<6u; i++)
{
boundaryInteraction_[i].ppPairs().beforeBroadSearch();
boundaryInteraction_[i].pwPairs().beforeBroadSearch();
}
if( sphParticles_.numActive()<=0)return true;
@ -187,14 +196,34 @@ bool pFlow::sphereInteraction<cFM,gMM, cLT>::iterate()
fatalExit;
}
for(uint32 i=0; i<6u; i++)
{
if( !contactSearch_().boundaryBroadSearch(
i,
iter,
t,
dt,
boundaryInteraction_[i].ppPairs(),
boundaryInteraction_[i].pwPairs()))
{
fatalErrorInFunction<<
"failed to perform broadSearch for boundary index "<<i<<endl;
return false;
}
}
if(broadSearch && contactSearch_().performedBroadSearch())
{
contactListTimer_.start();
contactListMangementTimer_.resume();
ppContactList_().afterBroadSearch();
pwContactList_().afterBroadSearch();
contactListTimer_.end();
contactListMangementTimer_.end();
}
for(uint32 i=0; i<6u; i++)
{
boundaryInteraction_[i].ppPairs().afterBroadSearch();
boundaryInteraction_[i].pwPairs().afterBroadSearch();
}
ppInteractionTimer_.start();
@ -206,7 +235,14 @@ bool pFlow::sphereInteraction<cFM,gMM, cLT>::iterate()
sphereWallInteraction();
pwInteractionTimer_.end();
boundaryInteractionTimer_.start();
for(uint32 i=0; i<6u; i++)
{
boundaryInteraction_[i].sphereSphereInteraction(
dt,
this->forceModel_());
}
boundaryInteractionTimer_.end();
return true;
}

View File

@ -23,7 +23,11 @@ Licence:
#include "interaction.hpp"
#include "sphereParticles.hpp"
#include "boundarySphereInteractionList.hpp"
#include "sphereInteractionKernels.hpp"
//#include "unsortedContactList.hpp"
namespace pFlow
{
@ -45,6 +49,8 @@ public:
using MotionModel = typename geometryMotionModel::MotionModel;
using ModelStorage = typename ContactForceModel::contactForceStorage;
using BoundaryListType = boundarySphereInteractionList<ContactForceModel,GeometryMotionModel>;
using IdType = uint32;
@ -53,6 +59,9 @@ public:
using ContactListType =
contactListType<ModelStorage, DefaultExecutionSpace, IdType>;
//using BoundaryContactListType = unsortedContactList<ModelStorage, DefaultExecutionSpace, IdType>;
private:
@ -62,6 +71,9 @@ private:
/// const reference to particles
const sphereParticles& sphParticles_;
/// particle-particle and particle-wall interactions at boundaries
BoundaryListType boundaryInteraction_;
/// contact search object for pp and pw interactions
uniquePtr<contactSearch> contactSearch_ = nullptr;
@ -72,7 +84,8 @@ private:
uniquePtr<ContactListType> ppContactList_ = nullptr;
/// contact list for particle-wall interactions (keeps the history)
uniquePtr<ContactListType> pwContactList_ = nullptr;
uniquePtr<ContactListType> pwContactList_ = nullptr;
/// timer for particle-particle interaction computations
Timer ppInteractionTimer_;
@ -80,9 +93,13 @@ private:
/// timer for particle-wall interaction computations
Timer pwInteractionTimer_;
Timer contactListTimer_;
/// timer for managing contact lists (only inernal points)
Timer contactListMangementTimer_;
Timer contactListTimer0_;
/// timer for boundary interaction time
Timer boundaryInteractionTimer_;
bool createSphereInteraction();

View File

@ -1,277 +0,0 @@
/*------------------------------- phasicFlow ---------------------------------
O C enter of
O O E ngineering and
O O M ultiscale modeling of
OOOOOOO F luid flow
------------------------------------------------------------------------------
Copyright (C): www.cemf.ir
email: hamid.r.norouzi AT gmail.com
------------------------------------------------------------------------------
Licence:
This file is part of phasicFlow code. It is a free software for simulating
granular and multiphase flows. You can redistribute it and/or modify it under
the terms of GNU General Public License v3 or any other later versions.
phasicFlow is distributed to help others in their research in the field of
granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-----------------------------------------------------------------------------*/
#include "sphereInteraction.hpp"
#include "geometryMotions.hpp"
#include "contactForceModels.hpp"
#include "unsortedContactList.hpp"
#include "sortedContactList.hpp"
template class pFlow::sphereInteraction<
pFlow::cfModels::limitedLinearNormalRolling,
pFlow::stationaryGeometry,
pFlow::unsortedContactList>;
template class pFlow::sphereInteraction<
pFlow::cfModels::limitedLinearNormalRolling,
pFlow::stationaryGeometry,
pFlow::sortedContactList>;
template class pFlow::sphereInteraction<
pFlow::cfModels::nonLimitedLinearNormalRolling,
pFlow::stationaryGeometry,
pFlow::unsortedContactList>;
template class pFlow::sphereInteraction<
pFlow::cfModels::nonLimitedLinearNormalRolling,
pFlow::stationaryGeometry,
pFlow::sortedContactList>;
template class pFlow::sphereInteraction<
pFlow::cfModels::limitedLinearNormalRolling,
pFlow::rotationAxisMotionGeometry,
pFlow::unsortedContactList>;
template class pFlow::sphereInteraction<
pFlow::cfModels::limitedLinearNormalRolling,
pFlow::rotationAxisMotionGeometry,
pFlow::sortedContactList>;
template class pFlow::sphereInteraction<
pFlow::cfModels::nonLimitedLinearNormalRolling,
pFlow::rotationAxisMotionGeometry,
pFlow::unsortedContactList>;
template class pFlow::sphereInteraction<
pFlow::cfModels::nonLimitedLinearNormalRolling,
pFlow::rotationAxisMotionGeometry,
pFlow::sortedContactList>;
template class pFlow::sphereInteraction<
pFlow::cfModels::limitedLinearNormalRolling,
pFlow::vibratingMotionGeometry,
pFlow::unsortedContactList>;
template class pFlow::sphereInteraction<
pFlow::cfModels::limitedLinearNormalRolling,
pFlow::vibratingMotionGeometry,
pFlow::sortedContactList>;
template class pFlow::sphereInteraction<
pFlow::cfModels::nonLimitedLinearNormalRolling,
pFlow::vibratingMotionGeometry,
pFlow::unsortedContactList>;
template class pFlow::sphereInteraction<
pFlow::cfModels::nonLimitedLinearNormalRolling,
pFlow::vibratingMotionGeometry,
pFlow::sortedContactList>;
/*template class pFlow::sphereInteraction<
pFlow::cfModels::limitedLinearNormalRolling,
pFlow::multiRotationAxisMotionGeometry,
pFlow::unsortedContactList>;
template class pFlow::sphereInteraction<
pFlow::cfModels::limitedLinearNormalRolling,
pFlow::multiRotationAxisMotionGeometry,
pFlow::sortedContactList>;
template class pFlow::sphereInteraction<
pFlow::cfModels::nonLimitedLinearNormalRolling,
pFlow::multiRotationAxisMotionGeometry,
pFlow::unsortedContactList>;
template class pFlow::sphereInteraction<
pFlow::cfModels::nonLimitedLinearNormalRolling,
pFlow::multiRotationAxisMotionGeometry,
pFlow::sortedContactList>;*/
/// non-linear models
template class pFlow::sphereInteraction<
pFlow::cfModels::limitedNonLinearNormalRolling,
pFlow::stationaryGeometry,
pFlow::unsortedContactList>;
template class pFlow::sphereInteraction<
pFlow::cfModels::limitedNonLinearNormalRolling,
pFlow::stationaryGeometry,
pFlow::sortedContactList>;
template class pFlow::sphereInteraction<
pFlow::cfModels::nonLimitedNonLinearNormalRolling,
pFlow::stationaryGeometry,
pFlow::unsortedContactList>;
template class pFlow::sphereInteraction<
pFlow::cfModels::nonLimitedNonLinearNormalRolling,
pFlow::stationaryGeometry,
pFlow::sortedContactList>;
template class pFlow::sphereInteraction<
pFlow::cfModels::limitedNonLinearNormalRolling,
pFlow::rotationAxisMotionGeometry,
pFlow::unsortedContactList>;
template class pFlow::sphereInteraction<
pFlow::cfModels::limitedNonLinearNormalRolling,
pFlow::rotationAxisMotionGeometry,
pFlow::sortedContactList>;
template class pFlow::sphereInteraction<
pFlow::cfModels::nonLimitedNonLinearNormalRolling,
pFlow::rotationAxisMotionGeometry,
pFlow::unsortedContactList>;
template class pFlow::sphereInteraction<
pFlow::cfModels::nonLimitedNonLinearNormalRolling,
pFlow::rotationAxisMotionGeometry,
pFlow::sortedContactList>;
template class pFlow::sphereInteraction<
pFlow::cfModels::limitedNonLinearNormalRolling,
pFlow::vibratingMotionGeometry,
pFlow::unsortedContactList>;
template class pFlow::sphereInteraction<
pFlow::cfModels::limitedNonLinearNormalRolling,
pFlow::vibratingMotionGeometry,
pFlow::sortedContactList>;
template class pFlow::sphereInteraction<
pFlow::cfModels::nonLimitedNonLinearNormalRolling,
pFlow::vibratingMotionGeometry,
pFlow::unsortedContactList>;
template class pFlow::sphereInteraction<
pFlow::cfModels::nonLimitedNonLinearNormalRolling,
pFlow::vibratingMotionGeometry,
pFlow::sortedContactList>;
/*template class pFlow::sphereInteraction<
pFlow::cfModels::limitedNonLinearNormalRolling,
pFlow::multiRotationAxisMotionGeometry,
pFlow::unsortedContactList>;
template class pFlow::sphereInteraction<
pFlow::cfModels::limitedNonLinearNormalRolling,
pFlow::multiRotationAxisMotionGeometry,
pFlow::sortedContactList>;
template class pFlow::sphereInteraction<
pFlow::cfModels::nonLimitedNonLinearNormalRolling,
pFlow::multiRotationAxisMotionGeometry,
pFlow::unsortedContactList>;
template class pFlow::sphereInteraction<
pFlow::cfModels::nonLimitedNonLinearNormalRolling,
pFlow::multiRotationAxisMotionGeometry,
pFlow::sortedContactList>;*/
// - nonLinearMod models
template class pFlow::sphereInteraction<
pFlow::cfModels::limitedNonLinearModNormalRolling,
pFlow::stationaryGeometry,
pFlow::unsortedContactList>;
template class pFlow::sphereInteraction<
pFlow::cfModels::limitedNonLinearModNormalRolling,
pFlow::stationaryGeometry,
pFlow::sortedContactList>;
template class pFlow::sphereInteraction<
pFlow::cfModels::nonLimitedNonLinearModNormalRolling,
pFlow::stationaryGeometry,
pFlow::unsortedContactList>;
template class pFlow::sphereInteraction<
pFlow::cfModels::nonLimitedNonLinearModNormalRolling,
pFlow::stationaryGeometry,
pFlow::sortedContactList>;
template class pFlow::sphereInteraction<
pFlow::cfModels::limitedNonLinearModNormalRolling,
pFlow::rotationAxisMotionGeometry,
pFlow::unsortedContactList>;
template class pFlow::sphereInteraction<
pFlow::cfModels::limitedNonLinearModNormalRolling,
pFlow::rotationAxisMotionGeometry,
pFlow::sortedContactList>;
template class pFlow::sphereInteraction<
pFlow::cfModels::nonLimitedNonLinearModNormalRolling,
pFlow::rotationAxisMotionGeometry,
pFlow::unsortedContactList>;
template class pFlow::sphereInteraction<
pFlow::cfModels::nonLimitedNonLinearModNormalRolling,
pFlow::rotationAxisMotionGeometry,
pFlow::sortedContactList>;
template class pFlow::sphereInteraction<
pFlow::cfModels::limitedNonLinearModNormalRolling,
pFlow::vibratingMotionGeometry,
pFlow::unsortedContactList>;
template class pFlow::sphereInteraction<
pFlow::cfModels::limitedNonLinearModNormalRolling,
pFlow::vibratingMotionGeometry,
pFlow::sortedContactList>;
template class pFlow::sphereInteraction<
pFlow::cfModels::nonLimitedNonLinearModNormalRolling,
pFlow::vibratingMotionGeometry,
pFlow::unsortedContactList>;
template class pFlow::sphereInteraction<
pFlow::cfModels::nonLimitedNonLinearModNormalRolling,
pFlow::vibratingMotionGeometry,
pFlow::sortedContactList>;
/*template class pFlow::sphereInteraction<
pFlow::cfModels::limitedNonLinearModNormalRolling,
pFlow::multiRotationAxisMotionGeometry,
pFlow::unsortedContactList>;
template class pFlow::sphereInteraction<
pFlow::cfModels::limitedNonLinearModNormalRolling,
pFlow::multiRotationAxisMotionGeometry,
pFlow::sortedContactList>;
template class pFlow::sphereInteraction<
pFlow::cfModels::nonLimitedNonLinearModNormalRolling,
pFlow::multiRotationAxisMotionGeometry,
pFlow::unsortedContactList>;
template class pFlow::sphereInteraction<
pFlow::cfModels::nonLimitedNonLinearModNormalRolling,
pFlow::multiRotationAxisMotionGeometry,
pFlow::sortedContactList>;
*/

View File

@ -0,0 +1,59 @@
/*------------------------------- phasicFlow ---------------------------------
O C enter of
O O E ngineering and
O O M ultiscale modeling of
OOOOOOO F luid flow
------------------------------------------------------------------------------
Copyright (C): www.cemf.ir
email: hamid.r.norouzi AT gmail.com
------------------------------------------------------------------------------
Licence:
This file is part of phasicFlow code. It is a free software for simulating
granular and multiphase flows. You can redistribute it and/or modify it under
the terms of GNU General Public License v3 or any other later versions.
phasicFlow is distributed to help others in their research in the field of
granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-----------------------------------------------------------------------------*/
#include "sphereInteraction.hpp"
#include "geometryMotions.hpp"
#include "contactForceModels.hpp"
#include "unsortedContactList.hpp"
#include "sortedContactList.hpp"
#include "createBoundarySphereInteraction.hpp"
#define createInteraction(ForceModel,GeomModel) \
\
template class pFlow::sphereInteraction< \
ForceModel, \
GeomModel, \
pFlow::unsortedContactList>; \
\
template class pFlow::sphereInteraction< \
ForceModel, \
GeomModel, \
pFlow::sortedContactList>; \
createBoundarySphereInteraction(ForceModel, GeomModel)
// stationaryGeometry
createInteraction(pFlow::cfModels::limitedLinearNormalRolling, pFlow::stationaryGeometry);
createInteraction(pFlow::cfModels::nonLimitedLinearNormalRolling,pFlow::stationaryGeometry);
// rotationAxisMotionGeometry
createInteraction(pFlow::cfModels::limitedLinearNormalRolling, pFlow::rotationAxisMotionGeometry);
createInteraction(pFlow::cfModels::nonLimitedLinearNormalRolling,pFlow::rotationAxisMotionGeometry);
// vibratingMotionGeometry
createInteraction(pFlow::cfModels::limitedLinearNormalRolling, pFlow::vibratingMotionGeometry);
createInteraction(pFlow::cfModels::nonLimitedLinearNormalRolling,pFlow::vibratingMotionGeometry);
// multiRotationAxisMotionGeometry
//createInteraction(pFlow::cfModels::limitedLinearNormalRolling, pFlow::multiRotationAxisMotionGeometry);
//createInteraction(pFlow::cfModels::nonLimitedLinearNormalRolling,pFlow::multiRotationAxisMotionGeometry);

View File

@ -0,0 +1,58 @@
/*------------------------------- phasicFlow ---------------------------------
O C enter of
O O E ngineering and
O O M ultiscale modeling of
OOOOOOO F luid flow
------------------------------------------------------------------------------
Copyright (C): www.cemf.ir
email: hamid.r.norouzi AT gmail.com
------------------------------------------------------------------------------
Licence:
This file is part of phasicFlow code. It is a free software for simulating
granular and multiphase flows. You can redistribute it and/or modify it under
the terms of GNU General Public License v3 or any other later versions.
phasicFlow is distributed to help others in their research in the field of
granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-----------------------------------------------------------------------------*/
#include "sphereInteraction.hpp"
#include "geometryMotions.hpp"
#include "contactForceModels.hpp"
#include "unsortedContactList.hpp"
#include "sortedContactList.hpp"
#include "createBoundarySphereInteraction.hpp"
#define createInteraction(ForceModel,GeomModel) \
\
template class pFlow::sphereInteraction< \
ForceModel, \
GeomModel, \
pFlow::unsortedContactList>; \
\
template class pFlow::sphereInteraction< \
ForceModel, \
GeomModel, \
pFlow::sortedContactList>; \
createBoundarySphereInteraction(ForceModel, GeomModel)
// stationaryGeometry
createInteraction(pFlow::cfModels::limitedNonLinearModNormalRolling, pFlow::stationaryGeometry);
createInteraction(pFlow::cfModels::nonLimitedNonLinearModNormalRolling,pFlow::stationaryGeometry);
// rotationAxisMotionGeometry
createInteraction(pFlow::cfModels::limitedNonLinearModNormalRolling, pFlow::rotationAxisMotionGeometry);
createInteraction(pFlow::cfModels::nonLimitedNonLinearModNormalRolling,pFlow::rotationAxisMotionGeometry);
// vibratingMotionGeometry
createInteraction(pFlow::cfModels::limitedNonLinearModNormalRolling, pFlow::vibratingMotionGeometry);
createInteraction(pFlow::cfModels::nonLimitedNonLinearModNormalRolling,pFlow::vibratingMotionGeometry);
// multiRotationAxisMotionGeometry
//createInteraction(pFlow::cfModels::limitedNonLinearModNormalRolling, pFlow::multiRotationAxisMotionGeometry);
//createInteraction(pFlow::cfModels::nonLimitedNonLinearModNormalRolling,pFlow::multiRotationAxisMotionGeometry);

View File

@ -0,0 +1,58 @@
/*------------------------------- phasicFlow ---------------------------------
O C enter of
O O E ngineering and
O O M ultiscale modeling of
OOOOOOO F luid flow
------------------------------------------------------------------------------
Copyright (C): www.cemf.ir
email: hamid.r.norouzi AT gmail.com
------------------------------------------------------------------------------
Licence:
This file is part of phasicFlow code. It is a free software for simulating
granular and multiphase flows. You can redistribute it and/or modify it under
the terms of GNU General Public License v3 or any other later versions.
phasicFlow is distributed to help others in their research in the field of
granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-----------------------------------------------------------------------------*/
#include "sphereInteraction.hpp"
#include "geometryMotions.hpp"
#include "contactForceModels.hpp"
#include "unsortedContactList.hpp"
#include "sortedContactList.hpp"
#include "createBoundarySphereInteraction.hpp"
#define createInteraction(ForceModel,GeomModel) \
\
template class pFlow::sphereInteraction< \
ForceModel, \
GeomModel, \
pFlow::unsortedContactList>; \
\
template class pFlow::sphereInteraction< \
ForceModel, \
GeomModel, \
pFlow::sortedContactList>; \
createBoundarySphereInteraction(ForceModel, GeomModel)
// stationaryGeometry
createInteraction(pFlow::cfModels::limitedNonLinearNormalRolling, pFlow::stationaryGeometry);
createInteraction(pFlow::cfModels::nonLimitedNonLinearNormalRolling,pFlow::stationaryGeometry);
// rotationAxisMotionGeometry
createInteraction(pFlow::cfModels::limitedNonLinearNormalRolling, pFlow::rotationAxisMotionGeometry);
createInteraction(pFlow::cfModels::nonLimitedNonLinearNormalRolling,pFlow::rotationAxisMotionGeometry);
// vibratingMotionGeometry
createInteraction(pFlow::cfModels::limitedNonLinearNormalRolling, pFlow::vibratingMotionGeometry);
createInteraction(pFlow::cfModels::nonLimitedNonLinearNormalRolling,pFlow::vibratingMotionGeometry);
// multiRotationAxisMotionGeometry
//createInteraction(pFlow::cfModels::limitedNonLinearNormalRolling, pFlow::multiRotationAxisMotionGeometry);
//createInteraction(pFlow::cfModels::nonLimitedNonLinearNormalRolling,pFlow::multiRotationAxisMotionGeometry);

View File

@ -128,6 +128,12 @@ public:
return dynPointStruct_.thisDomain();
}
inline
const auto& extendedDomain()const
{
return dynPointStruct_.extendedDomain();
}
inline auto size()const{
return dynPointStruct_.size();
}

View File

@ -62,8 +62,8 @@ containers/Field/Fields.cpp
containers/symArrayHD/symArrays.cpp
containers/List/anyList/anyList.cpp
structuredData/pointStructure/internalPointsKernels.cpp
structuredData/pointStructure/internalPoints.cpp
structuredData/pointStructure/internalPoints/internalPointsKernels.cpp
structuredData/pointStructure/internalPoints/internalPoints.cpp
structuredData/zAxis/zAxis.cpp
structuredData/box/box.cpp
@ -79,28 +79,24 @@ structuredData/boundaries/boundaryExit/boundaryExit.cpp
structuredData/boundaries/boundaryNone/boundaryNone.cpp
structuredData/boundaries/boundaryPeriodic/boundaryPeriodic.cpp
structuredData/boundaries/boundaryList.cpp
structuredData/pointStructure/pointStructure.cpp
structuredData/pointStructure/pointStructure/pointStructure.cpp
structuredData/pointStructure/selectors/pStructSelector/pStructSelector.cpp
structuredData/pointStructure/selectors/selectBox/selectBox.cpp
structuredData/pointStructure/selectors/selectRange/selectRange.cpp
structuredData/pointStructure/selectors/selectRandom/selectRandom.cpp
triSurface/subSurface.cpp
triSurface/triSurface.cpp
triSurface/multiTriSurface.cpp
containers/pointField/boundaryField/generalBoundary.cpp
containers/pointField/pointFields.cpp
containers/pointField/boundaryField/generalBoundary/generalBoundary.cpp
containers/pointField/pointField/pointFields.cpp
containers/triSurfaceField/triSurfaceFields.cpp
setFieldList/setFieldList.cpp
setFieldList/setFieldEntry.cpp
)
set(link_libs)

View File

@ -77,6 +77,19 @@ using hostRPolicyStatic =
Kokkos::Schedule<Kokkos::Static>,
Kokkos::IndexType<pFlow::uint32> >;
using deviceRPolicyDynamic =
Kokkos::RangePolicy<
Kokkos::DefaultExecutionSpace,
Kokkos::Schedule<Kokkos::Dynamic>,
Kokkos::IndexType<pFlow::uint32> >;
using hostRPolicyDynamic =
Kokkos::RangePolicy<
Kokkos::DefaultExecutionSpace,
Kokkos::Schedule<Kokkos::Dynamic>,
Kokkos::IndexType<pFlow::uint32> >;
/// Pair of two variables
template<typename T1, typename T2>

View File

@ -42,21 +42,25 @@ protected:
using timer = std::chrono::high_resolution_clock;
// - name for the timer
word name_ = "noNameTimer";
// start time
/// start time
timer::time_point start_;
// number of times start() and end() are called
/// number of times start() and end() are called
int32 numIteration_ = 0;
// sum of time duratios (in seconds) between all start() and end() calls
/// sum of time duratios (in seconds) between all start() and end() calls
real accTime_ = 0.0;
//
/// last time duration
real lastTime_ = 0.0;
/// @brief Accumulative duration for multiple steps between start() and end()
real stepAccTime_ = 0.0;
/// name for the timer
word name_ = "noNameTimer";
/// @brief parrent of timer
Timers* parrent_ = nullptr;
public:
@ -95,16 +99,28 @@ public:
}
void start()
{
start_ = timer::now();
stepAccTime_ = 0;
}
void pause()
{
auto end = timer::now();
stepAccTime_ += std::chrono::duration_cast
< std::chrono::duration<real> >(end - start_).count();
}
void resume()
{
start_ = timer::now();
}
void end()
{
auto end = timer::now();
lastTime_ = std::chrono::duration_cast
< std::chrono::duration<real> >(end - start_).count();
pause();
lastTime_ = stepAccTime_;
numIteration_++;
accTime_ += lastTime_;
}

View File

@ -21,14 +21,12 @@ Licence:
#include "Fields.hpp"
template class pFlow::Field<pFlow::int8>;
template class pFlow::Field<pFlow::uint8>;
template class pFlow::Field<pFlow::int32>;
template class pFlow::Field<pFlow::uint32>;
template class pFlow::Field<pFlow::uint64>;
template class pFlow::Field<pFlow::real>;
template class pFlow::Field<pFlow::realx3>;

View File

@ -74,29 +74,6 @@ using realx3x3Field_H = Field<realx3x3, HostSpace>;
using wordField_H = Field<word, HostSpace>;
// host device fields
/*using int8Field_HD = Field<VectorDual, int8>;
using int32Field_HD = Field<VectorDual, int32>;
using int64Field_HD = Field<VectorDual, int64>;
using uint32Field_HD = Field<VectorDual, uint32>;
using labelField_HD = Field<VectorDual, label>;
using realField_HD = Field<VectorDual, real>;
using realx3Field_HD = Field<VectorDual, realx3>;
using uint32x3Field_HD = Field<VectorDual, uint32x3>;
using int32x3Field_HD = Field<VectorDual, int32x3>;
using int64x3Field_HD = Field<VectorDual, int64x3>;
using realx3x3Field_HD = Field<VectorDual, realx3x3>;*/
}

View File

@ -24,9 +24,6 @@ Licence:
template class Kokkos::View<pFlow::uint8*>;
template class pFlow::VectorSingle<pFlow::uint8>;
template class Kokkos::View<pFlow::int32*>;
template class pFlow::VectorSingle<pFlow::int32>;
template class Kokkos::View<pFlow::uint32*>;
template class pFlow::VectorSingle<pFlow::uint32>;

View File

@ -41,6 +41,8 @@ public:
using execution_space = typename InternalFieldType::execution_space;
using FieldAccessType = scatteredFieldAccess<T, memory_space>;
protected:
/// @brief a ref to the internal field
@ -98,6 +100,23 @@ public:
return true;
}
FieldAccessType thisField()const
{
return FieldAccessType(
this->size(),
this->indexList().deviceViewAll(),
internal_.deviceViewAll());
}
FieldAccessType mirrorField()const
{
return FieldAccessType(
this->mirrorBoundary().size(),
this->mirrorBoundary().indexList().deviceViewAll(),
internal_.deviceViewAll());
}
void fill(const std::any& val)override
{
return;

View File

@ -15,8 +15,8 @@ Licence:
phasicFlow is distributed to help others in their research in the field of
granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-----------------------------------------------------------------------------*/
#ifndef __boundaryFieldList_hpp__
#define __boundaryFieldList_hpp__

View File

@ -15,9 +15,9 @@ Licence:
phasicFlow is distributed to help others in their research in the field of
granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-----------------------------------------------------------------------------*/
#ifndef __createBoundaryFields_hpp__
#define __createBoundaryFields_hpp__

View File

@ -1,21 +0,0 @@
#include "generalBoundary.hpp"
#include "pointStructure.hpp"
pFlow::generalBoundary::generalBoundary
(
const boundaryBase& boundary,
const pointStructure& pStruct,
const word& dataType,
const word& option
)
:
observer(&boundary, defaultMessage_),
boundary_(boundary),
pStruct_(pStruct)
{}
pFlow::Time const& pFlow::generalBoundary::time() const
{
return pStruct_.time();
}

View File

@ -0,0 +1,41 @@
/*------------------------------- phasicFlow ---------------------------------
O C enter of
O O E ngineering and
O O M ultiscale modeling of
OOOOOOO F luid flow
------------------------------------------------------------------------------
Copyright (C): www.cemf.ir
email: hamid.r.norouzi AT gmail.com
------------------------------------------------------------------------------
Licence:
This file is part of phasicFlow code. It is a free software for simulating
granular and multiphase flows. You can redistribute it and/or modify it under
the terms of GNU General Public License v3 or any other later versions.
phasicFlow is distributed to help others in their research in the field of
granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-----------------------------------------------------------------------------*/
#include "generalBoundary.hpp"
#include "pointStructure.hpp"
pFlow::generalBoundary::generalBoundary
(
const boundaryBase& boundary,
const pointStructure& pStruct,
const word& dataType,
const word& option
)
:
observer(&boundary, defaultMessage_),
boundary_(boundary),
pStruct_(pStruct)
{}
pFlow::Time const& pFlow::generalBoundary::time() const
{
return pStruct_.time();
}

View File

@ -99,6 +99,18 @@ public:
return boundary_;
}
inline
const auto& indexList()const
{
return boundary_.indexList();
}
inline
const auto& mirrorBoundary()const
{
return boundary_.mirrorBoundary();
}
inline
const word& name()const
{
@ -122,7 +134,7 @@ public:
virtual
void fill(const std::any& val)=0;
template<typename BoundaryFieldType>
/*template<typename BoundaryFieldType>
BoundaryFieldType& thisField()
{
return static_cast<BoundaryFieldType&>(*this);
@ -132,7 +144,7 @@ public:
const BoundaryFieldType& thisField()const
{
return static_cast<const BoundaryFieldType&>(*this);
}
}*/
};

View File

@ -15,7 +15,6 @@ Licence:
phasicFlow is distributed to help others in their research in the field of
granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-----------------------------------------------------------------------------*/
template<class T, class MemorySpace>

View File

@ -15,8 +15,8 @@ Licence:
phasicFlow is distributed to help others in their research in the field of
granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-----------------------------------------------------------------------------*/
#ifndef __periodicBoundaryField_hpp__
#define __periodicBoundaryField_hpp__

View File

@ -15,7 +15,6 @@ Licence:
phasicFlow is distributed to help others in their research in the field of
granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-----------------------------------------------------------------------------*/
template<class T, class MemorySpace>

View File

@ -15,8 +15,8 @@ Licence:
phasicFlow is distributed to help others in their research in the field of
granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-----------------------------------------------------------------------------*/
#ifndef __internalField_hpp__
#define __internalField_hpp__

View File

@ -15,7 +15,6 @@ Licence:
phasicFlow is distributed to help others in their research in the field of
granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-----------------------------------------------------------------------------*/
#ifndef __internalFieldAlgorithms_hpp__

View File

@ -15,7 +15,6 @@ Licence:
phasicFlow is distributed to help others in their research in the field of
granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-----------------------------------------------------------------------------*/
template<class T, class MemorySpace>

View File

@ -15,7 +15,6 @@ Licence:
phasicFlow is distributed to help others in their research in the field of
granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-----------------------------------------------------------------------------*/
#ifndef __pointField_hpp__
@ -102,6 +101,16 @@ public:
return static_cast<const InternalFieldType&>(*this);
}
const auto& boundaryFields()const
{
return boundaryFieldList_;
}
const auto& BoundaryField(uint32 i)const
{
return boundaryFieldList_[i];
}
// - reference to pointStructure
inline const pointStructure& pStruct()const {
return pStruct_;

View File

@ -15,7 +15,6 @@ Licence:
phasicFlow is distributed to help others in their research in the field of
granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-----------------------------------------------------------------------------*/

View File

@ -27,15 +27,9 @@ Licence:
template class pFlow::exitBoundaryField<DataType, MemorySpaceType>; \
template class pFlow::periodicBoundaryField<DataType, MemorySpaceType>;
template class pFlow::pointField<pFlow::int8, pFlow::HostSpace>;
createBaseBoundary(pFlow::int8, pFlow::HostSpace);
createAllBoundary(pFlow::int8, pFlow::HostSpace);
template class pFlow::pointField<pFlow::int8>;
createBaseBoundary(pFlow::int8, void);
createAllBoundary(pFlow::int8, void);
// uint8
template class pFlow::pointField<pFlow::uint8, pFlow::HostSpace>;
createBaseBoundary(pFlow::uint8, pFlow::HostSpace);
createAllBoundary(pFlow::uint8, pFlow::HostSpace);
@ -44,14 +38,7 @@ template class pFlow::pointField<pFlow::uint8>;
createBaseBoundary(pFlow::uint8, void);
createAllBoundary(pFlow::uint8, void);
template class pFlow::pointField<pFlow::int32, pFlow::HostSpace>;
createBaseBoundary(pFlow::int32, pFlow::HostSpace);
createAllBoundary(pFlow::int32, pFlow::HostSpace);
template class pFlow::pointField<pFlow::int32>;
createBaseBoundary(pFlow::int32, void);
createAllBoundary(pFlow::int32, void);
/// uint32
template class pFlow::pointField<pFlow::uint32, pFlow::HostSpace>;
createBaseBoundary(pFlow::uint32, pFlow::HostSpace);
createAllBoundary(pFlow::uint32, pFlow::HostSpace);
@ -60,6 +47,7 @@ template class pFlow::pointField<pFlow::uint32>;
createBaseBoundary(pFlow::uint32, void);
createAllBoundary(pFlow::uint32, void);
/// uint64
template class pFlow::pointField<pFlow::uint64, pFlow::HostSpace>;
createBaseBoundary(pFlow::uint64, pFlow::HostSpace);
createAllBoundary(pFlow::uint64, pFlow::HostSpace);
@ -68,15 +56,16 @@ template class pFlow::pointField<pFlow::uint64>;
createBaseBoundary(pFlow::uint64, void);
createAllBoundary(pFlow::uint64, void);
/// real
template class pFlow::pointField<pFlow::real, pFlow::HostSpace>;
createBaseBoundary(pFlow::real, pFlow::HostSpace);
createAllBoundary(pFlow::real, pFlow::HostSpace);
template class pFlow::pointField<pFlow::real>;
createBaseBoundary(pFlow::real, void);
createAllBoundary(pFlow::real, void);
/// realx3
template class pFlow::pointField<pFlow::realx3, pFlow::HostSpace>;
createBaseBoundary(pFlow::realx3, pFlow::HostSpace);
createAllBoundary(pFlow::realx3, pFlow::HostSpace);
@ -87,6 +76,7 @@ createBaseBoundary(pFlow::realx3, void);
createAllBoundary(pFlow::realx3, void);
/// realx4
template class pFlow::pointField<pFlow::realx4, pFlow::HostSpace>;
createBaseBoundary(pFlow::realx4, pFlow::HostSpace);
createAllBoundary(pFlow::realx4, pFlow::HostSpace);
@ -96,6 +86,8 @@ template class pFlow::pointField<pFlow::realx4>;
createBaseBoundary(pFlow::realx4, void);
createAllBoundary(pFlow::realx4, void);
/// word
template class pFlow::pointField<pFlow::word, pFlow::HostSpace>;
createBaseBoundary(pFlow::word, pFlow::HostSpace);
createAllBoundary(pFlow::word, pFlow::HostSpace);

View File

@ -36,21 +36,13 @@ template<typename T>
using pointField_D = pointField<T>;
using int8PointField_D = pointField_D<int8>;
using int8PointField_H = pointField_H<int8>;
using uint8PointField_D = pointField_D<uint8>;
using uint8PointField_H = pointField_H<uint8>;
using int32PointField_D = pointField_D<int32>;
using int32PointField_H = pointField_H<int32>;
using uint32PointField_D = pointField_D<uint32>;
using uint32PointField_H = pointField_H<uint32>;
using int64PointField_D = pointField_D<int64>;
using int64PointField_H = pointField_H<int64>;
using uint64PointField_D = pointField_D<uint64>;
using uint64PointField_H = pointField_H<uint64>;

View File

@ -21,14 +21,5 @@ Licence:
#include "triSurfaceFields.hpp"
template class pFlow::triSurfaceField<pFlow::real>;
template class pFlow::triSurfaceField<pFlow::realx3>;
/*template class pFlow::triSurfaceField<pFlow::VectorSingle, pFlow::real, pFlow::HostSpace>;
template class pFlow::triSurfaceField<pFlow::VectorSingle, pFlow::realx3>;
template class pFlow::triSurfaceField<pFlow::VectorSingle, pFlow::realx3, pFlow::HostSpace>;
template class pFlow::triSurfaceField<pFlow::VectorDual, pFlow::real>;
template class pFlow::triSurfaceField<pFlow::VectorDual, pFlow::realx3>;*/

View File

@ -208,7 +208,7 @@ const pFlow::boundaryBase &pFlow::boundaryBase::mirrorBoundary() const
}
typename pFlow::boundaryBase::pointFieldAccessType
pFlow::boundaryBase::thisPoints()
pFlow::boundaryBase::thisPoints()const
{
return pointFieldAccessType
@ -221,7 +221,7 @@ pFlow::boundaryBase::thisPoints()
}
typename pFlow::boundaryBase::pointFieldAccessType
pFlow::boundaryBase::neighborPoints()
pFlow::boundaryBase::neighborPoints()const
{
notImplementedFunction;
return pointFieldAccessType();

View File

@ -234,13 +234,12 @@ public:
const boundaryBase& mirrorBoundary()const;
virtual
const plane& boundaryPlane()const
{
return boundaryPlane_;
}
/// @brief displacement vector that transfers points from
/// @brief displacement vector that transfers points
/// to a distance that is equal to the distance between
/// this plane and the mirror plane, the vector points from
/// this plane to mirror plane
@ -257,10 +256,10 @@ public:
virtual
bool afterIteration(uint32 iterNum, real t, real dt) = 0;
pointFieldAccessType thisPoints();
pointFieldAccessType thisPoints()const;
virtual
pointFieldAccessType neighborPoints();
pointFieldAccessType neighborPoints()const;
/// - static create
static

View File

@ -1,3 +1,22 @@
/*------------------------------- phasicFlow ---------------------------------
O C enter of
O O E ngineering and
O O M ultiscale modeling of
OOOOOOO F luid flow
------------------------------------------------------------------------------
Copyright (C): www.cemf.ir
email: hamid.r.norouzi AT gmail.com
------------------------------------------------------------------------------
Licence:
This file is part of phasicFlow code. It is a free software for simulating
granular and multiphase flows. You can redistribute it and/or modify it under
the terms of GNU General Public License v3 or any other later versions.
phasicFlow is distributed to help others in their research in the field of
granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-----------------------------------------------------------------------------*/
#ifndef __scatteredFieldAccess_hpp__
#define __scatteredFieldAccess_hpp__
@ -39,8 +58,8 @@ public:
scatteredFieldAccess(
uint32 sz,
ViewType1D<uint32, memory_space> ind,
ViewType1D<T, memory_space> fVals)
const ViewType1D<uint32, memory_space>& ind,
const ViewType1D<T, memory_space>& fVals)
:
size_(sz),
indices_(ind),
@ -74,13 +93,30 @@ public:
INLINE_FUNCTION_HD
T& operator[](uint32 i)
{
return fieldVals_(indices_(i));
return fieldVals_[indices_[i]];
}
INLINE_FUNCTION_HD
const T& operator[](uint32 i)const
{
return fieldVals_(indices_(i));
return fieldVals_[indices_[i]];
}
INLINE_FUNCTION_HD
const viewType& field()const
{
return fieldVals_;
}
INLINE_FUNCTION_HD
viewType& field()
{
return fieldVals_;
}
uint32 index(uint32 i)const
{
return indices_[i];
}
INLINE_FUNCTION_HD

View File

@ -21,6 +21,33 @@ Licence:
#include "boundaryList.hpp"
#include "pointStructure.hpp"
void pFlow::boundaryList::setExtendedDomain()
{
if(!listSet_)
{
fatalErrorInFunction<<
"boundary list is not set yet and you used the objects."<<endl;
fatalExit;
}
realx3 lowerExt =
boundary(0).boundaryExtensionLength() +
boundary(2).boundaryExtensionLength() +
boundary(4).boundaryExtensionLength();
realx3 upperExt =
boundary(1).boundaryExtensionLength()+
boundary(3).boundaryExtensionLength()+
boundary(5).boundaryExtensionLength();
extendedDomain_ = pStruct_.simDomain().extendThisDomain
(
lowerExt,
upperExt
);
}
bool pFlow::boundaryList::resetLists()
{
@ -31,7 +58,11 @@ bool pFlow::boundaryList::resetLists()
bool pFlow::boundaryList::updateLists()
{
if(!listSet_)
{
setLists();
}
std::array<real,6> dist;
dist[0] = boundary(0).neighborLength();
dist[1] = boundary(1).neighborLength();
@ -40,20 +71,10 @@ bool pFlow::boundaryList::updateLists()
dist[4] = boundary(4).neighborLength();
dist[5] = boundary(5).neighborLength();
realx3 lowerExt =
boundary(0).boundaryExtensionLength() +
boundary(2).boundaryExtensionLength() +
boundary(4).boundaryExtensionLength();
realx3 upperExt =
boundary(1).boundaryExtensionLength()+
boundary(3).boundaryExtensionLength()+
boundary(5).boundaryExtensionLength();
auto extDomain = pStruct_.simDomain().extendThisDomain(lowerExt, upperExt);
pStruct_.updateFlag(
extDomain,
extendedDomain_,
dist);
const auto& maskD = pStruct_.activePointsMaskDevice();
boundary(0).setSize( maskD.leftSize() );
boundary(1).setSize( maskD.rightSize() );
@ -69,7 +90,8 @@ bool pFlow::boundaryList::updateLists()
boundary(3).indexList().deviceViewAll(),
boundary(4).indexList().deviceViewAll(),
boundary(5).indexList().deviceViewAll());
return true;
}
@ -117,7 +139,7 @@ bool pFlow::boundaryList::setLists()
);
}
listSet_ = true;
setExtendedDomain();
return true;
}

View File

@ -22,6 +22,7 @@ Licence:
#ifndef __boundaryList_hpp__
#define __boundaryList_hpp__
#include "domain.hpp"
#include "boundaryBase.hpp"
#include "ListPtr.hpp"
#include "baseTimeControl.hpp"
@ -36,22 +37,26 @@ class boundaryList
:
public ListPtr<boundaryBase>
{
protected:
private:
//// - data members
pointStructure& pStruct_;
baseTimeControl timeControl_;
domain extendedDomain_;
bool listSet_ = false;
void setExtendedDomain();
bool resetLists();
/// @brief update neighbor list of boundaries regardless
/// of the time intervals
bool updateLists();
public:
/// type info
@ -70,26 +75,36 @@ public:
bool setLists();
inline
const pointStructure& pStruct()const
{
return pStruct_;
}
inline
auto& boundary(size_t i)
{
return ListPtr<boundaryBase>::operator[](i);
}
inline
const auto& boundary(size_t i)const
{
return ListPtr<boundaryBase>::operator[](i);
}
inline
const baseTimeControl& timeControl()const
{
return timeControl_;
}
inline
const auto& extendedDomain()const
{
return extendedDomain_;
}
bool beforeIteration(uint32 iter, real t, real dt);
bool iterate(uint32 iter, real t, real dt);

View File

@ -34,24 +34,18 @@ pFlow::boundaryPeriodic::boundaryPeriodic
:
boundaryBase(dict, bplane, internal, bndrs, thisIndex),
mirrorBoundaryIndex_(dict.getVal<uint32>("mirrorBoundaryIndex"))
{
extendedPlane_ = boundaryBase::boundaryPlane().parallelPlane(-boundaryBase::neighborLength());
}
{}
pFlow::real pFlow::boundaryPeriodic::neighborLength() const
{
return 2.0*boundaryBase::neighborLength();
return (1+extensionLength_)*boundaryBase::neighborLength();
}
pFlow::realx3 pFlow::boundaryPeriodic::boundaryExtensionLength() const
{
return -neighborLength()*boundaryBase::boundaryPlane().normal();
return -extensionLength_*neighborLength()*boundaryBase::boundaryPlane().normal();
}
const pFlow::plane &pFlow::boundaryPeriodic::boundaryPlane() const
{
return extendedPlane_;
}
bool pFlow::boundaryPeriodic::beforeIteration(
uint32 iterNum,
@ -63,7 +57,7 @@ bool pFlow::boundaryPeriodic::beforeIteration(
{
return true;
}
uint32 s = size();
uint32Vector_D transferFlags("transferFlags",s+1, s+1, RESERVE());
transferFlags.fill(0u);
@ -71,6 +65,7 @@ bool pFlow::boundaryPeriodic::beforeIteration(
auto points = thisPoints();
auto p = boundaryPlane().infPlane();
const auto & transferD = transferFlags.deviceViewAll();
uint32 numTransfered = 0;
Kokkos::parallel_reduce
@ -96,7 +91,7 @@ bool pFlow::boundaryPeriodic::beforeIteration(
// to obtain the transfer vector
realx3 transferVec = displacementVectroToMirror();
return transferPoints
(
numTransfered,

View File

@ -35,7 +35,8 @@ private:
uint32 mirrorBoundaryIndex_;
plane extendedPlane_;
static
inline const real extensionLength_ = 0.1;
public:
@ -62,7 +63,7 @@ public:
realx3 boundaryExtensionLength()const override;
const plane& boundaryPlane()const override;
//const plane& boundaryPlane()const override;*/
bool beforeIteration(uint32 iterNum, real t, real dt) override;

View File

@ -46,7 +46,7 @@ public:
//// - Constructors
INLINE_FUNCTION_HD
box(){}
box() = default;
INLINE_FUNCTION_HD
box(const realx3& minP, const realx3& maxP)
@ -57,10 +57,10 @@ public:
FUNCTION_H
box(const dictionary& dict);
explicit box(const dictionary& dict);
FUNCTION_H
box(iIstream& is);
explicit box(iIstream& is);
INLINE_FUNCTION_HD
box(const box&) = default;
@ -129,6 +129,19 @@ iIstream& operator >>(iIstream& is, box& b);
FUNCTION_H
iOstream& operator << (iOstream& os, const box& b);
INLINE_FUNCTION_HD
bool equal(const box& b1, const box& b2, real tol = smallValue)
{
return equal(b1.minPoint(), b2.minPoint(), tol) &&
equal(b1.maxPoint(), b2.maxPoint(), tol);
}
INLINE_FUNCTION_HD
bool operator ==(const box& b1, const box& b2)
{
return equal(b1, b2);
}
INLINE_FUNCTION_HD
box extendBox(const box& b, const realx3& dl)
{

View File

@ -30,7 +30,7 @@ namespace pFlow
class domain
{
protected:
private:
box domainBox_;
@ -60,10 +60,10 @@ public:
//// - Constructors
INLINE_FUNCTION_HD
domain(){}
domain() = default;
FUNCTION_H
domain(const box& db);
explicit domain(const box& db);
INLINE_FUNCTION_HD
domain(const domain&) = default;
@ -127,25 +127,43 @@ public:
INLINE_FUNCTION_H
const auto& boundaryPlane(uint32 i)const
{
if(i==0) return left_;
if(i==1) return right_;
if(i==2) return bottom_;
if(i==3) return top_;
if(i==4) return rear_;
return front_;
switch (i)
{
case 0:
return left_;
case 1:
return right_;
case 2:
return bottom_;
case 3:
return top_;
case 4:
return rear_;
case 5:
return front_;
default:
fatalErrorInFunction;
return front_;
}
}
INLINE_FUNCTION_HD
const auto& minPoint()const
{
return domainBox_.minPoint();
}
INLINE_FUNCTION_HD
const auto& maxPoint()const
{
return domainBox_.maxPoint();
}
}; // domain
INLINE_FUNCTION_HD
bool equal(const domain& d1, const domain& d2)
{
return equal(d1.domainBox(), d2.domainBox());
}
INLINE_FUNCTION_HD
bool equal(const domain& d1, const domain& d2, real tol)
bool equal(const domain& d1, const domain& d2, real tol=smallValue)
{
return equal(d1.domainBox(), d2.domainBox(), tol);
}

View File

@ -1,3 +1,23 @@
/*------------------------------- phasicFlow ---------------------------------
O C enter of
O O E ngineering and
O O M ultiscale modeling of
OOOOOOO F luid flow
------------------------------------------------------------------------------
Copyright (C): www.cemf.ir
email: hamid.r.norouzi AT gmail.com
------------------------------------------------------------------------------
Licence:
This file is part of phasicFlow code. It is a free software for simulating
granular and multiphase flows. You can redistribute it and/or modify it under
the terms of GNU General Public License v3 or any other later versions.
phasicFlow is distributed to help others in their research in the field of
granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-----------------------------------------------------------------------------*/
#include <cstring>
#include "regularSimulationDomain.hpp"

View File

@ -1,3 +1,22 @@
/*------------------------------- phasicFlow ---------------------------------
O C enter of
O O E ngineering and
O O M ultiscale modeling of
OOOOOOO F luid flow
------------------------------------------------------------------------------
Copyright (C): www.cemf.ir
email: hamid.r.norouzi AT gmail.com
------------------------------------------------------------------------------
Licence:
This file is part of phasicFlow code. It is a free software for simulating
granular and multiphase flows. You can redistribute it and/or modify it under
the terms of GNU General Public License v3 or any other later versions.
phasicFlow is distributed to help others in their research in the field of
granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-----------------------------------------------------------------------------*/
#ifndef __regularSimulationDomain_hpp__
#define __regularSimulationDomain_hpp__

View File

@ -47,8 +47,8 @@ pFlow::domain pFlow::simulationDomain::extendThisDomain
const realx3 &upperPointExtension
) const
{
realx3 minP = thisDomain().domainBox().minPoint() + lowerPointExtension;
realx3 maxP = thisDomain().domainBox().maxPoint() + upperPointExtension;
realx3 minP = thisDomain().minPoint() + lowerPointExtension;
realx3 maxP = thisDomain().maxPoint() + upperPointExtension;
return domain({minP, maxP});
}

View File

@ -31,7 +31,7 @@ class plane
:
public infinitePlane
{
protected:
private:
/// First point
realx3 p1_;

View File

@ -89,6 +89,11 @@ public:
return end_-start_;
}
uint32 numPoints()const
{
return pointEnd_ - pointStart_;
}
friend iOstream& operator<< (iOstream& str, const subSurface & sub);
/// >> operator

View File

@ -169,12 +169,12 @@ public:
return vertices_.capacity();
}
const auto& points() const
const realx3Field_D& points() const
{
return points_;
}
auto& points()
realx3Field_D& points()
{
return points_;
}
@ -189,12 +189,12 @@ public:
return area_;
}
const auto& vertices() const
const uint32x3Field_D& vertices() const
{
return vertices_;
}
auto& vertices()
uint32x3Field_D& vertices()
{
return vertices_;
}

View File

@ -197,5 +197,12 @@ namespace pFlow
} \
virtual word typeName() const { return TYPENAME();}
#define TypeInfoTemplate22(tBase,tName1, Type1, Type2) \
inline static word TYPENAME() \
{ \
return word(tBase)+"<"+word(tName1)+","+getTypeName<Type1>()+","+getTypeName<Type2>()+">"; \
} \
virtual word typeName() const { return TYPENAME();}
#endif

View File

@ -42,7 +42,7 @@ int main(int argc, char** argv )
" date in time folders into vtk file format.");
wordVector times;
bool noGoem = false;
cmds.add_flag(
"--no-geometry",
@ -57,7 +57,7 @@ int main(int argc, char** argv )
cmds.addOption("-o,--out-folder",
outFolder,
"path to output folder of VTK",
"path");
"path");
bool separateSurfaces = false;
cmds.add_flag(