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 ()
 
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.

See also [insert link to the original paper by LE]. 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 42 of file LeesEdwardsBoundary.h.

Constructor & Destructor Documentation

LeesEdwardsBoundary::LeesEdwardsBoundary ( )
inline

Definition at line 46 of file LeesEdwardsBoundary.h.

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

Referenced by copy().

47  {
48 #ifdef MERCURY_USE_MPI
49  MPIContainer& communicator = MPIContainer::Instance();
50  if (communicator.getNumberOfProcessors() > 1)
51  {
52  logger(WARN,"LeesEdwardsBoundaries are currently not implemented in parallel MercuryDPM");
53  }
54 #endif
55  }
This class contains all information and functions required for communication between processors...
Definition: MpiContainer.h:125
static MPIContainer & Instance()
fetch the instance to be used for communication
Definition: MpiContainer.h:130
Logger< MERCURY_LOGLEVEL > logger("MercuryKernel")
std::size_t getNumberOfProcessors() const
Get the total number of processors participating in this simulation.

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 290 of file LeesEdwardsBoundary.cc.

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

Referenced by checkBoundaryAfterParticlesMove().

291 {
292  bool positive;
293  while (getVerticalDistance(*p, positive) < 0)
294  {
295  shiftVerticalPosition(p, positive);
296  }
297  while (getHorizontalDistance(*p, positive) < 0)
298  {
299  shiftHorizontalPosition(p, positive);
300  }
301 }
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 303 of file LeesEdwardsBoundary.cc.

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

304 {
305  for (auto p = pH.begin(); p != pH.end(); ++p)
306  {
308  }
309 }
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 99 of file LeesEdwardsBoundary.cc.

References LeesEdwardsBoundary().

100 {
101  return new LeesEdwardsBoundary(*this);
102 }
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 197 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().

198 {
199  bool positive; // TRUE if the particle is closest to the left boundary
200  // wall (set by getVerticalDistance in the following if-statement)
201  // check if particle is close enough to either of the walls
203  if (getHorizontalDistance(*p, positive) < maxDistance)
204  {
205  // create a periodic copy of the particle
206  BaseParticle* F0 = p->copy();
207  pH.addObject(F0);
209 
210  // If Particle is doubly shifted, get correct original particle
211  BaseParticle* From = p;
212  while (From->getPeriodicFromParticle() != nullptr)
213  From = From->getPeriodicFromParticle();
214  F0->setPeriodicFromParticle(From);
215 
216  // shift the copy to the 'periodic' position
217  shiftHorizontalPosition(F0, positive);
218 
219  // NB: No extra creation of possible vertical copies of the horizontal copy
220  // here (as compared to createVerticalPeriodicParticles), because these would
221  // overlap with the extra creation of horizontal copies in createVerticalPeriodicParticles.
222  }
223 }
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:359
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:438
BaseParticle * getPeriodicFromParticle() const
Returns the 'original' particle this one's a periodic copy of.
Definition: BaseParticle.h:338
virtual BaseParticle * copy() const =0
Particle copy method. It calls to copy constructor of this Particle, useful for polymorfism.
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 270 of file LeesEdwardsBoundary.cc.

References createHorizontalPeriodicParticles(), and createVerticalPeriodicParticles().

Referenced by createPeriodicParticles().

271 {
274 }
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 276 of file LeesEdwardsBoundary.cc.

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

277 {
278  unsigned numberOfParticles = pH.getSize();
279  for (unsigned i = 0; i < numberOfParticles; i++)
280  {
282  }
283 }
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:50
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 233 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().

234 {
235  bool positive; // TRUE if the particle is closest to the bottom boundary
236  // wall (set by getVerticalDistance in the following if-statement)
237  // check if particle is close enough to either of the walls
239  if (getVerticalDistance(*p, positive) < maxDistance)
240  {
241  // create a periodic copy of the particle
242  BaseParticle* F0 = p->copy();
243  pH.addObject(F0);
245 
246  // If Particle is doubly shifted, get correct original particle
247  BaseParticle* From = p;
248  while (From->getPeriodicFromParticle() != nullptr)
249  From = From->getPeriodicFromParticle();
250  F0->setPeriodicFromParticle(From);
251 
252  // shift the copy to the 'periodic' position
253  shiftVerticalPosition(F0, positive);
254  while (getHorizontalDistance(*F0, positive) < 0)
255  {
256  shiftHorizontalPosition(F0, positive);
257  }
258 
259  // Create horizontal periodic copies of the copy particle, if needed (i.e.,
260  // if the original particle is in one of the boundary corners).
262  }
263 }
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:359
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:438
BaseParticle * getPeriodicFromParticle() const
Returns the 'original' particle this one's a periodic copy of.
Definition: BaseParticle.h:338
virtual BaseParticle * copy() const =0
Particle copy method. It calls to copy constructor of this Particle, useful for polymorfism.
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 312 of file LeesEdwardsBoundary.cc.

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

313 {
314  Mdouble time = getHandler()->getDPMBase()->getTime();
315  return shift_(time);
316 }
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:797
Mdouble LeesEdwardsBoundary::getCurrentVelocity ( )

Definition at line 318 of file LeesEdwardsBoundary.cc.

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

319 {
320  Mdouble time = getHandler()->getDPMBase()->getTime();
321  return velocity_(time);
322 }
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:797
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 110 of file LeesEdwardsBoundary.cc.

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

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

111 {
112  Mdouble left = p.getPosition().X - left_;
113  Mdouble right = right_ - p.getPosition().X;
114  if (left < right)
115  {
116  positive = true;
117  return left;
118  }
119  else
120  {
121  positive = false;
122  return right;
123  }
124 }
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 90 of file LeesEdwardsBoundary.cc.

91 {
92  return "LeesEdwardsBoundary";
93 }
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 132 of file LeesEdwardsBoundary.cc.

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

Referenced by checkBoundaryAfterParticleMoved(), and createVerticalPeriodicParticles().

133 {
134  Mdouble down = p.getPosition().Y - down_;
135  Mdouble up = up_ - p.getPosition().Y;
136  if (down < up)
137  {
138  positive = true;
139  return down;
140  }
141  else
142  {
143  positive = false;
144  return up;
145  }
146 }
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 64 of file LeesEdwardsBoundary.cc.

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

65 {
66  std::string dummy;
68  Mdouble shift;
69  Mdouble velocity;
70  is >> dummy >> left_ >> dummy >> right_ >> dummy >> down_ >> dummy >> up_ >> dummy >> shift >> dummy >> velocity;
71  shift_ = [shift, velocity](Mdouble time UNUSED) { return shift + velocity * time; };
72  velocity_ = [velocity](Mdouble time UNUSED) { return velocity; };
73 }
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 40 of file LeesEdwardsBoundary.cc.

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

Referenced by StressStrainControlBoundary::set().

42 {
43  shift_ = shift;
44  velocity_ = velocity;
45  left_ = left;
46  right_ = right;
47  down_ = down;
48  up_ = up;
49 }
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 324 of file LeesEdwardsBoundary.cc.

References shift_.

325 {
326  shift_ = shift;
327 }
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 329 of file LeesEdwardsBoundary.cc.

References velocity_.

330 {
331  velocity_ = velocity;
332 }
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 155 of file LeesEdwardsBoundary.cc.

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

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

156 {
157  if (positive)
158  {
159  p->move(Vec3D(right_ - left_, 0.0, 0.0));
160  }
161  else
162  {
163  p->move(Vec3D(left_ - right_, 0.0, 0.0));
164  }
165 }
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 174 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().

175 {
176  Mdouble time = getHandler()->getDPMBase()->getTime();
177  if (positive)
178  {
179  p->move(Vec3D(shift_(time), up_ - down_, 0.0));
180  p->addVelocity(Vec3D(velocity_(time), 0.0, 0.0));
181  }
182  else
183  {
184  p->move(Vec3D(-shift_(time), down_ - up_, 0.0));
185  p->addVelocity(Vec3D(-velocity_(time), 0.0, 0.0));
186  }
187 }
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:797
void LeesEdwardsBoundary::updateBoundaries ( Mdouble  left,
Mdouble  right,
Mdouble  down,
Mdouble  up 
)

Definition at line 51 of file LeesEdwardsBoundary.cc.

References down_, left_, right_, and up_.

52 {
53  left_ = left;
54  right_ = right;
55  down_ = down;
56  up_ = up;
57 }
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 79 of file LeesEdwardsBoundary.cc.

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

80 {
82  Mdouble time = getHandler()->getDPMBase()->getTime();
83  os << " left " << left_ << " right " << right_ << " down " << down_ << " up " << up_ << " shift " << shift_(time)
84  << " vel " << velocity_(time);
85 }
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:797

Member Data Documentation

Mdouble LeesEdwardsBoundary::down_
private

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

Definition at line 144 of file LeesEdwardsBoundary.h.

Referenced by getVerticalDistance(), 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 143 of file LeesEdwardsBoundary.h.

Referenced by getHorizontalDistance(), 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 146 of file LeesEdwardsBoundary.h.

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

Mdouble LeesEdwardsBoundary::up_
private

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

Definition at line 145 of file LeesEdwardsBoundary.h.

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

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

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