RandomClusterInsertionBoundary Class Reference

#include <RandomClusterInsertionBoundary.h>

+ Inheritance diagram for RandomClusterInsertionBoundary:

Public Member Functions

 RandomClusterInsertionBoundary ()
 Constructor: inherits from BaseClusterInsertionBoundary constructor. More...
 
 RandomClusterInsertionBoundary (const RandomClusterInsertionBoundary &other)
 Copy constructor with deep copy. More...
 
 ~RandomClusterInsertionBoundary () override
 Destructor: default destructor. More...
 
RandomClusterInsertionBoundarycopy () const override
 Creates a copy on the heap and returns a pointer. More...
 
void set (BaseParticle *particleToCopy, unsigned int maxFailed, Vec3D posMin, Vec3D posMax, Vec3D velMin, Vec3D velMax, Mdouble rMicroParticle)
 Sets the properties of the ClusterInsertionBoundary. More...
 
void set (BaseParticle &particleToCopy, unsigned int maxFailed, Vec3D posMin, Vec3D posMax, Vec3D velMin, Vec3D velMax, Mdouble rMicroParticle)
 
void set (BaseParticle *particleToCopy, unsigned int maxFailed, Vec3D posMin, Vec3D posMax, unsigned int nParticlesPerCluster, Vec3D velMin, Vec3D velMax)
 Sets the properties of the ClusterInsertionBoundary. More...
 
void set (BaseParticle &particleToCopy, unsigned int maxFailed, Vec3D posMin, Vec3D posMax, unsigned int nParticlesPerCluster, Vec3D velMin, Vec3D velMax)
 
void setNumberOfParticlesPerCluster (unsigned int nParticlesPeCluster)
 sets the number of particles per cluster More...
 
void checkBoundaryBeforeTimeStep (DPMBase *md) override
 inserts cluster, if no interactions are detected. More...
 
void placeParticle (BaseParticle *p, RNG &random) override
 sets random position and velocity for the cluster. More...
 
- Public Member Functions inherited from BaseClusterInsertionBoundary
 BaseClusterInsertionBoundary ()
 Constructor; sets everything to 0. More...
 
 BaseClusterInsertionBoundary (const BaseClusterInsertionBoundary &other)
 Copy constructor with deep copy. More...
 
 ~BaseClusterInsertionBoundary () override
 Destructor: default destructor. More...
 
void setRandomised (bool randomised)
 this turns off the randomise(): created for UnitTests. More...
 
bool getRandomised ()
 this returns a bool which indicates if the process is randomised (true) or not (false). More...
 
unsigned int getNumberOfClusterInserted ()
 this returns the number of cluster inserted. More...
 
void setRadiusMicroParticle (Mdouble rMP)
 this sets the radius of the micro particle composing the cluster. More...
 
void setGeometry (Vec3D posMin, Vec3D posMax)
 Sets the geometry (position and velocity distribution) of the ClusterInsertionBoundary. More...
 
void setVelocityRange (Vec3D velMin, Vec3D velMax)
 Sets the velocity range of the ClusterInsertionBoundary. More...
 
void setAdditionalClusterProperties (Mdouble collisionTimeOverTimeStep, Mdouble velocityDampingModulus, Mdouble energyRatioTolerance)
 sets additional cluster properties as: More...
 
void setOutputClusterProperties (bool doCdatOutput, bool doOverlOutput, bool doAmatOutput, bool doIntStrucOutput, bool doVtkOutput, bool doRestartOutput, bool doFStatOutput, bool doEneOutput)
 sets cluster whether or not cluster output files will be created, for example: More...
 
void read (std::istream &is) override
 reads boundary properties from istream More...
 
void write (std::ostream &os) const override
 writes boundary properties to ostream More...
 
- Public Member Functions inherited from InsertionBoundary
 InsertionBoundary ()
 
 InsertionBoundary (const InsertionBoundary &other)
 Copy constructor (with deep copy) More...
 
 ~InsertionBoundary () override
 Destructor: delete the particle that has to be copied at every insertion. More...
 
virtual BaseParticlegenerateParticle (RNG &random)
 Sets the properties of the InsertionBoundary for a single particle type ‍/ virtual void set(BaseParticle* particleToCopy, unsigned int maxFailed, Vec3D velMin, Vec3D velMax, double radMin, double radMax)=0;. More...
 
void insertParticles (DPMBase *md)
 Fill a certain domain with particles. More...
 
unsigned int getNumberOfParticlesInserted () const
 Gets the number of particles inserted by the boundary. More...
 
Mdouble getMassOfParticlesInserted () const
 Gets the mass of particles inserted by the boundary. More...
 
Mdouble getVolumeOfParticlesInserted () const
 Gets the volume of particles inserted by the boundary. More...
 
void reset ()
 resets particle property counter variables. More...
 
void activate ()
 Turns on the InsertionBoundary. More...
 
void deactivate ()
 Turns off the InsertionBoundary. More...
 
bool isActivated ()
 Returns whether the InsertionBoundary is activated. More...
 
unsigned int getMaxFailed () const
 Gets the number of times that the boundary may fail to insert a particle. More...
 
void setParticleToCopy (std::vector< BaseParticle * > particleToCopy)
 Sets multiple different particles that will be inserted through the insertion boundary. More...
 
void setParticleToCopy (BaseParticle *particleToCopy)
 Sets the particle that will be inserted through the insertion boundary. More...
 
std::vector< BaseParticle * > getParticleToCopy ()
 Gets the particles that will be inserted through the insertion boundary. More...
 
void read (std::istream &is) override
 Reads the boundary's id_ and maxFailed_. More...
 
void write (std::ostream &os) const override
 Writes the boundary's id_ and maxFailed_. More...
 
Mdouble getVolumeFlowRate () const
 Gets the volume flow rate of the insertion routine. More...
 
void setVolumeFlowRate (Mdouble volumeFlowRate_)
 Sets the volume flow rate of the insertion routine. More...
 
Mdouble getInitialVolume () const
 Gets the initialVolume() . More...
 
void setInitialVolume (Mdouble initialVolume)
 Gets the Volume which should be inserted by the insertion routine. More...
 
void setPSD (const PSD psd)
 Sets the range of particle radii that may be generated from a user defined PSD. More...
 
void setPSD (std::vector< PSD > psd, std::vector< Mdouble > probability)
 Sets the ranges of particle radii that may be generated from user defined PSDs. More...
 
std::vector< PSDgetPSD ()
 Gets the particle size distributions set by the user. More...
 
void setVariableVolumeFlowRate (const std::vector< Mdouble > &variableCumulativeVolumeFlowRate, Mdouble samplingInterval)
 Sets a variable volume flow rate. More...
 
bool insertParticle (Mdouble time)
 Checks the inserted total volume and returns if a particle is still allowed to be inserted. More...
 
bool getCheckParticleForInteraction () const
 Gets the variable that checks if a particle has an interaction. More...
 
void setCheckParticleForInteraction (bool checkParticleForInteraction)
 Sets the variable that checks if a particle has an interaction. More...
 
void setManualInsertion (bool manualInsertion)
 Set the flag for a manual PSD insertion routine. 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 checkBoundaryAfterParticlesMove (ParticleHandler &pH)
 Virtual function that does things to particles, each time step after particles have moved. 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 Member Functions

std::string getName () const override
 Returns the name of the object. More...
 

Additional Inherited Members

- Public Attributes inherited from InsertionBoundary
std::vector< BaseParticle * > particleToCopy_
 read Distribution class from file. ‍/ friend std::istream& operator>>(std::istream& is, InsertionBoundary::Distribution& type); More...
 
unsigned int maxFailed_
 Number of times that the wall may fail to insert a particle. More...
 
unsigned int numberOfParticlesInserted_
 Number of particles that are already inserted. More...
 
Mdouble massInserted_
 Total mass of particles inserted. More...
 
Mdouble volumeInserted_
 Total volume of particles inserted. More...
 
bool isActivated_
 The InsertionBoundary is activated by default. If the InsertionBoundary is deactivated, then it introduces no particles (useful for trying to maintain a certain insertion rate). More...
 
Mdouble volumeFlowRate_
 
Mdouble initialVolume_
 
std::vector< MdoublevariableCumulativeVolumeFlowRate_
 
Mdouble samplingInterval_
 
bool checkParticleForInteraction_
 Checks if a particle has an interaction with a wall or other particles. More...
 
std::vector< PSDparticleSizeDistributionVector_
 Defines a particle size distribution as an object of the PSD class; if particleSizeDistributionVector_ is empty, distribution_ is used instead. More...
 
Vec3D velMin_
 Minimum and maximum velocity of the particles to be inserted. More...
 
Vec3D velMax_
 
bool isManuallyInserting_
 A flag to enable a top-down class-by-class manual insertion of a PSD; default is FALSE. More...
 
std::vector< Mdoubleprobability_
 vector of probabilities in range [0,1] which determine the mixing ratio of partice size distributions. More...
 
int chosenSpecies_
 stores the chosen species for each timestep. More...
 
- Protected Attributes inherited from BaseClusterInsertionBoundary
unsigned int nClusterInserted_
 
Mdouble radiusParticle_
 
int nParticles_
 
LinearPlasticViscoelasticFrictionSpeciesclusterSpecies_
 
bool isCdatOutputOn_
 
bool isOverlOutputOn_
 
bool isAmatOutputOn_
 
bool isIntStrucOutputOn_
 
bool isVtkOutputOn_
 
bool isRestartOutputOn_
 
bool isFStatOutputOn_
 
bool isEneOutputOn_
 
Mdouble sizeDispersityParticle_
 
Mdouble velocityDampingModulus_
 
int nInternalStructurePoints_
 
Mdouble energyRatioTolerance_
 
Mdouble collisionTimeOverTimeStep_
 
Vec3D posMin_
 
Vec3D posMax_
 
Vec3D velMin_
 
Vec3D velMax_
 
bool setRadiusParticleAndNotNumberOfParticles_
 
std::vector< Vec3DclusterPositions_
 
std::vector< MdoubleclusterRadii_
 
bool randomised_
 

Detailed Description

RandomClusterInsertionBoundary This class works exactly like CubeInsertionBoundary class but inserts clusters instead of particles. MPI: It does not work with MPI. One of the reasons is the need to adapt function DPMBase::importParticlesAs(). In particular particles and interaction should be imported as MPIParticle and MPIInteraction. In addition to this, the same should be done inside BaseCluster::actionsAfterSolve() when particles are centred around the desired position.

Constructor & Destructor Documentation

◆ RandomClusterInsertionBoundary() [1/2]

RandomClusterInsertionBoundary::RandomClusterInsertionBoundary ( )

Constructor: inherits from BaseClusterInsertionBoundary constructor.

Default constructor: inherits from BaseClusterInsertionBoundary constructor.

37 {
38  logger(DEBUG, "RandomClusterInsertionBoundary::RandomClusterInsertionBoundary() finished");
39 }
Logger< MERCURYDPM_LOGLEVEL > logger("MercuryKernel")
Definition of different loggers with certain modules. A user can define its own custom logger here.
@ DEBUG
BaseClusterInsertionBoundary()
Constructor; sets everything to 0.
Definition: BaseClusterInsertionBoundary.cc:34

References DEBUG, and logger.

Referenced by copy().

◆ RandomClusterInsertionBoundary() [2/2]

RandomClusterInsertionBoundary::RandomClusterInsertionBoundary ( const RandomClusterInsertionBoundary other)

Copy constructor with deep copy.

Copy constructor

46 
47  logger(DEBUG, "RandomClusterInsertionBoundary::RandomClusterInsertionBoundary() finished");
48 }

References DEBUG, and logger.

◆ ~RandomClusterInsertionBoundary()

RandomClusterInsertionBoundary::~RandomClusterInsertionBoundary ( )
overridedefault

Destructor: default destructor.

Default Destructor.

Member Function Documentation

◆ checkBoundaryBeforeTimeStep()

void RandomClusterInsertionBoundary::checkBoundaryBeforeTimeStep ( DPMBase md)
overridevirtual

inserts cluster, if no interactions are detected.

Reimplemented from BaseClusterInsertionBoundary.

153 {
154  logger(VERBOSE, "In RandomClusterInsertionBoundary::checkBoundaryBeforeTimeStep\n");
155 
156  if (!isActivated_)
157  return;
158 
159  /* Each time step, the InsertionBoundary attempts to fill up a region with
160  * clusters.
161  *
162  * It first calls generateParticle() to get a randomised particle, subject
163  * to a specified distribution over sizes and species. (The basic class
164  * supports size dispersity only but PolydisperseInsertionBoundary will
165  * support species dispersity.)
166  * Then it repeatedly calls placeParticle(), which gives the cluster a
167  * random location (and possibly velocity) in a specified,
168  * geometry-dependent bound. Each time, it checks whether the new cluster
169  * would have an interaction with another cluster or a wall.
170  *
171  * If it manages to do that within maxFailed_ tries, then:
172  * * the new cluster is created and inserted,
173  * * the failure counter is reset, and
174  * the processes is repeated with a new generateParticle().
175  *
176  * Otherwise, the processes terminates for this time step.
177  * */
178 
179  // Keep count of how many successive times we have failed to place a new
180  // particle.
181  unsigned int failed = 0;
182  while (failed <= maxFailed_ && insertParticle(md->getNextTime())) // 'generating' loop
183  {
184  /* Generate random *intrinsic* properties for the new particle. */
185  logger(VERBOSE, "about to call generateParticle\n");
186 
187  auto p0 = generateParticle(md->random);
188  logger(VERBOSE, "generated a particle with intrinsics %", p0);
189 
190  while (true) // 'placing' loop
191  {
192  /* Generate extrinsic properties (position and velocity) for this
193  * new particle. */
194 
195  placeParticle(p0, md->random);
196 
197  logger(VERBOSE, "attempting to place particle at %, vel %", p0->getPosition(), p0->getVelocity());
198 
199 #ifdef MERCURYDPM_USE_MPI
200  /* Communicate the new particle's properties by setHandler (note
201  * that this doesn't actually add the particle to the handler). */
202  if (NUMBER_OF_PROCESSORS > 1)
203  {
204  MPIParticle particle;
205  // //Every domain generates a particle (to get the species right etc)
206 
207  //Send particle data from root to other processors to sync the particle properties
208  if (PROCESSOR_ID == 0)
209  {
210  particle = copyDataFromParticleToMPIParticle(p0);
211  }
212 
214 
215  //Process the received data
216  if (PROCESSOR_ID != 0)
217  {
218  copyDataFromMPIParticleToParticle(&particle, p0, &(md->particleHandler));
219  }
220  }
221 #endif
222  p0->setHandler(&md->particleHandler);
223 
224  /* Check whether the particle has any interactions. */
225  if (md->checkParticleForInteraction(*p0))
226  {
227  BaseCluster cluster;
228  if(getRandomised())
229  cluster.random.randomise();
235  cluster.doCdatOutput(isCdatOutputOn_);
237  cluster.doAmatOutput(isAmatOutputOn_);
239  cluster.doVtkOutput(isVtkOutputOn_);
242  cluster.doEneOutput(isEneOutputOn_);
246  else
248  cluster.setRadiusCluster(p0->getRadius());
249  cluster.setPosition(p0->getPosition());
250  cluster.setVelocity(p0->getVelocity());
251  cluster.setParticleSpecies(
253  md->speciesHandler.getObject(p0->getIndSpecies())));
254 #ifdef MERCURYDPM_USE_MPI
255  cluster.setNumberOfDomains(md->getNumberOfDomains());
256  cluster.setDomain(md->getMin(), md->getMax());
258 #endif
259  cluster.solve();
260 
261  md->importParticlesAs( cluster.particleHandler, cluster.interactionHandler, p0->getSpecies() );
262 
263  failed = 0;
264 
265  // Number of cluster inserted
267  // Total number of particles inserted
269  // This is the total mass composed by every single particle (not cluster!) inserted
271  // This is the total volume composed by every single particle (not cluster!) inserted
273  logger(VERBOSE, "successfully placed a particle %, with position: % after % fails.", p0,
274  p0->getPosition(), failed);
275 
276  /* JMFT: The generateParticle() routine allocates memory, so we should
277  * free it here. (Don't worry, the particle will have been copied to the
278  * particleHandler by this point iff we want it.) */
279  delete p0;
280 
281  break; // out of the 'placing' loop
282  }
283  else
284  {
285  failed++;
286  logger(VERBOSE, "failed to place a cluster; have failed % times", failed);
287  }
288 
289  if (failed > maxFailed_)
290  {
291  logger(VERBOSE, "failed too many times; giving up");
292  break; // out of the 'placing' loop (and will leave the 'generating' loop too
293  }
294  }
295  logger(VERBOSE, "failed % times, so breaking out of InsertionBoundary loop for this timestep.", failed);
296  }
297  // logger(INFO, "volumeInserted_ = %", volumeInserted_);
298 }
#define PROCESSOR_ID
Definition: GeneralDefine.h:63
#define NUMBER_OF_PROCESSORS
For the MPI communication routines this quantity is often required. defining this macro makes the cod...
Definition: GeneralDefine.h:62
@ VERBOSE
@ PARTICLE
Definition: MpiContainer.h:67
void copyDataFromMPIParticleToParticle(MPIParticle *bP, BaseParticle *p, ParticleHandler *particleHandler)
Copies data from an MPIParticle class to a BaseParticle and sets the particleHandler and species.
Definition: MpiDataClass.cc:105
MPIParticle copyDataFromParticleToMPIParticle(BaseParticle *p)
Copies data from a NonSphericalParticle to an MPIParticle class and returns this.
Definition: MpiDataClass.cc:124
bool isIntStrucOutputOn_
Definition: BaseClusterInsertionBoundary.h:177
bool isFStatOutputOn_
Definition: BaseClusterInsertionBoundary.h:183
bool isOverlOutputOn_
Definition: BaseClusterInsertionBoundary.h:173
int nInternalStructurePoints_
Definition: BaseClusterInsertionBoundary.h:193
bool isCdatOutputOn_
Definition: BaseClusterInsertionBoundary.h:171
Mdouble energyRatioTolerance_
Definition: BaseClusterInsertionBoundary.h:195
bool isRestartOutputOn_
Definition: BaseClusterInsertionBoundary.h:181
bool isAmatOutputOn_
Definition: BaseClusterInsertionBoundary.h:175
Mdouble velocityDampingModulus_
Definition: BaseClusterInsertionBoundary.h:191
unsigned int nClusterInserted_
Definition: BaseClusterInsertionBoundary.h:157
Mdouble collisionTimeOverTimeStep_
Definition: BaseClusterInsertionBoundary.h:198
bool isVtkOutputOn_
Definition: BaseClusterInsertionBoundary.h:179
Mdouble sizeDispersityParticle_
Definition: BaseClusterInsertionBoundary.h:189
Mdouble radiusParticle_
Definition: BaseClusterInsertionBoundary.h:160
bool isEneOutputOn_
Definition: BaseClusterInsertionBoundary.h:185
int nParticles_
Definition: BaseClusterInsertionBoundary.h:164
bool getRandomised()
this returns a bool which indicates if the process is randomised (true) or not (false).
Definition: BaseClusterInsertionBoundary.cc:184
bool setRadiusParticleAndNotNumberOfParticles_
Definition: BaseClusterInsertionBoundary.h:208
Definition: BaseCluster.h:51
void setRadiusParticle(Mdouble rP)
This sets the value of particles' radius if there's no dispersity in size.
Definition: BaseCluster.cc:97
void doFStatOutput(bool isfStatOutputOn)
This sets the bool variable that defines whether the cluster fStat output will be written or not.
Definition: BaseCluster.cc:362
void setEnergyRatioTolerance(Mdouble eRT)
This sets the value of the value of the energy ratio threshold under which the process can be conside...
Definition: BaseCluster.cc:234
void doRestartOutput(bool isRestartOutputOn)
This sets the bool variable that defines whether the cluster restart output will be written or not.
Definition: BaseCluster.cc:348
void doEneOutput(bool isEneOutputOn)
This sets the bool variable that defines whether the cluster ene output will be written or not.
Definition: BaseCluster.cc:376
void setParticleSpecies(LinearPlasticViscoelasticFrictionSpecies *particleSpecies)
This sets the species of the particle.
Definition: BaseCluster.cc:250
void setPosition(Vec3D p)
This sets the value of position_, which is the position in which the cluster will be inserted.
Definition: BaseCluster.cc:60
void setRadiusCluster(Mdouble rCR)
This sets the desired value of the cluster radius (there is no getter of this value,...
Definition: BaseCluster.cc:149
void doCdatOutput(bool iCOO)
This sets the bool variable that defines whether the cluster data output will be written or not.
Definition: BaseCluster.cc:278
void setVelocity(Vec3D v)
This sets the value of velocity after creation.
Definition: BaseCluster.cc:264
void setNumberOfParticles(int nP)
This sets the value of the number of particles in the cluster.
Definition: BaseCluster.cc:134
void setVelocityDampingModulus(Mdouble vDM)
This sets the value of the velocity damping modulus.
Definition: BaseCluster.cc:200
void doVtkOutput(bool iVOO)
This sets the bool variable that defines whether the cluster vtk output will be written or not.
Definition: BaseCluster.cc:334
void setSizeDispersityParticle(Mdouble sDP)
This sets the value of particles' dispersity in size.
Definition: BaseCluster.cc:117
void doAmatOutput(bool iAOO)
This sets the bool variable that defines whether the cluster adjacency matrix output will be written ...
Definition: BaseCluster.cc:306
void setNumberOfInternalStructurePoints(int gL)
This sets the value of the number of particles used to compute the internal structure.
Definition: BaseCluster.cc:217
void setClusterId(unsigned int iC)
This sets the value of the cluster ID.
Definition: BaseCluster.cc:183
void doIntStrucOutput(bool iISOO)
This sets the bool variable that defines whether the cluster internal structure output will be writte...
Definition: BaseCluster.cc:320
void setCollisionTimeOverTimeStep(Mdouble cTOTS)
This sets the collisionTimeOverTimeStep number (which is the ratio between collision time and time st...
Definition: BaseCluster.cc:76
void doOverlOutput(bool iOOO)
This sets the bool variable that defines whether the cluster overlap output will be written or not.
Definition: BaseCluster.cc:292
unsigned getNextGroupId()
Should be called each time you assign a groupId. Returns the value of nextGroupId_ and increases next...
Definition: BaseHandler.h:293
std::enable_if<!std::is_pointer< U >::value, U * >::type copyAndAddObject(const U &object)
Creates a copy of a Object and adds it to the BaseHandler.
Definition: BaseHandler.h:379
unsigned int getSize() const
Gets the size of the particleHandler (including mpi and periodic particles)
Definition: BaseHandler.h:655
T * getObject(const unsigned int id)
Gets a pointer to the Object at the specified index in the BaseHandler.
Definition: BaseHandler.h:613
SpeciesHandler speciesHandler
A handler to that stores the species type i.e. LinearViscoelasticSpecies, etc.
Definition: DPMBase.h:1427
void setDomain(const Vec3D &min, const Vec3D &max)
Sets the minimum coordinates of the problem domain.
Definition: DPMBase.cc:1098
std::vector< unsigned > getNumberOfDomains()
returns the number of domains
Definition: DPMBase.cc:5280
void setNumberOfDomains(std::vector< unsigned > direction)
Sets the number of domains in x-,y- and z-direction. Required for parallel computations.
Definition: DPMBase.cc:5213
Mdouble getNextTime() const
Returns the current simulation time.
Definition: DPMBase.cc:816
Vec3D getMax() const
Definition: DPMBase.h:670
Vec3D getMin() const
Definition: DPMBase.h:664
InteractionHandler interactionHandler
An object of the class InteractionHandler.
Definition: DPMBase.h:1467
ParticleHandler particleHandler
An object of the class ParticleHandler, contains the pointers to all the particles created.
Definition: DPMBase.h:1437
RNG random
This is a random generator, often used for setting up the initial conditions etc.....
Definition: DPMBase.h:1432
void importParticlesAs(ParticleHandler &particleHandler, InteractionHandler &interactionHandler, const ParticleSpecies *species)
Copies particles, interactions assigning species from a local simulation to a global one....
Definition: DPMBase.cc:4954
void solve()
The work horse of the code.
Definition: DPMBase.cc:4270
virtual bool checkParticleForInteraction(const BaseParticle &P)
Checks whether a particle P has any interaction with walls or other particles.
Definition: DPMBase.cc:4805
unsigned int maxFailed_
Number of times that the wall may fail to insert a particle.
Definition: InsertionBoundary.h:270
unsigned int numberOfParticlesInserted_
Number of particles that are already inserted.
Definition: InsertionBoundary.h:275
bool insertParticle(Mdouble time)
Checks the inserted total volume and returns if a particle is still allowed to be inserted.
Definition: InsertionBoundary.cc:150
bool isActivated_
The InsertionBoundary is activated by default. If the InsertionBoundary is deactivated,...
Definition: InsertionBoundary.h:293
virtual BaseParticle * generateParticle(RNG &random)
Sets the properties of the InsertionBoundary for a single particle type ‍/ virtual void set(BaseParti...
Definition: InsertionBoundary.cc:103
Mdouble massInserted_
Total mass of particles inserted.
Definition: InsertionBoundary.h:280
Mdouble volumeInserted_
Total volume of particles inserted.
Definition: InsertionBoundary.h:285
std::enable_if< std::is_scalar< T >::value, void >::type broadcast(T &t, int fromProcessor=0)
Broadcasts a scalar from the root to all other processors.
Definition: MpiContainer.h:441
static MPIContainer & Instance()
fetch the instance to be used for communication
Definition: MpiContainer.h:134
Data class to send a particle over MPI.
Definition: MpiDataClass.h:81
Mdouble getVolume() const
Definition: ParticleHandler.cc:1263
Mdouble getMass() const
Definition: ParticleHandler.cc:611
void randomise()
sets the random variables such that they differ for each run
Definition: RNG.cc:98
void placeParticle(BaseParticle *p, RNG &random) override
sets random position and velocity for the cluster.
Definition: RandomClusterInsertionBoundary.cc:302
Contains material and contact force properties.
Definition: Species.h:35

References MPIContainer::broadcast(), DPMBase::checkParticleForInteraction(), BaseClusterInsertionBoundary::collisionTimeOverTimeStep_, BaseHandler< T >::copyAndAddObject(), copyDataFromMPIParticleToParticle(), copyDataFromParticleToMPIParticle(), BaseCluster::doAmatOutput(), BaseCluster::doCdatOutput(), BaseCluster::doEneOutput(), BaseCluster::doFStatOutput(), BaseCluster::doIntStrucOutput(), BaseCluster::doOverlOutput(), BaseCluster::doRestartOutput(), BaseCluster::doVtkOutput(), BaseClusterInsertionBoundary::energyRatioTolerance_, InsertionBoundary::generateParticle(), ParticleHandler::getMass(), DPMBase::getMax(), DPMBase::getMin(), BaseHandler< T >::getNextGroupId(), DPMBase::getNextTime(), DPMBase::getNumberOfDomains(), BaseHandler< T >::getObject(), BaseClusterInsertionBoundary::getRandomised(), BaseHandler< T >::getSize(), ParticleHandler::getVolume(), DPMBase::importParticlesAs(), InsertionBoundary::insertParticle(), MPIContainer::Instance(), DPMBase::interactionHandler, InsertionBoundary::isActivated_, BaseClusterInsertionBoundary::isAmatOutputOn_, BaseClusterInsertionBoundary::isCdatOutputOn_, BaseClusterInsertionBoundary::isEneOutputOn_, BaseClusterInsertionBoundary::isFStatOutputOn_, BaseClusterInsertionBoundary::isIntStrucOutputOn_, BaseClusterInsertionBoundary::isOverlOutputOn_, BaseClusterInsertionBoundary::isRestartOutputOn_, BaseClusterInsertionBoundary::isVtkOutputOn_, logger, InsertionBoundary::massInserted_, InsertionBoundary::maxFailed_, BaseClusterInsertionBoundary::nClusterInserted_, BaseClusterInsertionBoundary::nInternalStructurePoints_, BaseClusterInsertionBoundary::nParticles_, NUMBER_OF_PROCESSORS, InsertionBoundary::numberOfParticlesInserted_, PARTICLE, DPMBase::particleHandler, placeParticle(), PROCESSOR_ID, BaseClusterInsertionBoundary::radiusParticle_, DPMBase::random, RNG::randomise(), BaseCluster::setClusterId(), BaseCluster::setCollisionTimeOverTimeStep(), DPMBase::setDomain(), BaseCluster::setEnergyRatioTolerance(), DPMBase::setNumberOfDomains(), BaseCluster::setNumberOfInternalStructurePoints(), BaseCluster::setNumberOfParticles(), BaseCluster::setParticleSpecies(), BaseCluster::setPosition(), BaseCluster::setRadiusCluster(), BaseCluster::setRadiusParticle(), BaseClusterInsertionBoundary::setRadiusParticleAndNotNumberOfParticles_, BaseCluster::setSizeDispersityParticle(), BaseCluster::setVelocity(), BaseCluster::setVelocityDampingModulus(), BaseClusterInsertionBoundary::sizeDispersityParticle_, DPMBase::solve(), DPMBase::speciesHandler, BaseClusterInsertionBoundary::velocityDampingModulus_, VERBOSE, and InsertionBoundary::volumeInserted_.

◆ copy()

RandomClusterInsertionBoundary * RandomClusterInsertionBoundary::copy ( ) const
overridevirtual

Creates a copy on the heap and returns a pointer.

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

Returns
pointer to the copy on the heap

Reimplemented from BaseClusterInsertionBoundary.

61 {
62 #ifdef DEBUG_CONSTRUCTOR
63  std::cout << "BaseClusterInsertionBoundary::copy() const finished" << std::endl;
64 #endif
65  return new RandomClusterInsertionBoundary(*this);
66 }
RandomClusterInsertionBoundary()
Constructor: inherits from BaseClusterInsertionBoundary constructor.
Definition: RandomClusterInsertionBoundary.cc:36

References RandomClusterInsertionBoundary().

◆ getName()

std::string RandomClusterInsertionBoundary::getName ( ) const
overrideprivatevirtual

Returns the name of the object.

Returns the name of the object class

Returns
the object's class' name, i.e. 'ClusterInsertionBoundary'

Reimplemented from BaseClusterInsertionBoundary.

322 {
323  return "RandomClusterInsertionBoundary";
324 }

◆ placeParticle()

void RandomClusterInsertionBoundary::placeParticle ( BaseParticle p,
RNG random 
)
overridevirtual

sets random position and velocity for the cluster.

this sets position and velocity of the cluster.

Reimplemented from BaseClusterInsertionBoundary.

303 {
304  if(getRandomised())
305  random.randomise();
306  Vec3D pos, vel;
307  pos.X = random.getRandomNumber(posMin_.X, posMax_.X);
308  pos.Y = random.getRandomNumber(posMin_.Y, posMax_.Y);
309  pos.Z = random.getRandomNumber(posMin_.Z, posMax_.Z);
310  vel.X = random.getRandomNumber(velMin_.X, velMax_.X);
311  vel.Y = random.getRandomNumber(velMin_.Y, velMax_.Y);
312  vel.Z = random.getRandomNumber(velMin_.Z, velMax_.Z);
313  p->setPosition(pos);
314  p->setVelocity(vel);
315 }
Vec3D velMin_
Definition: BaseClusterInsertionBoundary.h:204
Vec3D posMax_
Definition: BaseClusterInsertionBoundary.h:204
Vec3D velMax_
Definition: BaseClusterInsertionBoundary.h:204
Vec3D posMin_
Definition: BaseClusterInsertionBoundary.h:204
void setVelocity(const Vec3D &velocity)
set the velocity of the BaseInteractable.
Definition: BaseInteractable.cc:350
virtual void setPosition(const Vec3D &position)
Sets the position of this BaseInteractable.
Definition: BaseInteractable.h:239
Mdouble getRandomNumber()
This is a random generating routine can be used for initial positions.
Definition: RNG.cc:143
Definition: Vector.h:51
Mdouble Y
Definition: Vector.h:66
Mdouble Z
Definition: Vector.h:66
Mdouble X
the vector components
Definition: Vector.h:66

References BaseClusterInsertionBoundary::getRandomised(), RNG::getRandomNumber(), BaseClusterInsertionBoundary::posMax_, BaseClusterInsertionBoundary::posMin_, RNG::randomise(), BaseInteractable::setPosition(), BaseInteractable::setVelocity(), BaseClusterInsertionBoundary::velMax_, BaseClusterInsertionBoundary::velMin_, Vec3D::X, Vec3D::Y, and Vec3D::Z.

Referenced by checkBoundaryBeforeTimeStep().

◆ set() [1/4]

void RandomClusterInsertionBoundary::set ( BaseParticle particleToCopy,
unsigned int  maxFailed,
Vec3D  posMin,
Vec3D  posMax,
unsigned int  nParticlesPerCluster,
Vec3D  velMin,
Vec3D  velMax 
)
138 {
139  set(&particleToCopy, maxFailed, posMin, posMax, nParticlesPerCluster, velMin, velMax);
140 }
void set(BaseParticle *particleToCopy, unsigned int maxFailed, Vec3D posMin, Vec3D posMax, Vec3D velMin, Vec3D velMax, Mdouble rMicroParticle)
Sets the properties of the ClusterInsertionBoundary.
Definition: RandomClusterInsertionBoundary.cc:83

References set().

◆ set() [2/4]

void RandomClusterInsertionBoundary::set ( BaseParticle particleToCopy,
unsigned int  maxFailed,
Vec3D  posMin,
Vec3D  posMax,
Vec3D  velMin,
Vec3D  velMax,
Mdouble  rMicroParticle 
)
99 {
100  set(&particleToCopy, maxFailed, posMin, posMax, velMin, velMax, rMicroParticle);
101 }

References set().

◆ set() [3/4]

void RandomClusterInsertionBoundary::set ( BaseParticle particleToCopy,
unsigned int  maxFailed,
Vec3D  posMin,
Vec3D  posMax,
unsigned int  nParticlesPerCluster,
Vec3D  velMin,
Vec3D  velMax 
)

Sets the properties of the ClusterInsertionBoundary.

Sets all the properties of the cuboidal insertion boundary.

Parameters
[in]particleToCopyPointer to the BaseParticle which is used as a basis for clusters to be inserted
[in]maxFailedThe maximum number of times the insertion of a particle may be tried and failed before the insertion of particles is considered done NB: this property is used in the parent's InsertionBoundary::checkBoundaryBeforeTimeStep().
[in]posMinFirst defining corner of cuboidal insertion boundary
[in]posMaxSecond defining corner of cuboidal insertion boundary
[in]nParticlesPerClusterNumber of particles composing the cluster.
[in]velMinMinimum velocity of inserted particles
[in]velMaxMaximum velocity of inserted particles

Important: this function differs from the class above because gives the possiblity to set the number of particles instead of the radius of the micro particle.

125 {
126  setParticleToCopy(particleToCopy);
127  velMin_ = velMin;
128  velMax_ = velMax;
129  maxFailed_ = maxFailed;
130  setGeometry(posMin, posMax);
131 
132  setNumberOfParticlesPerCluster(nParticlesPerCluster);
133 }
void setGeometry(Vec3D posMin, Vec3D posMax)
Sets the geometry (position and velocity distribution) of the ClusterInsertionBoundary.
Definition: BaseClusterInsertionBoundary.cc:202
void setParticleToCopy(std::vector< BaseParticle * > particleToCopy)
Sets multiple different particles that will be inserted through the insertion boundary.
Definition: InsertionBoundary.cc:411
void setNumberOfParticlesPerCluster(unsigned int nParticlesPeCluster)
sets the number of particles per cluster
Definition: RandomClusterInsertionBoundary.cc:142

References InsertionBoundary::maxFailed_, BaseClusterInsertionBoundary::setGeometry(), setNumberOfParticlesPerCluster(), InsertionBoundary::setParticleToCopy(), BaseClusterInsertionBoundary::velMax_, and BaseClusterInsertionBoundary::velMin_.

◆ set() [4/4]

void RandomClusterInsertionBoundary::set ( BaseParticle particleToCopy,
unsigned int  maxFailed,
Vec3D  posMin,
Vec3D  posMax,
Vec3D  velMin,
Vec3D  velMax,
Mdouble  rMicroParticle 
)

Sets the properties of the ClusterInsertionBoundary.

Sets all the properties of the cuboidal insertion boundary.

Parameters
[in]particleToCopyPointer to the BaseParticle which is used as a basis for clusters to be inserted
[in]maxFailedThe maximum number of times the insertion of a particle may be tried and failed before the insertion of particles is considered done NB: this property is used in the parent's InsertionBoundary::checkBoundaryBeforeTimeStep().
[in]posMinFirst defining corner of cuboidal insertion boundary
[in]posMaxSecond defining corner of cuboidal insertion boundary
[in]velMinMinimum velocity of inserted particles
[in]velMaxMaximum velocity of inserted particles
[in]rMicroParticleRadius of the single particle composing the cluster.
86 {
87  setParticleToCopy(particleToCopy);
88  velMin_ = velMin;
89  velMax_ = velMax;
90  maxFailed_ = maxFailed;
91  setGeometry(posMin, posMax);
92 
93  setRadiusMicroParticle(rMicroParticle);
94 }
void setRadiusMicroParticle(Mdouble rMP)
this sets the radius of the micro particle composing the cluster.
Definition: BaseClusterInsertionBoundary.cc:192

References InsertionBoundary::maxFailed_, BaseClusterInsertionBoundary::setGeometry(), InsertionBoundary::setParticleToCopy(), BaseClusterInsertionBoundary::setRadiusMicroParticle(), BaseClusterInsertionBoundary::velMax_, and BaseClusterInsertionBoundary::velMin_.

Referenced by set(), and RandomClusterInsertionBoundarySelfTest::setupInitialConditions().

◆ setNumberOfParticlesPerCluster()

void RandomClusterInsertionBoundary::setNumberOfParticlesPerCluster ( unsigned int  nParticlesPeCluster)

sets the number of particles per cluster

143 {
144  if (nParticlesPeCluster <= 0)
145  logger(ERROR, "The number of particles for a single cluster must be greater than zero. nParticlesPeCluster = %", nParticlesPeCluster);
146  else {
147  nParticles_ = nParticlesPeCluster;
149  }
150 }
@ ERROR

References ERROR, logger, BaseClusterInsertionBoundary::nParticles_, and BaseClusterInsertionBoundary::setRadiusParticleAndNotNumberOfParticles_.

Referenced by set().


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