MercuryDPM
Alpha
|
Defines a pair of periodic walls. Inherits from BaseBoundary. More...
#include <PeriodicBoundary.h>
Public Member Functions | |
PeriodicBoundary () | |
default constructor More... | |
~PeriodicBoundary () | |
destructor More... | |
PeriodicBoundary * | copy () const override |
copy method More... | |
void | set (Vec3D normal, Mdouble distanceLeft, Mdouble distanceRight) |
Defines a periodic wall. More... | |
void | set (Vec3D normal, Vec3D positionLeft, Vec3D positionRight) |
void | set (Vec3D normal, Mdouble distanceLeft, Mdouble distanceRight, Vec3D shiftDirection) |
For general parallelogramic domains, the direction of the shift vector can to be set manually. More... | |
Vec3D | getNormal () const |
returns the vector normal to the periodic boundary More... | |
Mdouble | getDistanceLeft () const |
Returns the distance of the left wall to the origin, in normal direction. More... | |
Mdouble | getDistanceRight () const |
Returns the distance of the right wall to the origin, in normal direction. More... | |
Vec3D | getShift () const |
Returns the vector going from the left to the right side of the periodic boundary. More... | |
void | moveLeft (Mdouble distanceLeft) |
Sets the distance from the origin of the 'left' periodic wall. More... | |
void | moveRight (Mdouble distanceRight) |
Sets the distance from the origin of the 'right' periodic wall. More... | |
Mdouble | getDistance (const BaseParticle &p) const |
Returns the distance of the wall to the particle. More... | |
Mdouble | getDistance (const Vec3D &position) const |
Returns the distance of the wall to the position. More... | |
void | shiftPosition (BaseParticle *p) const |
shifts the particle More... | |
void | shiftPositions (Vec3D &postition1, Vec3D &postion2) const |
shifts two positions More... | |
bool | isClosestToLeftBoundary (const BaseParticle &p) const |
Returns TRUE if last particle/position checked is closest to the 'left' wall, and FALSE if it is closest to the 'right' wall. More... | |
bool | isClosestToLeftBoundary (const Vec3D &p) const |
void | read (std::istream &is) override |
reads boundary properties from istream More... | |
MERCURY_DEPRECATED void | oldRead (std::istream &is) |
deprecated version of CubeInsertionBoundary::read(). More... | |
void | write (std::ostream &os) const override |
writes boundary properties to ostream More... | |
virtual std::string | getName () const override |
Returns the name of the object. More... | |
void | createPeriodicParticles (BaseParticle *p, ParticleHandler &pH) |
Checks distance of particle to closest wall and creates periodic copy if necessary. More... | |
bool | checkBoundaryAfterParticleMoved (BaseParticle *p, ParticleHandler &pH UNUSED) |
Checks if particle has crossed either boundary wall, and applies a shift if that is the case. NB: ALWAYS returns FALSE. 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 | |
Vec3D | normal_ |
outward unit normal vector for right wall More... | |
Mdouble | distanceLeft_ |
position of left wall, s.t. normal*x=position_left More... | |
Mdouble | distanceRight_ |
position of right wall, s.t. normal*x=position_right More... | |
Mdouble | scaleFactor_ |
This is the normal to rescale the normal vector to a unit vectors. More... | |
Vec3D | shift_ |
shift from left to right boundary More... | |
Defines a pair of periodic walls. Inherits from BaseBoundary.
The particles are in {x: position_left<=normal*x <position_right}, with normal being the outward unit normal vector of the right wall. If a particle moves outside these boundaries, it will be shifted.
Definition at line 41 of file PeriodicBoundary.h.
PeriodicBoundary::PeriodicBoundary | ( | ) |
default constructor
constructor
Definition at line 37 of file PeriodicBoundary.cc.
References DEBUG, distanceLeft_, distanceRight_, logger, scaleFactor_, and WARN.
Referenced by copy().
PeriodicBoundary::~PeriodicBoundary | ( | ) |
destructor
destructor
Definition at line 58 of file PeriodicBoundary.cc.
bool PeriodicBoundary::checkBoundaryAfterParticleMoved | ( | BaseParticle * | p, |
ParticleHandler &pH | UNUSED | ||
) |
Checks if particle has crossed either boundary wall, and applies a shift if that is the case. NB: ALWAYS returns FALSE.
Checks whether given particle has crossed the closest wall, and if so, shifts its position so as to have it appear at the other wall
[in] | p | The particle to be checked and possibly shifted |
pH | The ParticleHandler, which is unused in this implementation |
Definition at line 391 of file PeriodicBoundary.cc.
References getDistance(), and shiftPosition().
|
overridevirtual |
copy method
Copy method; creates a copy on the heap and returns its pointer.
Implements BaseBoundary.
Definition at line 66 of file PeriodicBoundary.cc.
References PeriodicBoundary().
void PeriodicBoundary::createPeriodicParticles | ( | BaseParticle * | p, |
ParticleHandler & | pH | ||
) |
Checks distance of particle to closest wall and creates periodic copy if necessary.
Checks the distance of given particle to the closest of both periodic walls, and creates a periodic copy of the particle if needed (i.e. if the particle is closer to the periodic wall than the radius of the largest particle in the system).
[in] | p | Particle to be checked and possibly periodically copied |
[in,out] | pH | System's ParticleHandler, (1) from which the interaction radius of its largest particle is retrieved to determine the maximum distance from the wall at which a particle should still have a periodic copy created, and (2) to which a possible periodic copy of the particle will be added |
Definition at line 358 of file PeriodicBoundary.cc.
References ParticleHandler::addObject(), BaseParticle::copy(), BaseInteractable::copyInteractionsForPeriodicParticles(), getDistance(), BaseParticle::getInteractionRadius(), ParticleHandler::getLargestParticle(), BaseParticle::getPeriodicFromParticle(), BaseParticle::setPeriodicFromParticle(), and shiftPosition().
Mdouble PeriodicBoundary::getDistance | ( | const BaseParticle & | p | ) | const |
Returns the distance of the wall to the particle.
Returns the distance to the closest wall of the boundary to the particle. Since this function should be called before calculating any Particle-Wall interactions, it can also be used to set the shift vector in case of curved walls. Positive means that the particle is insid-> the periodic domain, negative means that it is outsid-> the periodic domain.
[in] | p | A reference to the particle which distance to the periodic boundary is calculated |
Definition at line 182 of file PeriodicBoundary.cc.
References BaseInteractable::getPosition().
Referenced by checkBoundaryAfterParticleMoved(), DPMBase::checkParticleForInteractionLocalPeriodic(), and createPeriodicParticles().
Returns the distance of the wall to the position.
Returns the distance to the wall closest to the position
[in] | position | A reference to the position which distance to the periodic boundary is to be calculated |
Definition at line 192 of file PeriodicBoundary.cc.
References distanceLeft_, distanceRight_, Vec3D::dot(), and normal_.
Mdouble PeriodicBoundary::getDistanceLeft | ( | ) | const |
Returns the distance of the left wall to the origin, in normal direction.
Definition at line 128 of file PeriodicBoundary.cc.
References distanceLeft_.
Mdouble PeriodicBoundary::getDistanceRight | ( | ) | const |
Returns the distance of the right wall to the origin, in normal direction.
Definition at line 136 of file PeriodicBoundary.cc.
References distanceRight_.
|
overridevirtual |
Returns the name of the object.
Returns the name of the object class
Implements BaseObject.
Definition at line 334 of file PeriodicBoundary.cc.
Vec3D PeriodicBoundary::getNormal | ( | ) | const |
returns the vector normal to the periodic boundary
Definition at line 120 of file PeriodicBoundary.cc.
References normal_.
Vec3D PeriodicBoundary::getShift | ( | ) | const |
Returns the vector going from the left to the right side of the periodic boundary.
Definition at line 144 of file PeriodicBoundary.cc.
References shift_.
bool PeriodicBoundary::isClosestToLeftBoundary | ( | const BaseParticle & | p | ) | const |
Returns TRUE if last particle/position checked is closest to the 'left' wall, and FALSE if it is closest to the 'right' wall.
Definition at line 254 of file PeriodicBoundary.cc.
References BaseInteractable::getPosition().
Referenced by shiftPosition(), and shiftPositions().
bool PeriodicBoundary::isClosestToLeftBoundary | ( | const Vec3D & | p | ) | const |
Definition at line 264 of file PeriodicBoundary.cc.
References distanceLeft_, distanceRight_, Vec3D::dot(), and normal_.
void PeriodicBoundary::moveLeft | ( | Mdouble | distanceLeft | ) |
Sets the distance from the origin of the 'left' periodic wall.
Allows the left periodic boundary to be moved to a new position and automatically changes its shift value
[in] | distanceLeft | The distance (from the origin) to which the left boundary is moved |
Definition at line 155 of file PeriodicBoundary.cc.
References distanceLeft_, distanceRight_, normal_, scaleFactor_, and shift_.
void PeriodicBoundary::moveRight | ( | Mdouble | distanceRight | ) |
Sets the distance from the origin of the 'right' periodic wall.
Allows the right periodic wall to be moved to a new position and automatically changes its shift value
[in] | distanceRight | The distance (from the origin) to which the right boundary is moved |
Definition at line 167 of file PeriodicBoundary.cc.
References distanceLeft_, distanceRight_, normal_, scaleFactor_, and shift_.
void PeriodicBoundary::oldRead | ( | std::istream & | is | ) |
deprecated version of CubeInsertionBoundary::read().
Deprecated version of read().
Definition at line 306 of file PeriodicBoundary.cc.
References distanceLeft_, distanceRight_, normal_, scaleFactor_, and shift_.
|
overridevirtual |
reads boundary properties from istream
Reads the boundary properties from an istream
[in] | is | the istream |
Implements BaseBoundary.
Definition at line 291 of file PeriodicBoundary.cc.
References distanceLeft_, distanceRight_, normal_, BaseBoundary::read(), scaleFactor_, and shift_.
Defines a periodic wall.
Defines the boundary, given a normal vector such that all particles are within {x: position_left<=normal*x<position_right}. The shift vector is set assuming that the domain is rectangular (shift parallel to normal).
[in] | normal | The normal vector pointing from the left wall into the domain |
[in] | distanceLeft | The (signed) distance between the left wall and the origin |
[in] | distanceRight | The (signed) distance between the right wall and the origin |
Definition at line 79 of file PeriodicBoundary.cc.
References distanceLeft_, distanceRight_, Vec3D::dot(), logger, normal_, scaleFactor_, and shift_.
Referenced by BoundaryHandler::readOldObject(), DPMBase::readParAndIniFiles(), set(), ChuteBottom::setupInitialConditions(), and Chute::setupSideWalls().
Definition at line 91 of file PeriodicBoundary.cc.
References Vec3D::dot(), and set().
void PeriodicBoundary::set | ( | Vec3D | normal, |
Mdouble | distanceLeft, | ||
Mdouble | distanceRight, | ||
Vec3D | shiftDirection | ||
) |
For general parallelogramic domains, the direction of the shift vector can to be set manually.
like PeriodicBoundary::set(normal, distanceLeft, distanceRight), but including the possibility of setting the shift direction vector.
[in] | normal | The normal vector pointing from the left wall into the domain |
[in] | distanceLeft | The (signed) distance between the left wall and the origin |
[in] | distanceRight | The (signed) distance between the right wall and the origin |
[in] | shiftDirection | The vector over which particles will be shifted when moving through the PeriodicBoundary |
Definition at line 105 of file PeriodicBoundary.cc.
References distanceLeft_, distanceRight_, Vec3D::dot(), normal_, scaleFactor_, and shift_.
void PeriodicBoundary::shiftPosition | ( | BaseParticle * | p | ) | const |
shifts the particle
[in] | p | A pointer to the particle which will be shifted. |
Shifts the particle either to the left or right, using the method isClosestToLeftBoundary to determine which sid-> it should be shifted to.
[in] | p | A pointer to the particle which will be shifted. |
Definition at line 203 of file PeriodicBoundary.cc.
References isClosestToLeftBoundary(), BaseInteractable::move(), and shift_.
Referenced by checkBoundaryAfterParticleMoved(), DPMBase::checkParticleForInteractionLocalPeriodic(), and createPeriodicParticles().
shifts two positions
Shifts two given positions by the shift_ vector.
[in] | position1 | The first position to be shifted |
[in] | position2 | The second position to be shifted |
Definition at line 235 of file PeriodicBoundary.cc.
References isClosestToLeftBoundary(), and shift_.
|
overridevirtual |
writes boundary properties to ostream
Writes boundary's properties to an ostream
[in] | os | the ostream |
Implements BaseBoundary.
Definition at line 320 of file PeriodicBoundary.cc.
References distanceLeft_, distanceRight_, normal_, scaleFactor_, shift_, and BaseBoundary::write().
|
private |
position of left wall, s.t. normal*x=position_left
Definition at line 185 of file PeriodicBoundary.h.
Referenced by getDistance(), getDistanceLeft(), isClosestToLeftBoundary(), moveLeft(), moveRight(), oldRead(), PeriodicBoundary(), read(), set(), and write().
|
private |
position of right wall, s.t. normal*x=position_right
Definition at line 189 of file PeriodicBoundary.h.
Referenced by getDistance(), getDistanceRight(), isClosestToLeftBoundary(), moveLeft(), moveRight(), oldRead(), PeriodicBoundary(), read(), set(), and write().
|
private |
outward unit normal vector for right wall
Definition at line 181 of file PeriodicBoundary.h.
Referenced by getDistance(), getNormal(), isClosestToLeftBoundary(), moveLeft(), moveRight(), oldRead(), read(), set(), and write().
|
private |
This is the normal to rescale the normal vector to a unit vectors.
Definition at line 193 of file PeriodicBoundary.h.
Referenced by moveLeft(), moveRight(), oldRead(), PeriodicBoundary(), read(), set(), and write().
|
private |
shift from left to right boundary
Definition at line 197 of file PeriodicBoundary.h.
Referenced by getShift(), moveLeft(), moveRight(), oldRead(), read(), set(), shiftPosition(), shiftPositions(), and write().