LeesEdwardsBoundary.h
Go to the documentation of this file.
1 // This file is part of the MercuryDPM project (https://www.mercurydpm.org).
2 // Copyright (c), The MercuryDPM Developers Team. All rights reserved.
3 // License: BSD 3-Clause License; see the LICENSE file in the root directory.
4 
5 #ifndef LEESEDWARDSBOUNDARY_H
6 #define LEESEDWARDSBOUNDARY_H
7 
8 #include "BaseBoundary.h"
9 
10 #include <functional>
11 
12 class ParticleHandler;
13 
26 {
27 public:
28 
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  }
39 
44 
48  void
49  set(std::function<Mdouble(Mdouble)> shift, std::function<Mdouble(Mdouble)> velocity, Mdouble left, Mdouble right,
50  Mdouble down, Mdouble up);
51 
52  void updateBoundaries(Mdouble left, Mdouble right, Mdouble down, Mdouble up);
53 
57  void read(std::istream& is) override;
58 
62  void write(std::ostream& os) const override;
63 
67  std::string getName() const override;
68 
72  LeesEdwardsBoundary* copy() const override;
73 
77  Mdouble getHorizontalDistance(BaseParticle& p, bool& positive);
78 
82  Mdouble getVerticalDistance(BaseParticle& p, bool& positive);
83 
87  void shiftHorizontalPosition(BaseParticle* p, bool positive);
88 
92  void shiftVerticalPosition(BaseParticle* p, bool positive);
93 
98 
103 
105 
109  void createPeriodicParticles(ParticleHandler& pH) override;
110 
115 
120 
122 
124 
125  void setShift(std::function<Mdouble(Mdouble)>);
126 
127  void setVelocity(std::function<Mdouble(Mdouble)>);
128 
129 private:
134  std::function<Mdouble(Mdouble)> shift_;
135  std::function<Mdouble(Mdouble)> velocity_;
136 };
137 
138 #endif
double Mdouble
Definition: GeneralDefine.h:13
Logger< MERCURYDPM_LOGLEVEL > logger("MercuryKernel")
Definition of different loggers with certain modules. A user can define its own custom logger here.
@ WARN
float * p
Definition: Tutorial_Map_using.cpp:9
Definition: BaseBoundary.h:28
Definition: BaseParticle.h:33
Class which creates a boundary with Lees-Edwards type periodic boundary conditions.
Definition: LeesEdwardsBoundary.h:26
Mdouble getVerticalDistance(BaseParticle &p, bool &positive)
Returns distance from given particle to the closest vertical wall.
Definition: LeesEdwardsBoundary.cc:121
void setVelocity(std::function< Mdouble(Mdouble)>)
Definition: LeesEdwardsBoundary.cc:320
Mdouble down_
(signed) Horizontal distance between the right wall and the origin
Definition: LeesEdwardsBoundary.h:132
LeesEdwardsBoundary * copy() const override
Creates a copy of the object.
Definition: LeesEdwardsBoundary.cc:88
void set(std::function< Mdouble(Mdouble)> shift, std::function< Mdouble(Mdouble)> velocity, Mdouble left, Mdouble right, Mdouble down, Mdouble up)
Sets all boundary properties.
Definition: LeesEdwardsBoundary.cc:29
std::string getName() const override
Returns the name of the object.
Definition: LeesEdwardsBoundary.cc:79
Mdouble left_
Definition: LeesEdwardsBoundary.h:130
void write(std::ostream &os) const override
Writes all boundary properties to a stream.
Definition: LeesEdwardsBoundary.cc:68
Mdouble right_
(signed) Horizontal distance between the left wall and the origin
Definition: LeesEdwardsBoundary.h:131
Mdouble getHorizontalDistance(BaseParticle &p, bool &positive)
Returns distance from given particle to the closest horizontal wall.
Definition: LeesEdwardsBoundary.cc:99
void checkBoundaryAfterParticlesMove(ParticleHandler &pH) override
Checks if particles need to be adjusted after their position has been updated.
Definition: LeesEdwardsBoundary.cc:294
void checkBoundaryAfterParticleMoved(BaseParticle *p)
Checks if particle crossed a boundary wall and if so, applies periodic shift.
Definition: LeesEdwardsBoundary.cc:281
void read(std::istream &is) override
Reads all boundary properties from a stream.
Definition: LeesEdwardsBoundary.cc:53
LeesEdwardsBoundary()
Definition: LeesEdwardsBoundary.h:29
void shiftHorizontalPosition(BaseParticle *p, bool positive)
Applies a horizontal shift to the given particle.
Definition: LeesEdwardsBoundary.cc:144
void createVerticalPeriodicParticle(BaseParticle *p, ParticleHandler &pH)
Creates vertical periodic copies of given particle, if needed.
Definition: LeesEdwardsBoundary.cc:224
Mdouble up_
(signed) Vertical distance between the bottom wall and the origin
Definition: LeesEdwardsBoundary.h:133
void shiftVerticalPosition(BaseParticle *p, bool positive)
Applies a vertical shift to the given particle.
Definition: LeesEdwardsBoundary.cc:163
Mdouble getCurrentShift()
Definition: LeesEdwardsBoundary.cc:303
void createPeriodicParticle(BaseParticle *p, ParticleHandler &pH) override
Definition: LeesEdwardsBoundary.cc:261
void setShift(std::function< Mdouble(Mdouble)>)
Definition: LeesEdwardsBoundary.cc:315
void createHorizontalPeriodicParticle(BaseParticle *p, ParticleHandler &pH)
Creates horizontal periodic copies of given particle, if needed.
Definition: LeesEdwardsBoundary.cc:186
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
void updateBoundaries(Mdouble left, Mdouble right, Mdouble down, Mdouble up)
Definition: LeesEdwardsBoundary.cc:40
Mdouble getCurrentVelocity()
Definition: LeesEdwardsBoundary.cc:309
void createPeriodicParticles(ParticleHandler &pH) override
Creates horizontal and vertical periodic copies of given particle, if needed.
Definition: LeesEdwardsBoundary.cc:267
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
Container to store pointers to all particles.
Definition: ParticleHandler.h:28
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