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     Philippe Seil (JKU Linz)
39 
40     Copyright 2012-     DCS Computing GmbH, Linz
41     Copyright 2009-2012 JKU Linz
42 ------------------------------------------------------------------------- */
43 
44 #ifdef FIX_CLASS
45 
46 #else
47 
48 #ifndef LMP_FIX_MESH_H
49 #define LMP_FIX_MESH_H
50 
51 #include "fix_base_liggghts.h"
52 #include "fix_move_mesh.h"
53 #include "abstract_mesh.h"
54 #include <list>
55 
56 namespace LAMMPS_NS
57 {
58     class FixMesh : public FixBaseLiggghts
59     {
60       public:
61 
62         FixMesh(LAMMPS *lmp, int narg, char **arg);
63         virtual ~FixMesh();
64 
65         virtual void post_create();
66         virtual void pre_delete(bool unfixflag);
67 
68         virtual void init();
69         virtual void setup(int vflag);
70 
71         virtual int setmask();
72         void setup_pre_force(int);
73 
74         void write_restart(FILE *fp);
75         void restart(char *buf);
76 
77         virtual void pre_exchange();
78         virtual void pre_force(int);
79         virtual void final_integrate();
80 
81         void box_extent(double &xlo,double &xhi,double &ylo,double &yhi,double &zlo,double &zhi);
82 
83         int min_type();
84         int max_type();
85 
86         void resetNodePosOrig(const FixMoveMesh * const caller);
87         void move(const double * const dx, const FixMoveMesh * const caller);
88         void rotate(const double dphi, const double * const axis, const double * const center, const FixMoveMesh * const caller);
89 
mesh()90         class AbstractMesh* mesh()
91         { return mesh_; }
92 
surfaceVel()93         virtual bool surfaceVel()
94         { return false; }
95 
trackPerElementTemp()96         inline bool trackPerElementTemp()
97         { return trackPerElementTemp_; }
98 
manipulated()99         bool manipulated()
100         { return manipulated_; }
101 
verbose()102         bool verbose()
103         { return verbose_; }
104 
register_move(FixMoveMesh * toInsert)105         void register_move(FixMoveMesh * toInsert)
106         { fixMoveMeshes_.push_back(toInsert); }
107 
unregister_move(const FixMoveMesh * const toDelete)108         void unregister_move(const FixMoveMesh * const toDelete)
109         {
110             std::list<FixMoveMesh *>::iterator it;
111             for (it = fixMoveMeshes_.begin(); it != fixMoveMeshes_.end(); it++)
112             {
113                 if (*it == toDelete)
114                 {
115                     fixMoveMeshes_.erase(it);
116                     return;
117                 }
118             }
119         }
120 
121       protected:
122 
123         // mesh manipulation upon creation
124         virtual void moveMesh(double const dx, double const dy, double const dz);
125 
126         virtual void rotateMesh(double const axisX, double const axisY, double const axisZ, double const phi);
127         virtual void scaleMesh(double const factor);
128 
129         void create_mesh(char *mesh_fname, bool is_fix);
130         void create_mesh_restart(char *mesh_fname);
131 
132         int iarg_;
133 
134         int atom_type_mesh_;
135 
136         double temperature_mesh_;
137         double mass_temperature_;
138 
139         bool trackPerElementTemp_;
140 
141       private:
142 
143         void handle_exclusion_list();
144 
145         void initialSetup();
146 
147         // mesh object
148         class AbstractMesh *mesh_;
149 
150         // flag if mesh is already setup
151         bool setupFlag_;
152 
153         // decides if parallel operations needed for
154         // mesh on this time-step
155         bool pOpFlag_;
156 
157         bool manipulated_;
158 
159         // flags and params to be passed to the mesh
160         bool verbose_,autoRemoveDuplicates_;
161 
162         // mesh precision
163         double precision_;
164 
165         // ignore features smaller than this size
166         double min_feature_length_;
167 
168         // mesh correction
169         FILE *element_exclusion_list_;
170         bool read_exclusion_list_;
171         int *exclusion_list_;
172         int size_exclusion_list_;
173 
174         class FixPropertyGlobal *fix_capacity_;
175 
176         std::list<FixMoveMesh *> fixMoveMeshes_;
177 
178         // this friend class needs access to the moveMesh function
179         friend class MeshModuleStress6DOF;
180         friend class MeshModuleStress6DOFexternal;
181     };
182 
183 } /* namespace LAMMPS_NS */
184 
185 #endif
186 #endif
187