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 (JKU Linz, DCS Computing GmbH, Linz)
37     Philippe Seil   (JKU Linz)
38     Arno Mayrhofer  (CFDEMresearch GmbH, DCS Computing GmbH, Linz)
39 
40     Copyright 2012-     DCS Computing GmbH, Linz
41     Copyright 2009-2012 JKU Linz
42     Copyright 2016-     CFDEMresearch GmbH, Linz
43 ------------------------------------------------------------------------- */
44 
45 #ifdef FIX_CLASS
46 
47 FixStyle(mesh/surface,FixMeshSurface)
48 FixStyle(mesh/surface/planar,FixMeshSurface)
49 
50 #else
51 
52 #ifndef LMP_FIX_SURFACE_MESH_H
53 #define LMP_FIX_SURFACE_MESH_H
54 
55 #include "fix_mesh.h"
56 #include "tri_mesh.h"
57 #include "fix_contact_history_mesh.h"
58 #include "fix_contact_property_atom.h"
59 #include "fix_neighlist_mesh.h"
60 #include "custom_value_tracker.h"
61 #include "mesh_module.h"
62 #include <map>
63 #include <vector>
64 #include <string>
65 #include <algorithm>
66 #include <cstddef>
67 
68 namespace LAMMPS_NS
69 {
70   class FixMeshSurface : public FixMesh
71   {
72       public:
73 
74         FixMeshSurface(LAMMPS *lmp, int narg, char **arg);
75         virtual ~FixMeshSurface();
76 
77         virtual void post_create_pre_restart();
78         virtual void post_create();
79         virtual void pre_delete(bool unfixflag);
80 
81         virtual void init();
82         virtual void setup(int vflag);
83 
84         virtual int setmask();
85         virtual void setup_pre_force(int);
86 
87         virtual void pre_force(int);
88         virtual void initial_integrate(int);
89         virtual void final_integrate();
90         virtual void end_of_step();
91 
92         virtual int modify_param(int narg, char **arg);
93 
94         virtual double compute_vector (int);
95 
96         virtual void createWallNeighList(int igrp);
97         virtual class FixNeighlistMesh* createOtherNeighList(int igrp,const char *nId);
98         void createContactHistory(int dnum);
99         void createMeshforceContact();
100 
101         void createMeshforceContactStress();
102         void createMulticontactData();
103 
104         void deleteWallNeighList();
105         void deleteOtherNeighList(const char *nId);
106         void deleteAllOtherNeighList();
107         void deleteContactHistory();
108         void deleteMeshforceContact();
109 
110         void deleteMeshforceContactStress();
111         void deleteMeshMulticontactData();
112 
113         MeshModule* get_module(std::string name);
114         void add_particle_contribution(int ip, double *frc, double *delta, int iTri, double *v_wall);
115 
116         bool trackStress();
117 
118         inline int atomTypeWall()
119         { return atom_type_mesh_;}
120 
121         inline class FixContactHistoryMesh* contactHistory()
122         { return fix_contact_history_mesh_;}
123 
124         inline class FixNeighlistMesh* meshNeighlist()
125         { return fix_mesh_neighlist_;}
126 
127         inline bool hasNeighList()
128         { return fix_mesh_neighlist_?true:false; }
129 
130         inline bool hasOtherNeighList()
131         { return list_other_neighlist_.size() > 0; }
132 
133         inline class FixContactPropertyAtomWall* meshforceContact()
134         { return fix_meshforce_contact_;}
135 
136         inline class FixContactPropertyAtomWall* meshforceContactStress()
137         { return fix_meshforce_contact_stress_;}
138 
139         inline class FixContactPropertyAtomWall* meshMulticontactData()
140         { return fix_mesh_multicontact_data_;}
141 
142         inline class TriMesh *triMesh()
143         { return static_cast<TriMesh*>(mesh()); }
144 
145         bool surfaceVel()
146         { return (velFlag_ || angVelFlag_); }
147 
148         void dumpAdd()
149         { n_dump_active_++; }
150 
151         void dumpRemove()
152         { n_dump_active_--; }
153 
154         inline int get_groupbit() const
155         { return groupbit; }
156 
157         inline int get_nevery() const
158         { return nevery; }
159 
160         inline bigint* get_next_reneighbor_ptr()
161         { return &next_reneighbor; }
162 
163         void set_global_freq(const unsigned int global_freq_)
164         { global_freq = global_freq_; }
165 
166         void set_extvector(const unsigned int extvector_)
167         { extvector = extvector_; }
168 
169         void set_time_depend(const unsigned int time_depend_)
170         { time_depend = time_depend_; }
171 
172         void set_nevery(const unsigned int nevery_)
173         { nevery = nevery_; }
174 
175       protected:
176 
177         int getCreateMeshTriCount()
178         { return extrusion_tri_count_; }
179 
180         double * getCreateMeshTriNode(const int i)
181         { return &(extrusion_tri_nodes_[i*3]); }
182 
183         class FixContactHistoryMesh *fix_contact_history_mesh_;
184         class FixNeighlistMesh *fix_mesh_neighlist_;
185         class FixContactPropertyAtomWall *fix_meshforce_contact_;
186         class FixContactPropertyAtomWall *fix_meshforce_contact_stress_;
187         class FixContactPropertyAtomWall *fix_mesh_multicontact_data_;
188 
189         // list of neighbor lists created by createOtherNeighList
190         std::map<std::string, FixNeighlistMesh*> list_other_neighlist_;
191 
192       private:
193 
194         void initVel();
195         void setVel();
196         void initAngVel();
197         void setAngVel();
198 
199         // surface velocity
200         bool velFlag_;
201         double vSurf_[3];
202         char *vSurfStrX_, *vSurfStrY_, *vSurfStrZ_;
203         int vSurfVarX_, vSurfVarY_, vSurfVarZ_;
204         int vSurfStyleX_, vSurfStyleY_, vSurfStyleZ_;
205 
206         // rotational surf vel
207         bool angVelFlag_;
208         double origin_[3];
209         double axis_[3];
210         double omegaSurf_;
211         char *omegaStr_;
212         int omegaVar_, omegaStyle_;
213 
214         // flag if dump mesh/* or dump stl is active
215         int n_dump_active_;
216 
217         // mesh curvature
218         double curvature_;
219         bool curvature_tolerant_;
220 
221         // extrude mesh
222         bool extrude_mesh_;
223         double extrusion_length_;
224         int extrusion_tri_count_;
225         double *extrusion_tri_nodes_;
226         bool extrusion_created_;
227 
228         // active mesh modules
229         typedef MeshModule *(*MeshModuleCreator)(LAMMPS *lmp, int &iarg_, int narg, char **arg, FixMeshSurface *fix_mesh);
230         std::map<std::string, MeshModule*> active_mesh_modules;
231         std::vector<std::string> mesh_module_order;
232 
233         template <typename T> static MeshModule *meshmodule_creator(LAMMPS *lmp, int &iarg_, int narg, char **arg, FixMeshSurface *fix_mesh);
234   };
235 
236 } /* namespace LAMMPS_NS */
237 
238 #endif /* LMP_FIX_MESH_H */
239 #endif /* FIX_CLASS */
240