MercuryDPM
Beta
|
Class which creates a boundary with Lees-Edwards type periodic boundary conditions. More...
#include <LeesEdwardsBoundary.h>
Public Member Functions | |
void | set (std::function< double(double)> shift, std::function< double(double)> velocity, Mdouble left, Mdouble right, Mdouble down, Mdouble up) |
Sets all boundary properties. More... | |
void | read (std::istream &is) |
Reads all boundary properties from a stream. More... | |
void | write (std::ostream &os) const |
Writes all boundary properties to a stream. More... | |
virtual std::string | getName () const |
Returns the name of the object. More... | |
LeesEdwardsBoundary * | copy () const |
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... | |
bool | checkBoundaryAfterParticleMoved (BaseParticle *p, ParticleHandler &pH UNUSED) |
Checks if particle crossed a boundary wall and if so, applies periodic shift. More... | |
void | createPeriodicParticles (BaseParticle *p, ParticleHandler &pH) |
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... | |
Public Member Functions inherited from BaseBoundary | |
BaseBoundary () | |
default constructor. More... | |
BaseBoundary (const BaseBoundary &b) | |
copy constructor More... | |
virtual | ~BaseBoundary () |
destructor More... | |
virtual void | createPeriodicParticles (BaseParticle *P UNUSED, ParticleHandler &pH UNUSED) |
Creates periodic copies of given particle in case of periodic boundaries. More... | |
virtual bool | checkBoundaryAfterParticleMoved (BaseParticle *P UNUSED, ParticleHandler &pH UNUSED) |
Checks if given particle passed the boundary. More... | |
virtual void | checkBoundaryBeforeTimeStep (DPMBase *md UNUSED) |
Fills a (3D) boundary with particles. More... | |
void | setHandler (BoundaryHandler *handler) |
Sets the boundary's BoundaryHandler. More... | |
BoundaryHandler * | getHandler () const |
Returns the boundary's BoundaryHandler. More... | |
Public Member Functions inherited from BaseObject | |
BaseObject () | |
Default constructor. More... | |
BaseObject (const BaseObject &p) | |
Copy constructor, copies all the objects BaseObject contains. More... | |
virtual | ~BaseObject () |
virtual destructor More... | |
virtual void | moveInHandler (const unsigned int index) |
Except that it is virtual, it does the same thing as setIndex() does. More... | |
void | setIndex (const unsigned int index) |
Allows one to assign an index to an object in the handler/container. More... | |
void | setId (const unsigned int 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... | |
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< double(double)> | shift_ |
(signed) Vertical distance between the top wall and the origin More... | |
std::function< double(double)> | velocity_ |
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.
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.
bool LeesEdwardsBoundary::checkBoundaryAfterParticleMoved | ( | BaseParticle * | p, |
ParticleHandler &pH | UNUSED | ||
) |
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
[in] | p | A pointer to the BaseParticle that is checked |
Definition at line 263 of file LeesEdwardsBoundary.cc.
References getHorizontalDistance(), getVerticalDistance(), shiftHorizontalPosition(), and shiftVerticalPosition().
|
virtual |
Creates a copy of the object.
Copy method; creates a copy on the heap and returns its pointer.
Implements BaseBoundary.
Definition at line 87 of file LeesEdwardsBoundary.cc.
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
[in] | p | A pointer to the BaseParticle that is checked |
[out] | pH | A reference to the ParticleHandler where periodic copies will be added |
Definition at line 181 of file LeesEdwardsBoundary.cc.
References ParticleHandler::addObject(), BaseParticle::copy(), BaseInteractable::copyInteractionsForPeriodicParticles(), getHorizontalDistance(), BaseParticle::getInteractionRadius(), ParticleHandler::getLargestParticle(), BaseParticle::getPeriodicFromParticle(), BaseParticle::setPeriodicFromParticle(), and shiftHorizontalPosition().
Referenced by createPeriodicParticles(), and createVerticalPeriodicParticles().
void LeesEdwardsBoundary::createPeriodicParticles | ( | BaseParticle * | p, |
ParticleHandler & | pH | ||
) |
Creates horizontal and vertical periodic copies of given particle, if needed.
Check if periodic copies of the particle have to be made for the contact detection and if so makes them
[in] | p | A pointer to the BaseParticle that is checked |
[out] | pH | A reference to the ParticleHandler where periodic copies will be added |
Definition at line 252 of file LeesEdwardsBoundary.cc.
References createHorizontalPeriodicParticles(), and createVerticalPeriodicParticles().
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
[in] | p | A pointer to the BaseParticle that is checked |
[out] | pH | A reference to the ParticleHandler where periodic copies will be added |
Definition at line 216 of file LeesEdwardsBoundary.cc.
References ParticleHandler::addObject(), BaseParticle::copy(), BaseInteractable::copyInteractionsForPeriodicParticles(), createHorizontalPeriodicParticles(), getHorizontalDistance(), BaseParticle::getInteractionRadius(), ParticleHandler::getLargestParticle(), BaseHandler< T >::getLastObject(), BaseParticle::getPeriodicFromParticle(), getVerticalDistance(), BaseParticle::setPeriodicFromParticle(), shiftHorizontalPosition(), and shiftVerticalPosition().
Referenced by createPeriodicParticles().
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
[in] | p | A reference to the BaseParticle |
[out] | positive | A boolean which is true when the left wall is closest |
Definition at line 98 of file LeesEdwardsBoundary.cc.
References BaseInteractable::getPosition(), left_, right_, and Vec3D::X.
Referenced by checkBoundaryAfterParticleMoved(), createHorizontalPeriodicParticles(), and createVerticalPeriodicParticles().
|
virtual |
Returns the name of the object.
Implements BaseObject.
Definition at line 78 of file LeesEdwardsBoundary.cc.
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
[in] | p | A reference to the BaseParticle |
[out] | positive | A boolean which is true when the bottom wall is closest |
Definition at line 119 of file LeesEdwardsBoundary.cc.
References down_, BaseInteractable::getPosition(), up_, and Vec3D::Y.
Referenced by checkBoundaryAfterParticleMoved(), and createVerticalPeriodicParticles().
|
virtual |
Reads all boundary properties from a stream.
Reads all the properties of the LeesEdwardsBoundary from an std::istream
[in,out] | is | The stream from which the parameters are read |
Implements BaseBoundary.
Definition at line 53 of file LeesEdwardsBoundary.cc.
References down_, left_, BaseBoundary::read(), right_, shift_, UNUSED, up_, and velocity_.
void LeesEdwardsBoundary::set | ( | std::function< double(double)> | shift, |
std::function< double(double)> | 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.
[in] | velocity | The difference in velocities at which the bottom and to wall move |
[in] | left | The (signed) distance between the origin and the left wall |
[in] | right | The (signed) distance between the origin and the right wall |
[in] | down | The (signed) distance between the origin and the top wall |
[in] | up | The (signed) distance between the origin and the bottom wall |
Definition at line 39 of file LeesEdwardsBoundary.cc.
References down_, left_, right_, shift_, up_, and 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.
[in] | p | A reference to the BaseParticle that has to be shifted |
[in] | positive | A boolean which determines the direction of the shift NB: TRUE if particle is closest to the left boundary wall |
Definition at line 141 of file LeesEdwardsBoundary.cc.
References left_, BaseInteractable::move(), and right_.
Referenced by checkBoundaryAfterParticleMoved(), createHorizontalPeriodicParticles(), and createVerticalPeriodicParticles().
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.
[in] | p | A reference to the BaseParticle that has to be shifted |
[in] | positive | A boolean which determines the direction of the shift NB: TRUE if particle is closest to the bottom boundary wall |
Definition at line 159 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().
|
virtual |
Writes all boundary properties to a stream.
Writes all the properties of the LeesEdwardsBoundary to an std::ostream
[out] | os | The stream to which the parameters are written |
Implements BaseBoundary.
Definition at line 68 of file LeesEdwardsBoundary.cc.
References down_, BaseHandler< T >::getDPMBase(), BaseBoundary::getHandler(), DPMBase::getTime(), left_, right_, shift_, up_, velocity_, and BaseBoundary::write().
|
private |
(signed) Horizontal distance between the right wall and the origin
Definition at line 113 of file LeesEdwardsBoundary.h.
Referenced by getVerticalDistance(), read(), set(), shiftVerticalPosition(), and write().
|
private |
Definition at line 111 of file LeesEdwardsBoundary.h.
Referenced by getHorizontalDistance(), read(), set(), shiftHorizontalPosition(), and write().
|
private |
(signed) Horizontal distance between the left wall and the origin
Definition at line 112 of file LeesEdwardsBoundary.h.
Referenced by getHorizontalDistance(), read(), set(), shiftHorizontalPosition(), and write().
|
private |
(signed) Vertical distance between the top wall and the origin
Definition at line 115 of file LeesEdwardsBoundary.h.
Referenced by read(), set(), shiftVerticalPosition(), and write().
|
private |
(signed) Vertical distance between the bottom wall and the origin
Definition at line 114 of file LeesEdwardsBoundary.h.
Referenced by getVerticalDistance(), read(), set(), shiftVerticalPosition(), and write().
|
private |
Definition at line 116 of file LeesEdwardsBoundary.h.
Referenced by read(), set(), shiftVerticalPosition(), and write().