/
fix_wall_gran.h
287 lines (214 loc) · 7.25 KB
/
fix_wall_gran.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
/* ----------------------------------------------------------------------
LIGGGHTS - LAMMPS Improved for General Granular and Granular Heat
Transfer Simulations
LIGGGHTS is part of the CFDEMproject
www.liggghts.com | www.cfdem.com
This file was modified with respect to the release in LAMMPS
Modifications are Copyright 2009-2012 JKU Linz
Copyright 2012- DCS Computing GmbH, Linz
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
http://lammps.sandia.gov, Sandia National Laboratories
Steve Plimpton, sjplimp@sandia.gov
Copyright (2003) Sandia Corporation. Under the terms of Contract
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
certain rights in this software. This software is distributed under
the GNU General Public License.
See the README file in the top-level directory.
------------------------------------------------------------------------- */
#ifdef FIX_CLASS
FixStyle(wall/gran,FixWallGran)
#else
#ifndef LMP_FIX_WALL_GRAN_H
#define LMP_FIX_WALL_GRAN_H
#include "fix_mesh_surface.h"
#include "contact_interface.h"
#include "granular_wall.h"
#include <string>
#include <vector>
#include "fix_contact_property_atom_wall.h"
#include "compute_pair_gran_local.h"
#include "primitive_wall.h"
#include "fix_property_atom.h"
namespace LCM = LIGGGHTS::ContactModels;
namespace LAMMPS_NS {
class FixWallGran : public Fix, public LIGGGHTS::IContactHistorySetup {
public:
FixWallGran(class LAMMPS *, int, char **);
~FixWallGran();
/* INHERITED FROM Fix */
virtual int setmask();
virtual void post_create();
virtual void pre_delete(bool unfixflag);
virtual void init();
virtual void setup(int vflag);
virtual void post_force(int vflag);
virtual void post_force_pgl();
virtual void post_force_respa(int, int, int);
virtual int min_type() const;
virtual int max_type() const;
virtual int64_t hashcode();
/* PUBLIC ACCESS FUNCTIONS */
void setSkinDistance(double newSkinDistance)
{ skinDistance_ = newSkinDistance; }
void setDnum(int newDnum)
{ dnum_ = newDnum; }
inline int store_force() const
{ return store_force_; }
inline int iarg() const
{ return iarg_; }
int add_history_value(const std::string & name, const std::string & newtonflag) {
history_arg.push_back(name);
return dnum_++;
}
int get_history_value_offset(const std::string & name) {
for(std::vector<std::string>::size_type it = 0; it != history_arg.size(); ++it) {
if (history_arg[it] == name) {
return it;
}
}
return -1;
}
inline int dnum() const
{ return dnum_; }
inline int n_meshes() const
{ return n_FixMesh_; }
inline class FixMeshSurface ** mesh_list() const
{ return FixMesh_list_; }
inline int atom_type_wall() const
{ return atom_type_wall_; }
inline bool is_mesh_wall() const
{ return 1 == meshwall_; }
inline bool store_force_contact() const
{ return store_force_contact_; }
class PrimitiveWall* primitiveWall();
int n_contacts_all();
int n_contacts_all(int);
int n_contacts_local();
int n_contacts_local(int);
int n_ghosts_all();
int n_ghosts_local();
int is_moving();
void register_compute_wall_local(ComputePairGranLocal *,int&);
void unregister_compute_wall_local(ComputePairGranLocal *ptr);
ComputePairGranLocal * compute_pair_gran_local() const {
return cwl_;
}
int addflag() const {
return addflag_;
}
int body(int i) const {
return body_[i];
}
double masstotal(int i) const {
return masstotal_[i];
}
class FixRigid *fix_rigid() const {
return fix_rigid_;
}
void add_contactforce_wall(int ip, const LCM::ForceData & i_forces)
{
// add to fix wallforce contact
// always add 0 as ID
double forces_torques_i[6];
if(!fix_wallforce_contact_->has_partner(ip,0))
{
vectorCopy3D(i_forces.delta_F,&(forces_torques_i[0]));
vectorCopy3D(i_forces.delta_torque,&(forces_torques_i[3]));
fix_wallforce_contact_->add_partner(ip,0,forces_torques_i);
}
}
void cwl_add_wall_2(const LCM::CollisionData & cdata, const LCM::ForceData & i_forces)
{
const double fx = i_forces.delta_F[0];
const double fy = i_forces.delta_F[1];
const double fz = i_forces.delta_F[2];
const double tor1 = i_forces.delta_torque[0]*cdata.area_ratio;
const double tor2 = i_forces.delta_torque[1]*cdata.area_ratio;
const double tor3 = i_forces.delta_torque[2]*cdata.area_ratio;
double normal[3];
vectorNegate3D(cdata.en,normal);
cwl_->add_wall_2(cdata.i,fx,fy,fz,tor1,tor2,tor3,cdata.contact_history,cdata.rsq,normal);
}
protected:
int iarg_, narg_;
int atom_type_wall_;
std::vector<std::string> history_arg;
//NP flag if forces are actually computed
int computeflag_;
//NP cwl reference and flag if add to cwl
int addflag_;
ComputePairGranLocal *cwl_;
double dt_;
int shearupdate_;
// class variables for atom properties
int nlocal_;
double **x_, **f_, *radius_, *rmass_, **wallforce_, r0_;
#ifdef SUPERQUADRIC_ACTIVE_FLAG
double **quat_, **shape_, **blockiness_;
#endif
void set_r0(double _r0)
{ r0_ = _r0; }
virtual void init_granular() {}
// heat transfer
void init_heattransfer();
bool heattransfer_flag_;
// model for contact area calculation
int area_calculation_mode_;
// mesh and primitive force implementations
virtual void post_force_mesh(int);
virtual void post_force_primitive(int);
// virtual functions that allow implementation of the
// actual physics in the derived classes
virtual void compute_force(LCM::CollisionData & cdata, double *vwall);
void addHeatFlux(class TriMesh *mesh,int i,double rsq,double area_ratio);
// sets flag that neigh list shall be built
virtual void pre_neighbor();
// builds neigh list if necessary
virtual void pre_force(int vflag);
// references to mesh walls
int n_FixMesh_;
class FixMeshSurface **FixMesh_list_;
class FixRigid *fix_rigid_;
int *body_;
double *masstotal_;
// heat transfer
class FixPropertyAtom *fppa_T;
class FixPropertyAtom *fppa_hf;
double Temp_wall;
double fixed_contact_area_;
double Q,Q_add;
const double *th_cond;
double const* const* deltan_ratio;
LIGGGHTS::Walls::IGranularWall * impl;
// per-contact force storage
bool store_force_contact_;
class FixContactPropertyAtomWall *fix_wallforce_contact_;
int nlevels_respa_;
int shear_, shearDim_, shearAxis_;
double vshear_;
double shearAxisVec_[3];
// distance in order to calculate interaction with
// rough wall
double skinDistance_;
// number of values for contact history
int dnum_;
// flag if mesh wall
int meshwall_;
// flag for stressanalysis
// true if any of the meshes tracks stresses
bool stress_flag_;
std::vector<PrimitiveWall*> primitiveWalls_;
std::vector<FixPropertyAtom*> primitiveWallsHistory_;
// class to keep track of wall contacts
bool rebuildPrimitiveNeighlist_;
// force storage
bool store_force_;
class FixPropertyAtom *fix_wallforce_;
// max neigh cutoff - as in Neighbor
double cutneighmax_;
virtual void post_force_wall(int vflag);
inline void post_force_eval_contact(LCM::CollisionData & cdata, bool intersectflag, double * v_wall, int iMesh = -1, FixMeshSurface *fix_mesh = 0, TriMesh *mesh = 0, int iTri = 0);
};
}
#endif
#endif