|
Class which creates a boundary with Lees-Edwards type periodic boundary conditions. More...
#include <ShearBoxBoundary.h>
Public Member Functions | |
void | set (std::function< double(double, double)> velocity, Mdouble left, Mdouble right, Mdouble down, Mdouble up) |
Sets all boundary properties. More... | |
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... | |
ShearBoxBoundary * | 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... | |
bool | checkBoundaryAfterParticleMoved (BaseParticle *p, ParticleHandler &pH UNUSED) |
Checks if particle crossed a boundary wall and if so, applies periodic shift. More... | |
void | createPeriodicParticle (BaseParticle *p, 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... | |
void | setVelocity (std::function< double(double, double)>) |
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 | checkBoundaryAfterParticlesMove (ParticleHandler &pH) |
Virtual function that does things to particles, each time step after particles have moved. 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< double(double, double)> | velocity_ |
(signed) Vertical distance between the top wall and the origin More... | |
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.
bool ShearBoxBoundary::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 |
References getHorizontalDistance(), getVerticalDistance(), shiftHorizontalPosition(), and shiftVerticalPosition().
|
overridevirtual |
Creates a copy of the object.
Copy method; creates a copy on the heap and returns its pointer.
Implements BaseBoundary.
void ShearBoxBoundary::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 |
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 |
References createHorizontalPeriodicParticle(), and createVerticalPeriodicParticle().
void ShearBoxBoundary::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 ShearBoxBoundary::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 ShearBoxBoundary::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 ShearBoxBoundary from an std::istream
[in,out] | is | The stream from which the parameters are read |
Implements BaseBoundary.
References down_, left_, BaseBoundary::read(), right_, UNUSED, up_, and velocity_.
void ShearBoxBoundary::set | ( | std::function< double(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 ShearBoxBoundary 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 |
void ShearBoxBoundary::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 BaseInteractable::addVelocity(), BaseHandler< T >::getDPMBase(), BaseBoundary::getHandler(), BaseInteractable::getPosition(), DPMBase::getTime(), left_, BaseInteractable::move(), right_, velocity_, and Vec3D::Z.
Referenced by checkBoundaryAfterParticleMoved(), createHorizontalPeriodicParticle(), and createVerticalPeriodicParticle().
void ShearBoxBoundary::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 down_, BaseInteractable::move(), and up_.
Referenced by checkBoundaryAfterParticleMoved(), and createVerticalPeriodicParticle().
|
overridevirtual |
Writes all boundary properties to a stream.
Writes all the properties of the ShearBoxBoundary to an std::ostream
[out] | os | The stream to which the parameters are written |
Implements BaseBoundary.
References down_, left_, right_, up_, and BaseBoundary::write().
|
private |
(signed) Horizontal distance between the right wall and the origin
Referenced by getVerticalDistance(), read(), set(), shiftVerticalPosition(), and write().
|
private |
Referenced by getHorizontalDistance(), read(), set(), shiftHorizontalPosition(), and write().
|
private |
(signed) Horizontal distance between the left wall and the origin
Referenced by getHorizontalDistance(), read(), set(), shiftHorizontalPosition(), and write().
|
private |
(signed) Vertical distance between the bottom wall and the origin
Referenced by getVerticalDistance(), read(), set(), shiftVerticalPosition(), and write().
(signed) Vertical distance between the top wall and the origin
Referenced by read(), set(), setVelocity(), and shiftHorizontalPosition().