![]() |
|
Class which creates a boundary with Lees-Edwards type periodic boundary conditions. More...
#include <TimeDependentPeriodicBoundary.h>
Public Member Functions | |
TimeDependentPeriodicBoundary () | |
default constructor More... | |
~TimeDependentPeriodicBoundary () | |
destructor More... | |
TimeDependentPeriodicBoundary * | copy () const override |
copy method More... | |
TimeDependentPeriodicBoundary (const TimeDependentPeriodicBoundary &other) | |
copy constructor More... | |
void | set (Vec3D normal, Mdouble distanceLeft, Mdouble distanceRight, std::function< Vec3D(Mdouble)> planewiseShift, std::function< Vec3D(Mdouble)> boost) |
Defines a TimeDependentPeriodicBoundary by its normal and positions, and by the shifting and boosting that it does (projected onto the planewise direction) More... | |
void | set (Vec3D normal, Vec3D positionLeft, Vec3D positionRight, std::function< Vec3D(Mdouble)> shift, std::function< Vec3D(Mdouble)> boost) |
As above, but by specifying two positions that the boundaries go through instead of distanceLeft and distanceRight. More... | |
void | setPlanewiseShiftAndBoost (std::function< Vec3D(Mdouble)> shift, std::function< Vec3D(Mdouble)> boost) |
Set the planewise shift and boost (projected onto the planewise direction) as functions of time. (Boost should be the derivative of shift) More... | |
void | setMaxShift (Mdouble maxShift) |
Set the maximum shift (will take fmod w.r.t. this) 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 (Mdouble time) const |
Returns the vector going from the left to the right side of the periodic boundary. More... | |
Vec3D | getPlanewiseShift (Mdouble time) const |
Returns the planewise shift as a function of time. More... | |
Vec3D | getBoost (Mdouble time) const |
Returns the planewise boost as a function of time. 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 and boosts the particle More... | |
virtual void | shiftAndBoostParticle (BaseParticle *p, Mdouble time) const |
virtual void | shiftPositions (Vec3D &position1, Vec3D &position2) const |
shifts two positions (JMFT: Why, what is this for?) More... | |
virtual bool | isClosestToLeftBoundary (const BaseParticle &p) const |
Returns true if particle checked is closer to the 'left' edge, and false if it is closer to the 'right' edge. More... | |
virtual bool | isClosestToLeftBoundary (const Vec3D &p) const override |
Returns true if position checked is closer to the 'left' edge, and false if it is closer to the 'right' edge. More... | |
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... | |
virtual 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... | |
![]() | |
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... | |
![]() | |
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... | |
![]() | |
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... | |
std::function< Vec3D(Mdouble)> | planewiseShift_ |
shift from left to right boundary in the planewise direction (Note: total shift = planewiseShift_(time) + normal * (distanceRight_ - distanceLeft_) More... | |
std::function< Vec3D(Mdouble)> | boost_ |
boost from the left to right boundary More... | |
Mdouble | maxShift_ |
Maximum shifting (will take fmod(shift, maxshift) ) More... | |
Class which creates a boundary with Lees-Edwards type periodic boundary conditions.
A TimeDependentPeriodicBoundary is like a PeriodicBoundary, but, when a particle crosses an edge,
In general, the shift and the boost may depend on time in an arbitrary way. They are to be specified as std::function<Mdouble (Mdouble)>.
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.
TimeDependentPeriodicBoundary::TimeDependentPeriodicBoundary | ( | ) |
default constructor
constructor
References DEBUG, distanceLeft_, distanceRight_, MPIContainer::getNumberOfProcessors(), MPIContainer::Instance(), logger, maxShift_, and WARN.
Referenced by copy().
TimeDependentPeriodicBoundary::~TimeDependentPeriodicBoundary | ( | ) |
TimeDependentPeriodicBoundary::TimeDependentPeriodicBoundary | ( | const TimeDependentPeriodicBoundary & | other | ) |
copy constructor
Copy constructor
References boost_, distanceLeft_, distanceRight_, maxShift_, normal_, and planewiseShift_.
|
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.
References BaseHandler< T >::begin(), BaseHandler< T >::end(), getDistance(), BaseHandler< T >::getDPMBase(), DPMBase::getTime(), NUMBER_OF_PROCESSORS, p, and shiftAndBoostParticle().
|
overridevirtual |
copy method
Copy method; creates a copy on the heap and returns its pointer.
Implements BasePeriodicBoundary.
References TimeDependentPeriodicBoundary().
void TimeDependentPeriodicBoundary::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::getTime(), DPMBase::particleHandler, BaseParticle::setPeriodicFromParticle(), and shiftAndBoostParticle().
Referenced by createPeriodicParticle().
|
override |
Creates a single periodic particle if required from a given particle.
References createGhostParticle(), getDistance(), ParticleHandler::getLargestParticle(), BaseParticle::getMaxInteractionRadius(), and p.
Referenced by createPeriodicParticles().
|
overridevirtual |
Checks distance of particle to closer edge and creates a periodic copy if necessary.
References createPeriodicParticle(), BaseHandler< T >::getObject(), BaseHandler< T >::getSize(), i, and NUMBER_OF_PROCESSORS.
Returns the planewise boost as a function of time.
References boost_.
Referenced by shiftAndBoostParticle().
|
overridevirtual |
Returns the distance of the edge to the particle.
Implements BasePeriodicBoundary.
References p.
Referenced by checkBoundaryAfterParticlesMove(), and createPeriodicParticle().
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.
References distanceLeft_, distanceRight_, Vec3D::dot(), min, and normal_.
Mdouble TimeDependentPeriodicBoundary::getDistanceLeft | ( | ) | const |
Returns the distance of the left wall to the origin, in normal direction.
References distanceLeft_.
Mdouble TimeDependentPeriodicBoundary::getDistanceRight | ( | ) | const |
Returns the distance of the right wall to the origin, in normal direction.
References distanceRight_.
|
overridevirtual |
Returns the name of the object.
Returns the name of the object class
Implements BaseObject.
Vec3D TimeDependentPeriodicBoundary::getNormal | ( | ) | const |
Returns the planewise shift as a function of time.
References ERROR, Eigen::bfloat16_impl::fmod(), logger, m, maxShift_, n, p, and planewiseShift_.
Referenced by getShift().
Returns the vector going from the left to the right side of the periodic boundary.
References distanceLeft_, distanceRight_, getPlanewiseShift(), and normal_.
Referenced by shiftAndBoostParticle(), and shiftPositions().
|
virtual |
Returns true if particle checked is closer to the 'left' edge, and false if it is closer to the 'right' edge.
References p.
Referenced by shiftAndBoostParticle(), and shiftPositions().
|
overridevirtual |
Returns true if position checked is closer to the 'left' edge, and false if it is closer to the 'right' edge.
Implements BasePeriodicBoundary.
References distanceLeft_, distanceRight_, Vec3D::dot(), normal_, and p.
void TimeDependentPeriodicBoundary::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_.
void TimeDependentPeriodicBoundary::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 distanceRight_.
|
overridevirtual |
reads boundary properties from istream
Reads the boundary properties from an istream
[in] | is | the istream |
Reimplemented from BasePeriodicBoundary.
References distanceLeft_, distanceRight_, normal_, BasePeriodicBoundary::read(), and oomph::Global_string_for_annotation::string().
void TimeDependentPeriodicBoundary::set | ( | Vec3D | normal, |
Mdouble | distanceLeft, | ||
Mdouble | distanceRight, | ||
std::function< Vec3D(Mdouble)> | planewiseShift, | ||
std::function< Vec3D(Mdouble)> | boost | ||
) |
Defines a TimeDependentPeriodicBoundary by its normal and positions, and by the shifting and boosting that it does (projected onto the planewise direction)
[in] | normal | Vector specifying the normal direction of the edges |
[in] | distanceLeft | Position of the first edge |
[in] | distanceRight | Position of the second edge |
[in] | shift | Vector (projected to remove normal component) by which particles crossing an edge are to be shifted, as a function of time. |
[in] | boost | Vector (projected to remove normal component) by which particles crossing an edge are to be boosted, as a function of time. |
References boost_, distanceLeft_, distanceRight_, constants::inf, maxShift_, WallFunction::normal(), normal_, and planewiseShift_.
void TimeDependentPeriodicBoundary::set | ( | Vec3D | normal, |
Vec3D | positionLeft, | ||
Vec3D | positionRight, | ||
std::function< Vec3D(Mdouble)> | shift, | ||
std::function< Vec3D(Mdouble)> | boost | ||
) |
As above, but by specifying two positions that the boundaries go through instead of distanceLeft and distanceRight.
References Vec3D::dot(), WallFunction::normal(), and set().
Referenced by set().
void TimeDependentPeriodicBoundary::setMaxShift | ( | Mdouble | maxShift | ) |
void TimeDependentPeriodicBoundary::setPlanewiseShiftAndBoost | ( | std::function< Vec3D(Mdouble)> | shift, |
std::function< Vec3D(Mdouble)> | boost | ||
) |
Set the planewise shift and boost (projected onto the planewise direction) as functions of time. (Boost should be the derivative of shift)
References boost_, and planewiseShift_.
|
virtual |
References getBoost(), getShift(), isClosestToLeftBoundary(), and p.
Referenced by checkBoundaryAfterParticlesMove(), and createGhostParticle().
|
overridevirtual |
shifts and boosts the particle
[in] | p | A pointer to the particle which will be shifted and boosted. |
Shouldn't be used for TimeDependentPeriodicBoundary. Instead, use TimeDependentPeriodicBoundary::shiftandBoostParticle.
Implements BasePeriodicBoundary.
|
virtual |
shifts two positions (JMFT: Why, what is this for?)
References getShift(), and isClosestToLeftBoundary().
|
overridevirtual |
writes boundary properties to ostream
Writes boundary's properties to an ostream
[in] | os | the ostream |
Reimplemented from BasePeriodicBoundary.
References distanceLeft_, distanceRight_, normal_, and BasePeriodicBoundary::write().
boost from the left to right boundary
Referenced by getBoost(), set(), setPlanewiseShiftAndBoost(), and TimeDependentPeriodicBoundary().
|
protected |
position of left edge, s.t. normal*x = distanceLeft_
Referenced by getDistance(), getDistanceLeft(), getShift(), isClosestToLeftBoundary(), moveLeft(), read(), set(), TimeDependentPeriodicBoundary(), and write().
|
protected |
position of right edge, s.t. normal*x = distanceRight_
Referenced by getDistance(), getDistanceRight(), getShift(), isClosestToLeftBoundary(), moveRight(), read(), set(), TimeDependentPeriodicBoundary(), and write().
|
protected |
Maximum shifting (will take fmod(shift, maxshift) )
Referenced by getPlanewiseShift(), set(), setMaxShift(), and TimeDependentPeriodicBoundary().
|
protected |
outward unit normal vector for right edge
Referenced by getDistance(), getNormal(), getShift(), isClosestToLeftBoundary(), read(), set(), TimeDependentPeriodicBoundary(), and write().
shift from left to right boundary in the planewise direction (Note: total shift = planewiseShift_(time) + normal * (distanceRight_ - distanceLeft_)
Referenced by getPlanewiseShift(), set(), setPlanewiseShiftAndBoost(), and TimeDependentPeriodicBoundary().