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, Vec3D velMin, Vec3D velMax, Mdouble rMin, Mdouble rMax, Mdouble rMicroParticle)
 old style set function which assumes a uniform psd. More...
 
void set (BaseParticle &particleToCopy, unsigned int maxFailed, Vec3D posMin, Vec3D posMax, Vec3D velMin, Vec3D velMax, Mdouble rMin, Mdouble rMax, Mdouble rMicroParticle)
 old style set function which assumes a uniform psd. More...
 
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 set (BaseParticle *particleToCopy, unsigned int maxFailed, Vec3D posMin, Vec3D posMax, unsigned int nParticlesPerCluster, Vec3D velMin, Vec3D velMax, Mdouble rMin, Mdouble rMax)
 old style set function which assumes a uniform psd. More...
 
void set (BaseParticle &particleToCopy, unsigned int maxFailed, Vec3D posMin, Vec3D posMax, unsigned int nParticlesPerCluster, Vec3D velMin, Vec3D velMax, Mdouble rMin, Mdouble rMax)
 old style set function which assumes a uniform psd. More...
 
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...
 
virtual void shiftBoundary (Vec3D shift)
 virtual function that shifts the boundary. More...
 
virtual void rotateBoundary (Vec3D angle)
 virtual function that rotates the boundary. 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...
 
BaseParticlep0 = nullptr
 pointer to the next particle that should be inserted (needs to be stored across time steps). 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.

16 {
17  logger(DEBUG, "RandomClusterInsertionBoundary::RandomClusterInsertionBoundary() finished");
18 }
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:13

References DEBUG, and logger.

Referenced by copy().

◆ RandomClusterInsertionBoundary() [2/2]

RandomClusterInsertionBoundary::RandomClusterInsertionBoundary ( const RandomClusterInsertionBoundary other)

Copy constructor with deep copy.

Copy constructor

25 
26  logger(DEBUG, "RandomClusterInsertionBoundary::RandomClusterInsertionBoundary() finished");
27 }

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.

176 {
177  logger(VERBOSE, "In RandomClusterInsertionBoundary::checkBoundaryBeforeTimeStep\n");
178 
179  if (!isActivated_)
180  return;
181 
182  /* Each time step, the InsertionBoundary attempts to fill up a region with
183  * clusters.
184  *
185  * It first calls generateParticle() to get a randomised particle, subject
186  * to a specified distribution over sizes and species. (The basic class
187  * supports size dispersity only but PolydisperseInsertionBoundary will
188  * support species dispersity.)
189  * Then it repeatedly calls placeParticle(), which gives the cluster a
190  * random location (and possibly velocity) in a specified,
191  * geometry-dependent bound. Each time, it checks whether the new cluster
192  * would have an interaction with another cluster or a wall.
193  *
194  * If it manages to do that within maxFailed_ tries, then:
195  * * the new cluster is created and inserted,
196  * * the failure counter is reset, and
197  * the processes is repeated with a new generateParticle().
198  *
199  * Otherwise, the processes terminates for this time step.
200  * */
201 
202  // Keep count of how many successive times we have failed to place a new
203  // particle.
204  unsigned int failed = 0;
205  while (failed <= maxFailed_ && insertParticle(md->getNextTime())) // 'generating' loop
206  {
207  /* Generate random *intrinsic* properties for the new particle. */
208  logger(VERBOSE, "about to call generateParticle\n");
209 
210  auto p0 = generateParticle(md->random);
211  logger(VERBOSE, "generated a particle with intrinsics %", p0);
212 
213  while (true) // 'placing' loop
214  {
215  /* Generate extrinsic properties (position and velocity) for this
216  * new particle. */
217 
218  placeParticle(p0, md->random);
219 
220  logger(VERBOSE, "attempting to place particle at %, vel %", p0->getPosition(), p0->getVelocity());
221 
222 #ifdef MERCURYDPM_USE_MPI
223  /* Communicate the new particle's properties by setHandler (note
224  * that this doesn't actually add the particle to the handler). */
225  if (NUMBER_OF_PROCESSORS > 1)
226  {
227  MPIParticle particle;
228  // //Every domain generates a particle (to get the species right etc)
229 
230  //Send particle data from root to other processors to sync the particle properties
231  if (PROCESSOR_ID == 0)
232  {
234  }
235 
237 
238  //Process the received data
239  if (PROCESSOR_ID != 0)
240  {
241  copyDataFromMPIParticleToParticle(&particle, p0, &(md->particleHandler));
242  }
243  }
244 #endif
245  p0->setHandler(&md->particleHandler);
246 
247  /* Check whether the particle has any interactions. */
248  if (md->checkParticleForInteraction(*p0))
249  {
250  BaseCluster cluster;
251  if(getRandomised())
252  cluster.random.randomise();
258  cluster.doCdatOutput(isCdatOutputOn_);
260  cluster.doAmatOutput(isAmatOutputOn_);
262  cluster.doVtkOutput(isVtkOutputOn_);
265  cluster.doEneOutput(isEneOutputOn_);
266  cluster.setClusterId(md->particleHandler.getNextGroupId());
269  else
271  cluster.setRadiusCluster(p0->getRadius());
272  cluster.setPosition(p0->getPosition());
273  cluster.setVelocity(p0->getVelocity());
274  cluster.setParticleSpecies(
276  md->speciesHandler.getObject(p0->getIndSpecies())));
277 #ifdef MERCURYDPM_USE_MPI
278  cluster.setNumberOfDomains(md->getNumberOfDomains());
279  cluster.setDomain(md->getMin(), md->getMax());
280  cluster.speciesHandler.copyAndAddObject(md->speciesHandler.getObject(0));
281 #endif
282  cluster.solve();
283 
284  md->importParticlesAs( cluster.particleHandler, cluster.interactionHandler, p0->getSpecies() );
285 
286  failed = 0;
287 
288  // Number of cluster inserted
290  // Total number of particles inserted
292  // This is the total mass composed by every single particle (not cluster!) inserted
294  // This is the total volume composed by every single particle (not cluster!) inserted
296  logger(VERBOSE, "successfully placed a particle %, with position: % after % fails.", p0,
297  p0->getPosition(), failed);
298 
299  /* JMFT: The generateParticle() routine allocates memory, so we should
300  * free it here. (Don't worry, the particle will have been copied to the
301  * particleHandler by this point iff we want it.) */
302  delete p0;
303 
304  break; // out of the 'placing' loop
305  }
306  else
307  {
308  failed++;
309  logger(VERBOSE, "failed to place a cluster; have failed % times", failed);
310  }
311 
312  if (failed > maxFailed_)
313  {
314  logger(VERBOSE, "failed too many times; giving up");
315  break; // out of the 'placing' loop (and will leave the 'generating' loop too
316  }
317  }
318  logger(VERBOSE, "failed % times, so breaking out of InsertionBoundary loop for this timestep.", failed);
319  }
320  // logger(INFO, "volumeInserted_ = %", volumeInserted_);
321 }
#define PROCESSOR_ID
Definition: GeneralDefine.h:42
#define NUMBER_OF_PROCESSORS
For the MPI communication routines this quantity is often required. defining this macro makes the cod...
Definition: GeneralDefine.h:41
@ VERBOSE
Matrix2d md
Definition: MatrixBase_cast.cpp:1
@ PARTICLE
Definition: MpiContainer.h:46
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:84
MPIParticle copyDataFromParticleToMPIParticle(BaseParticle *p)
Copies data from a NonSphericalParticle to an MPIParticle class and returns this.
Definition: MpiDataClass.cc:103
bool isIntStrucOutputOn_
Definition: BaseClusterInsertionBoundary.h:156
bool isFStatOutputOn_
Definition: BaseClusterInsertionBoundary.h:162
bool isOverlOutputOn_
Definition: BaseClusterInsertionBoundary.h:152
int nInternalStructurePoints_
Definition: BaseClusterInsertionBoundary.h:172
bool isCdatOutputOn_
Definition: BaseClusterInsertionBoundary.h:150
Mdouble energyRatioTolerance_
Definition: BaseClusterInsertionBoundary.h:174
bool isRestartOutputOn_
Definition: BaseClusterInsertionBoundary.h:160
bool isAmatOutputOn_
Definition: BaseClusterInsertionBoundary.h:154
Mdouble velocityDampingModulus_
Definition: BaseClusterInsertionBoundary.h:170
unsigned int nClusterInserted_
Definition: BaseClusterInsertionBoundary.h:136
Mdouble collisionTimeOverTimeStep_
Definition: BaseClusterInsertionBoundary.h:177
bool isVtkOutputOn_
Definition: BaseClusterInsertionBoundary.h:158
Mdouble sizeDispersityParticle_
Definition: BaseClusterInsertionBoundary.h:168
Mdouble radiusParticle_
Definition: BaseClusterInsertionBoundary.h:139
bool isEneOutputOn_
Definition: BaseClusterInsertionBoundary.h:164
int nParticles_
Definition: BaseClusterInsertionBoundary.h:143
bool getRandomised()
this returns a bool which indicates if the process is randomised (true) or not (false).
Definition: BaseClusterInsertionBoundary.cc:163
bool setRadiusParticleAndNotNumberOfParticles_
Definition: BaseClusterInsertionBoundary.h:187
Definition: BaseCluster.h:30
void setRadiusParticle(Mdouble rP)
This sets the value of particles' radius if there's no dispersity in size.
Definition: BaseCluster.cc:76
void doFStatOutput(bool isfStatOutputOn)
This sets the bool variable that defines whether the cluster fStat output will be written or not.
Definition: BaseCluster.cc:341
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:213
void doRestartOutput(bool isRestartOutputOn)
This sets the bool variable that defines whether the cluster restart output will be written or not.
Definition: BaseCluster.cc:327
void doEneOutput(bool isEneOutputOn)
This sets the bool variable that defines whether the cluster ene output will be written or not.
Definition: BaseCluster.cc:355
void setParticleSpecies(LinearPlasticViscoelasticFrictionSpecies *particleSpecies)
This sets the species of the particle.
Definition: BaseCluster.cc:229
void setPosition(Vec3D p)
This sets the value of position_, which is the position in which the cluster will be inserted.
Definition: BaseCluster.cc:39
void setRadiusCluster(Mdouble rCR)
This sets the desired value of the cluster radius (there is no getter of this value,...
Definition: BaseCluster.cc:128
void doCdatOutput(bool iCOO)
This sets the bool variable that defines whether the cluster data output will be written or not.
Definition: BaseCluster.cc:257
void setVelocity(Vec3D v)
This sets the value of velocity after creation.
Definition: BaseCluster.cc:243
void setNumberOfParticles(int nP)
This sets the value of the number of particles in the cluster.
Definition: BaseCluster.cc:113
void setVelocityDampingModulus(Mdouble vDM)
This sets the value of the velocity damping modulus.
Definition: BaseCluster.cc:179
void doVtkOutput(bool iVOO)
This sets the bool variable that defines whether the cluster vtk output will be written or not.
Definition: BaseCluster.cc:313
void setSizeDispersityParticle(Mdouble sDP)
This sets the value of particles' dispersity in size.
Definition: BaseCluster.cc:96
void doAmatOutput(bool iAOO)
This sets the bool variable that defines whether the cluster adjacency matrix output will be written ...
Definition: BaseCluster.cc:285
void setNumberOfInternalStructurePoints(int gL)
This sets the value of the number of particles used to compute the internal structure.
Definition: BaseCluster.cc:196
void setClusterId(unsigned int iC)
This sets the value of the cluster ID.
Definition: BaseCluster.cc:162
void doIntStrucOutput(bool iISOO)
This sets the bool variable that defines whether the cluster internal structure output will be writte...
Definition: BaseCluster.cc:299
void setCollisionTimeOverTimeStep(Mdouble cTOTS)
This sets the collisionTimeOverTimeStep number (which is the ratio between collision time and time st...
Definition: BaseCluster.cc:55
void doOverlOutput(bool iOOO)
This sets the bool variable that defines whether the cluster overlap output will be written or not.
Definition: BaseCluster.cc:271
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:360
unsigned int getSize() const
Gets the size of the particleHandler (including mpi and periodic particles)
Definition: BaseHandler.h:663
virtual const Vec3D & getVelocity() const
Returns the velocity of this interactable.
Definition: BaseInteractable.cc:307
const ParticleSpecies * getSpecies() const
Returns a pointer to the species of this BaseInteractable.
Definition: BaseInteractable.h:87
const Vec3D & getPosition() const
Returns the position of this BaseInteractable.
Definition: BaseInteractable.h:197
unsigned int getIndSpecies() const
Returns the index of the species associated with the interactable object.
Definition: BaseInteractable.h:67
Mdouble getRadius() const
Returns the particle's radius.
Definition: BaseParticle.h:331
void setHandler(ParticleHandler *handler)
Sets the pointer to the particle's ParticleHandler.
Definition: BaseParticle.cc:640
SpeciesHandler speciesHandler
A handler to that stores the species type i.e. LinearViscoelasticSpecies, etc.
Definition: DPMBase.h:1433
void setDomain(const Vec3D &min, const Vec3D &max)
Sets the minimum coordinates of the problem domain.
Definition: DPMBase.cc:1089
void setNumberOfDomains(std::vector< unsigned > direction)
Sets the number of domains in x-,y- and z-direction. Required for parallel computations.
Definition: DPMBase.cc:5302
InteractionHandler interactionHandler
An object of the class InteractionHandler.
Definition: DPMBase.h:1473
ParticleHandler particleHandler
An object of the class ParticleHandler, contains the pointers to all the particles created.
Definition: DPMBase.h:1443
RNG random
This is a random generator, often used for setting up the initial conditions etc.....
Definition: DPMBase.h:1438
void solve()
The work horse of the code.
Definition: DPMBase.cc:4334
unsigned int maxFailed_
Number of times that the wall may fail to insert a particle.
Definition: InsertionBoundary.h:265
unsigned int numberOfParticlesInserted_
Number of particles that are already inserted.
Definition: InsertionBoundary.h:270
bool insertParticle(Mdouble time)
Checks the inserted total volume and returns if a particle is still allowed to be inserted.
Definition: InsertionBoundary.cc:129
bool isActivated_
The InsertionBoundary is activated by default. If the InsertionBoundary is deactivated,...
Definition: InsertionBoundary.h:288
virtual BaseParticle * generateParticle(RNG &random)
Sets the properties of the InsertionBoundary for a single particle type ‍/ virtual void set(BaseParti...
Definition: InsertionBoundary.cc:82
Mdouble massInserted_
Total mass of particles inserted.
Definition: InsertionBoundary.h:275
BaseParticle * p0
pointer to the next particle that should be inserted (needs to be stored across time steps).
Definition: InsertionBoundary.h:349
Mdouble volumeInserted_
Total volume of particles inserted.
Definition: InsertionBoundary.h:280
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:420
static MPIContainer & Instance()
fetch the instance to be used for communication
Definition: MpiContainer.h:113
Data class to send a particle over MPI.
Definition: MpiDataClass.h:60
Mdouble getVolume() const
Definition: ParticleHandler.cc:1261
Mdouble getMass() const
Definition: ParticleHandler.cc:605
void randomise()
sets the random variables such that they differ for each run
Definition: RNG.cc:78
void placeParticle(BaseParticle *p, RNG &random) override
sets random position and velocity for the cluster.
Definition: RandomClusterInsertionBoundary.cc:325
Contains material and contact force properties.
Definition: Species.h:14

References MPIContainer::broadcast(), 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(), BaseInteractable::getIndSpecies(), ParticleHandler::getMass(), BaseInteractable::getPosition(), BaseParticle::getRadius(), BaseClusterInsertionBoundary::getRandomised(), BaseHandler< T >::getSize(), BaseInteractable::getSpecies(), BaseInteractable::getVelocity(), ParticleHandler::getVolume(), 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_, md, BaseClusterInsertionBoundary::nClusterInserted_, BaseClusterInsertionBoundary::nInternalStructurePoints_, BaseClusterInsertionBoundary::nParticles_, NUMBER_OF_PROCESSORS, InsertionBoundary::numberOfParticlesInserted_, InsertionBoundary::p0, PARTICLE, DPMBase::particleHandler, placeParticle(), PROCESSOR_ID, BaseClusterInsertionBoundary::radiusParticle_, DPMBase::random, RNG::randomise(), BaseCluster::setClusterId(), BaseCluster::setCollisionTimeOverTimeStep(), DPMBase::setDomain(), BaseCluster::setEnergyRatioTolerance(), BaseParticle::setHandler(), 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.

40 {
41 #ifdef DEBUG_CONSTRUCTOR
42  std::cout << "BaseClusterInsertionBoundary::copy() const finished" << std::endl;
43 #endif
44  return new RandomClusterInsertionBoundary(*this);
45 }
RandomClusterInsertionBoundary()
Constructor: inherits from BaseClusterInsertionBoundary constructor.
Definition: RandomClusterInsertionBoundary.cc:15

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.

345 {
346  return "RandomClusterInsertionBoundary";
347 }

◆ 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.

326 {
327  if(getRandomised())
328  random.randomise();
329  Vec3D pos, vel;
330  pos.X = random.getRandomNumber(posMin_.X, posMax_.X);
331  pos.Y = random.getRandomNumber(posMin_.Y, posMax_.Y);
332  pos.Z = random.getRandomNumber(posMin_.Z, posMax_.Z);
333  vel.X = random.getRandomNumber(velMin_.X, velMax_.X);
334  vel.Y = random.getRandomNumber(velMin_.Y, velMax_.Y);
335  vel.Z = random.getRandomNumber(velMin_.Z, velMax_.Z);
336  p->setPosition(pos);
337  p->setVelocity(vel);
338 }
float * p
Definition: Tutorial_Map_using.cpp:9
Vec3D velMin_
Definition: BaseClusterInsertionBoundary.h:183
Vec3D posMax_
Definition: BaseClusterInsertionBoundary.h:183
Vec3D velMax_
Definition: BaseClusterInsertionBoundary.h:183
Vec3D posMin_
Definition: BaseClusterInsertionBoundary.h:183
Mdouble getRandomNumber()
This is a random generating routine can be used for initial positions.
Definition: RNG.cc:123
Definition: Kernel/Math/Vector.h:30
Mdouble Y
Definition: Kernel/Math/Vector.h:45
Mdouble Z
Definition: Kernel/Math/Vector.h:45
Mdouble X
the vector components
Definition: Kernel/Math/Vector.h:45

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

Referenced by checkBoundaryBeforeTimeStep().

◆ set() [1/8]

void RandomClusterInsertionBoundary::set ( BaseParticle particleToCopy,
unsigned int  maxFailed,
Vec3D  posMin,
Vec3D  posMax,
unsigned int  nParticlesPerCluster,
Vec3D  velMin,
Vec3D  velMax 
)
134 {
135  set(&particleToCopy, maxFailed, posMin, posMax, nParticlesPerCluster, velMin, velMax);
136 }
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:62

References set().

◆ set() [2/8]

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

old style set function which assumes a uniform psd.

old style set function which also assumes a uniform psd. Note if you want a specific PSD do not use but this is quicker for a uniform in size PSD

145 {
146  PSD uniformPSD;
147  uniformPSD.setDistributionUniform(rMin, rMax, 2);
148  setPSD(uniformPSD);
149  set(particleToCopy, maxFailed, posMin, posMax, nParticlesPerCluster, velMin, velMax);
150 }
void setPSD(const PSD psd)
Sets the range of particle radii that may be generated from a user defined PSD.
Definition: InsertionBoundary.cc:652
Contains a vector with radii and probabilities of a user defined particle size distribution (PSD)
Definition: PSD.h:47
void setDistributionUniform(Mdouble radMin, Mdouble radMax, int numberOfBins)
create a PSD vector for a uniform distribution.
Definition: PSD.cc:294

References set(), PSD::setDistributionUniform(), and InsertionBoundary::setPSD().

◆ set() [3/8]

void RandomClusterInsertionBoundary::set ( BaseParticle particleToCopy,
unsigned int  maxFailed,
Vec3D  posMin,
Vec3D  posMax,
Vec3D  velMin,
Vec3D  velMax,
Mdouble  rMicroParticle 
)
77 {
78  set(&particleToCopy, maxFailed, posMin, posMax, velMin, velMax, rMicroParticle);
79 }

References set().

◆ set() [4/8]

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

old style set function which assumes a uniform psd.

84 {
85  PSD uniformPSD;
86  uniformPSD.setDistributionUniform(rMin, rMax, 2);
87  setPSD(uniformPSD);
88  set(particleToCopy, maxFailed, posMin, posMax, velMin, velMax, rMicroParticle);
89 }

References set(), PSD::setDistributionUniform(), and InsertionBoundary::setPSD().

◆ set() [5/8]

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.

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

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

◆ set() [6/8]

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

old style set function which assumes a uniform psd.

155 {
156  PSD uniformPSD;
157  uniformPSD.setDistributionUniform(rMin, rMax, 2);
158  setPSD(uniformPSD);
159  set(particleToCopy, maxFailed, posMin, posMax, nParticlesPerCluster, velMin, velMax);
160 }

References set(), PSD::setDistributionUniform(), and InsertionBoundary::setPSD().

◆ set() [7/8]

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.
65 {
66  setParticleToCopy(particleToCopy);
67  velMin_ = velMin;
68  velMax_ = velMax;
69  maxFailed_ = maxFailed;
70  setGeometry(posMin, posMax);
71 
72  setRadiusMicroParticle(rMicroParticle);
73 }
void setRadiusMicroParticle(Mdouble rMP)
this sets the radius of the micro particle composing the cluster.
Definition: BaseClusterInsertionBoundary.cc:171

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

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

◆ set() [8/8]

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

old style set function which assumes a uniform psd.

94 {
95  PSD uniformPSD;
96  uniformPSD.setDistributionUniform(rMin, rMax, 2);
97  setPSD(uniformPSD);
98  set(particleToCopy, maxFailed, posMin, posMax, velMin, velMax, rMicroParticle);
99 }

References set(), PSD::setDistributionUniform(), and InsertionBoundary::setPSD().

◆ setNumberOfParticlesPerCluster()

void RandomClusterInsertionBoundary::setNumberOfParticlesPerCluster ( unsigned int  nParticlesPeCluster)

sets the number of particles per cluster

164 {
165  if (nParticlesPeCluster <= 0)
166  logger(ERROR, "The number of particles for a single cluster must be greater than zero. nParticlesPeCluster = %",
167  nParticlesPeCluster);
168  else
169  {
170  nParticles_ = nParticlesPeCluster;
172  }
173 }
@ ERROR

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

Referenced by set().


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