21 template<
typename cFM,
typename gMM,
template <
class,
class,
class>
class cLT>
27 auto modelDict = this->subDict(
"model");
29 forceModel_ = makeUnique<ContactForceModel>(
35 uint32 nPrtcl = grnParticles_.size();
37 contactSearch_ = contactSearch::create(
38 subDict(
"contactSearch"),
39 grnParticles_.extendedDomain().domainBox(),
44 ppContactList_ = makeUnique<ContactListType>(nPrtcl+1);
46 pwContactList_ = makeUnique<ContactListType>(nPrtcl/5+1);
52 template<
typename cFM,
typename gMM,
template <
class,
class,
class>
class cLT>
55 auto lastItem = ppContactList_().loopCount();
63 grnParticles_.diameter().deviceViewAll(),
64 grnParticles_.coarseGrainFactor().deviceViewAll(),
65 grnParticles_.propertyId().deviceViewAll(),
66 grnParticles_.pointPosition().deviceViewAll(),
67 grnParticles_.velocity().deviceViewAll(),
68 grnParticles_.rVelocity().deviceViewAll(),
69 grnParticles_.contactForce().deviceViewAll(),
70 grnParticles_.contactTorque().deviceViewAll()
85 template<
typename cFM,
typename gMM,
template <
class,
class,
class>
class cLT>
89 uint32 lastItem = pwContactList_().loopCount();
90 uint32 iter = this->currentIter();
91 real t = this->currentTime();
99 geometryMotion_.getTriangleAccessor(),
100 geometryMotion_.getModel(iter, t, dt) ,
101 grnParticles_.diameter().deviceViewAll() ,
102 grnParticles_.coarseGrainFactor().deviceViewAll() ,
103 grnParticles_.propertyId().deviceViewAll(),
104 grnParticles_.pointPosition().deviceViewAll(),
105 grnParticles_.velocity().deviceViewAll(),
106 grnParticles_.rVelocity().deviceViewAll() ,
107 grnParticles_.contactForce().deviceViewAll(),
108 grnParticles_.contactTorque().deviceViewAll() ,
109 geometryMotion_.triMotionIndex().deviceViewAll(),
110 geometryMotion_.propertyId().deviceViewAll(),
111 geometryMotion_.contactForceWall().deviceViewAll()
114 Kokkos::parallel_for(
127 template<
typename cFM,
typename gMM,
template <
class,
class,
class>
class cLT>
138 boundaryInteraction_(grnParticles_,geometryMotion_),
139 ppInteractionTimer_(
"grain-graine interaction (internal)", &this->timers()),
140 pwInteractionTimer_(
"grain-wall interaction (internal)", &this->timers()),
141 boundaryInteractionTimer_(
"grain-grain interaction (boundary)",&this->timers()),
142 contactListMangementTimer_(
"list management (interal)", &this->timers()),
143 contactListMangementBoundaryTimer_(
"list management (boundary)", &this->timers())
146 if(!createGrainInteraction())
153 activeBoundaries_[i] = boundaryInteraction_[i].ppPairsAllocated();
157 template<
typename cFM,
typename gMM,
template <
class,
class,
class>
class cLT>
163 template<
typename cFM,
typename gMM,
template <
class,
class,
class>
class cLT>
168 auto iter = ti.
iter();
172 auto& contactSearchRef = contactSearch_();
174 bool broadSearch = contactSearchRef.enterBroadSearch(ti);
175 bool broadSearchBoundary = contactSearchRef.enterBroadSearchBoundary(ti);
178 grnParticles_.diameter().updateBoundaries(DataDirection::SlaveToMaster);
179 grnParticles_.velocity().updateBoundaries(DataDirection::SlaveToMaster);
180 grnParticles_.rVelocity().updateBoundaries(DataDirection::SlaveToMaster);
181 grnParticles_.propertyId().updateBoundaries(DataDirection::SlaveToMaster);
186 contactListMangementTimer_.start();
188 ppContactList_().beforeBroadSearch();
189 pwContactList_().beforeBroadSearch();
191 contactListMangementTimer_.pause();
194 if(broadSearchBoundary)
196 contactListMangementBoundaryTimer_.start();
198 for(
uint32 i=0; i<6u; i++)
200 if(activeBoundaries_[i])
202 auto& BI = boundaryInteraction_[i];
203 BI.ppPairs().beforeBroadSearch();
204 BI.pwPairs().beforeBroadSearch();
208 contactListMangementBoundaryTimer_.pause();
211 if( grnParticles_.numActive()<=0)
return true;
214 if( !contactSearchRef.broadSearch(
220 "unable to perform broadSearch.\n";
224 for(
uint32 i=0; i<6u; i++)
226 if(activeBoundaries_[i])
228 auto& BI = boundaryInteraction_[i];
229 if(!contactSearchRef.boundaryBroadSearch(
237 "failed to perform broadSearch for boundary index "<<i<<
endl;
244 if(broadSearch && contactSearchRef.performedSearch())
246 contactListMangementTimer_.resume();
248 ppContactList_().afterBroadSearch();
249 pwContactList_().afterBroadSearch();
251 contactListMangementTimer_.end();
254 if(broadSearchBoundary && contactSearchRef.performedSearchBoundary())
256 contactListMangementBoundaryTimer_.resume();
258 for(
uint32 i=0; i<6u; i++)
260 if(activeBoundaries_[i])
262 auto& BI = boundaryInteraction_[i];
263 BI.ppPairs().afterBroadSearch();
264 BI.pwPairs().afterBroadSearch();
268 contactListMangementBoundaryTimer_.end();
273 const auto& cfModel = this->forceModel_();
275 boundaryInteractionTimer_.start();
277 while(requireStep.anyElement(
true) && step <= 10)
279 for(
uint32 i=0; i<6u; i++)
283 requireStep[i] = boundaryInteraction_[i].grainGrainInteraction(
293 boundaryInteractionTimer_.pause();
296 ppInteractionTimer_.start();
300 ppInteractionTimer_.end();
303 pwInteractionTimer_.start();
305 grainWallInteraction();
307 pwInteractionTimer_.end();
310 boundaryInteractionTimer_.resume();
315 const auto& cfModel = this->forceModel_();
316 while( requireStep.anyElement(
true) && step < 20 )
318 for(
uint32 i=0; i<6u; i++)
322 requireStep[i] = boundaryInteraction_[i].grainGrainInteraction(
332 boundaryInteractionTimer_.end();
338 template<
typename cFM,
typename gMM,
template <
class,
class,
class>
class cLT>
344 template<
typename cFM,
typename gMM,
template <
class,
class,
class>
class cLT>