1
#ifndef GHOST_MANAGER_H
2
#define GHOST_MANAGER_H
5
#include "MatrixLibrary.h"
6
#include "PerAtomQuantityLibrary.h"
7
#include "TimeIntegrator.h"
8
#include "ATC_TypeDefs.h"
12
// forward declarations
15
class LammpsInterface;
19
* @brief Manages methods for modifying ghost atoms
26
/** types of ghost boundary conditions in momentum */
27
enum BoundaryDynamicsType {
28
NO_BOUNDARY_DYNAMICS=0,
38
GhostManager(ATC_Method * atc);
41
virtual ~GhostManager();
43
/** parser/modifier */
44
virtual bool modify(int narg, char **arg);
46
/** create objects to implement requested numerical method */
47
virtual void construct_methods();
49
/** create and get necessary transfer operators */
50
virtual void construct_transfers();
52
/** pre time integration initialization of data */
53
virtual void initialize();
55
/** prior to lammps exchange */
56
virtual void pre_exchange();
58
/** Predictor phase, Verlet first step for velocity */
59
virtual void init_integrate_velocity(double dt);
61
/** Predictor phase, Verlet first step for position */
62
virtual void init_integrate_position(double dt);
64
/** set positions after integration */
65
virtual void post_init_integrate();
67
/** Corrector phase, Verlet second step for velocity */
68
virtual void final_integrate(double dt);
70
/** sets the boundary dynamics flag as desired */
71
void set_boundary_dynamics(BoundaryDynamicsType boundaryDynamics) {boundaryDynamics_ = boundaryDynamics;}
74
bool need_reset() const {return needReset_;};
76
/** access to ATC method object */
77
ATC_Method * atc() {return atc_;};
81
/** pointer to routines that modify ghosts */
82
GhostModifier* ghostModifier_;
84
/** pointer to access ATC methods */
87
/** boundary dynamics method type */
88
BoundaryDynamicsType boundaryDynamics_;
93
/** spring constant for some models */
96
/** damping constant for some models */
99
/** ratio between mass of ghost types and desired mass for some models */
104
// DO NOT define this
110
* @class GhostModifier
111
* @brief Base class for objects which modify the ghost atoms, integrates ghost atoms using velocity-verlet if requested
114
class GhostModifier {
119
GhostModifier(GhostManager * ghostManager);
122
virtual ~GhostModifier();
124
/** create and get necessary transfer operators */
125
virtual void construct_transfers();
127
/** pre time integration initialization of data */
128
virtual void initialize(){};
130
/** Predictor phase, Verlet first step for velocity */
131
virtual void init_integrate_velocity(double dt);
133
/** Predictor phase, Verlet first step for position */
134
virtual void init_integrate_position(double dt);
136
/** set positions after integration */
137
virtual void post_init_integrate(){};
139
/** prior to lammps exchange */
140
virtual void pre_exchange(){};
142
/** Corrector phase, Verlet second step for velocity */
143
virtual void final_integrate(double dt);
145
/** sets the verlet integration flag as desired */
146
void set_integrate_atoms(bool integrateAtoms) {integrateAtoms_ = integrateAtoms;}
150
/** owning ghost manager */
151
GhostManager * ghostManager_;
153
/** object which integrates atoms */
154
AtomTimeIntegrator * atomTimeIntegrator_;
156
/** flag to perform velocity-verlet integration of ghosts */
157
bool integrateAtoms_;
162
// DO NOT define this
168
* @class GhostModifierPrescribed
169
* @brief sets ghost atom positions based on FE displacement
172
class GhostModifierPrescribed : public GhostModifier {
177
GhostModifierPrescribed(GhostManager * ghostManager);
180
virtual ~GhostModifierPrescribed(){};
182
/** create and get necessary transfer operators */
183
virtual void construct_transfers();
185
/** set positions after integration */
186
virtual void post_init_integrate();
190
/** positions of atoms */
191
PerAtomQuantity<double> * atomPositions_;
193
/** FE displacement at ghost locations */
194
PerAtomQuantity<double> * atomFeDisplacement_;
196
/** atom reference positions */
197
PerAtomQuantity<double> * atomRefPositions_;
201
// DO NOT define this
202
GhostModifierPrescribed();
207
* @class GhostModifierDampedHarmonic
208
* @brief Integrates ghost atoms using velocity-verlet with a damped harmonic force
211
class GhostModifierDampedHarmonic : public GhostModifierPrescribed {
216
GhostModifierDampedHarmonic(GhostManager * ghostManager,
217
double kappa_, double gamma, double mu);
220
virtual ~GhostModifierDampedHarmonic(){};
222
/** create and get necessary transfer operators */
223
virtual void construct_transfers();
225
/** Predictor phase, Verlet first step for velocity */
226
virtual void init_integrate_velocity(double dt);
228
/** Predictor phase, Verlet first step for position */
229
virtual void init_integrate_position(double dt);
231
/** set positions after integration */
232
virtual void post_init_integrate(){};
234
/** Corrector phase, Verlet second step for velocity */
235
virtual void final_integrate(double dt);
239
/** velocities of atoms */
240
PerAtomQuantity<double> * atomVelocities_;
242
/** FE velocity at ghost locations */
243
PerAtomQuantity<double> * atomFeVelocity_;
246
PerAtomQuantity<double> * atomForces_;
248
/** spring constant */
251
/** damping constant */
254
/** ratio between mass of ghost types and desired mass */
262
// DO NOT define this
263
GhostModifierDampedHarmonic();
268
* @class GhostIntegratorSwap
269
* @brief Integrates ghost atoms using velocity-verlet, and swaps atoms between ghost
270
* and internal depending on what element they are in
273
class GhostIntegratorSwap : public GhostModifier {
278
GhostIntegratorSwap(GhostManager * ghostManager);
281
virtual ~GhostIntegratorSwap(){};
283
/** create and get necessary transfer operators */
284
virtual void construct_transfers();
286
/** pre time integration initialization of data */
287
virtual void initialize();
289
/** prior to lammps exchange */
290
virtual void pre_exchange();
294
/** pointer to lammps interface */
295
LammpsInterface * lammpsInterface_;
297
/** internal element set */
298
const std::set<int> & elementSet_;
300
/** internal to element map */
301
PerAtomQuantity<int> * atomElement_;
303
/** ghost to element map */
304
PerAtomQuantity<int> * atomGhostElement_;
306
/** internal to atom map */
307
const Array<int> & internalToAtom_;
309
/** ghost to atom map */
310
const Array<int> & ghostToAtom_;
312
/** group bit for internal */
315
/** group bit for ghost */
320
// DO NOT define this
321
GhostIntegratorSwap();