www.cemf.ir
periodicBoundaryContactSearch.cpp
Go to the documentation of this file.
1 /*------------------------------- phasicFlow ---------------------------------
2  O C enter of
3  O O E ngineering and
4  O O M ultiscale modeling of
5  OOOOOOO F luid flow
6 ------------------------------------------------------------------------------
7  Copyright (C): www.cemf.ir
8  email: hamid.r.norouzi AT gmail.com
9 ------------------------------------------------------------------------------
10 Licence:
11  This file is part of phasicFlow code. It is a free software for simulating
12  granular and multiphase flows. You can redistribute it and/or modify it under
13  the terms of GNU General Public License v3 or any other later versions.
14 
15  phasicFlow is distributed to help others in their research in the field of
16  granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the
17  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
18 
19 -----------------------------------------------------------------------------*/
20 
22 #include "contactSearch.hpp"
23 #include "particles.hpp"
24 #include "pointStructure.hpp"
25 #include "geometry.hpp"
26 
27 
29 {
30 
31  auto db = pStruct().thisDomain().domainBox();
32  auto n1 = boundary().mirrorBoundary().boundaryPlane().normal();
33  auto l1 = boundary().mirrorBoundary().neighborLength();
34  auto n2 = boundary().boundaryPlane().normal();
35  auto l2 = boundary().neighborLength();
36 
37  realx3 minP = db.minPoint() + (db.maxPoint()-db.minPoint())* n1+(n2*l2);
38  realx3 maxP = db.maxPoint() + (n1*l1);
39 
40  searchBox_={minP, maxP};
41 }
42 
43 pFlow::periodicBoundaryContactSearch::periodicBoundaryContactSearch(
44  const dictionary &dict,
45  const boundaryBase &boundary,
46  const contactSearch &cSearch)
47 :
48  boundaryContactSearch(dict, boundary, cSearch),
49  transferVec_(boundary.mirrorBoundary().displacementVectroToMirror()),
50  thisIndex_(thisBoundaryIndex()),
51  mirrorIndex_(mirrorBoundaryindex()),
52  diameter_(cSearch.Particles().boundingSphere())
53 {
54 
55  if(thisIndex_%2==1)
56  {
57  masterSearch_ = true;
58 
59  setSearchBox();
60 
61  real minD;
62  real maxD;
63  cSearch.Particles().boundingSphereMinMax(minD, maxD);
64 
65  ppContactSearch_ = makeUnique<ppwBndryContactSearch>(
66  searchBox_,
67  maxD);
68 
69  const auto& geom = cSearch.Geometry();
70 
71  pwContactSearch_ = makeUnique<wallBoundaryContactSearch>(
72  0.5,
73  geom.numPoints(),
74  geom.size(),
75  geom.points().deviceViewAll(),
76  geom.vertices().deviceViewAll(),
77  geom.normals().deviceViewAll());
78  }
79  else
80  {
81  masterSearch_ = false;
82  searchBox_={{0,0,0},{0,0,0}};
83  }
84 }
85 
87 (
88  uint32 iter,
89  real t,
90  real dt,
91  csPairContainerType &ppPairs,
92  csPairContainerType &pwPairs,
93  bool force
94 )
95 {
96  if(masterSearch_)
97  {
98 
99  auto thisP = boundary().thisPoints();
100  auto thisDiams = diameter_.BoundaryField(thisIndex_).thisField();
101  auto mirrorP = mirrorBoundary().thisPoints();
102  auto mirrorDiams = diameter_.BoundaryField(mirrorIndex_).thisField();
103 
104  ppContactSearch_().broadSearchPP(
105  ppPairs,
106  thisP,
107  thisDiams,
108  mirrorP,
109  mirrorDiams,
110  transferVec_);
111 
112  /*pwContactSearch_().broadSearch(
113  pwPairs,
114  ppContactSearch_().searchCells(),
115  thisP,
116  thisDiams,
117  mirrorP,
118  mirrorDiams,
119  transferVec_,
120  ppContactSearch_().sizeRatio());*/
121 
122  //output<<t<<" boundary pp size "<< ppPairs.size()<<endl;
123  //output<<t<<" boundary pw size "<< pwPairs.size()<<endl;
124 
125  return true;
126 
127  }else
128  {
129  return true;
130  }
131 }
pFlow::infinitePlane::normal
const INLINE_FUNCTION_HD auto & normal() const
Definition: infinitePlane.hpp:155
pFlow::real
float real
Definition: builtinTypes.hpp:45
pFlow::periodicBoundaryContactSearch::thisIndex_
uint32 thisIndex_
Definition: periodicBoundaryContactSearch.hpp:41
pFlow::boundaryBase::boundaryPlane
const plane & boundaryPlane() const
the actual boundary plane of this boundary
Definition: boundaryBase.hpp:345
pFlow::periodicBoundaryContactSearch::masterSearch_
bool masterSearch_
Definition: periodicBoundaryContactSearch.hpp:51
pFlow::uint32
unsigned int uint32
Definition: builtinTypes.hpp:56
pFlow::periodicBoundaryContactSearch::ppContactSearch_
uniquePtr< ppwBndryContactSearch > ppContactSearch_
Definition: periodicBoundaryContactSearch.hpp:45
pFlow::boundaryBase::mirrorBoundary
boundaryBase & mirrorBoundary()
Definition: boundaryBase.cpp:259
particles.hpp
pFlow::generalBoundary::pStruct
const auto & pStruct() const
Definition: generalBoundary.hpp:138
pFlow::unsortedPairs
Definition: unsortedPairs.hpp:32
pFlow::periodicBoundaryContactSearch::pwContactSearch_
uniquePtr< wallBoundaryContactSearch > pwContactSearch_
Definition: periodicBoundaryContactSearch.hpp:47
periodicBoundaryContactSearch.hpp
geometry.hpp
pFlow::boundaryBase
Definition: boundaryBase.hpp:42
pFlow::periodicBoundaryContactSearch::setSearchBox
void setSearchBox()
Definition: periodicBoundaryContactSearch.cpp:28
pFlow::boundaryContactSearch
Definition: boundaryContactSearch.hpp:32
pFlow::contactSearch
Definition: contactSearch.hpp:42
pFlow::periodicBoundaryContactSearch::cSearch
const boundaryBase const contactSearch & cSearch
Definition: periodicBoundaryContactSearch.hpp:61
pFlow::periodicBoundaryContactSearch::boundary
const boundaryBase & boundary
Definition: periodicBoundaryContactSearch.hpp:60
contactSearch.hpp
pFlow::periodicBoundaryContactSearch::broadSearch
bool broadSearch(uint32 iter, real t, real dt, csPairContainerType &ppPairs, csPairContainerType &pwPairs, bool force=false) override
Definition: periodicBoundaryContactSearch.cpp:87
pFlow::periodicBoundaryContactSearch::searchBox_
box searchBox_
Definition: periodicBoundaryContactSearch.hpp:37
pFlow::triple< real >
pointStructure.hpp
pFlow::boundaryBase::thisPoints
pointFieldAccessType thisPoints() const
Definition: boundaryBase.cpp:270
pFlow::dictionary
Dictionary holds a set of data entries or sub-dictionaries that are enclosed in a curely braces or ar...
Definition: dictionary.hpp:67
pFlow::boundaryBase::neighborLength
virtual real neighborLength() const
The distance length from boundary plane where neighbor particles still exist in that distance.
Definition: boundaryBase.hpp:222