MercuryDPM  Trunk
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
LeesEdwardsBoundary Class Reference

Class which creates a boundary with Lees-Edwards type periodic boundary conditions. More...

#include <LeesEdwardsBoundary.h>

+ Inheritance diagram for LeesEdwardsBoundary:

Public Member Functions

 LeesEdwardsBoundary ()
 
 LeesEdwardsBoundary (const LeesEdwardsBoundary &other)
 Copy constructor. More...
 
void set (std::function< Mdouble(Mdouble)> shift, std::function< Mdouble(Mdouble)> velocity, Mdouble left, Mdouble right, Mdouble down, Mdouble up)
 Sets all boundary properties. More...
 
void updateBoundaries (Mdouble left, Mdouble right, Mdouble down, Mdouble up)
 
void read (std::istream &is) override
 Reads all boundary properties from a stream. More...
 
void write (std::ostream &os) const override
 Writes all boundary properties to a stream. More...
 
std::string getName () const override
 Returns the name of the object. More...
 
LeesEdwardsBoundarycopy () const override
 Creates a copy of the object. More...
 
Mdouble getHorizontalDistance (BaseParticle &p, bool &positive)
 Returns distance from given particle to the closest horizontal wall. More...
 
Mdouble getVerticalDistance (BaseParticle &p, bool &positive)
 Returns distance from given particle to the closest vertical wall. More...
 
void shiftHorizontalPosition (BaseParticle *p, bool positive)
 Applies a horizontal shift to the given particle. More...
 
void shiftVerticalPosition (BaseParticle *p, bool positive)
 Applies a vertical shift to the given particle. More...
 
void checkBoundaryAfterParticleMoved (BaseParticle *p)
 Checks if particle crossed a boundary wall and if so, applies periodic shift. More...
 
void checkBoundaryAfterParticlesMove (ParticleHandler &pH) override
 Checks if particles need to be adjusted after their position has been updated. More...
 
void createPeriodicParticle (BaseParticle *p, ParticleHandler &pH) override
 
void createPeriodicParticles (ParticleHandler &pH) override
 Creates horizontal and vertical periodic copies of given particle, if needed. More...
 
void createHorizontalPeriodicParticles (BaseParticle *p, ParticleHandler &pH)
 Creates horizontal periodic copies of given particle, if needed. More...
 
void createVerticalPeriodicParticles (BaseParticle *p, ParticleHandler &pH)
 Creates vertical periodic copies of given particle, if needed. More...
 
Mdouble getCurrentShift ()
 
Mdouble getCurrentVelocity ()
 
void setShift (std::function< Mdouble(Mdouble)>)
 
void setVelocity (std::function< Mdouble(Mdouble)>)
 
- Public Member Functions inherited from BaseBoundary
 BaseBoundary ()
 default constructor. More...
 
 BaseBoundary (const BaseBoundary &b)
 copy constructor More...
 
 ~BaseBoundary () override
 destructor More...
 
virtual void createPeriodicParticle (BaseParticle *p UNUSED, ParticleHandler &pH UNUSED)
 Creates a periodic particle in case of periodic boundaries in serial build. More...
 
virtual void createPeriodicParticles (ParticleHandler &pH UNUSED)
 Creates periodic copies of given particle in case of periodic boundaries. More...
 
virtual void checkBoundaryBeforeTimeStep (DPMBase *md)
 Virtual function that does things before each time step. More...
 
virtual void actionsBeforeTimeLoop ()
 Virtual function that does something after DPMBase::setupInitialConditions but before the first time step. More...
 
virtual void modifyGhostAfterCreation (BaseParticle *particle, int i)
 
virtual void writeVTK (std::fstream &file)
 
void setHandler (BoundaryHandler *handler)
 Sets the boundary's BoundaryHandler. More...
 
BoundaryHandlergetHandler () const
 Returns the boundary's BoundaryHandler. More...
 
- Public Member Functions inherited from BaseObject
 BaseObject ()=default
 Default constructor. More...
 
 BaseObject (const BaseObject &p)=default
 Copy constructor, copies all the objects BaseObject contains. More...
 
virtual ~BaseObject ()=default
 virtual destructor More...
 
virtual void moveInHandler (unsigned int index)
 Except that it is virtual, it does the same thing as setIndex() does. More...
 
void setIndex (unsigned int index)
 Allows one to assign an index to an object in the handler/container. More...
 
void setId (unsigned long id)
 Assigns a unique identifier to each object in the handler (container) which remains constant even after the object is deleted from the container/handler. More...
 
unsigned int getIndex () const
 Returns the index of the object in the handler. More...
 
unsigned int getId () const
 Returns the unique identifier of any particular object. More...
 
void setGroupId (unsigned groupId)
 
unsigned getGroupId () const
 

Private Attributes

Mdouble left_
 
Mdouble right_
 (signed) Horizontal distance between the left wall and the origin More...
 
Mdouble down_
 (signed) Horizontal distance between the right wall and the origin More...
 
Mdouble up_
 (signed) Vertical distance between the bottom wall and the origin More...
 
std::function< Mdouble(Mdouble)> shift_
 (signed) Vertical distance between the top wall and the origin More...
 
std::function< Mdouble(Mdouble)> velocity_
 

Detailed Description

Class which creates a boundary with Lees-Edwards type periodic boundary conditions.

A LeesEdwardsBoundary is like a PeriodicBoundary, but when a particle crosses one edge and is copied to the other side then the particle is also shifted. This sort of boundary is useful for studying shear flows.

See also Lees and Edwards (J. Phys. C 1921, doi:1088/0022-3719/5/15/006). Inherits from BaseBoundary.

Todo:

Add link to paper by Lees-Edwards in the documentation of this class.

Is implemented for 2D only now. Needs extension to 3D.

Definition at line 46 of file LeesEdwardsBoundary.h.

Constructor & Destructor Documentation

LeesEdwardsBoundary::LeesEdwardsBoundary ( )
inline

Definition at line 50 of file LeesEdwardsBoundary.h.

References MPIContainer::getNumberOfProcessors(), MPIContainer::Instance(), logger, and WARN.

Referenced by copy().

51  {
52 #ifdef MERCURY_USE_MPI
53  MPIContainer& communicator = MPIContainer::Instance();
54  if (communicator.getNumberOfProcessors() > 1)
55  {
56  logger(WARN,"LeesEdwardsBoundaries are currently not implemented in parallel MercuryDPM");
57  }
58 #endif
59  }
This class contains all information and functions required for communication between processors...
Definition: MpiContainer.h:129
static MPIContainer & Instance()
fetch the instance to be used for communication
Definition: MpiContainer.h:134
Logger< MERCURY_LOGLEVEL > logger("MercuryKernel")
Definition of different loggers with certain modules. A user can define its own custom logger here...
std::size_t getNumberOfProcessors() const
Get the total number of processors participating in this simulation.
LeesEdwardsBoundary::LeesEdwardsBoundary ( const LeesEdwardsBoundary other)

Copy constructor.

Definition at line 31 of file LeesEdwardsBoundary.cc.

References down_, left_, right_, shift_, up_, and velocity_.

31  : BaseBoundary(other)
32 {
33  shift_ = other.shift_;
34  velocity_ = other.velocity_;
35  left_ = other.left_;
36  right_ = other.right_;
37  down_ = other.down_;
38  up_ = other.up_;
39 }
std::function< Mdouble(Mdouble)> shift_
(signed) Vertical distance between the top wall and the origin
std::function< Mdouble(Mdouble)> velocity_
Mdouble up_
(signed) Vertical distance between the bottom wall and the origin
Mdouble down_
(signed) Horizontal distance between the right wall and the origin
Mdouble right_
(signed) Horizontal distance between the left wall and the origin
BaseBoundary()
default constructor.
Definition: BaseBoundary.cc:32

Member Function Documentation

void LeesEdwardsBoundary::checkBoundaryAfterParticleMoved ( BaseParticle p)

Checks if particle crossed a boundary wall and if so, applies periodic shift.

Checks if the particle has to be shifted into the main domain (i.e., if the particle has crossed any of the boundary walls) and if so performs the shift

Parameters
[in]pA pointer to the BaseParticle that is checked

Definition at line 302 of file LeesEdwardsBoundary.cc.

References getHorizontalDistance(), getVerticalDistance(), shiftHorizontalPosition(), and shiftVerticalPosition().

Referenced by checkBoundaryAfterParticlesMove().

303 {
304  bool positive;
305  while (getVerticalDistance(*p, positive) < 0)
306  {
307  shiftVerticalPosition(p, positive);
308  }
309  while (getHorizontalDistance(*p, positive) < 0)
310  {
311  shiftHorizontalPosition(p, positive);
312  }
313 }
void shiftVerticalPosition(BaseParticle *p, bool positive)
Applies a vertical shift to the given particle.
void shiftHorizontalPosition(BaseParticle *p, bool positive)
Applies a horizontal shift to the given particle.
Mdouble getHorizontalDistance(BaseParticle &p, bool &positive)
Returns distance from given particle to the closest horizontal wall.
Mdouble getVerticalDistance(BaseParticle &p, bool &positive)
Returns distance from given particle to the closest vertical wall.
void LeesEdwardsBoundary::checkBoundaryAfterParticlesMove ( ParticleHandler pH)
overridevirtual

Checks if particles need to be adjusted after their position has been updated.

Reimplemented from BaseBoundary.

Definition at line 315 of file LeesEdwardsBoundary.cc.

References BaseHandler< T >::begin(), checkBoundaryAfterParticleMoved(), and BaseHandler< T >::end().

316 {
317  for (auto p = pH.begin(); p != pH.end(); ++p)
318  {
320  }
321 }
const std::vector< T * >::const_iterator end() const
Gets the end of the const_iterator over all BaseBoundary in this BaseHandler.
Definition: BaseHandler.h:704
const std::vector< T * >::const_iterator begin() const
Gets the begin of the const_iterator over all Object in this BaseHandler.
Definition: BaseHandler.h:690
void checkBoundaryAfterParticleMoved(BaseParticle *p)
Checks if particle crossed a boundary wall and if so, applies periodic shift.
LeesEdwardsBoundary * LeesEdwardsBoundary::copy ( ) const
overridevirtual

Creates a copy of the object.

Copy method; creates a copy on the heap and returns its pointer.

Returns
pointer to the copy on the heap

Implements BaseBoundary.

Definition at line 109 of file LeesEdwardsBoundary.cc.

References LeesEdwardsBoundary().

110 {
111  return new LeesEdwardsBoundary(*this);
112 }
void LeesEdwardsBoundary::createHorizontalPeriodicParticles ( BaseParticle p,
ParticleHandler pH 
)

Creates horizontal periodic copies of given particle, if needed.

Check if periodic copies of the particle in horizontal direction have to be made (i.e., if the distance of the particle to either of the horizontal boundary walls is smaller than its radius plus the radius of the largest particle in the system), and if so makes them

Parameters
[in]pA pointer to the BaseParticle that is checked
[out]pHA reference to the ParticleHandler where periodic copies will be added

Definition at line 207 of file LeesEdwardsBoundary.cc.

References ParticleHandler::addObject(), BaseParticle::copy(), BaseInteractable::copyInteractionsForPeriodicParticles(), getHorizontalDistance(), ParticleHandler::getLargestParticle(), BaseParticle::getMaxInteractionRadius(), BaseParticle::getPeriodicFromParticle(), BaseParticle::setPeriodicFromParticle(), and shiftHorizontalPosition().

Referenced by createPeriodicParticle(), and createVerticalPeriodicParticles().

208 {
209  bool positive; // TRUE if the particle is closest to the left boundary
210  // wall (set by getVerticalDistance in the following if-statement)
211  //
212  // Note, 'positive' is passed by reference to getHorizontalDistance
213  // check if particle is close enough to either of the walls
215  if (getHorizontalDistance(*p, positive) < maxDistance)
216  {
217  // create a periodic copy of the particle
218  BaseParticle* F0 = p->copy();
219  pH.addObject(F0);
221 
222  // If Particle is doubly shifted, get correct original particle
223  BaseParticle* From = p;
224  while (From->getPeriodicFromParticle() != nullptr)
225  From = From->getPeriodicFromParticle();
226  F0->setPeriodicFromParticle(From);
227 
228  // shift the copy to the 'periodic' position
229  shiftHorizontalPosition(F0, positive);
230 
231  // NB: No extra creation of possible vertical copies of the horizontal copy
232  // here (as compared to createVerticalPeriodicParticles), because these would
233  // overlap with the extra creation of horizontal copies in createVerticalPeriodicParticles.
234  }
235 }
BaseParticle * getLargestParticle() const
Returns the pointer of the largest particle in the particle handler. When mercury is running in paral...
void addObject(BaseParticle *P) override
Adds a BaseParticle to the ParticleHandler.
double Mdouble
Definition: GeneralDefine.h:34
Mdouble getMaxInteractionRadius() const
Returns the particle's interaction radius, which might be different from radius_ (e.g., when dealing with wet particles)
Definition: BaseParticle.h:362
void setPeriodicFromParticle(BaseParticle *p)
Assigns the pointer to the 'original' particle this one's a periodic copy of (used in periodic bounda...
Definition: BaseParticle.h:441
BaseParticle * getPeriodicFromParticle() const
Returns the 'original' particle this one's a periodic copy of.
Definition: BaseParticle.h:341
virtual BaseParticle * copy() const =0
Particle copy method. It calls to copy constructor of this Particle, useful for polymorphism.
void copyInteractionsForPeriodicParticles(const BaseInteractable &p)
Copies interactions to this BaseInteractable whenever a periodic copy made.
void shiftHorizontalPosition(BaseParticle *p, bool positive)
Applies a horizontal shift to the given particle.
Mdouble getHorizontalDistance(BaseParticle &p, bool &positive)
Returns distance from given particle to the closest horizontal wall.
void LeesEdwardsBoundary::createPeriodicParticle ( BaseParticle p,
ParticleHandler pH 
)
override

Check if periodic copies of the particle have to be made for the contact detection and if so makes them

Parameters
[in]pA pointer to the BaseParticle that is checked
[out]pHA reference to the ParticleHandler where periodic copies will be added

Definition at line 282 of file LeesEdwardsBoundary.cc.

References createHorizontalPeriodicParticles(), and createVerticalPeriodicParticles().

Referenced by createPeriodicParticles().

283 {
286 }
void createHorizontalPeriodicParticles(BaseParticle *p, ParticleHandler &pH)
Creates horizontal periodic copies of given particle, if needed.
void createVerticalPeriodicParticles(BaseParticle *p, ParticleHandler &pH)
Creates vertical periodic copies of given particle, if needed.
void LeesEdwardsBoundary::createPeriodicParticles ( ParticleHandler pH)
override

Creates horizontal and vertical periodic copies of given particle, if needed.

Definition at line 288 of file LeesEdwardsBoundary.cc.

References createPeriodicParticle(), BaseHandler< T >::getObject(), BaseHandler< T >::getSize(), and constants::i.

289 {
290  unsigned numberOfParticles = pH.getSize();
291  for (unsigned i = 0; i < numberOfParticles; i++)
292  {
294  }
295 }
unsigned int getSize() const
Gets the size of the particleHandler (including mpi and periodic particles)
Definition: BaseHandler.h:655
void createPeriodicParticle(BaseParticle *p, ParticleHandler &pH) override
const std::complex< Mdouble > i
Definition: ExtendedMath.h:51
T * getObject(const unsigned int id)
Gets a pointer to the Object at the specified index in the BaseHandler.
Definition: BaseHandler.h:613
void LeesEdwardsBoundary::createVerticalPeriodicParticles ( BaseParticle p,
ParticleHandler pH 
)

Creates vertical periodic copies of given particle, if needed.

Check if periodic copies of the particle in vertical direction have to be made (i.e., if the distance of the particle to either of the vertical boundary walls is smaller than its radius plus the radius of the largest particle in the system), and if so makes them

Parameters
[in]pA pointer to the BaseParticle that is checked
[out]pHA reference to the ParticleHandler where periodic copies will be added

Definition at line 245 of file LeesEdwardsBoundary.cc.

References ParticleHandler::addObject(), BaseParticle::copy(), BaseInteractable::copyInteractionsForPeriodicParticles(), createHorizontalPeriodicParticles(), getHorizontalDistance(), ParticleHandler::getLargestParticle(), BaseHandler< T >::getLastObject(), BaseParticle::getMaxInteractionRadius(), BaseParticle::getPeriodicFromParticle(), getVerticalDistance(), BaseParticle::setPeriodicFromParticle(), shiftHorizontalPosition(), and shiftVerticalPosition().

Referenced by createPeriodicParticle().

246 {
247  bool positive; // TRUE if the particle is closest to the bottom boundary
248  // wall (set by getVerticalDistance in the following if-statement)
249  // check if particle is close enough to either of the walls
251  if (getVerticalDistance(*p, positive) < maxDistance)
252  {
253  // create a periodic copy of the particle
254  BaseParticle* F0 = p->copy();
255  pH.addObject(F0);
257 
258  // If Particle is doubly shifted, get correct original particle
259  BaseParticle* From = p;
260  while (From->getPeriodicFromParticle() != nullptr)
261  From = From->getPeriodicFromParticle();
262  F0->setPeriodicFromParticle(From);
263 
264  // shift the copy to the 'periodic' position
265  shiftVerticalPosition(F0, positive);
266  while (getHorizontalDistance(*F0, positive) < 0)
267  {
268  shiftHorizontalPosition(F0, positive);
269  }
270 
271  // Create horizontal periodic copies of the copy particle, if needed (i.e.,
272  // if the original particle is in one of the boundary corners).
274  }
275 }
BaseParticle * getLargestParticle() const
Returns the pointer of the largest particle in the particle handler. When mercury is running in paral...
void addObject(BaseParticle *P) override
Adds a BaseParticle to the ParticleHandler.
double Mdouble
Definition: GeneralDefine.h:34
Mdouble getMaxInteractionRadius() const
Returns the particle's interaction radius, which might be different from radius_ (e.g., when dealing with wet particles)
Definition: BaseParticle.h:362
void setPeriodicFromParticle(BaseParticle *p)
Assigns the pointer to the 'original' particle this one's a periodic copy of (used in periodic bounda...
Definition: BaseParticle.h:441
BaseParticle * getPeriodicFromParticle() const
Returns the 'original' particle this one's a periodic copy of.
Definition: BaseParticle.h:341
virtual BaseParticle * copy() const =0
Particle copy method. It calls to copy constructor of this Particle, useful for polymorphism.
void createHorizontalPeriodicParticles(BaseParticle *p, ParticleHandler &pH)
Creates horizontal periodic copies of given particle, if needed.
void shiftVerticalPosition(BaseParticle *p, bool positive)
Applies a vertical shift to the given particle.
void copyInteractionsForPeriodicParticles(const BaseInteractable &p)
Copies interactions to this BaseInteractable whenever a periodic copy made.
void shiftHorizontalPosition(BaseParticle *p, bool positive)
Applies a horizontal shift to the given particle.
T * getLastObject()
Gets a pointer to the last Object in this BaseHandler.
Definition: BaseHandler.h:634
Mdouble getHorizontalDistance(BaseParticle &p, bool &positive)
Returns distance from given particle to the closest horizontal wall.
Mdouble getVerticalDistance(BaseParticle &p, bool &positive)
Returns distance from given particle to the closest vertical wall.
Mdouble LeesEdwardsBoundary::getCurrentShift ( )

Definition at line 324 of file LeesEdwardsBoundary.cc.

References BaseHandler< T >::getDPMBase(), BaseBoundary::getHandler(), DPMBase::getTime(), and shift_.

325 {
326  Mdouble time = getHandler()->getDPMBase()->getTime();
327  return shift_(time);
328 }
double Mdouble
Definition: GeneralDefine.h:34
std::function< Mdouble(Mdouble)> shift_
(signed) Vertical distance between the top wall and the origin
BoundaryHandler * getHandler() const
Returns the boundary's BoundaryHandler.
DPMBase * getDPMBase()
Gets the problem that is solved using this handler.
Definition: BaseHandler.h:725
Mdouble getTime() const
Returns the current simulation time.
Definition: DPMBase.cc:805
Mdouble LeesEdwardsBoundary::getCurrentVelocity ( )

Definition at line 330 of file LeesEdwardsBoundary.cc.

References BaseHandler< T >::getDPMBase(), BaseBoundary::getHandler(), DPMBase::getTime(), and velocity_.

331 {
332  Mdouble time = getHandler()->getDPMBase()->getTime();
333  return velocity_(time);
334 }
double Mdouble
Definition: GeneralDefine.h:34
std::function< Mdouble(Mdouble)> velocity_
BoundaryHandler * getHandler() const
Returns the boundary's BoundaryHandler.
DPMBase * getDPMBase()
Gets the problem that is solved using this handler.
Definition: BaseHandler.h:725
Mdouble getTime() const
Returns the current simulation time.
Definition: DPMBase.cc:805
Mdouble LeesEdwardsBoundary::getHorizontalDistance ( BaseParticle p,
bool &  positive 
)

Returns distance from given particle to the closest horizontal wall.

Returns the distance between BaseParticle p and the closest boundary wall in horizontal direction

Parameters
[in]pA reference to the BaseParticle
[out]positiveA boolean which is true when the left wall is closest
Returns
The distance to the closes wall in horizontal direction

Definition at line 120 of file LeesEdwardsBoundary.cc.

References BaseInteractable::getPosition(), left_, right_, and Vec3D::X.

Referenced by checkBoundaryAfterParticleMoved(), createHorizontalPeriodicParticles(), and createVerticalPeriodicParticles().

121 {
122  Mdouble left = p.getPosition().X - left_;
123  Mdouble right = right_ - p.getPosition().X;
124  if (left < right)
125  {
126  positive = true;
127  return left;
128  }
129  else
130  {
131  positive = false;
132  return right;
133  }
134 }
const Vec3D & getPosition() const
Returns the position of this BaseInteractable.
Mdouble X
the vector components
Definition: Vector.h:65
double Mdouble
Definition: GeneralDefine.h:34
Mdouble right_
(signed) Horizontal distance between the left wall and the origin
std::string LeesEdwardsBoundary::getName ( ) const
overridevirtual

Returns the name of the object.

Returns
The name of this object (i.e. "LeesEdwardsBoundary")

Implements BaseObject.

Definition at line 100 of file LeesEdwardsBoundary.cc.

101 {
102  return "LeesEdwardsBoundary";
103 }
Mdouble LeesEdwardsBoundary::getVerticalDistance ( BaseParticle p,
bool &  positive 
)

Returns distance from given particle to the closest vertical wall.

Returns the distance between BaseParticle p and the closest wall in vertical direction

Parameters
[in]pA reference to the BaseParticle
[out]positiveA boolean which is true when the bottom wall is closest
Returns
The distance to the closes wall in vertical direction

Definition at line 142 of file LeesEdwardsBoundary.cc.

References down_, BaseInteractable::getPosition(), up_, and Vec3D::Y.

Referenced by checkBoundaryAfterParticleMoved(), and createVerticalPeriodicParticles().

143 {
144  Mdouble down = p.getPosition().Y - down_;
145  Mdouble up = up_ - p.getPosition().Y;
146  if (down < up)
147  {
148  positive = true;
149  return down;
150  }
151  else
152  {
153  positive = false;
154  return up;
155  }
156 }
const Vec3D & getPosition() const
Returns the position of this BaseInteractable.
double Mdouble
Definition: GeneralDefine.h:34
Mdouble up_
(signed) Vertical distance between the bottom wall and the origin
Mdouble down_
(signed) Horizontal distance between the right wall and the origin
Mdouble Y
Definition: Vector.h:65
void LeesEdwardsBoundary::read ( std::istream &  is)
overridevirtual

Reads all boundary properties from a stream.

Reads all the properties of the LeesEdwardsBoundary from an std::istream

Parameters
[in,out]isThe stream from which the parameters are read

Implements BaseBoundary.

Definition at line 74 of file LeesEdwardsBoundary.cc.

References down_, left_, BaseBoundary::read(), right_, shift_, UNUSED, up_, and velocity_.

75 {
76  std::string dummy;
78  Mdouble shift;
79  Mdouble velocity;
80  is >> dummy >> left_ >> dummy >> right_ >> dummy >> down_ >> dummy >> up_ >> dummy >> shift >> dummy >> velocity;
81  shift_ = [shift, velocity](Mdouble time UNUSED) { return shift + velocity * time; };
82  velocity_ = [velocity](Mdouble time UNUSED) { return velocity; };
83 }
double Mdouble
Definition: GeneralDefine.h:34
std::function< Mdouble(Mdouble)> shift_
(signed) Vertical distance between the top wall and the origin
void read(std::istream &is) override=0
Reads the object's id_ from given istream NB: purely virtual function, overriding the version of Base...
Definition: BaseBoundary.cc:61
std::function< Mdouble(Mdouble)> velocity_
Mdouble up_
(signed) Vertical distance between the bottom wall and the origin
#define UNUSED
Definition: GeneralDefine.h:39
Mdouble down_
(signed) Horizontal distance between the right wall and the origin
Mdouble right_
(signed) Horizontal distance between the left wall and the origin
void LeesEdwardsBoundary::set ( std::function< Mdouble(Mdouble)>  shift,
std::function< Mdouble(Mdouble)>  velocity,
Mdouble  left,
Mdouble  right,
Mdouble  down,
Mdouble  up 
)

Sets all boundary properties.

Allows the user to set all the properties of the LeesEdwardsBoundary at once.

Parameters
[in]velocityThe difference in velocities at which the bottom and to wall move
[in]leftThe (signed) distance between the origin and the left wall
[in]rightThe (signed) distance between the origin and the right wall
[in]downThe (signed) distance between the origin and the top wall
[in]upThe (signed) distance between the origin and the bottom wall

Definition at line 50 of file LeesEdwardsBoundary.cc.

References down_, left_, right_, shift_, up_, and velocity_.

Referenced by StressStrainControlBoundary::set().

52 {
53  shift_ = shift;
54  velocity_ = velocity;
55  left_ = left;
56  right_ = right;
57  down_ = down;
58  up_ = up;
59 }
std::function< Mdouble(Mdouble)> shift_
(signed) Vertical distance between the top wall and the origin
std::function< Mdouble(Mdouble)> velocity_
Mdouble up_
(signed) Vertical distance between the bottom wall and the origin
Mdouble down_
(signed) Horizontal distance between the right wall and the origin
Mdouble right_
(signed) Horizontal distance between the left wall and the origin
void LeesEdwardsBoundary::setShift ( std::function< Mdouble(Mdouble)>  shift)

Definition at line 336 of file LeesEdwardsBoundary.cc.

References shift_.

337 {
338  shift_ = shift;
339 }
std::function< Mdouble(Mdouble)> shift_
(signed) Vertical distance between the top wall and the origin
void LeesEdwardsBoundary::setVelocity ( std::function< Mdouble(Mdouble)>  velocity)

Definition at line 341 of file LeesEdwardsBoundary.cc.

References velocity_.

342 {
343  velocity_ = velocity;
344 }
std::function< Mdouble(Mdouble)> velocity_
void LeesEdwardsBoundary::shiftHorizontalPosition ( BaseParticle p,
bool  positive 
)

Applies a horizontal shift to the given particle.

Shifts the BaseParticle p in horizontal direction to its 'periodic' position, i.e. over the horizontal length of the boundary.

Parameters
[in]pA reference to the BaseParticle that has to be shifted
[in]positiveA boolean which determines the direction of the shift NB: TRUE if particle is closest to the left boundary wall

Definition at line 165 of file LeesEdwardsBoundary.cc.

References left_, BaseInteractable::move(), and right_.

Referenced by checkBoundaryAfterParticleMoved(), createHorizontalPeriodicParticles(), and createVerticalPeriodicParticles().

166 {
167  if (positive)
168  {
169  p->move(Vec3D(right_ - left_, 0.0, 0.0));
170  }
171  else
172  {
173  p->move(Vec3D(left_ - right_, 0.0, 0.0));
174  }
175 }
Mdouble right_
(signed) Horizontal distance between the left wall and the origin
Definition: Vector.h:49
virtual void move(const Vec3D &move)
Moves this BaseInteractable by adding an amount to the position.
void LeesEdwardsBoundary::shiftVerticalPosition ( BaseParticle p,
bool  positive 
)

Applies a vertical shift to the given particle.

Shifts the BaseParticle p in vertical direction to its 'periodic' position, i.e. over the vertical length of the boundary.

Parameters
[in]pA reference to the BaseParticle that has to be shifted
[in]positiveA boolean which determines the direction of the shift NB: TRUE if particle is closest to the bottom boundary wall

Definition at line 184 of file LeesEdwardsBoundary.cc.

References BaseInteractable::addVelocity(), down_, BaseHandler< T >::getDPMBase(), BaseBoundary::getHandler(), DPMBase::getTime(), BaseInteractable::move(), shift_, up_, and velocity_.

Referenced by checkBoundaryAfterParticleMoved(), and createVerticalPeriodicParticles().

185 {
186  Mdouble time = getHandler()->getDPMBase()->getTime();
187  if (positive)
188  {
189  p->move(Vec3D(shift_(time), up_ - down_, 0.0));
190  p->addVelocity(Vec3D(velocity_(time), 0.0, 0.0));
191  }
192  else
193  {
194  p->move(Vec3D(-shift_(time), down_ - up_, 0.0));
195  p->addVelocity(Vec3D(-velocity_(time), 0.0, 0.0));
196  }
197 }
void addVelocity(const Vec3D &velocity)
adds an increment to the velocity.
double Mdouble
Definition: GeneralDefine.h:34
std::function< Mdouble(Mdouble)> shift_
(signed) Vertical distance between the top wall and the origin
std::function< Mdouble(Mdouble)> velocity_
Mdouble up_
(signed) Vertical distance between the bottom wall and the origin
BoundaryHandler * getHandler() const
Returns the boundary's BoundaryHandler.
Mdouble down_
(signed) Horizontal distance between the right wall and the origin
Definition: Vector.h:49
virtual void move(const Vec3D &move)
Moves this BaseInteractable by adding an amount to the position.
DPMBase * getDPMBase()
Gets the problem that is solved using this handler.
Definition: BaseHandler.h:725
Mdouble getTime() const
Returns the current simulation time.
Definition: DPMBase.cc:805
void LeesEdwardsBoundary::updateBoundaries ( Mdouble  left,
Mdouble  right,
Mdouble  down,
Mdouble  up 
)

Definition at line 61 of file LeesEdwardsBoundary.cc.

References down_, left_, right_, and up_.

62 {
63  left_ = left;
64  right_ = right;
65  down_ = down;
66  up_ = up;
67 }
Mdouble up_
(signed) Vertical distance between the bottom wall and the origin
Mdouble down_
(signed) Horizontal distance between the right wall and the origin
Mdouble right_
(signed) Horizontal distance between the left wall and the origin
void LeesEdwardsBoundary::write ( std::ostream &  os) const
overridevirtual

Writes all boundary properties to a stream.

Writes all the properties of the LeesEdwardsBoundary to an std::ostream

Parameters
[out]osThe stream to which the parameters are written

Implements BaseBoundary.

Definition at line 89 of file LeesEdwardsBoundary.cc.

References down_, BaseHandler< T >::getDPMBase(), BaseBoundary::getHandler(), DPMBase::getTime(), left_, right_, shift_, up_, velocity_, and BaseBoundary::write().

90 {
92  Mdouble time = getHandler()->getDPMBase()->getTime();
93  os << " left " << left_ << " right " << right_ << " down " << down_ << " up " << up_ << " shift " << shift_(time)
94  << " vel " << velocity_(time);
95 }
double Mdouble
Definition: GeneralDefine.h:34
std::function< Mdouble(Mdouble)> shift_
(signed) Vertical distance between the top wall and the origin
std::function< Mdouble(Mdouble)> velocity_
Mdouble up_
(signed) Vertical distance between the bottom wall and the origin
void write(std::ostream &os) const override=0
Adds object's id_ to given ostream NB: purely virtual function, overriding the version of BaseObject...
Definition: BaseBoundary.cc:70
BoundaryHandler * getHandler() const
Returns the boundary's BoundaryHandler.
Mdouble down_
(signed) Horizontal distance between the right wall and the origin
Mdouble right_
(signed) Horizontal distance between the left wall and the origin
DPMBase * getDPMBase()
Gets the problem that is solved using this handler.
Definition: BaseHandler.h:725
Mdouble getTime() const
Returns the current simulation time.
Definition: DPMBase.cc:805

Member Data Documentation

Mdouble LeesEdwardsBoundary::down_
private

(signed) Horizontal distance between the right wall and the origin

Definition at line 153 of file LeesEdwardsBoundary.h.

Referenced by getVerticalDistance(), LeesEdwardsBoundary(), read(), set(), shiftVerticalPosition(), updateBoundaries(), and write().

Mdouble LeesEdwardsBoundary::left_
private
Mdouble LeesEdwardsBoundary::right_
private

(signed) Horizontal distance between the left wall and the origin

Definition at line 152 of file LeesEdwardsBoundary.h.

Referenced by getHorizontalDistance(), LeesEdwardsBoundary(), read(), set(), shiftHorizontalPosition(), updateBoundaries(), and write().

std::function<Mdouble(Mdouble)> LeesEdwardsBoundary::shift_
private

(signed) Vertical distance between the top wall and the origin

Definition at line 155 of file LeesEdwardsBoundary.h.

Referenced by getCurrentShift(), LeesEdwardsBoundary(), read(), set(), setShift(), shiftVerticalPosition(), and write().

Mdouble LeesEdwardsBoundary::up_
private

(signed) Vertical distance between the bottom wall and the origin

Definition at line 154 of file LeesEdwardsBoundary.h.

Referenced by getVerticalDistance(), LeesEdwardsBoundary(), read(), set(), shiftVerticalPosition(), updateBoundaries(), and write().

std::function<Mdouble(Mdouble)> LeesEdwardsBoundary::velocity_
private

The documentation for this class was generated from the following files: