|
Defines a pair of periodic walls. Inherits from BaseBoundary. More...
#include <PeriodicBoundary.h>
Public Member Functions | |
PeriodicBoundary () | |
default constructor More... | |
~PeriodicBoundary () override | |
destructor More... | |
PeriodicBoundary * | copy () const override |
copy method More... | |
PeriodicBoundary (const PeriodicBoundary &other) | |
copy constructor More... | |
void | set (Vec3D normal, Mdouble distanceLeft, Mdouble distanceRight) |
Defines a PeriodicBoundary by its normal and positions. More... | |
void | set (Vec3D normal, Vec3D positionLeft, Vec3D positionRight) |
As above, but by specifying two positions that the boundaries go through instead of distanceLeft and distanceRight. More... | |
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... | |
void | setPlanewiseShift (Vec3D planewiseShift) |
Set the planewise shift (projected onto the planewise direction, and zero by default). 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 override |
Returns the distance of the edge to the particle. More... | |
Mdouble | getDistance (const Vec3D &position) const override |
Returns the distance of the edge to the position. More... | |
virtual void | shiftPosition (BaseParticle *p) const override |
shifts the particle More... | |
void | shiftPosition (Vec3D &p) const |
virtual void | shiftPositions (Vec3D &postition1, Vec3D &postion2) const |
shifts two positions More... | |
virtual bool | isClosestToLeftBoundary (const BaseParticle &p) const |
Returns TRUE if particle checked is closest to the 'left' edge, and FALSE if it is closest to the 'right' edge. More... | |
bool | isClosestToLeftBoundary (const Vec3D &p) const override |
virtual void | createPeriodicParticles (ParticleHandler &pH) override |
Checks distance of particle to closer edge and creates a periodic copy if necessary. More... | |
void | createGhostParticle (BaseParticle *pReal) |
Creates and adds a ghost particle from a given real particle. More... | |
void | createPeriodicParticle (BaseParticle *p, ParticleHandler &pH) override |
Creates a single periodic particle if required from a given particle. More... | |
virtual void | checkBoundaryAfterParticlesMove (ParticleHandler &pH) override |
Loops over particles, checks if each particle has crossed either boundary edge, and applies a shift if that is the case. More... | |
virtual void | read (std::istream &is) override |
reads boundary properties from istream More... | |
MERCURYDPM_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... | |
std::string | getName () const override |
Returns the name of the object. More... | |
Public Member Functions inherited from BasePeriodicBoundary | |
BasePeriodicBoundary () | |
default constructor. More... | |
BasePeriodicBoundary (const BasePeriodicBoundary &b) | |
copy constructor More... | |
~BasePeriodicBoundary () override | |
destructor More... | |
void | setPeriodicHandler (PeriodicBoundaryHandler *periodicHandler) |
Sets the periodicBoundaryHandler, required for parallel periodic boundaries. More... | |
PeriodicBoundaryHandler * | getPeriodicHandler () const |
Returns the periodic boundary handler. More... | |
void | createPeriodicParticles (ParticleHandler &pH) override |
Creates periodic ocpies of given particle in case of periodic boundaries in serial build. More... | |
virtual void | modifyPeriodicComplexity (std::vector< int > &complexity, int &totalPeriodicComplexity, BaseParticle *particle, int i) const |
Modifies periodic complexity of a particle if necessary (i.e. maser boundary) More... | |
virtual void | performActionsBeforeAddingParticles () |
Actions that need to be performed before adding new ghost particles. More... | |
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 |
Protected Attributes | |
Vec3D | normal_ |
outward unit normal vector for right edge More... | |
Mdouble | distanceLeft_ |
position of left edge, s.t. normal*x = distanceLeft_ More... | |
Mdouble | distanceRight_ |
position of right edge, s.t. normal*x = distanceRight_ 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.
PeriodicBoundary::PeriodicBoundary | ( | ) |
default constructor
constructor
References DEBUG, distanceLeft_, distanceRight_, logger, and scaleFactor_.
Referenced by copy().
|
override |
PeriodicBoundary::PeriodicBoundary | ( | const PeriodicBoundary & | other | ) |
copy constructor
Copy constructor
References distanceLeft_, distanceRight_, normal_, scaleFactor_, and shift_.
|
overridevirtual |
Loops over particles, checks if each particle has crossed either boundary edge, and applies a shift if that is the case.
Loops through all particles to see if they have become ghosts. If that is the case their position is shifted. Note: This is only for a serial build - periodic particles work different in paralle
[in] |
Reimplemented from BasePeriodicBoundary.
Reimplemented in SubcriticalMaserBoundaryTEST.
References BaseHandler< T >::begin(), BaseHandler< T >::end(), getDistance(), BaseHandler< T >::getDPMBase(), BaseBoundary::getHandler(), Vec3D::getLengthSquared(), DPMBase::hGridUpdateMove(), NUMBER_OF_PROCESSORS, shift_, and shiftPosition().
|
overridevirtual |
copy method
Copy method; creates a copy on the heap and returns its pointer.
Implements BasePeriodicBoundary.
Reimplemented in SubcriticalMaserBoundaryTEST.
References PeriodicBoundary().
void PeriodicBoundary::createGhostParticle | ( | BaseParticle * | pReal | ) |
Creates and adds a ghost particle from a given real particle.
References ParticleHandler::addObject(), BaseParticle::copy(), BaseInteractable::copyInteractionsForPeriodicParticles(), BaseHandler< T >::getDPMBase(), BaseBoundary::getHandler(), BaseParticle::getPeriodicFromParticle(), DPMBase::particleHandler, BaseParticle::setPeriodicFromParticle(), BaseParticle::setPeriodicGhostParticle(), and shiftPosition().
Referenced by createPeriodicParticle(), and SubcriticalMaserBoundaryTEST::createPeriodicParticle().
|
override |
Creates a single periodic particle if required from a given particle.
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 |
References createGhostParticle(), getDistance(), ParticleHandler::getLargestParticle(), BaseParticle::getMaxInteractionRadius(), and BaseParticle::isClump().
Referenced by createPeriodicParticles().
|
overridevirtual |
Checks distance of particle to closer edge and creates a 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 |
References createPeriodicParticle(), BaseHandler< T >::getObject(), BaseHandler< T >::getSize(), constants::i, and NUMBER_OF_PROCESSORS.
|
overridevirtual |
Returns the distance of the edge to the particle.
Returns the distance to the closest edge 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 |
Implements BasePeriodicBoundary.
References BaseInteractable::getPosition().
Referenced by ChuteWithPeriodicInflow::Check_and_Duplicate_Periodic_Particle(), checkBoundaryAfterParticlesMove(), DPMBase::checkParticleForInteractionLocalPeriodic(), createPeriodicParticle(), SubcriticalMaserBoundaryTEST::getDistance(), and ChuteWithPeriodicInflow::integrateBeforeForceComputation().
Returns the distance of the edge to the position.
Returns the distance to the edge closest to the position
[in] | position | A reference to the position which distance to the periodic boundary is to be calculated |
Implements BasePeriodicBoundary.
Reimplemented in SubcriticalMaserBoundaryTEST.
References distanceLeft_, distanceRight_, Vec3D::dot(), and normal_.
Mdouble PeriodicBoundary::getDistanceLeft | ( | ) | const |
Returns the distance of the left wall to the origin, in normal direction.
References distanceLeft_.
Referenced by ConstantMassFlowMaserBoundary::ConstantMassFlowMaserBoundary(), and SubcriticalMaserBoundary::SubcriticalMaserBoundary().
Mdouble PeriodicBoundary::getDistanceRight | ( | ) | const |
Returns the distance of the right wall to the origin, in normal direction.
References distanceRight_.
Referenced by ConstantMassFlowMaserBoundary::ConstantMassFlowMaserBoundary(), and SubcriticalMaserBoundary::SubcriticalMaserBoundary().
|
overridevirtual |
Returns the name of the object.
Returns the name of the object class
Implements BaseObject.
Reimplemented in SubcriticalMaserBoundaryTEST.
Vec3D PeriodicBoundary::getNormal | ( | ) | const |
returns the vector normal to the periodic boundary
References normal_.
Referenced by ConstantMassFlowMaserBoundary::ConstantMassFlowMaserBoundary(), and SubcriticalMaserBoundary::SubcriticalMaserBoundary().
Vec3D PeriodicBoundary::getShift | ( | ) | const |
Returns the vector going from the left to the right side of the periodic boundary.
References shift_.
Referenced by ConstantMassFlowMaserBoundary::ConstantMassFlowMaserBoundary(), and SubcriticalMaserBoundary::SubcriticalMaserBoundary().
|
virtual |
Returns TRUE if particle checked is closest to the 'left' edge, and FALSE if it is closest to the 'right' edge.
References BaseInteractable::getPosition().
Referenced by ChuteWithPeriodicInflow::integrateBeforeForceComputation(), shiftPosition(), and shiftPositions().
Returns TRUE if position checked is closest to the 'left' edge, and FALSE if it is closest to the 'right' edge`.
Implements BasePeriodicBoundary.
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 |
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 |
References distanceLeft_, distanceRight_, normal_, scaleFactor_, and shift_.
void PeriodicBoundary::oldRead | ( | std::istream & | is | ) |
deprecated version of CubeInsertionBoundary::read().
Deprecated version of read().
References distanceLeft_, distanceRight_, normal_, scaleFactor_, and shift_.
|
overridevirtual |
reads boundary properties from istream
Reads the boundary properties from an istream
[in] | is | the istream |
Reimplemented from BasePeriodicBoundary.
Reimplemented in SubcriticalMaserBoundaryTEST.
References distanceLeft_, distanceRight_, normal_, BasePeriodicBoundary::read(), scaleFactor_, and shift_.
Referenced by SubcriticalMaserBoundaryTEST::read().
Defines a PeriodicBoundary by its normal and positions.
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 |
References distanceLeft_, distanceRight_, Vec3D::dot(), logger, normal_, scaleFactor_, and shift_.
Referenced by Chutebelt::actionsAfterTimeStep(), AngledPeriodicBoundaryUnitTest::AngledPeriodicBoundaryUnitTest(), ChutePeriodicDemo::ChutePeriodicDemo(), ChuteWithContraction::ChuteWithContraction(), ChuteWithPeriodicInflowAndContraction::ChuteWithPeriodicInflowAndContraction(), ClosedCSCWalls::ClosedCSCWalls(), ContractionWithPeriodicInflow::ContractionWithPeriodicInflow(), Funnel::create_walls(), SegregationPeriodic::createWalls(), CSCWalls::CSCWalls(), ChuteWithPeriodicInflow::ExtendInWidth(), FluxAndPeriodicBoundarySelfTest::FluxAndPeriodicBoundarySelfTest(), InitialConditions< SpeciesType >::InitialConditions(), main(), BoundaryHandler::readOldObject(), DPMBase::readParAndIniFiles(), StressStrainControlBoundary::set(), set(), ChutePeriodic::setupInitialConditions(), MercuryLogo::setupInitialConditions(), my_problem::setupInitialConditions(), RotatingDrumWet::setupInitialConditions(), MaserRepeatedOutInMPI2Test::setupInitialConditions(), MpiPeriodicBoundaryUnitTest::setupInitialConditions(), PeriodicBounaryEnteringMPIDomainTest::setupInitialConditions(), CubicCell::setupInitialConditions(), FreeCooling2DinWalls::setupInitialConditions(), FreeCooling3DDemoProblem::setupInitialConditions(), FreeCoolingDemoProblem::setupInitialConditions(), MinimalExampleDrum::setupInitialConditions(), Cstatic2d::setupInitialConditions(), SilbertPeriodic::setupInitialConditions(), SegregationPeriodic::setupInitialConditions(), Chutebelt::setupInitialConditions(), TriangulatedScrewSelfTest::setupInitialConditions(), ScalingTestInitialConditionsRelax::setupInitialConditions(), Tutorial6::setupInitialConditions(), Packing::setupInitialConditions(), FullRestartTest::setupInitialConditions(), MD_demo::setupInitialConditions(), MpiMaserChuteTest::setupInitialConditions(), PeriodicWalls::setupInitialConditions(), PeriodicWallsWithSlidingFrictionUnitTest::setupInitialConditions(), ChuteBottom::setupInitialConditions(), and Chute::setupSideWalls().
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 |
References distanceLeft_, distanceRight_, Vec3D::dot(), normal_, scaleFactor_, and shift_.
As above, but by specifying two positions that the boundaries go through instead of distanceLeft and distanceRight.
References Vec3D::dot(), and set().
void PeriodicBoundary::setPlanewiseShift | ( | Vec3D | planewiseShift | ) |
Set the planewise shift (projected onto the planewise direction, and zero by default).
Sets the shift_ vector through setting the planewise shift. We delete the component of planewiseShift that is parallel to normal_.
References distanceLeft_, distanceRight_, Vec3D::dot(), normal_, and shift_.
|
overridevirtual |
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. |
Implements BasePeriodicBoundary.
References isClosestToLeftBoundary(), BaseInteractable::move(), and shift_.
Referenced by ChuteWithPeriodicInflow::Check_and_Duplicate_Periodic_Particle(), SubcriticalMaserBoundaryTEST::checkBoundaryAfterParticleMoved(), checkBoundaryAfterParticlesMove(), Mercury3Dclump::checkClumpForInteractionPeriodic(), DPMBase::checkParticleForInteractionLocalPeriodic(), createGhostParticle(), and ChuteWithPeriodicInflow::integrateBeforeForceComputation().
void PeriodicBoundary::shiftPosition | ( | Vec3D & | p | ) | const |
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. |
References isClosestToLeftBoundary(), and shift_.
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 |
References isClosestToLeftBoundary(), and shift_.
|
overridevirtual |
writes boundary properties to ostream
Writes boundary's properties to an ostream
[in] | os | the ostream |
Reimplemented from BasePeriodicBoundary.
Reimplemented in SubcriticalMaserBoundaryTEST.
References distanceLeft_, distanceRight_, normal_, scaleFactor_, shift_, and BasePeriodicBoundary::write().
Referenced by SubcriticalMaserBoundaryTEST::write().
|
protected |
position of left edge, s.t. normal*x = distanceLeft_
Referenced by getDistance(), getDistanceLeft(), isClosestToLeftBoundary(), moveLeft(), moveRight(), oldRead(), PeriodicBoundary(), read(), set(), setPlanewiseShift(), SubcriticalMaserBoundaryTEST::SubcriticalMaserBoundaryTEST(), and write().
|
protected |
position of right edge, s.t. normal*x = distanceRight_
Referenced by getDistance(), SubcriticalMaserBoundaryTEST::getDistanceFromRight(), getDistanceRight(), isClosestToLeftBoundary(), moveLeft(), moveRight(), oldRead(), PeriodicBoundary(), read(), set(), setPlanewiseShift(), SubcriticalMaserBoundaryTEST::SubcriticalMaserBoundaryTEST(), and write().
|
protected |
outward unit normal vector for right edge
Referenced by getDistance(), SubcriticalMaserBoundaryTEST::getDistanceFromRight(), getNormal(), isClosestToLeftBoundary(), moveLeft(), moveRight(), oldRead(), PeriodicBoundary(), read(), set(), setPlanewiseShift(), and write().
|
protected |
This is the normal to rescale the normal vector to a unit vectors.
Referenced by moveLeft(), moveRight(), oldRead(), PeriodicBoundary(), read(), set(), and write().
|
protected |
shift from left to right boundary
Referenced by checkBoundaryAfterParticlesMove(), SubcriticalMaserBoundaryTEST::copyExtraParticles(), SubcriticalMaserBoundaryTEST::extendBottom(), getShift(), moveLeft(), moveRight(), oldRead(), PeriodicBoundary(), read(), set(), setPlanewiseShift(), shiftPosition(), shiftPositions(), and write().