LeesEdwardsBoundary Class Reference

Class which creates a boundary with Lees-Edwards type periodic boundary conditions. More...

#include <LeesEdwardsBoundary.h>

+ Inheritance diagram for LeesEdwardsBoundary:

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...
 
LeesEdwardsBoundarycopy () 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...
 
BoundaryHandlergetHandler () 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_
 

Detailed Description

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.

Todo:

Add link to paper by Lees-Edwards in the documentation of this class.

Is implemented for 2D only now. Needs extension to 3D.

Constructor & Destructor Documentation

◆ LeesEdwardsBoundary() [1/2]

LeesEdwardsBoundary::LeesEdwardsBoundary ( )
inline
30  {
31 #ifdef MERCURYDPM_USE_MPI
32  MPIContainer& communicator = MPIContainer::Instance();
33  if (communicator.getNumberOfProcessors() > 1)
34  {
35  logger(WARN,"LeesEdwardsBoundaries are currently not implemented in parallel MercuryDPM");
36  }
37 #endif
38  }
Logger< MERCURYDPM_LOGLEVEL > logger("MercuryKernel")
Definition of different loggers with certain modules. A user can define its own custom logger here.
@ WARN
This class contains all information and functions required for communication between processors.
Definition: MpiContainer.h:109
std::size_t getNumberOfProcessors() const
Get the total number of processors participating in this simulation.
Definition: MpiContainer.cc:83
static MPIContainer & Instance()
fetch the instance to be used for communication
Definition: MpiContainer.h:113

References MPIContainer::getNumberOfProcessors(), MPIContainer::Instance(), logger, and WARN.

Referenced by copy().

◆ LeesEdwardsBoundary() [2/2]

LeesEdwardsBoundary::LeesEdwardsBoundary ( const LeesEdwardsBoundary other)

Copy constructor.

10  : BaseBoundary(other)
11 {
12  shift_ = other.shift_;
13  velocity_ = other.velocity_;
14  left_ = other.left_;
15  right_ = other.right_;
16  down_ = other.down_;
17  up_ = other.up_;
18 }
BaseBoundary()
default constructor.
Definition: BaseBoundary.cc:11
Mdouble down_
(signed) Horizontal distance between the right wall and the origin
Definition: LeesEdwardsBoundary.h:132
Mdouble left_
Definition: LeesEdwardsBoundary.h:130
Mdouble right_
(signed) Horizontal distance between the left wall and the origin
Definition: LeesEdwardsBoundary.h:131
Mdouble up_
(signed) Vertical distance between the bottom wall and the origin
Definition: LeesEdwardsBoundary.h:133
std::function< Mdouble(Mdouble)> velocity_
Definition: LeesEdwardsBoundary.h:135
std::function< Mdouble(Mdouble)> shift_
(signed) Vertical distance between the top wall and the origin
Definition: LeesEdwardsBoundary.h:134

References down_, left_, right_, shift_, up_, and velocity_.

Member Function Documentation

◆ checkBoundaryAfterParticleMoved()

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

Parameters
[in]pA pointer to the BaseParticle that is checked
282 {
283  bool positive;
284  while (getVerticalDistance(*p, positive) < 0)
285  {
286  shiftVerticalPosition(p, positive);
287  }
288  while (getHorizontalDistance(*p, positive) < 0)
289  {
290  shiftHorizontalPosition(p, positive);
291  }
292 }
float * p
Definition: Tutorial_Map_using.cpp:9
Mdouble getVerticalDistance(BaseParticle &p, bool &positive)
Returns distance from given particle to the closest vertical wall.
Definition: LeesEdwardsBoundary.cc:121
Mdouble getHorizontalDistance(BaseParticle &p, bool &positive)
Returns distance from given particle to the closest horizontal wall.
Definition: LeesEdwardsBoundary.cc:99
void shiftHorizontalPosition(BaseParticle *p, bool positive)
Applies a horizontal shift to the given particle.
Definition: LeesEdwardsBoundary.cc:144
void shiftVerticalPosition(BaseParticle *p, bool positive)
Applies a vertical shift to the given particle.
Definition: LeesEdwardsBoundary.cc:163

References getHorizontalDistance(), getVerticalDistance(), p, shiftHorizontalPosition(), and shiftVerticalPosition().

Referenced by checkBoundaryAfterParticlesMove().

◆ checkBoundaryAfterParticlesMove()

void LeesEdwardsBoundary::checkBoundaryAfterParticlesMove ( ParticleHandler pH)
overridevirtual

Checks if particles need to be adjusted after their position has been updated.

Reimplemented from BaseBoundary.

295 {
296  for (auto p = pH.begin(); p != pH.end(); ++p)
297  {
299  }
300 }
const std::vector< T * >::const_iterator begin() const
Gets the begin of the const_iterator over all Object in this BaseHandler.
Definition: BaseHandler.h:698
const std::vector< T * >::const_iterator end() const
Gets the end of the const_iterator over all BaseBoundary in this BaseHandler.
Definition: BaseHandler.h:712
void checkBoundaryAfterParticleMoved(BaseParticle *p)
Checks if particle crossed a boundary wall and if so, applies periodic shift.
Definition: LeesEdwardsBoundary.cc:281

References BaseHandler< T >::begin(), checkBoundaryAfterParticleMoved(), BaseHandler< T >::end(), and p.

◆ copy()

LeesEdwardsBoundary * LeesEdwardsBoundary::copy ( ) const
overridevirtual

Creates a copy of the object.

Copy method; creates a copy on the heap and returns its pointer.

Returns
pointer to the copy on the heap

Implements BaseBoundary.

89 {
90  return new LeesEdwardsBoundary(*this);
91 }
LeesEdwardsBoundary()
Definition: LeesEdwardsBoundary.h:29

References LeesEdwardsBoundary().

◆ createHorizontalPeriodicParticle()

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

Parameters
[in]pA pointer to the BaseParticle that is checked
[out]pHA reference to the ParticleHandler where periodic copies will be added
187 {
188  bool positive; // TRUE if the particle is closest to the left boundary
189  // wall (set by getVerticalDistance in the following if-statement)
190  //
191  // Note, 'positive' is passed by reference to getHorizontalDistance
192  // check if particle is close enough to either of the walls
193  const Mdouble maxDistance = p->getMaxInteractionRadius() + pH.getLargestParticle()->getMaxInteractionRadius();
194  if (getHorizontalDistance(*p, positive) < maxDistance)
195  {
196  // create a periodic copy of the particle
197  BaseParticle* F0 = p->copy();
198  pH.addObject(F0);
200 
201  // If Particle is doubly shifted, get correct original particle
202  BaseParticle* From = p;
203  while (From->getPeriodicFromParticle() != nullptr)
204  From = From->getPeriodicFromParticle();
205  F0->setPeriodicFromParticle(From);
206 
207  // shift the copy to the 'periodic' position
208  shiftHorizontalPosition(F0, positive);
209 
210  // NB: No extra creation of possible vertical copies of the horizontal copy
211  // here (as compared to createVerticalPeriodicParticle), because these would
212  // overlap with the extra creation of horizontal copies in createVerticalPeriodicParticle.
213  }
214 }
void copyInteractionsForPeriodicParticles(const BaseInteractable &p)
Copies interactions to this BaseInteractable whenever a periodic copy made.
Definition: BaseInteractable.cc:364
Definition: BaseParticle.h:33
void setPeriodicFromParticle(BaseParticle *p)
Assigns the pointer to the 'original' particle this one's a periodic copy of (used in periodic bounda...
Definition: BaseParticle.h:416
Mdouble getMaxInteractionRadius() const
Returns the particle's interaction radius, which might be different from radius_ (e....
Definition: BaseParticle.h:345
BaseParticle * getPeriodicFromParticle() const
Returns the 'original' particle this one's a periodic copy of.
Definition: BaseParticle.h:324
void addObject(BaseParticle *P) override
Adds a BaseParticle to the ParticleHandler.
Definition: ParticleHandler.cc:150
BaseParticle * getLargestParticle() const
Returns the pointer of the largest particle in the particle handler. When mercury is running in paral...
Definition: ParticleHandler.cc:528

References ParticleHandler::addObject(), BaseInteractable::copyInteractionsForPeriodicParticles(), getHorizontalDistance(), ParticleHandler::getLargestParticle(), BaseParticle::getMaxInteractionRadius(), BaseParticle::getPeriodicFromParticle(), p, BaseParticle::setPeriodicFromParticle(), and shiftHorizontalPosition().

Referenced by createPeriodicParticle(), and createVerticalPeriodicParticle().

◆ createPeriodicParticle()

void LeesEdwardsBoundary::createPeriodicParticle ( BaseParticle p,
ParticleHandler pH 
)
override

Check if periodic copies of the particle have to be made for the contact detection and if so makes them

Parameters
[in]pA pointer to the BaseParticle that is checked
[out]pHA reference to the ParticleHandler where periodic copies will be added
262 {
265 }
void createVerticalPeriodicParticle(BaseParticle *p, ParticleHandler &pH)
Creates vertical periodic copies of given particle, if needed.
Definition: LeesEdwardsBoundary.cc:224
void createHorizontalPeriodicParticle(BaseParticle *p, ParticleHandler &pH)
Creates horizontal periodic copies of given particle, if needed.
Definition: LeesEdwardsBoundary.cc:186

References createHorizontalPeriodicParticle(), createVerticalPeriodicParticle(), and p.

Referenced by createPeriodicParticles().

◆ createPeriodicParticles()

void LeesEdwardsBoundary::createPeriodicParticles ( ParticleHandler pH)
override

Creates horizontal and vertical periodic copies of given particle, if needed.

268 {
269  unsigned numberOfParticles = pH.getSize();
270  for (unsigned i = 0; i < numberOfParticles; i++)
271  {
273  }
274 }
int i
Definition: BiCGSTAB_step_by_step.cpp:9
unsigned int getSize() const
Gets the size of the particleHandler (including mpi and periodic particles)
Definition: BaseHandler.h:663
T * getObject(const unsigned int id)
Gets a pointer to the Object at the specified index in the BaseHandler.
Definition: BaseHandler.h:621
void createPeriodicParticle(BaseParticle *p, ParticleHandler &pH) override
Definition: LeesEdwardsBoundary.cc:261

References createPeriodicParticle(), BaseHandler< T >::getObject(), BaseHandler< T >::getSize(), and i.

◆ createVerticalPeriodicParticle()

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

Parameters
[in]pA pointer to the BaseParticle that is checked
[out]pHA reference to the ParticleHandler where periodic copies will be added
225 {
226  bool positive; // TRUE if the particle is closest to the bottom boundary
227  // wall (set by getVerticalDistance in the following if-statement)
228  // check if particle is close enough to either of the walls
229  const Mdouble maxDistance = p->getMaxInteractionRadius() + pH.getLargestParticle()->getMaxInteractionRadius();
230  if (getVerticalDistance(*p, positive) < maxDistance)
231  {
232  // create a periodic copy of the particle
233  BaseParticle* F0 = p->copy();
234  pH.addObject(F0);
236 
237  // If Particle is doubly shifted, get correct original particle
238  BaseParticle* From = p;
239  while (From->getPeriodicFromParticle() != nullptr)
240  From = From->getPeriodicFromParticle();
241  F0->setPeriodicFromParticle(From);
242 
243  // shift the copy to the 'periodic' position
244  shiftVerticalPosition(F0, positive);
245  while (getHorizontalDistance(*F0, positive) < 0)
246  {
247  shiftHorizontalPosition(F0, positive);
248  }
249 
250  // Create horizontal periodic copies of the copy particle, if needed (i.e.,
251  // if the original particle is in one of the boundary corners).
253  }
254 }
T * getLastObject()
Gets a pointer to the last Object in this BaseHandler.
Definition: BaseHandler.h:642

References ParticleHandler::addObject(), BaseInteractable::copyInteractionsForPeriodicParticles(), createHorizontalPeriodicParticle(), getHorizontalDistance(), ParticleHandler::getLargestParticle(), BaseHandler< T >::getLastObject(), BaseParticle::getMaxInteractionRadius(), BaseParticle::getPeriodicFromParticle(), getVerticalDistance(), p, BaseParticle::setPeriodicFromParticle(), shiftHorizontalPosition(), and shiftVerticalPosition().

Referenced by createPeriodicParticle().

◆ getCurrentShift()

Mdouble LeesEdwardsBoundary::getCurrentShift ( )
304 {
305  Mdouble time = getHandler()->getDPMBase()->getTime();
306  return shift_(time);
307 }
BoundaryHandler * getHandler() const
Returns the boundary's BoundaryHandler.
Definition: BaseBoundary.cc:122
DPMBase * getDPMBase()
Gets the problem that is solved using this handler.
Definition: BaseHandler.h:733
Mdouble getTime() const
Returns the current simulation time.
Definition: DPMBase.cc:799

References BaseHandler< T >::getDPMBase(), BaseBoundary::getHandler(), DPMBase::getTime(), and shift_.

◆ getCurrentVelocity()

Mdouble LeesEdwardsBoundary::getCurrentVelocity ( )
310 {
311  Mdouble time = getHandler()->getDPMBase()->getTime();
312  return velocity_(time);
313 }

References BaseHandler< T >::getDPMBase(), BaseBoundary::getHandler(), DPMBase::getTime(), and velocity_.

◆ getHorizontalDistance()

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

Parameters
[in]pA reference to the BaseParticle
[out]positiveA boolean which is true when the left wall is closest
Returns
The distance to the closes wall in horizontal direction
100 {
101  Mdouble left = p.getPosition().X - left_;
102  Mdouble right = right_ - p.getPosition().X;
103  if (left < right)
104  {
105  positive = true;
106  return left;
107  }
108  else
109  {
110  positive = false;
111  return right;
112  }
113 }

References left_, p, and right_.

Referenced by checkBoundaryAfterParticleMoved(), createHorizontalPeriodicParticle(), and createVerticalPeriodicParticle().

◆ getName()

std::string LeesEdwardsBoundary::getName ( ) const
overridevirtual

Returns the name of the object.

Returns
The name of this object (i.e. "LeesEdwardsBoundary")

Implements BaseObject.

80 {
81  return "LeesEdwardsBoundary";
82 }

◆ getVerticalDistance()

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

Parameters
[in]pA reference to the BaseParticle
[out]positiveA boolean which is true when the bottom wall is closest
Returns
The distance to the closes wall in vertical direction
122 {
123  Mdouble down = p.getPosition().Y - down_;
124  Mdouble up = up_ - p.getPosition().Y;
125  if (down < up)
126  {
127  positive = true;
128  return down;
129  }
130  else
131  {
132  positive = false;
133  return up;
134  }
135 }

References down_, p, and up_.

Referenced by checkBoundaryAfterParticleMoved(), and createVerticalPeriodicParticle().

◆ read()

void LeesEdwardsBoundary::read ( std::istream &  is)
overridevirtual

Reads all boundary properties from a stream.

Reads all the properties of the LeesEdwardsBoundary from an std::istream

Parameters
[in,out]isThe stream from which the parameters are read

Implements BaseBoundary.

54 {
55  std::string dummy;
57  Mdouble shift;
59  is >> dummy >> left_ >> dummy >> right_ >> dummy >> down_ >> dummy >> up_ >> dummy >> shift >> dummy >> velocity;
60  shift_ = [shift, velocity](Mdouble time UNUSED) { return shift + velocity * time; };
61  velocity_ = [velocity](Mdouble time UNUSED) { return velocity; };
62 }
#define UNUSED
Definition: GeneralDefine.h:18
void read(std::istream &is) override=0
Reads the object's id_ from given istream NB: purely virtual function, overriding the version of Base...
Definition: BaseBoundary.cc:40
double velocity(const double &t)
Angular velocity as function of time t.
Definition: jeffery_orbit.cc:107
std::string string(const unsigned &i)
Definition: oomph_definitions.cc:286

References down_, left_, BaseBoundary::read(), right_, shift_, oomph::Global_string_for_annotation::string(), UNUSED, up_, Jeffery_Solution::velocity(), and velocity_.

◆ set()

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.

Parameters
[in]velocityThe difference in velocities at which the bottom and to wall move
[in]leftThe (signed) distance between the origin and the left wall
[in]rightThe (signed) distance between the origin and the right wall
[in]downThe (signed) distance between the origin and the top wall
[in]upThe (signed) distance between the origin and the bottom wall
31 {
32  shift_ = shift;
34  left_ = left;
35  right_ = right;
36  down_ = down;
37  up_ = up;
38 }

References down_, left_, right_, shift_, up_, Jeffery_Solution::velocity(), and velocity_.

Referenced by LeesEdwardsSelfTest::LeesEdwardsSelfTest(), StressStrainControlBoundary::set(), LeesEdwardsDemo::setupInitialConditions(), and FullRestartTest::setupInitialConditions().

◆ setShift()

void LeesEdwardsBoundary::setShift ( std::function< Mdouble(Mdouble)>  shift)
316 {
317  shift_ = shift;
318 }

References shift_.

◆ setVelocity()

void LeesEdwardsBoundary::setVelocity ( std::function< Mdouble(Mdouble)>  velocity)
321 {
323 }

References Jeffery_Solution::velocity(), and velocity_.

◆ shiftHorizontalPosition()

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.

Parameters
[in]pA reference to the BaseParticle that has to be shifted
[in]positiveA boolean which determines the direction of the shift NB: TRUE if particle is closest to the left boundary wall
145 {
146  if (positive)
147  {
148  p->move(Vec3D(right_ - left_, 0.0, 0.0));
149  }
150  else
151  {
152  p->move(Vec3D(left_ - right_, 0.0, 0.0));
153  }
154 }
Definition: Kernel/Math/Vector.h:30

References left_, p, and right_.

Referenced by checkBoundaryAfterParticleMoved(), createHorizontalPeriodicParticle(), and createVerticalPeriodicParticle().

◆ shiftVerticalPosition()

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.

Parameters
[in]pA reference to the BaseParticle that has to be shifted
[in]positiveA boolean which determines the direction of the shift NB: TRUE if particle is closest to the bottom boundary wall
164 {
165  Mdouble time = getHandler()->getDPMBase()->getTime();
166  if (positive)
167  {
168  p->move(Vec3D(shift_(time), up_ - down_, 0.0));
169  p->addVelocity(Vec3D(velocity_(time), 0.0, 0.0));
170  }
171  else
172  {
173  p->move(Vec3D(-shift_(time), down_ - up_, 0.0));
174  p->addVelocity(Vec3D(-velocity_(time), 0.0, 0.0));
175  }
176 }

References down_, BaseHandler< T >::getDPMBase(), BaseBoundary::getHandler(), DPMBase::getTime(), p, shift_, up_, and velocity_.

Referenced by checkBoundaryAfterParticleMoved(), and createVerticalPeriodicParticle().

◆ updateBoundaries()

void LeesEdwardsBoundary::updateBoundaries ( Mdouble  left,
Mdouble  right,
Mdouble  down,
Mdouble  up 
)
41 {
42  left_ = left;
43  right_ = right;
44  down_ = down;
45  up_ = up;
46 }

References down_, left_, right_, and up_.

◆ write()

void LeesEdwardsBoundary::write ( std::ostream &  os) const
overridevirtual

Writes all boundary properties to a stream.

Writes all the properties of the LeesEdwardsBoundary to an std::ostream

Parameters
[out]osThe stream to which the parameters are written

Implements BaseBoundary.

69 {
71  Mdouble time = getHandler()->getDPMBase()->getTime();
72  os << " left " << left_ << " right " << right_ << " down " << down_ << " up " << up_ << " shift " << shift_(time)
73  << " vel " << velocity_(time);
74 }
void write(std::ostream &os) const override=0
Adds object's id_ to given ostream NB: purely virtual function, overriding the version of BaseObject.
Definition: BaseBoundary.cc:49

References down_, BaseHandler< T >::getDPMBase(), BaseBoundary::getHandler(), DPMBase::getTime(), left_, right_, shift_, up_, velocity_, and BaseBoundary::write().

Member Data Documentation

◆ down_

Mdouble LeesEdwardsBoundary::down_
private

(signed) Horizontal distance between the right wall and the origin

Referenced by getVerticalDistance(), LeesEdwardsBoundary(), read(), set(), shiftVerticalPosition(), updateBoundaries(), and write().

◆ left_

◆ right_

Mdouble LeesEdwardsBoundary::right_
private

(signed) Horizontal distance between the left wall and the origin

Referenced by getHorizontalDistance(), LeesEdwardsBoundary(), read(), set(), shiftHorizontalPosition(), updateBoundaries(), and write().

◆ shift_

std::function<Mdouble(Mdouble)> LeesEdwardsBoundary::shift_
private

(signed) Vertical distance between the top wall and the origin

Referenced by getCurrentShift(), LeesEdwardsBoundary(), read(), set(), setShift(), shiftVerticalPosition(), and write().

◆ up_

Mdouble LeesEdwardsBoundary::up_
private

(signed) Vertical distance between the bottom wall and the origin

Referenced by getVerticalDistance(), LeesEdwardsBoundary(), read(), set(), shiftVerticalPosition(), updateBoundaries(), and write().

◆ velocity_

std::function<Mdouble(Mdouble)> LeesEdwardsBoundary::velocity_
private

The documentation for this class was generated from the following files: