diff --git a/CMakeLists.txt b/CMakeLists.txt index 927c1ec2..b2452565 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) diff --git a/solvers/sphereGranFlow/sphereGranFlow.cpp b/solvers/sphereGranFlow/sphereGranFlow.cpp index c36bc987..f68e829d 100755 --- a/solvers/sphereGranFlow/sphereGranFlow.cpp +++ b/solvers/sphereGranFlow/sphereGranFlow.cpp @@ -88,7 +88,7 @@ initialize_pFlowProcessors(); "particle insertion failed in sphereDFlow solver.\n"; return 1; }*/ - + // set force to zero surfGeometry.beforeIteration(); diff --git a/src/Interaction/CMakeLists.txt b/src/Interaction/CMakeLists.txt index 0869eeda..1427433f 100644 --- a/src/Interaction/CMakeLists.txt +++ b/src/Interaction/CMakeLists.txt @@ -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) diff --git a/src/Interaction/contactLists/unsortedContactList.hpp b/src/Interaction/contactLists/unsortedContactList.hpp index 2a3150b1..5922c4dc 100644 --- a/src/Interaction/contactLists/unsortedContactList.hpp +++ b/src/Interaction/contactLists/unsortedContactList.hpp @@ -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 { diff --git a/src/Interaction/contactSearch/ContactSearch/ContactSearch.hpp b/src/Interaction/contactSearch/ContactSearch/ContactSearch.hpp index c7afcbf0..531ecad9 100644 --- a/src/Interaction/contactSearch/ContactSearch/ContactSearch.hpp +++ b/src/Interaction/contactSearch/ContactSearch/ContactSearch.hpp @@ -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 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("method"); + /*auto method = dict().getVal("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 ( - 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 { diff --git a/src/Interaction/contactSearch/boundaries/boundaryContactSearch/boundaryContactSearch.cpp b/src/Interaction/contactSearch/boundaries/boundaryContactSearch/boundaryContactSearch.cpp new file mode 100644 index 00000000..e7d6145e --- /dev/null +++ b/src/Interaction/contactSearch/boundaries/boundaryContactSearch/boundaryContactSearch.cpp @@ -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("updateInterval")) +{ +} + +pFlow::uniquePtr +pFlow::boundaryContactSearch::create( + const dictionary &dict, + const boundaryBase &boundary, + const contactSearch &cSearch) +{ + + word bType = angleBracketsNames2( + "boundaryContactSearch", + pFlowProcessors().localRunTypeName(), + boundary.type()); + word altBType{"boundaryContactSearch"}; + + if( boundaryBasevCtorSelector_.search(bType) ) + { + REPORT(2)<<"Creating contact search boundary "<< Green_Text(bType)<< + " for "<"); + + 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 create( + const dictionary &dict, + const boundaryBase &boundary, + const contactSearch &cSearch); +}; + +} + +#endif //__boundaryContactSearch_hpp__ diff --git a/src/Interaction/contactSearch/boundaries/boundaryContactSearchList.cpp b/src/Interaction/contactSearch/boundaries/boundaryContactSearchList.cpp new file mode 100644 index 00000000..4f114430 --- /dev/null +++ b/src/Interaction/contactSearch/boundaries/boundaryContactSearchList.cpp @@ -0,0 +1,29 @@ +#include "boundaryContactSearchList.hpp" +#include "boundaryList.hpp" + +void pFlow::boundaryContactSearchList::setList( + const dictionary &dict, + const contactSearch &cSearch) +{ + for(auto i=0; iset + ( + 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); +} + + diff --git a/src/Interaction/contactSearch/boundaries/boundaryContactSearchList.hpp b/src/Interaction/contactSearch/boundaries/boundaryContactSearchList.hpp new file mode 100644 index 00000000..40e9f32e --- /dev/null +++ b/src/Interaction/contactSearch/boundaries/boundaryContactSearchList.hpp @@ -0,0 +1,35 @@ +#include "ListPtr.hpp" +#include "boundaryContactSearch.hpp" + +namespace pFlow +{ + +class boundaryList; +class contactSearch; + +class boundaryContactSearchList +: + public ListPtr +{ +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; + +}; + + +} \ No newline at end of file diff --git a/src/Interaction/contactSearch/boundaries/periodicBoundaryContactSearch/periodicBoundaryContactSearch.cpp b/src/Interaction/contactSearch/boundaries/periodicBoundaryContactSearch/periodicBoundaryContactSearch.cpp new file mode 100644 index 00000000..7dfcd1b5 --- /dev/null +++ b/src/Interaction/contactSearch/boundaries/periodicBoundaryContactSearch/periodicBoundaryContactSearch.cpp @@ -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( + searchBox_, + maxD); + + const auto& geom = cSearch.Geometry(); + + pwContactSearch_ = makeUnique( + 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< ppContactSearch_ = nullptr; + + uniquePtr pwContactSearch_ = nullptr; + + const realPointField_D &diameter_; + + bool masterSearch_ = false; + + void setSearchBox(); + +public: + TypeInfo("boundaryContactSearch") + + 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__ \ No newline at end of file diff --git a/src/Interaction/contactSearch/boundaries/periodicBoundaryContactSearch/ppwBndryContactSearch.cpp b/src/Interaction/contactSearch/boundaries/periodicBoundaryContactSearch/ppwBndryContactSearch.cpp new file mode 100644 index 00000000..ba6928a5 --- /dev/null +++ b/src/Interaction/contactSearch/boundaries/periodicBoundaryContactSearch/ppwBndryContactSearch.cpp @@ -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(-1)); +} + +void pFlow::ppwBndryContactSearch::nullifyNext(uint32 n) +{ + fill(next_, 0u, n, static_cast(-1)); +} + +void pFlow::ppwBndryContactSearch::buildList( + const deviceScatteredFieldAccess &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 &points, + const deviceScatteredFieldAccess& diams, + const deviceScatteredFieldAccess &mirrorPoints, + const deviceScatteredFieldAccess& 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 "<; + + using NextType = deviceViewType1D; + +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 &points); + +public: + ppwBndryContactSearch( + const box &domain, + real cellSize, + real sizeRatio = 1.0); + + bool broadSearchPP( + csPairContainerType &ppPairs, + const deviceScatteredFieldAccess &points, + const deviceScatteredFieldAccess &diams, + const deviceScatteredFieldAccess &mirrorPoints, + const deviceScatteredFieldAccess &mirrorDiams, + const realx3 &transferVec); + + const auto& searchCells()const + { + return searchCells_; + } + + real sizeRatio()const + { + return sizeRatio_; + } +}; + +} + +#endif //__ppwBndryContactSearch_hpp__ \ No newline at end of file diff --git a/src/Interaction/contactSearch/boundaries/periodicBoundaryContactSearch/ppwBndryContactSearchKernels.cpp b/src/Interaction/contactSearch/boundaries/periodicBoundaryContactSearch/ppwBndryContactSearchKernels.cpp new file mode 100644 index 00000000..ea266e78 --- /dev/null +++ b/src/Interaction/contactSearch/boundaries/periodicBoundaryContactSearch/ppwBndryContactSearchKernels.cpp @@ -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 &points, + const cells &searchCells, + deviceViewType3D &head, + deviceViewType1D &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 &points, + const deviceScatteredFieldAccess &diams, + const deviceScatteredFieldAccess &mirrorPoints, + const deviceScatteredFieldAccess &mirrorDiams, + const realx3 &transferVec, + const deviceViewType3D &head, + const deviceViewType1D &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; +} diff --git a/src/Interaction/contactSearch/boundaries/periodicBoundaryContactSearch/ppwBndryContactSearchKernels.hpp b/src/Interaction/contactSearch/boundaries/periodicBoundaryContactSearch/ppwBndryContactSearchKernels.hpp new file mode 100644 index 00000000..78c4a125 --- /dev/null +++ b/src/Interaction/contactSearch/boundaries/periodicBoundaryContactSearch/ppwBndryContactSearchKernels.hpp @@ -0,0 +1,31 @@ + +#include "contactSearchGlobals.hpp" +#include "cells.hpp" +#include "contactSearchFunctions.hpp" +#include "scatteredFieldAccess.hpp" + +namespace pFlow::pweBndryContactSearchKernels +{ + +void buildNextHead( + const deviceScatteredFieldAccess &points, + const cells &searchCells, + deviceViewType3D &head, + deviceViewType1D &next ); + + +uint32 broadSearchPP +( + csPairContainerType &ppPairs, + const deviceScatteredFieldAccess &points, + const deviceScatteredFieldAccess &diams, + const deviceScatteredFieldAccess &mirrorPoints, + const deviceScatteredFieldAccess &mirrorDiams, + const realx3 &transferVec, + const deviceViewType3D &head, + const deviceViewType1D &next, + const cells &searchCells, + real sizeRatio +); + +} \ No newline at end of file diff --git a/src/Interaction/contactSearch/boundaries/periodicBoundaryContactSearch/wallBoundaryContactSearch.cpp b/src/Interaction/contactSearch/boundaries/periodicBoundaryContactSearch/wallBoundaryContactSearch.cpp new file mode 100644 index 00000000..99bbb8ac --- /dev/null +++ b/src/Interaction/contactSearch/boundaries/periodicBoundaryContactSearch/wallBoundaryContactSearch.cpp @@ -0,0 +1,141 @@ +#include "wallBoundaryContactSearch.hpp" +#include "streams.hpp" + +pFlow::wallBoundaryContactSearch::wallBoundaryContactSearch +( + real cellExtent, + uint32 numPoints, + uint32 numElements, + const ViewType1D &points, + const ViewType1D &vertices, + const ViewType1D &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 &thisPoints, + const deviceScatteredFieldAccess &thisDiams, + const deviceScatteredFieldAccess &mirrorPoints, + const deviceScatteredFieldAccess &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 "< &pPoints, + const deviceScatteredFieldAccess &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 ¬InsertedUpdate) + { + auto p = pPoints[i]+transferVec; + int32x3 ind; + if( searchCells.pointIndexInDomain(p, ind) ) + { + for(uint32 nTri=0; nTri; + +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 vertices_; + + // - ref to points in the trisurface (borrowed) + ViewType1D points_; + + // - ref to normal vectors of triangles (borrowed) + ViewType1D normals_; + + // cell range of element/triangle bounding box + ViewType1D elementBox_; + + ViewType1D 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& points, + const ViewType1D& vertices, + const ViewType1D& 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& thisPoints, + const deviceScatteredFieldAccess& thisDiams, + const deviceScatteredFieldAccess& mirrorPoints, + const deviceScatteredFieldAccess& mirroDiams, + const realx3& transferVec, + real sizeRatio); + + uint32 findPairsElementRangeCount( + csPairContainerType &pairs, + const cells &searchCells, + const deviceScatteredFieldAccess &pPoints, + const deviceScatteredFieldAccess &pDiams, + const realx3 &transferVec, + uint baseTriIndex); + + + +}; // wallBoundaryContactSearch + +} // pFlow + + +#endif // __wallBoundaryContactSearch_hpp__ diff --git a/src/Interaction/contactSearch/boundaries/searchBoundary.cpp b/src/Interaction/contactSearch/boundaries/searchBoundary.cpp deleted file mode 100644 index f4dc8788..00000000 --- a/src/Interaction/contactSearch/boundaries/searchBoundary.cpp +++ /dev/null @@ -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("updateInterval")) -{ - -} - -pFlow::uniquePtr - pFlow::searchBoundary::create - ( - const dictionary &dict, - const boundaryBase &boundary, - const contactSearch &cSearch - ) -{ - return nullptr; -} - diff --git a/src/Interaction/contactSearch/boundaries/searchBoundary.hpp b/src/Interaction/contactSearch/boundaries/searchBoundary.hpp deleted file mode 100644 index 449197b3..00000000 --- a/src/Interaction/contactSearch/boundaries/searchBoundary.hpp +++ /dev/null @@ -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"); - - - 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 create( - const dictionary& dict, - const boundaryBase& boundary, - const contactSearch& cSearch); - -}; - -} - -#endif //__searchBoundary_hpp__ - diff --git a/src/Interaction/contactSearch/contactSearch/contactSearch.cpp b/src/Interaction/contactSearch/contactSearch/contactSearch.cpp index 0d110111..03574077 100644 --- a/src/Interaction/contactSearch/contactSearch/contactSearch.cpp +++ b/src/Interaction/contactSearch/contactSearch/contactSearch.cpp @@ -68,7 +68,7 @@ pFlow::uniquePtr 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_ diff --git a/src/Interaction/contactSearch/contactSearch/contactSearch.hpp b/src/Interaction/contactSearch/contactSearch/contactSearch.hpp index eaf9c100..235403c4 100644 --- a/src/Interaction/contactSearch/contactSearch/contactSearch.hpp +++ b/src/Interaction/contactSearch/contactSearch/contactSearch.hpp @@ -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; diff --git a/src/Interaction/contactSearch/contactSearchGlobals.hpp b/src/Interaction/contactSearch/contactSearchGlobals.hpp index 056ffbf8..f0235d48 100644 --- a/src/Interaction/contactSearch/contactSearchGlobals.hpp +++ b/src/Interaction/contactSearch/contactSearchGlobals.hpp @@ -33,6 +33,9 @@ using csIdType = uint32; using csPairContainerType = unsortedPairs; +inline +const uint32 BASE_MIRROR_WALL_INDEX = 1000000; + } #endif diff --git a/src/Interaction/interaction/interaction.cpp b/src/Interaction/interaction/interaction.cpp index ec8938d7..84786617 100644 --- a/src/Interaction/interaction/interaction.cpp +++ b/src/Interaction/interaction/interaction.cpp @@ -71,14 +71,15 @@ pFlow::uniquePtr pFlow::interaction::create clType); - REPORT(1)<< "Selecting interaction model..."< create( diff --git a/src/Interaction/sphereInteraction/boundaries/boundarySphereInteraction/boundarySphereInteraction.cpp b/src/Interaction/sphereInteraction/boundaries/boundarySphereInteraction/boundarySphereInteraction.cpp new file mode 100644 index 00000000..0f2f64fb --- /dev/null +++ b/src/Interaction/sphereInteraction/boundaries/boundarySphereInteraction/boundarySphereInteraction.cpp @@ -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 +pFlow::boundarySphereInteraction::boundarySphereInteraction( + const boundaryBase &boundary, + const sphereParticles &sphPrtcls, + const GeometryMotionModel &geomMotion) + : generalBoundary(boundary, sphPrtcls.pStruct(), "", ""), + geometryMotion_(geomMotion), + sphParticles_(sphPrtcls) +{ + ppPairs_ = makeUnique(1); + pwPairs_ = makeUnique(1); +} + +template +pFlow::uniquePtr> +pFlow::boundarySphereInteraction::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; +} diff --git a/src/Interaction/sphereInteraction/boundaries/boundarySphereInteraction/boundarySphereInteraction.hpp b/src/Interaction/sphereInteraction/boundaries/boundarySphereInteraction/boundarySphereInteraction.hpp new file mode 100644 index 00000000..b511ac6c --- /dev/null +++ b/src/Interaction/sphereInteraction/boundaries/boundarySphereInteraction/boundarySphereInteraction.hpp @@ -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 +class boundarySphereInteraction +: + public generalBoundary +{ +public: + + using BoundarySphereInteractionType + = boundarySphereInteraction; + + 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; + +private: + + const GeometryMotionModel& geometryMotion_; + + /// const reference to sphere particles + const sphereParticles& sphParticles_; + + uniquePtr ppPairs_; + + uniquePtr 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 create( + const boundaryBase& boundary, + const sphereParticles& sphPrtcls, + const GeometryMotionModel& geomMotion + ); + +}; + +} + +#include "boundarySphereInteraction.cpp" + +#endif //__boundarySphereInteraction_hpp__ diff --git a/src/Interaction/sphereInteraction/boundaries/boundarySphereInteractionList.cpp b/src/Interaction/sphereInteraction/boundaries/boundarySphereInteractionList.cpp new file mode 100644 index 00000000..7bc37847 --- /dev/null +++ b/src/Interaction/sphereInteraction/boundaries/boundarySphereInteractionList.cpp @@ -0,0 +1,23 @@ + + +template +pFlow::boundarySphereInteractionList::boundarySphereInteractionList +( + const sphereParticles &sphPrtcls, + const gMModel &geomMotion +) +: + ListPtr>(6), + boundaries_(sphPrtcls.pStruct().boundaries()) +{ + + for(uint32 i=0; i<6; i++) + { + this->set( + i, + boundarySphereInteraction::create( + boundaries_[i], + sphPrtcls, + geomMotion)); + } +} \ No newline at end of file diff --git a/src/Interaction/sphereInteraction/boundaries/boundarySphereInteractionList.hpp b/src/Interaction/sphereInteraction/boundaries/boundarySphereInteractionList.hpp new file mode 100644 index 00000000..1a5086fa --- /dev/null +++ b/src/Interaction/sphereInteraction/boundaries/boundarySphereInteractionList.hpp @@ -0,0 +1,40 @@ +#ifndef __boundarySphereInteractionList_hpp__ +#define __boundarySphereInteractionList_hpp__ + + +#include "boundaryList.hpp" +#include "ListPtr.hpp" +#include "boundarySphereInteraction.hpp" + + +namespace pFlow +{ + + +template +class boundarySphereInteractionList +: + public ListPtr> +{ +private: + + const boundaryList& boundaries_; + +public: + + boundarySphereInteractionList( + const sphereParticles& sphPrtcls, + const geometryMotionModel& geomMotion + ); + + ~boundarySphereInteractionList()=default; + +}; + + + +} + +#include "boundarySphereInteractionList.cpp" + +#endif //__boundarySphereInteractionList_hpp__ \ No newline at end of file diff --git a/src/Interaction/sphereInteraction/boundaries/createBoundarySphereInteraction.hpp b/src/Interaction/sphereInteraction/boundaries/createBoundarySphereInteraction.hpp new file mode 100644 index 00000000..27494be2 --- /dev/null +++ b/src/Interaction/sphereInteraction/boundaries/createBoundarySphereInteraction.hpp @@ -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>; + diff --git a/src/Interaction/sphereInteraction/boundaries/periodicBoundarySphereInteraction/periodicBoundarySIKernels.hpp b/src/Interaction/sphereInteraction/boundaries/periodicBoundarySphereInteraction/periodicBoundarySIKernels.hpp new file mode 100644 index 00000000..60661b3a --- /dev/null +++ b/src/Interaction/sphereInteraction/boundaries/periodicBoundarySphereInteraction/periodicBoundarySIKernels.hpp @@ -0,0 +1,125 @@ + +namespace pFlow::periodicBoundarySIKernels +{ + +template +void sphereSphereInteraction +( + real dt, + const ContactListType& cntctList, + const ContactForceModel& forceModel, + const realx3& transferVec, + const deviceScatteredFieldAccess& thisPoints, + const deviceScatteredFieldAccess& mirrorPoints, + const deviceViewType1D& diam, + const deviceViewType1D& propId, + const deviceViewType1D& vel, + const deviceViewType1D& rVel, + const deviceViewType1D& cForce, + const deviceViewType1D& 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 \ No newline at end of file diff --git a/src/Interaction/sphereInteraction/boundaries/periodicBoundarySphereInteraction/periodicBoundarySphereInteraction.cpp b/src/Interaction/sphereInteraction/boundaries/periodicBoundarySphereInteraction/periodicBoundarySphereInteraction.cpp new file mode 100644 index 00000000..38a4336b --- /dev/null +++ b/src/Interaction/sphereInteraction/boundaries/periodicBoundarySphereInteraction/periodicBoundarySphereInteraction.cpp @@ -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 +pFlow::periodicBoundarySphereInteraction::periodicBoundarySphereInteraction( + const boundaryBase &boundary, + const sphereParticles &sphPrtcls, + const GeometryMotionModel &geomMotion) + : boundarySphereInteraction(boundary, sphPrtcls, geomMotion), + transferVec_(boundary.mirrorBoundary().displacementVectroToMirror()) +{ + if(boundary.thisBoundaryIndex()%2==1) + { + masterInteraction_ = true; + } + else + { + masterInteraction_ = false; + } +} + +template +bool pFlow::periodicBoundarySphereInteraction::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; +} \ No newline at end of file diff --git a/src/Interaction/sphereInteraction/boundaries/periodicBoundarySphereInteraction/periodicBoundarySphereInteraction.hpp b/src/Interaction/sphereInteraction/boundaries/periodicBoundarySphereInteraction/periodicBoundarySphereInteraction.hpp new file mode 100644 index 00000000..e2887787 --- /dev/null +++ b/src/Interaction/sphereInteraction/boundaries/periodicBoundarySphereInteraction/periodicBoundarySphereInteraction.hpp @@ -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 +class periodicBoundarySphereInteraction +: + public boundarySphereInteraction +{ +public: + + using PBSInteractionType = + periodicBoundarySphereInteraction; + + using BSInteractionType = + boundarySphereInteraction; + + 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__ \ No newline at end of file diff --git a/src/Interaction/sphereInteraction/pLine.hpp b/src/Interaction/sphereInteraction/sphereInteraction/pLine.hpp similarity index 100% rename from src/Interaction/sphereInteraction/pLine.hpp rename to src/Interaction/sphereInteraction/sphereInteraction/pLine.hpp diff --git a/src/Interaction/sphereInteraction/sphereInteraction.cpp b/src/Interaction/sphereInteraction/sphereInteraction/sphereInteraction.cpp similarity index 82% rename from src/Interaction/sphereInteraction/sphereInteraction.cpp rename to src/Interaction/sphereInteraction/sphereInteraction/sphereInteraction.cpp index 983d3757..cb298cd7 100644 --- a/src/Interaction/sphereInteraction/sphereInteraction.cpp +++ b/src/Interaction/sphereInteraction/sphereInteraction/sphereInteraction.cpp @@ -35,9 +35,18 @@ bool pFlow::sphereInteraction::createSphereInteraction() uint32 nPrtcl = sphParticles_.size(); + contactSearch_ = contactSearch::create( + subDict("contactSearch"), + sphParticles_.extendedDomain().domainBox(), + sphParticles_, + geometryMotion_, + timers()); + ppContactList_ = makeUnique(nPrtcl+1); - pwContactList_ = makeUnique(nPrtcl/4+1); + pwContactList_ = makeUnique(nPrtcl/5+1); + + return true; } @@ -127,19 +136,13 @@ pFlow::sphereInteraction::sphereInteraction interaction(control, prtcl, geom), geometryMotion_(dynamic_cast(geom)), sphParticles_(dynamic_cast(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::iterate() //output<<"iter, t, dt "<< iter<<" "<< t << " "<::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 "<::iterate() sphereWallInteraction(); pwInteractionTimer_.end(); - + boundaryInteractionTimer_.start(); + for(uint32 i=0; i<6u; i++) + { + boundaryInteraction_[i].sphereSphereInteraction( + dt, + this->forceModel_()); + } + boundaryInteractionTimer_.end(); return true; } diff --git a/src/Interaction/sphereInteraction/sphereInteraction.hpp b/src/Interaction/sphereInteraction/sphereInteraction/sphereInteraction.hpp similarity index 86% rename from src/Interaction/sphereInteraction/sphereInteraction.hpp rename to src/Interaction/sphereInteraction/sphereInteraction/sphereInteraction.hpp index 56c00047..4ccb9836 100644 --- a/src/Interaction/sphereInteraction/sphereInteraction.hpp +++ b/src/Interaction/sphereInteraction/sphereInteraction/sphereInteraction.hpp @@ -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; using IdType = uint32; @@ -53,6 +59,9 @@ public: using ContactListType = contactListType; + //using BoundaryContactListType = unsortedContactList; + + 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_ = nullptr; @@ -72,7 +84,8 @@ private: uniquePtr ppContactList_ = nullptr; /// contact list for particle-wall interactions (keeps the history) - uniquePtr pwContactList_ = nullptr; + uniquePtr 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(); diff --git a/src/Interaction/sphereInteraction/sphereInteractionKernels.hpp b/src/Interaction/sphereInteraction/sphereInteraction/sphereInteractionKernels.hpp similarity index 100% rename from src/Interaction/sphereInteraction/sphereInteractionKernels.hpp rename to src/Interaction/sphereInteraction/sphereInteraction/sphereInteractionKernels.hpp diff --git a/src/Interaction/sphereInteraction/sphereTriSurfaceContact.hpp b/src/Interaction/sphereInteraction/sphereInteraction/sphereTriSurfaceContact.hpp similarity index 100% rename from src/Interaction/sphereInteraction/sphereTriSurfaceContact.hpp rename to src/Interaction/sphereInteraction/sphereInteraction/sphereTriSurfaceContact.hpp diff --git a/src/Interaction/sphereInteraction/triWall.hpp b/src/Interaction/sphereInteraction/sphereInteraction/triWall.hpp similarity index 100% rename from src/Interaction/sphereInteraction/triWall.hpp rename to src/Interaction/sphereInteraction/sphereInteraction/triWall.hpp diff --git a/src/Interaction/sphereInteraction/sphereInteractions.cpp b/src/Interaction/sphereInteraction/sphereInteractions.cpp deleted file mode 100644 index 1bd0da9c..00000000 --- a/src/Interaction/sphereInteraction/sphereInteractions.cpp +++ /dev/null @@ -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>; -*/ \ No newline at end of file diff --git a/src/Interaction/sphereInteraction/sphereInteractionsLinearModels.cpp b/src/Interaction/sphereInteraction/sphereInteractionsLinearModels.cpp new file mode 100644 index 00000000..8c30776f --- /dev/null +++ b/src/Interaction/sphereInteraction/sphereInteractionsLinearModels.cpp @@ -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); + diff --git a/src/Interaction/sphereInteraction/sphereInteractionsNonLinearModModels.cpp b/src/Interaction/sphereInteraction/sphereInteractionsNonLinearModModels.cpp new file mode 100644 index 00000000..b96e5d98 --- /dev/null +++ b/src/Interaction/sphereInteraction/sphereInteractionsNonLinearModModels.cpp @@ -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); diff --git a/src/Interaction/sphereInteraction/sphereInteractionsNonLinearModels.cpp b/src/Interaction/sphereInteraction/sphereInteractionsNonLinearModels.cpp new file mode 100644 index 00000000..3e8e2707 --- /dev/null +++ b/src/Interaction/sphereInteraction/sphereInteractionsNonLinearModels.cpp @@ -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); diff --git a/src/Particles/particles/particles.hpp b/src/Particles/particles/particles.hpp index 8ba1cfce..3ca77237 100644 --- a/src/Particles/particles/particles.hpp +++ b/src/Particles/particles/particles.hpp @@ -128,6 +128,12 @@ public: return dynPointStruct_.thisDomain(); } + inline + const auto& extendedDomain()const + { + return dynPointStruct_.extendedDomain(); + } + inline auto size()const{ return dynPointStruct_.size(); } diff --git a/src/phasicFlow/CMakeLists.txt b/src/phasicFlow/CMakeLists.txt index eee28785..3efe0d7e 100644 --- a/src/phasicFlow/CMakeLists.txt +++ b/src/phasicFlow/CMakeLists.txt @@ -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) diff --git a/src/phasicFlow/Kokkos/KokkosTypes.hpp b/src/phasicFlow/Kokkos/KokkosTypes.hpp index d58df4cb..6597b5b7 100644 --- a/src/phasicFlow/Kokkos/KokkosTypes.hpp +++ b/src/phasicFlow/Kokkos/KokkosTypes.hpp @@ -77,6 +77,19 @@ using hostRPolicyStatic = Kokkos::Schedule, Kokkos::IndexType >; +using deviceRPolicyDynamic = + Kokkos::RangePolicy< + Kokkos::DefaultExecutionSpace, + Kokkos::Schedule, + Kokkos::IndexType >; + + +using hostRPolicyDynamic = + Kokkos::RangePolicy< + Kokkos::DefaultExecutionSpace, + Kokkos::Schedule, + Kokkos::IndexType >; + /// Pair of two variables template diff --git a/src/phasicFlow/Timer/Timer.hpp b/src/phasicFlow/Timer/Timer.hpp index ac32ba35..54c5d118 100644 --- a/src/phasicFlow/Timer/Timer.hpp +++ b/src/phasicFlow/Timer/Timer.hpp @@ -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 >(end - start_).count(); + } + + void resume() { start_ = timer::now(); } void end() { - auto end = timer::now(); - lastTime_ = std::chrono::duration_cast - < std::chrono::duration >(end - start_).count(); - + pause(); + lastTime_ = stepAccTime_; + numIteration_++; accTime_ += lastTime_; } diff --git a/src/phasicFlow/containers/Field/Fields.cpp b/src/phasicFlow/containers/Field/Fields.cpp index 55337632..b0cbad75 100644 --- a/src/phasicFlow/containers/Field/Fields.cpp +++ b/src/phasicFlow/containers/Field/Fields.cpp @@ -21,14 +21,12 @@ Licence: #include "Fields.hpp" -template class pFlow::Field; - template class pFlow::Field; -template class pFlow::Field; - template class pFlow::Field; +template class pFlow::Field; + template class pFlow::Field; template class pFlow::Field; diff --git a/src/phasicFlow/containers/Field/Fields.hpp b/src/phasicFlow/containers/Field/Fields.hpp index a0b8d192..65d5ac7e 100644 --- a/src/phasicFlow/containers/Field/Fields.hpp +++ b/src/phasicFlow/containers/Field/Fields.hpp @@ -74,29 +74,6 @@ using realx3x3Field_H = Field; using wordField_H = Field; -// host device fields -/*using int8Field_HD = Field; - -using int32Field_HD = Field; - -using int64Field_HD = Field; - -using uint32Field_HD = Field; - -using labelField_HD = Field; - -using realField_HD = Field; - -using realx3Field_HD = Field; - -using uint32x3Field_HD = Field; - -using int32x3Field_HD = Field; - -using int64x3Field_HD = Field; - -using realx3x3Field_HD = Field;*/ - } diff --git a/src/phasicFlow/containers/VectorHD/VectorSingles.cpp b/src/phasicFlow/containers/VectorHD/VectorSingles.cpp index c856b7c1..59a58468 100644 --- a/src/phasicFlow/containers/VectorHD/VectorSingles.cpp +++ b/src/phasicFlow/containers/VectorHD/VectorSingles.cpp @@ -24,9 +24,6 @@ Licence: template class Kokkos::View; template class pFlow::VectorSingle; -template class Kokkos::View; -template class pFlow::VectorSingle; - template class Kokkos::View; template class pFlow::VectorSingle; diff --git a/src/phasicFlow/containers/pointField/boundaryField/boundaryField.cpp b/src/phasicFlow/containers/pointField/boundaryField/boundaryField/boundaryField.cpp similarity index 100% rename from src/phasicFlow/containers/pointField/boundaryField/boundaryField.cpp rename to src/phasicFlow/containers/pointField/boundaryField/boundaryField/boundaryField.cpp diff --git a/src/phasicFlow/containers/pointField/boundaryField/boundaryField.hpp b/src/phasicFlow/containers/pointField/boundaryField/boundaryField/boundaryField.hpp similarity index 86% rename from src/phasicFlow/containers/pointField/boundaryField/boundaryField.hpp rename to src/phasicFlow/containers/pointField/boundaryField/boundaryField/boundaryField.hpp index 8294d96a..7e1935a5 100644 --- a/src/phasicFlow/containers/pointField/boundaryField/boundaryField.hpp +++ b/src/phasicFlow/containers/pointField/boundaryField/boundaryField/boundaryField.hpp @@ -41,6 +41,8 @@ public: using execution_space = typename InternalFieldType::execution_space; + using FieldAccessType = scatteredFieldAccess; + 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; diff --git a/src/phasicFlow/containers/pointField/boundaryFieldList.hpp b/src/phasicFlow/containers/pointField/boundaryField/boundaryFieldList.hpp similarity index 100% rename from src/phasicFlow/containers/pointField/boundaryFieldList.hpp rename to src/phasicFlow/containers/pointField/boundaryField/boundaryFieldList.hpp index 61a396da..e4179bc2 100644 --- a/src/phasicFlow/containers/pointField/boundaryFieldList.hpp +++ b/src/phasicFlow/containers/pointField/boundaryField/boundaryFieldList.hpp @@ -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__ diff --git a/src/phasicFlow/containers/pointField/boundaryField/createBoundaryFields.hpp b/src/phasicFlow/containers/pointField/boundaryField/createBoundaryFields.hpp index 3403149d..8167a6ef 100644 --- a/src/phasicFlow/containers/pointField/boundaryField/createBoundaryFields.hpp +++ b/src/phasicFlow/containers/pointField/boundaryField/createBoundaryFields.hpp @@ -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__ diff --git a/src/phasicFlow/containers/pointField/boundaryField/exitBoundaryField.cpp b/src/phasicFlow/containers/pointField/boundaryField/exitBoundaryField/exitBoundaryField.cpp similarity index 100% rename from src/phasicFlow/containers/pointField/boundaryField/exitBoundaryField.cpp rename to src/phasicFlow/containers/pointField/boundaryField/exitBoundaryField/exitBoundaryField.cpp diff --git a/src/phasicFlow/containers/pointField/boundaryField/exitBoundaryField.hpp b/src/phasicFlow/containers/pointField/boundaryField/exitBoundaryField/exitBoundaryField.hpp similarity index 100% rename from src/phasicFlow/containers/pointField/boundaryField/exitBoundaryField.hpp rename to src/phasicFlow/containers/pointField/boundaryField/exitBoundaryField/exitBoundaryField.hpp diff --git a/src/phasicFlow/containers/pointField/boundaryField/generalBoundary.cpp b/src/phasicFlow/containers/pointField/boundaryField/generalBoundary.cpp deleted file mode 100644 index 52a61e87..00000000 --- a/src/phasicFlow/containers/pointField/boundaryField/generalBoundary.cpp +++ /dev/null @@ -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(); -} \ No newline at end of file diff --git a/src/phasicFlow/containers/pointField/boundaryField/generalBoundary/generalBoundary.cpp b/src/phasicFlow/containers/pointField/boundaryField/generalBoundary/generalBoundary.cpp new file mode 100644 index 00000000..3e2f0141 --- /dev/null +++ b/src/phasicFlow/containers/pointField/boundaryField/generalBoundary/generalBoundary.cpp @@ -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(); +} \ No newline at end of file diff --git a/src/phasicFlow/containers/pointField/boundaryField/generalBoundary.hpp b/src/phasicFlow/containers/pointField/boundaryField/generalBoundary/generalBoundary.hpp similarity index 92% rename from src/phasicFlow/containers/pointField/boundaryField/generalBoundary.hpp rename to src/phasicFlow/containers/pointField/boundaryField/generalBoundary/generalBoundary.hpp index 380f95b3..18105542 100644 --- a/src/phasicFlow/containers/pointField/boundaryField/generalBoundary.hpp +++ b/src/phasicFlow/containers/pointField/boundaryField/generalBoundary/generalBoundary.hpp @@ -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 + /*template BoundaryFieldType& thisField() { return static_cast(*this); @@ -132,7 +144,7 @@ public: const BoundaryFieldType& thisField()const { return static_cast(*this); - } + }*/ }; diff --git a/src/phasicFlow/containers/pointField/boundaryField/periodicBoundaryField.cpp b/src/phasicFlow/containers/pointField/boundaryField/periodicBoundaryField/periodicBoundaryField.cpp similarity index 99% rename from src/phasicFlow/containers/pointField/boundaryField/periodicBoundaryField.cpp rename to src/phasicFlow/containers/pointField/boundaryField/periodicBoundaryField/periodicBoundaryField.cpp index f850ce06..28177b23 100644 --- a/src/phasicFlow/containers/pointField/boundaryField/periodicBoundaryField.cpp +++ b/src/phasicFlow/containers/pointField/boundaryField/periodicBoundaryField/periodicBoundaryField.cpp @@ -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 diff --git a/src/phasicFlow/containers/pointField/boundaryField/periodicBoundaryField.hpp b/src/phasicFlow/containers/pointField/boundaryField/periodicBoundaryField/periodicBoundaryField.hpp similarity index 100% rename from src/phasicFlow/containers/pointField/boundaryField/periodicBoundaryField.hpp rename to src/phasicFlow/containers/pointField/boundaryField/periodicBoundaryField/periodicBoundaryField.hpp index 90a7f70d..712a5a07 100644 --- a/src/phasicFlow/containers/pointField/boundaryField/periodicBoundaryField.hpp +++ b/src/phasicFlow/containers/pointField/boundaryField/periodicBoundaryField/periodicBoundaryField.hpp @@ -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__ diff --git a/src/phasicFlow/containers/pointField/internalField.cpp b/src/phasicFlow/containers/pointField/internalField/internalField.cpp similarity index 99% rename from src/phasicFlow/containers/pointField/internalField.cpp rename to src/phasicFlow/containers/pointField/internalField/internalField.cpp index 99bd7860..df0f0756 100644 --- a/src/phasicFlow/containers/pointField/internalField.cpp +++ b/src/phasicFlow/containers/pointField/internalField/internalField.cpp @@ -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 diff --git a/src/phasicFlow/containers/pointField/internalField.hpp b/src/phasicFlow/containers/pointField/internalField/internalField.hpp similarity index 100% rename from src/phasicFlow/containers/pointField/internalField.hpp rename to src/phasicFlow/containers/pointField/internalField/internalField.hpp index 92ba1bf6..07ad006a 100644 --- a/src/phasicFlow/containers/pointField/internalField.hpp +++ b/src/phasicFlow/containers/pointField/internalField/internalField.hpp @@ -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__ diff --git a/src/phasicFlow/containers/pointField/internalFieldAlgorithms.hpp b/src/phasicFlow/containers/pointField/internalField/internalFieldAlgorithms.hpp similarity index 99% rename from src/phasicFlow/containers/pointField/internalFieldAlgorithms.hpp rename to src/phasicFlow/containers/pointField/internalField/internalFieldAlgorithms.hpp index 118fb21c..cb098ce3 100644 --- a/src/phasicFlow/containers/pointField/internalFieldAlgorithms.hpp +++ b/src/phasicFlow/containers/pointField/internalField/internalFieldAlgorithms.hpp @@ -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__ diff --git a/src/phasicFlow/containers/pointField/pointField copy.hpp b/src/phasicFlow/containers/pointField/pointField/pointField copy.hpp similarity index 100% rename from src/phasicFlow/containers/pointField/pointField copy.hpp rename to src/phasicFlow/containers/pointField/pointField/pointField copy.hpp diff --git a/src/phasicFlow/containers/pointField/pointField.cpp b/src/phasicFlow/containers/pointField/pointField/pointField.cpp similarity index 99% rename from src/phasicFlow/containers/pointField/pointField.cpp rename to src/phasicFlow/containers/pointField/pointField/pointField.cpp index 0a6315ab..0c1c44fd 100644 --- a/src/phasicFlow/containers/pointField/pointField.cpp +++ b/src/phasicFlow/containers/pointField/pointField/pointField.cpp @@ -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 diff --git a/src/phasicFlow/containers/pointField/pointField.hpp b/src/phasicFlow/containers/pointField/pointField/pointField.hpp similarity index 96% rename from src/phasicFlow/containers/pointField/pointField.hpp rename to src/phasicFlow/containers/pointField/pointField/pointField.hpp index c6191dc8..6977563e 100644 --- a/src/phasicFlow/containers/pointField/pointField.hpp +++ b/src/phasicFlow/containers/pointField/pointField/pointField.hpp @@ -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(*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_; diff --git a/src/phasicFlow/containers/pointField/pointFieldAlgorithms.hpp b/src/phasicFlow/containers/pointField/pointField/pointFieldAlgorithms.hpp similarity index 99% rename from src/phasicFlow/containers/pointField/pointFieldAlgorithms.hpp rename to src/phasicFlow/containers/pointField/pointField/pointFieldAlgorithms.hpp index ce3765d2..061025aa 100644 --- a/src/phasicFlow/containers/pointField/pointFieldAlgorithms.hpp +++ b/src/phasicFlow/containers/pointField/pointField/pointFieldAlgorithms.hpp @@ -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. - -----------------------------------------------------------------------------*/ diff --git a/src/phasicFlow/containers/pointField/pointField_old.hpp b/src/phasicFlow/containers/pointField/pointField/pointField_old.hpp similarity index 100% rename from src/phasicFlow/containers/pointField/pointField_old.hpp rename to src/phasicFlow/containers/pointField/pointField/pointField_old.hpp diff --git a/src/phasicFlow/containers/pointField/pointFields.cpp b/src/phasicFlow/containers/pointField/pointField/pointFields.cpp similarity index 84% rename from src/phasicFlow/containers/pointField/pointFields.cpp rename to src/phasicFlow/containers/pointField/pointField/pointFields.cpp index f116e5ee..6f3cf375 100644 --- a/src/phasicFlow/containers/pointField/pointFields.cpp +++ b/src/phasicFlow/containers/pointField/pointField/pointFields.cpp @@ -27,15 +27,9 @@ Licence: template class pFlow::exitBoundaryField; \ template class pFlow::periodicBoundaryField; -template class pFlow::pointField; -createBaseBoundary(pFlow::int8, pFlow::HostSpace); -createAllBoundary(pFlow::int8, pFlow::HostSpace); - -template class pFlow::pointField; -createBaseBoundary(pFlow::int8, void); -createAllBoundary(pFlow::int8, void); +// uint8 template class pFlow::pointField; createBaseBoundary(pFlow::uint8, pFlow::HostSpace); createAllBoundary(pFlow::uint8, pFlow::HostSpace); @@ -44,14 +38,7 @@ template class pFlow::pointField; createBaseBoundary(pFlow::uint8, void); createAllBoundary(pFlow::uint8, void); -template class pFlow::pointField; -createBaseBoundary(pFlow::int32, pFlow::HostSpace); -createAllBoundary(pFlow::int32, pFlow::HostSpace); - -template class pFlow::pointField; -createBaseBoundary(pFlow::int32, void); -createAllBoundary(pFlow::int32, void); - +/// uint32 template class pFlow::pointField; createBaseBoundary(pFlow::uint32, pFlow::HostSpace); createAllBoundary(pFlow::uint32, pFlow::HostSpace); @@ -60,6 +47,7 @@ template class pFlow::pointField; createBaseBoundary(pFlow::uint32, void); createAllBoundary(pFlow::uint32, void); +/// uint64 template class pFlow::pointField; createBaseBoundary(pFlow::uint64, pFlow::HostSpace); createAllBoundary(pFlow::uint64, pFlow::HostSpace); @@ -68,15 +56,16 @@ template class pFlow::pointField; createBaseBoundary(pFlow::uint64, void); createAllBoundary(pFlow::uint64, void); +/// real template class pFlow::pointField; createBaseBoundary(pFlow::real, pFlow::HostSpace); createAllBoundary(pFlow::real, pFlow::HostSpace); - template class pFlow::pointField; createBaseBoundary(pFlow::real, void); createAllBoundary(pFlow::real, void); +/// realx3 template class pFlow::pointField; 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; createBaseBoundary(pFlow::realx4, pFlow::HostSpace); createAllBoundary(pFlow::realx4, pFlow::HostSpace); @@ -96,6 +86,8 @@ template class pFlow::pointField; createBaseBoundary(pFlow::realx4, void); createAllBoundary(pFlow::realx4, void); + +/// word template class pFlow::pointField; createBaseBoundary(pFlow::word, pFlow::HostSpace); createAllBoundary(pFlow::word, pFlow::HostSpace); \ No newline at end of file diff --git a/src/phasicFlow/containers/pointField/pointFields.hpp b/src/phasicFlow/containers/pointField/pointField/pointFields.hpp similarity index 86% rename from src/phasicFlow/containers/pointField/pointFields.hpp rename to src/phasicFlow/containers/pointField/pointField/pointFields.hpp index 26e0d52a..3b1e41fc 100644 --- a/src/phasicFlow/containers/pointField/pointFields.hpp +++ b/src/phasicFlow/containers/pointField/pointField/pointFields.hpp @@ -36,21 +36,13 @@ template using pointField_D = pointField; -using int8PointField_D = pointField_D; -using int8PointField_H = pointField_H; using uint8PointField_D = pointField_D; using uint8PointField_H = pointField_H; -using int32PointField_D = pointField_D; -using int32PointField_H = pointField_H; - using uint32PointField_D = pointField_D; using uint32PointField_H = pointField_H; -using int64PointField_D = pointField_D; -using int64PointField_H = pointField_H; - using uint64PointField_D = pointField_D; using uint64PointField_H = pointField_H; diff --git a/src/phasicFlow/containers/triSurfaceField/triSurfaceFields.cpp b/src/phasicFlow/containers/triSurfaceField/triSurfaceFields.cpp index 95b75805..88850464 100644 --- a/src/phasicFlow/containers/triSurfaceField/triSurfaceFields.cpp +++ b/src/phasicFlow/containers/triSurfaceField/triSurfaceFields.cpp @@ -21,14 +21,5 @@ Licence: #include "triSurfaceFields.hpp" -template class pFlow::triSurfaceField; +template class pFlow::triSurfaceField; -/*template class pFlow::triSurfaceField; - -template class pFlow::triSurfaceField; - -template class pFlow::triSurfaceField; - -template class pFlow::triSurfaceField; - -template class pFlow::triSurfaceField;*/ \ No newline at end of file diff --git a/src/phasicFlow/structuredData/boundaries/boundaryBase/boundaryBase.cpp b/src/phasicFlow/structuredData/boundaries/boundaryBase/boundaryBase.cpp index d2d41e7f..a7f6c96d 100644 --- a/src/phasicFlow/structuredData/boundaries/boundaryBase/boundaryBase.cpp +++ b/src/phasicFlow/structuredData/boundaries/boundaryBase/boundaryBase.cpp @@ -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(); diff --git a/src/phasicFlow/structuredData/boundaries/boundaryBase/boundaryBase.hpp b/src/phasicFlow/structuredData/boundaries/boundaryBase/boundaryBase.hpp index 485ad270..261b7f94 100644 --- a/src/phasicFlow/structuredData/boundaries/boundaryBase/boundaryBase.hpp +++ b/src/phasicFlow/structuredData/boundaries/boundaryBase/boundaryBase.hpp @@ -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 diff --git a/src/phasicFlow/structuredData/boundaries/boundaryBase/scatteredFieldAccess.hpp b/src/phasicFlow/structuredData/boundaries/boundaryBase/scatteredFieldAccess.hpp index 19c9caa7..f26438db 100644 --- a/src/phasicFlow/structuredData/boundaries/boundaryBase/scatteredFieldAccess.hpp +++ b/src/phasicFlow/structuredData/boundaries/boundaryBase/scatteredFieldAccess.hpp @@ -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 ind, - ViewType1D fVals) + const ViewType1D& ind, + const ViewType1D& 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 diff --git a/src/phasicFlow/structuredData/boundaries/boundaryList.cpp b/src/phasicFlow/structuredData/boundaries/boundaryList.cpp index 237e4bd7..81a227a5 100644 --- a/src/phasicFlow/structuredData/boundaries/boundaryList.cpp +++ b/src/phasicFlow/structuredData/boundaries/boundaryList.cpp @@ -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."< 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; } diff --git a/src/phasicFlow/structuredData/boundaries/boundaryList.hpp b/src/phasicFlow/structuredData/boundaries/boundaryList.hpp index bed346da..6581d6cd 100644 --- a/src/phasicFlow/structuredData/boundaries/boundaryList.hpp +++ b/src/phasicFlow/structuredData/boundaries/boundaryList.hpp @@ -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 { - -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::operator[](i); } + inline const auto& boundary(size_t i)const { return ListPtr::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); diff --git a/src/phasicFlow/structuredData/boundaries/boundaryPeriodic/boundaryPeriodic.cpp b/src/phasicFlow/structuredData/boundaries/boundaryPeriodic/boundaryPeriodic.cpp index e59b41ef..30fdc039 100644 --- a/src/phasicFlow/structuredData/boundaries/boundaryPeriodic/boundaryPeriodic.cpp +++ b/src/phasicFlow/structuredData/boundaries/boundaryPeriodic/boundaryPeriodic.cpp @@ -34,24 +34,18 @@ pFlow::boundaryPeriodic::boundaryPeriodic : boundaryBase(dict, bplane, internal, bndrs, thisIndex), mirrorBoundaryIndex_(dict.getVal("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, diff --git a/src/phasicFlow/structuredData/boundaries/boundaryPeriodic/boundaryPeriodic.hpp b/src/phasicFlow/structuredData/boundaries/boundaryPeriodic/boundaryPeriodic.hpp index 3698926a..b4746a5e 100644 --- a/src/phasicFlow/structuredData/boundaries/boundaryPeriodic/boundaryPeriodic.hpp +++ b/src/phasicFlow/structuredData/boundaries/boundaryPeriodic/boundaryPeriodic.hpp @@ -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; diff --git a/src/phasicFlow/structuredData/box/box.hpp b/src/phasicFlow/structuredData/box/box.hpp index 4e78f2fc..8a350405 100644 --- a/src/phasicFlow/structuredData/box/box.hpp +++ b/src/phasicFlow/structuredData/box/box.hpp @@ -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) { diff --git a/src/phasicFlow/structuredData/domain/domain.hpp b/src/phasicFlow/structuredData/domain/domain.hpp index f29b33ab..0b733a45 100644 --- a/src/phasicFlow/structuredData/domain/domain.hpp +++ b/src/phasicFlow/structuredData/domain/domain.hpp @@ -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); } diff --git a/src/phasicFlow/structuredData/domain/regularSimulationDomain.cpp b/src/phasicFlow/structuredData/domain/regularSimulationDomain.cpp index 59ba7aa1..7f999541 100644 --- a/src/phasicFlow/structuredData/domain/regularSimulationDomain.cpp +++ b/src/phasicFlow/structuredData/domain/regularSimulationDomain.cpp @@ -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 #include "regularSimulationDomain.hpp" diff --git a/src/phasicFlow/structuredData/domain/regularSimulationDomain.hpp b/src/phasicFlow/structuredData/domain/regularSimulationDomain.hpp index 7eeb888a..39491387 100644 --- a/src/phasicFlow/structuredData/domain/regularSimulationDomain.hpp +++ b/src/phasicFlow/structuredData/domain/regularSimulationDomain.hpp @@ -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__ diff --git a/src/phasicFlow/structuredData/domain/simulationDomain.cpp b/src/phasicFlow/structuredData/domain/simulationDomain.cpp index 2930b1b4..dde24ae9 100644 --- a/src/phasicFlow/structuredData/domain/simulationDomain.cpp +++ b/src/phasicFlow/structuredData/domain/simulationDomain.cpp @@ -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}); } diff --git a/src/phasicFlow/structuredData/plane/plane.hpp b/src/phasicFlow/structuredData/plane/plane.hpp index 93930a85..9c8f23e0 100644 --- a/src/phasicFlow/structuredData/plane/plane.hpp +++ b/src/phasicFlow/structuredData/plane/plane.hpp @@ -31,7 +31,7 @@ class plane : public infinitePlane { -protected: +private: /// First point realx3 p1_; diff --git a/src/phasicFlow/structuredData/pointStructure/internalPoints.cpp b/src/phasicFlow/structuredData/pointStructure/internalPoints/internalPoints.cpp similarity index 100% rename from src/phasicFlow/structuredData/pointStructure/internalPoints.cpp rename to src/phasicFlow/structuredData/pointStructure/internalPoints/internalPoints.cpp diff --git a/src/phasicFlow/structuredData/pointStructure/internalPoints.hpp b/src/phasicFlow/structuredData/pointStructure/internalPoints/internalPoints.hpp similarity index 100% rename from src/phasicFlow/structuredData/pointStructure/internalPoints.hpp rename to src/phasicFlow/structuredData/pointStructure/internalPoints/internalPoints.hpp diff --git a/src/phasicFlow/structuredData/pointStructure/internalPointsKernels.cpp b/src/phasicFlow/structuredData/pointStructure/internalPoints/internalPointsKernels.cpp similarity index 100% rename from src/phasicFlow/structuredData/pointStructure/internalPointsKernels.cpp rename to src/phasicFlow/structuredData/pointStructure/internalPoints/internalPointsKernels.cpp diff --git a/src/phasicFlow/structuredData/pointStructure/internalPointsKernels.hpp b/src/phasicFlow/structuredData/pointStructure/internalPoints/internalPointsKernels.hpp similarity index 100% rename from src/phasicFlow/structuredData/pointStructure/internalPointsKernels.hpp rename to src/phasicFlow/structuredData/pointStructure/internalPoints/internalPointsKernels.hpp diff --git a/src/phasicFlow/structuredData/pointStructure/pointFlag.hpp b/src/phasicFlow/structuredData/pointStructure/internalPoints/pointFlag.hpp similarity index 100% rename from src/phasicFlow/structuredData/pointStructure/pointFlag.hpp rename to src/phasicFlow/structuredData/pointStructure/internalPoints/pointFlag.hpp diff --git a/src/phasicFlow/structuredData/pointStructure/pointFlagKernels.hpp b/src/phasicFlow/structuredData/pointStructure/internalPoints/pointFlagKernels.hpp similarity index 100% rename from src/phasicFlow/structuredData/pointStructure/pointFlagKernels.hpp rename to src/phasicFlow/structuredData/pointStructure/internalPoints/pointFlagKernels.hpp diff --git a/src/phasicFlow/structuredData/pointStructure/mortonIndexing.cpp b/src/phasicFlow/structuredData/pointStructure/pointStructure/mortonIndexing.cpp similarity index 100% rename from src/phasicFlow/structuredData/pointStructure/mortonIndexing.cpp rename to src/phasicFlow/structuredData/pointStructure/pointStructure/mortonIndexing.cpp diff --git a/src/phasicFlow/structuredData/pointStructure/mortonIndexing.hpp b/src/phasicFlow/structuredData/pointStructure/pointStructure/mortonIndexing.hpp similarity index 100% rename from src/phasicFlow/structuredData/pointStructure/mortonIndexing.hpp rename to src/phasicFlow/structuredData/pointStructure/pointStructure/mortonIndexing.hpp diff --git a/src/phasicFlow/structuredData/pointStructure/pStcutold.txt b/src/phasicFlow/structuredData/pointStructure/pointStructure/pStcutold.txt similarity index 100% rename from src/phasicFlow/structuredData/pointStructure/pStcutold.txt rename to src/phasicFlow/structuredData/pointStructure/pointStructure/pStcutold.txt diff --git a/src/phasicFlow/structuredData/pointStructure/pointStructure.cpp b/src/phasicFlow/structuredData/pointStructure/pointStructure/pointStructure.cpp similarity index 100% rename from src/phasicFlow/structuredData/pointStructure/pointStructure.cpp rename to src/phasicFlow/structuredData/pointStructure/pointStructure/pointStructure.cpp diff --git a/src/phasicFlow/structuredData/pointStructure/pointStructure.hpp b/src/phasicFlow/structuredData/pointStructure/pointStructure/pointStructure.hpp similarity index 100% rename from src/phasicFlow/structuredData/pointStructure/pointStructure.hpp rename to src/phasicFlow/structuredData/pointStructure/pointStructure/pointStructure.hpp diff --git a/src/phasicFlow/structuredData/pointStructure/pointStructureKernels.hpp b/src/phasicFlow/structuredData/pointStructure/pointStructure/pointStructureKernels.hpp similarity index 100% rename from src/phasicFlow/structuredData/pointStructure/pointStructureKernels.hpp rename to src/phasicFlow/structuredData/pointStructure/pointStructure/pointStructureKernels.hpp diff --git a/src/phasicFlow/triSurface/subSurface.hpp b/src/phasicFlow/triSurface/subSurface.hpp index f6cdc75f..430dbbeb 100644 --- a/src/phasicFlow/triSurface/subSurface.hpp +++ b/src/phasicFlow/triSurface/subSurface.hpp @@ -89,6 +89,11 @@ public: return end_-start_; } + uint32 numPoints()const + { + return pointEnd_ - pointStart_; + } + friend iOstream& operator<< (iOstream& str, const subSurface & sub); /// >> operator diff --git a/src/phasicFlow/triSurface/triSurface.hpp b/src/phasicFlow/triSurface/triSurface.hpp index 09a572a0..204e0376 100644 --- a/src/phasicFlow/triSurface/triSurface.hpp +++ b/src/phasicFlow/triSurface/triSurface.hpp @@ -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_; } diff --git a/src/phasicFlow/typeSelection/typeInfo.hpp b/src/phasicFlow/typeSelection/typeInfo.hpp index dc6cb8aa..e5b2b5be 100644 --- a/src/phasicFlow/typeSelection/typeInfo.hpp +++ b/src/phasicFlow/typeSelection/typeInfo.hpp @@ -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()+","+getTypeName()+">"; \ + } \ + virtual word typeName() const { return TYPENAME();} + #endif diff --git a/utilities/pFlowToVTK/pFlowToVTK.cpp b/utilities/pFlowToVTK/pFlowToVTK.cpp index 44cc6ed8..6dfcae3c 100755 --- a/utilities/pFlowToVTK/pFlowToVTK.cpp +++ b/utilities/pFlowToVTK/pFlowToVTK.cpp @@ -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(