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 = sphParticles_.size();
37 contactSearch_ = contactSearch::create(
38 subDict(
"contactSearch"),
39 sphParticles_.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 sphParticles_.diameter().deviceViewAll(),
64 sphParticles_.propertyId().deviceViewAll(),
65 sphParticles_.pointPosition().deviceViewAll(),
66 sphParticles_.velocity().deviceViewAll(),
67 sphParticles_.rVelocity().deviceViewAll(),
68 sphParticles_.contactForce().deviceViewAll(),
69 sphParticles_.contactTorque().deviceViewAll()
84 template<
typename cFM,
typename gMM,
template <
class,
class,
class>
class cLT>
88 uint32 lastItem = pwContactList_().loopCount();
89 uint32 iter = this->currentIter();
90 real t = this->currentTime();
98 geometryMotion_.getTriangleAccessor(),
99 geometryMotion_.getModel(iter, t, dt) ,
100 sphParticles_.diameter().deviceViewAll() ,
101 sphParticles_.propertyId().deviceViewAll(),
102 sphParticles_.pointPosition().deviceViewAll(),
103 sphParticles_.velocity().deviceViewAll(),
104 sphParticles_.rVelocity().deviceViewAll() ,
105 sphParticles_.contactForce().deviceViewAll(),
106 sphParticles_.contactTorque().deviceViewAll() ,
107 geometryMotion_.triMotionIndex().deviceViewAll(),
108 geometryMotion_.propertyId().deviceViewAll(),
109 geometryMotion_.contactForceWall().deviceViewAll()
112 Kokkos::parallel_for(
125 template<
typename cFM,
typename gMM,
template <
class,
class,
class>
class cLT>
136 boundaryInteraction_(sphParticles_,geometryMotion_),
137 ppInteractionTimer_(
"sphere-sphere interaction (internal)", &this->timers()),
138 pwInteractionTimer_(
"sphere-wall interaction (internal)", &this->timers()),
139 boundaryInteractionTimer_(
"sphere-sphere interaction (boundary)",&this->timers()),
140 contactListMangementTimer_(
"list management (interal)", &this->timers()),
141 contactListMangementBoundaryTimer_(
"list management (boundary)", &this->timers())
144 if(!createSphereInteraction())
151 activeBoundaries_[i] = boundaryInteraction_[i].ppPairsAllocated();
155 template<
typename cFM,
typename gMM,
template <
class,
class,
class>
class cLT>
161 template<
typename cFM,
typename gMM,
template <
class,
class,
class>
class cLT>
166 auto iter = ti.
iter();
170 auto& contactSearchRef = contactSearch_();
172 bool broadSearch = contactSearchRef.enterBroadSearch(ti);
173 bool broadSearchBoundary = contactSearchRef.enterBroadSearchBoundary(ti);
176 sphParticles_.diameter().updateBoundaries(DataDirection::SlaveToMaster);
177 sphParticles_.velocity().updateBoundaries(DataDirection::SlaveToMaster);
178 sphParticles_.rVelocity().updateBoundaries(DataDirection::SlaveToMaster);
179 sphParticles_.propertyId().updateBoundaries(DataDirection::SlaveToMaster);
184 contactListMangementTimer_.start();
186 ppContactList_().beforeBroadSearch();
187 pwContactList_().beforeBroadSearch();
189 contactListMangementTimer_.pause();
192 if(broadSearchBoundary)
194 contactListMangementBoundaryTimer_.start();
196 for(
uint32 i=0; i<6u; i++)
198 if(activeBoundaries_[i])
200 auto& BI = boundaryInteraction_[i];
201 BI.ppPairs().beforeBroadSearch();
202 BI.pwPairs().beforeBroadSearch();
206 contactListMangementBoundaryTimer_.pause();
209 if( sphParticles_.numActive()<=0)
return true;
212 if( !contactSearchRef.broadSearch(
218 "unable to perform broadSearch.\n";
222 for(
uint32 i=0; i<6u; i++)
224 if(activeBoundaries_[i])
226 auto& BI = boundaryInteraction_[i];
227 if(!contactSearchRef.boundaryBroadSearch(
235 "failed to perform broadSearch for boundary index "<<i<<
endl;
242 if(broadSearch && contactSearchRef.performedSearch())
244 contactListMangementTimer_.resume();
246 ppContactList_().afterBroadSearch();
247 pwContactList_().afterBroadSearch();
249 contactListMangementTimer_.end();
252 if(broadSearchBoundary && contactSearchRef.performedSearchBoundary())
254 contactListMangementBoundaryTimer_.resume();
256 for(
uint32 i=0; i<6u; i++)
258 if(activeBoundaries_[i])
260 auto& BI = boundaryInteraction_[i];
261 BI.ppPairs().afterBroadSearch();
262 BI.pwPairs().afterBroadSearch();
266 contactListMangementBoundaryTimer_.end();
271 const auto& cfModel = this->forceModel_();
273 boundaryInteractionTimer_.start();
275 while(requireStep.anyElement(
true) && step <= 10)
277 for(
uint32 i=0; i<6u; i++)
281 requireStep[i] = boundaryInteraction_[i].sphereSphereInteraction(
291 boundaryInteractionTimer_.pause();
294 ppInteractionTimer_.start();
298 ppInteractionTimer_.end();
301 pwInteractionTimer_.start();
303 sphereWallInteraction();
305 pwInteractionTimer_.end();
308 boundaryInteractionTimer_.resume();
313 const auto& cfModel = this->forceModel_();
314 while( requireStep.anyElement(
true) && step < 20 )
316 for(
uint32 i=0; i<6u; i++)
320 requireStep[i] = boundaryInteraction_[i].sphereSphereInteraction(
330 boundaryInteractionTimer_.end();
336 template<
typename cFM,
typename gMM,
template <
class,
class,
class>
class cLT>
342 template<
typename cFM,
typename gMM,
template <
class,
class,
class>
class cLT>