sphereInteraction.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 
21 template<
22  typename contactForceModel,
23  typename geometryMotionModel,
24  template <class, class, class> class contactListType >
27 {
28 
29  realVector_D rhoD(this->densities());
30 
31  auto modelDict = this->fileDict().subDict("model");
32 
33  REPORT(1)<<"Createing contact force model . . ."<<endREPORT;
34  forceModel_ = makeUnique<ContactForceModel>(
35  this->numMaterials(),
36  rhoD.deviceVector(),
37  modelDict );
38 
39 
40  uint32 nPrtcl = sphParticles_.size();
41 
42  ppContactList_ = makeUnique<ContactListType>(nPrtcl+1);
43 
44  pwContactList_ = makeUnique<ContactListType>(nPrtcl/4+1);
45 
46  return true;
47 }
48 
49 
50 
51 template<
52  typename contactForceModel,
53  typename geometryMotionModel,
54  template <class, class, class> class contactListType >
57 {
58 
59 
60 
61  auto lastItem = ppContactList_().loopCount();
62 
63  // create the kernel functor
65  ppInteraction(
66  this->dt(),
67  this->forceModel_(),
68  ppContactList_(), // to be read
69  sphParticles_.diameter().deviceVectorAll(),
70  sphParticles_.propertyId().deviceVectorAll(),
71  sphParticles_.pointPosition().deviceVectorAll(),
72  sphParticles_.velocity().deviceVectorAll(),
73  sphParticles_.rVelocity().deviceVectorAll(),
74  sphParticles_.contactForce().deviceVectorAll(),
75  sphParticles_.contactTorque().deviceVectorAll()
76  );
77 
78  Kokkos::parallel_for(
79  "",
80  rpPPInteraction(0,lastItem),
81  ppInteraction
82  );
83 
84  Kokkos::fence();
85 
86  return true;
87 }
88 
89 
90 template<
91  typename contactForceModel,
92  typename geometryMotionModel,
93  template <class, class, class> class contactListType >
96 {
97 
98  int32 lastItem = pwContactList_().loopCount();
99  real t = this->currentTime();
100 
102  pwInteraction(
103  this->dt(),
104  this->forceModel_(),
105  pwContactList_(),
106  geometryMotion_.getTriangleAccessor(),
107  geometryMotion_.getModel(t) ,
108  sphParticles_.diameter().deviceVectorAll() ,
109  sphParticles_.propertyId().deviceVectorAll(),
110  sphParticles_.pointPosition().deviceVectorAll(),
111  sphParticles_.velocity().deviceVectorAll(),
112  sphParticles_.rVelocity().deviceVectorAll() ,
113  sphParticles_.contactForce().deviceVectorAll(),
114  sphParticles_.contactTorque().deviceVectorAll() ,
115  geometryMotion_.triMotionIndex().deviceVectorAll(),
116  geometryMotion_.propertyId().deviceVectorAll(),
117  geometryMotion_.contactForceWall().deviceVectorAll()
118  );
119 
120  Kokkos::parallel_for(
121  "",
122  rpPWInteraction(0,lastItem),
123  pwInteraction
124  );
125 
126 
127  Kokkos::fence();
128 
129  return true;
130 }
pFlow::sphereInteraction::sphereWallInteraction
bool sphereWallInteraction()
Definition: sphereInteraction.cpp:95
pFlow::sphereInteractionKernels::ppInteractionFunctor
Definition: sphereInteractionKernels.hpp:33
endREPORT
#define endREPORT
Definition: streams.hpp:41
pFlow::real
float real
Definition: builtinTypes.hpp:46
REPORT
#define REPORT(n)
Definition: streams.hpp:40
pFlow::sphereInteraction::createSphereInteraction
bool createSphereInteraction()
Definition: sphereInteraction.cpp:26
pFlow::uint32
unsigned int uint32
Definition: builtinTypes.hpp:59
pFlow::sphereInteraction::rpPWInteraction
rpPPInteraction rpPWInteraction
range policy for p-w interaction execution
Definition: sphereInteraction.hpp:96
pFlow::sphereInteractionKernels::pwInteractionFunctor
Definition: sphereInteractionKernels.hpp:170
pFlow::int32
int int32
Definition: builtinTypes.hpp:53
pFlow::VectorSingle
Definition: VectorSingle.hpp:45
pFlow::VectorSingle::deviceVector
INLINE_FUNCTION_H viewType & deviceVector()
Definition: VectorSingle.hpp:307
pFlow::sphereInteraction::rpPPInteraction
Kokkos::RangePolicy< Kokkos::IndexType< int32 >, Kokkos::Schedule< Kokkos::Dynamic > > rpPPInteraction
range policy for p-p interaction execution
Definition: sphereInteraction.hpp:93
pFlow::sphereInteraction::sphereSphereInteraction
bool sphereSphereInteraction()
Definition: sphereInteraction.cpp:56