1 /* ----------------------------------------------------------------------
2     This is the
3 
4     ██╗     ██╗ ██████╗  ██████╗  ██████╗ ██╗  ██╗████████╗███████╗
5     ██║     ██║██╔════╝ ██╔════╝ ██╔════╝ ██║  ██║╚══██╔══╝██╔════╝
6     ██║     ██║██║  ███╗██║  ███╗██║  ███╗███████║   ██║   ███████╗
7     ██║     ██║██║   ██║██║   ██║██║   ██║██╔══██║   ██║   ╚════██║
8     ███████╗██║╚██████╔╝╚██████╔╝╚██████╔╝██║  ██║   ██║   ███████║
9     ╚══════╝╚═╝ ╚═════╝  ╚═════╝  ╚═════╝ ╚═╝  ╚═╝   ╚═╝   ╚══════╝®
10 
11     DEM simulation engine, released by
12     DCS Computing Gmbh, Linz, Austria
13     http://www.dcs-computing.com, office@dcs-computing.com
14 
15     LIGGGHTS® is part of CFDEM®project:
16     http://www.liggghts.com | http://www.cfdem.com
17 
18     Core developer and main author:
19     Christoph Kloss, christoph.kloss@dcs-computing.com
20 
21     LIGGGHTS® is open-source, distributed under the terms of the GNU Public
22     License, version 2 or later. It is distributed in the hope that it will
23     be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
24     of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. You should have
25     received a copy of the GNU General Public License along with LIGGGHTS®.
26     If not, see http://www.gnu.org/licenses . See also top-level README
27     and LICENSE files.
28 
29     LIGGGHTS® and CFDEM® are registered trade marks of DCS Computing GmbH,
30     the producer of the LIGGGHTS® software and the CFDEM®coupling software
31     See http://www.cfdem.com/terms-trademark-policy for details.
32 
33 -------------------------------------------------------------------------
34     Contributing author and copyright for this file:
35 
36     Christoph Kloss (DCS Computing GmbH, Linz)
37     Christoph Kloss (JKU Linz)
38     Richard Berger (JKU Linz)
39     Alexander Podlozhnyuk (DCS Computing GmbH, Linz)
40 
41     Copyright 2012-     DCS Computing GmbH, Linz
42     Copyright 2009-2012 JKU Linz
43 ------------------------------------------------------------------------- */
44 
45 #ifndef CONTACT_INTERFACE_H_
46 #define CONTACT_INTERFACE_H_
47 
48 #include <string>
49 
50 // forward declaration
51 namespace LAMMPS_NS
52 {
53 class TriMesh;
54 class FixMeshSurface;
55 }
56 
57 namespace LIGGGHTS {
58 namespace ContactModels {
59 
60 // data available in noCollision() and collision()
61 
62 struct SurfacesCloseData {
63   double radi;
64   double radj;
65   double radsum;
66   double rsq;
67   double delta[3];
68 
69   double area_ratio;
70 
71   int *contact_flags;
72   double *contact_history;
73   LAMMPS_NS::TriMesh *mesh;
74   LAMMPS_NS::FixMeshSurface *fix_mesh;
75 
76   int i;
77   int j;
78   int itype;
79   int jtype;
80 
81   bool is_wall;
82   bool has_force_update;
83 
84   double * v_i;
85   double * v_j;
86 
87   double * omega_i;
88   double * omega_j;
89 
90   bool is_non_spherical;
91 
92 #ifdef NONSPHERICAL_ACTIVE_FLAG
93   double contact_point[3];
94 #endif
95 
96 #ifdef SUPERQUADRIC_ACTIVE_FLAG
97   double reff;
98 #endif
99 
100   int computeflag;
101   int shearupdate;
102 
SurfacesCloseDataSurfacesCloseData103   SurfacesCloseData() :
104     radi(0.0),
105     radj(0.0),
106     radsum(0.0),
107     rsq(0.0),
108     area_ratio(1.0),
109     contact_flags(NULL),
110     contact_history(NULL),
111     mesh(NULL),
112     fix_mesh(NULL),
113     i(0),
114     j(0),
115     itype(0),
116     jtype(0),
117     is_wall(false),
118     has_force_update(false),
119     v_i(NULL),
120     v_j(NULL),
121     omega_i(NULL),
122     omega_j(NULL),
123     is_non_spherical(false),
124 #ifdef SUPERQUADRIC_ACTIVE_FLAG
125     reff(0.0),
126 #endif
127     computeflag(0),
128     shearupdate(0)
129   {}
130 };
131 
132 // data available in collision() only
133 
134 struct SurfacesIntersectData : SurfacesCloseData {
135 
136   double r;
137   double rinv;
138   double en[3];
139 
140   double kt;
141   double kn;
142   double gammat;
143   double gamman;
144 
145   double Fn;
146   double Ft;
147 
148   double vn;
149   double deltan;
150   double cri;
151   double crj;
152   double wr1;
153   double wr2;
154   double wr3;
155 
156   double vtr1;
157   double vtr2;
158   double vtr3;
159 
160   double mi;
161   double mj;
162   double meff;
163 
164   mutable double P_diss;
165 
SurfacesIntersectDataSurfacesIntersectData166   SurfacesIntersectData() : Fn(0.0), Ft(0.0) {}
167 };
168 
169 struct ForceData {
170   double delta_F[3];       // total force acting on particle
171   double delta_torque[3];  // torque acting on a particle
172 
ForceDataForceData173   ForceData()
174   {
175     reset();
176   }
177 
resetForceData178   inline void reset() {
179     delta_F[0] = 0.0;
180     delta_F[1] = 0.0;
181     delta_F[2] = 0.0;
182     delta_torque[0] = 0.0;
183     delta_torque[1] = 0.0;
184     delta_torque[2] = 0.0;
185   }
186 };
187 }
188 
189 class IContactHistorySetup {
190 public:
191   virtual int add_history_value(std::string name, std::string newtonflag) = 0;
192 };
193 
194 }
195 
196 #endif /* CONTACT_INTERFACE_H_ */
197