|
Class which creates a boundary with Lees-Edwards type periodic boundary conditions. More...
#include <LeesEdwardsBoundary.h>
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... | |
LeesEdwardsBoundary * | copy () 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 | createHorizontalPeriodicParticle (BaseParticle *p, ParticleHandler &pH) |
Creates horizontal periodic copies of given particle, if needed. More... | |
void | createVerticalPeriodicParticle (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... | |
BoundaryHandler * | getHandler () 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_ |
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.
Add link to paper by Lees-Edwards in the documentation of this class.
Is implemented for 2D only now. Needs extension to 3D.
|
inline |
References MPIContainer::getNumberOfProcessors(), MPIContainer::Instance(), logger, and WARN.
Referenced by copy().
LeesEdwardsBoundary::LeesEdwardsBoundary | ( | const LeesEdwardsBoundary & | other | ) |
Copy constructor.
References down_, left_, right_, shift_, up_, and velocity_.
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
[in] | p | A pointer to the BaseParticle that is checked |
References getHorizontalDistance(), getVerticalDistance(), shiftHorizontalPosition(), and shiftVerticalPosition().
Referenced by checkBoundaryAfterParticlesMove().
|
overridevirtual |
Checks if particles need to be adjusted after their position has been updated.
Reimplemented from BaseBoundary.
References BaseHandler< T >::begin(), checkBoundaryAfterParticleMoved(), and BaseHandler< T >::end().
|
overridevirtual |
Creates a copy of the object.
Copy method; creates a copy on the heap and returns its pointer.
Implements BaseBoundary.
References LeesEdwardsBoundary().
void LeesEdwardsBoundary::createHorizontalPeriodicParticle | ( | 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 |
References ParticleHandler::addObject(), BaseParticle::copy(), BaseInteractable::copyInteractionsForPeriodicParticles(), getHorizontalDistance(), ParticleHandler::getLargestParticle(), BaseParticle::getMaxInteractionRadius(), BaseParticle::getPeriodicFromParticle(), BaseParticle::setPeriodicFromParticle(), and shiftHorizontalPosition().
Referenced by createPeriodicParticle(), and createVerticalPeriodicParticle().
|
override |
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 |
References createHorizontalPeriodicParticle(), and createVerticalPeriodicParticle().
Referenced by createPeriodicParticles().
|
override |
Creates horizontal and vertical periodic copies of given particle, if needed.
References createPeriodicParticle(), BaseHandler< T >::getObject(), BaseHandler< T >::getSize(), and constants::i.
void LeesEdwardsBoundary::createVerticalPeriodicParticle | ( | 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 |
References ParticleHandler::addObject(), BaseParticle::copy(), BaseInteractable::copyInteractionsForPeriodicParticles(), createHorizontalPeriodicParticle(), getHorizontalDistance(), ParticleHandler::getLargestParticle(), BaseHandler< T >::getLastObject(), BaseParticle::getMaxInteractionRadius(), BaseParticle::getPeriodicFromParticle(), getVerticalDistance(), BaseParticle::setPeriodicFromParticle(), shiftHorizontalPosition(), and shiftVerticalPosition().
Referenced by createPeriodicParticle().
Mdouble LeesEdwardsBoundary::getCurrentShift | ( | ) |
References BaseHandler< T >::getDPMBase(), BaseBoundary::getHandler(), DPMBase::getTime(), and shift_.
Mdouble LeesEdwardsBoundary::getCurrentVelocity | ( | ) |
References BaseHandler< T >::getDPMBase(), BaseBoundary::getHandler(), DPMBase::getTime(), and velocity_.
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 |
References BaseInteractable::getPosition(), left_, right_, and Vec3D::X.
Referenced by checkBoundaryAfterParticleMoved(), createHorizontalPeriodicParticle(), and createVerticalPeriodicParticle().
|
overridevirtual |
Returns the name of the object.
Implements BaseObject.
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 |
References down_, BaseInteractable::getPosition(), up_, and Vec3D::Y.
Referenced by checkBoundaryAfterParticleMoved(), and createVerticalPeriodicParticle().
|
overridevirtual |
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.
References down_, left_, BaseBoundary::read(), right_, shift_, UNUSED, up_, and velocity_.
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.
[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 |
References down_, left_, right_, shift_, up_, and velocity_.
Referenced by StressStrainControlBoundary::set(), LeesEdwardsDemo::setupInitialConditions(), LeesEdwardsSelfTest::setupInitialConditions(), and FullRestartTest::setupInitialConditions().
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 |
References left_, BaseInteractable::move(), and right_.
Referenced by checkBoundaryAfterParticleMoved(), createHorizontalPeriodicParticle(), and createVerticalPeriodicParticle().
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 |
References BaseInteractable::addVelocity(), down_, BaseHandler< T >::getDPMBase(), BaseBoundary::getHandler(), DPMBase::getTime(), BaseInteractable::move(), shift_, up_, and velocity_.
Referenced by checkBoundaryAfterParticleMoved(), and createVerticalPeriodicParticle().
|
overridevirtual |
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.
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
Referenced by getVerticalDistance(), LeesEdwardsBoundary(), read(), set(), shiftVerticalPosition(), updateBoundaries(), and write().
|
private |
Referenced by getHorizontalDistance(), LeesEdwardsBoundary(), read(), set(), shiftHorizontalPosition(), updateBoundaries(), and write().
|
private |
(signed) Horizontal distance between the left wall and the origin
Referenced by getHorizontalDistance(), LeesEdwardsBoundary(), read(), set(), shiftHorizontalPosition(), updateBoundaries(), and write().
(signed) Vertical distance between the top wall and the origin
Referenced by getCurrentShift(), LeesEdwardsBoundary(), read(), set(), setShift(), shiftVerticalPosition(), and write().
|
private |
(signed) Vertical distance between the bottom wall and the origin
Referenced by getVerticalDistance(), LeesEdwardsBoundary(), read(), set(), shiftVerticalPosition(), updateBoundaries(), and write().
Referenced by getCurrentVelocity(), LeesEdwardsBoundary(), read(), set(), setVelocity(), shiftVerticalPosition(), and write().