InsertionBoundary Class Referenceabstract

Boundary structure for boundaries used for insertion of particles. More...

#include <InsertionBoundary.h>

+ Inheritance diagram for InsertionBoundary:

Public Member Functions

 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 placeParticle (BaseParticle *p, RNG &random)=0
 Purely virtual function that generates the extrinsic properties (position, velocity) of a particle. 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 checkBoundaryBeforeTimeStep (DPMBase *md) override
 Fills the boundary with particles. 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 BaseBoundarycopy () const =0
 Used to create a copy of the object NB: purely virtual function. 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 std::string getName () const =0
 A purely virtual function. 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
 

Public Attributes

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

Detailed Description

Boundary structure for boundaries used for insertion of particles.

To cite the InsertionBoundary algorithm: A. R. Thornton, D. Krijgsman, A. Te Voortwis, V. Ogarko, S. Luding, R. Fransen, S. Gonzalez, O. Bokhove, O. Imole, and T. Weinhart. A review of recent work on the discrete particle method at the University of Twente: An introduction to the open-source package MercuryDPM. DEM6 - International Conference on DEMs, 2013.

Constructor & Destructor Documentation

◆ InsertionBoundary() [1/2]

InsertionBoundary::InsertionBoundary ( )
Todo:
think about making both possible; a discrete distribution and a continuous which is more accurate
 \brief Defines a custom particle size distribution; distribution_ will always be used, unless particleSizeDistributionVector_ is non-empty
&zwj;/

enum class Distribution { Uniform, Normal_1_5 // TODO add LogNormal distribution // LogNormal };

/*!
   \brief Default constructor: set everything to 0/nullptr.

Default constructor, sets all data members to 0 or default.

17  : BaseBoundary()
18 {
20  massInserted_ = 0;
21  volumeInserted_ = 0;
22  maxFailed_ = 0;
23  isActivated_ = true;
25  initialVolume_ = 0;
28  velMin_ = Vec3D(0.0, 0.0, 0.0);
29  velMax_ = Vec3D(0.0, 0.0, 0.0);
31  isManuallyInserting_ = false;
32  chosenSpecies_ = 0;
33 }
BaseBoundary()
default constructor.
Definition: BaseBoundary.cc:11
Mdouble samplingInterval_
Definition: InsertionBoundary.h:313
int chosenSpecies_
stores the chosen species for each timestep.
Definition: InsertionBoundary.h:344
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 isManuallyInserting_
A flag to enable a top-down class-by-class manual insertion of a PSD; default is FALSE.
Definition: InsertionBoundary.h:334
Mdouble initialVolume_
Definition: InsertionBoundary.h:302
bool isActivated_
The InsertionBoundary is activated by default. If the InsertionBoundary is deactivated,...
Definition: InsertionBoundary.h:288
bool checkParticleForInteraction_
Checks if a particle has an interaction with a wall or other particles.
Definition: InsertionBoundary.h:318
Vec3D velMin_
Minimum and maximum velocity of the particles to be inserted.
Definition: InsertionBoundary.h:329
Mdouble massInserted_
Total mass of particles inserted.
Definition: InsertionBoundary.h:275
std::vector< PSD > particleSizeDistributionVector_
Defines a particle size distribution as an object of the PSD class; if particleSizeDistributionVector...
Definition: InsertionBoundary.h:324
Mdouble volumeFlowRate_
Definition: InsertionBoundary.h:299
Vec3D velMax_
Definition: InsertionBoundary.h:329
Mdouble volumeInserted_
Total volume of particles inserted.
Definition: InsertionBoundary.h:280
Definition: Kernel/Math/Vector.h:30
const Mdouble inf
Definition: GeneralDefine.h:23

References checkParticleForInteraction_, chosenSpecies_, constants::inf, initialVolume_, isActivated_, isManuallyInserting_, massInserted_, maxFailed_, numberOfParticlesInserted_, particleSizeDistributionVector_, samplingInterval_, velMax_, velMin_, volumeFlowRate_, and volumeInserted_.

◆ InsertionBoundary() [2/2]

InsertionBoundary::InsertionBoundary ( const InsertionBoundary other)

Copy constructor (with deep copy)

Copy constructor

39  : BaseBoundary(other)
40 {
44  maxFailed_ = other.maxFailed_;
45  isActivated_ = other.isActivated_;
52  probability_ = other.probability_;
53  velMin_ = other.velMin_;
54  velMax_ = other.velMax_;
57 
58  for (int i = 0; i < other.particleToCopy_.size(); i++)
59  {
60  particleToCopy_.resize(other.particleToCopy_.size());
61  particleToCopy_[i] = other.particleToCopy_[i]->copy();
62  }
63 }
int i
Definition: BiCGSTAB_step_by_step.cpp:9
std::vector< Mdouble > probability_
vector of probabilities in range [0,1] which determine the mixing ratio of partice size distributions...
Definition: InsertionBoundary.h:339
std::vector< BaseParticle * > particleToCopy_
read Distribution class from file. ‍/ friend std::istream& operator>>(std::istream& is,...
Definition: InsertionBoundary.h:260
std::vector< Mdouble > variableCumulativeVolumeFlowRate_
Definition: InsertionBoundary.h:310

References checkParticleForInteraction_, chosenSpecies_, i, initialVolume_, isActivated_, isManuallyInserting_, massInserted_, maxFailed_, numberOfParticlesInserted_, particleSizeDistributionVector_, particleToCopy_, probability_, samplingInterval_, variableCumulativeVolumeFlowRate_, velMax_, velMin_, volumeFlowRate_, and volumeInserted_.

◆ ~InsertionBoundary()

InsertionBoundary::~InsertionBoundary ( )
override

Destructor: delete the particle that has to be copied at every insertion.

Destructor that deletes the BaseParticle that is copied and inserted at every insertion.

70 {
71  for (auto& particleToCopy: particleToCopy_)
72  {
73  delete particleToCopy;
74  }
75 
76 }

References particleToCopy_.

Member Function Documentation

◆ activate()

void InsertionBoundary::activate ( )

Turns on the InsertionBoundary.

Turns on the InsertionBoundary by setting the boolean to TRUE.

343 {
344  isActivated_ = true;
345 }

References isActivated_.

Referenced by Chutebelt::actionsAfterTimeStep().

◆ checkBoundaryBeforeTimeStep()

void InsertionBoundary::checkBoundaryBeforeTimeStep ( DPMBase md)
overridevirtual

Fills the boundary with particles.

Is used to fill the insides of the boundary with particles until it is filled up.

Parameters
[in,out]mdthe problem's DPMBase object
Todo:
rename to something like "insertUntilMaxFailed"?
Todo:
create a definition for zero-size particles. Right now the zero-size particle is only used as a stop criterion for the manual PSD insertion

Reimplemented from BaseBoundary.

Reimplemented in RandomClusterInsertionBoundary.

164 {
165  logger(VERBOSE, "In InsertionBoundary::checkBoundaryBeforeTimeStep\n");
166 
167  if (!isActivated_)
168  {
169  return;
170  }
171 
172  /* Each timestep, the InsertionBoundary attempts to fill up a region with
173  * particles.
174  *
175  * It first calls generateParticle() to get a randomised particle, subject
176  * to a specified distribution over sizes and species. (The basic class
177  * supports size dispersity only but PolydisperseInsertionBoundary will
178  * support species dispersity.)
179  * Then it repeatedly calls placeParticle(), which gives the particle a
180  * random location (and possibly velocity) in a specified,
181  * geometry-dependent bound. Each time, it checks whether the new particle
182  * would have an interaction with another particle or a wall.
183  *
184  * If it manages to do that within maxFailed_ tries, then:
185  * * the new particle is inserted,
186  * * the failure counter is reset, and
187  * the processes is repeated with a new generateParticle().
188  *
189  * Otherwise, the processes terminates for this timestep.
190  * */
191 
192  // Keep count of how many successive times we have failed to place a new
193  // particle.
194  unsigned int failed = 0;
195  while (failed <= maxFailed_ && insertParticle(md->getNextTime())) // 'generating' loop
196  {
197  /* Generate random *intrinsic* properties for the new particle. */
198  logger(VERBOSE, "about to call generateParticle\n");
199 
200  //generate a particle the first time
201  if (!p0) p0 = generateParticle(md->random);
202  // Important for particle generation with a particle size distribution as it generates a particle with zero
203  // radius. If a particle is not allowed to be inserted by the PSD criteria it will generate a particle with
204  // zero diameter. This if statement prevents inserting particles with zero radius, which would else be a problem.
206  if (p0->getRadius() == 0)
207  {
208  logger(VERBOSE, "The PSD for the specified volume is fully set");
209  // free up memory space
210  delete p0;
211  // out of the 'placing' loop
212  failed = maxFailed_ + 1;
213  continue;
214  }
215  logger(VERBOSE, "generated a particle with intrinsics %", p0);
216 
217  while (true) // 'placing' loop
218  {
219  /* Generate extrinsic properties (position and velocity) for this
220  * new particle. */
221  placeParticle(p0, md->random);
222  logger(VERBOSE, "attempting to place particle with radius % at %, vel %", p0->getMaxInteractionRadius(), p0->getPosition(), p0->getVelocity());
223 
224 #ifdef MERCURYDPM_USE_MPI
225  /* Communicate the new particle's properties by setHandler (note
226  * that this doesn't actually add the particle to the handler). */
227  if (NUMBER_OF_PROCESSORS > 1)
228  {
229  MPIParticle particle;
230  // //Every domain generates a particle (to get the species right etc)
231 
232  //Send particle data from root to other processors to sync the particle properties
233  if (PROCESSOR_ID == 0)
234  {
236  }
237 
239 
240  //Process the received data
241  if (PROCESSOR_ID != 0)
242  {
243  copyDataFromMPIParticleToParticle(&particle, p0, &(md->particleHandler));
244  }
245  }
246 #endif
247  p0->setHandler(&md->particleHandler);
248  /* Check whether the particle has any interactions. */
249  if (!checkParticleForInteraction_ || md->checkParticleForInteraction(*p0))
250  {
251  //Note: in parallel only one of the domains will actually add the particle
252  md->particleHandler.copyAndAddObject(p0);
253  failed = 0;
254 
256  const double volume = p0->getVolume();
257  volumeInserted_ += volume;
258  massInserted_ += p0->getSpecies()->getDensity() * volume;
259  logger(VERBOSE, "successfully placed a particle %, with position: % after % fails.", p0,
260  p0->getPosition(), failed);
261  /* JMFT: The generateParticle() routine allocates memory, so we should
262  * free it here. (Don't worry, the particle will have been copied to the
263  * particleHandler by this point iff we want it.) */
264  delete p0;
265  // generate a new particle to be inserted only if the last particle could be successfully places
266  p0 = generateParticle(md->random);
267  break; // out of the 'placing' loop
268  }
269  else
270  {
271  failed++;
272  logger(VERBOSE, "failed to place a particle; have failed % times", failed);
273  }
274 
275  if (failed > maxFailed_)
276  {
277  logger(VERBOSE, "failed too many times; giving up");
279  {
280  particleSizeDistributionVector_[chosenSpecies_].decrementNParticlesPerClass();
281  particleSizeDistributionVector_[chosenSpecies_].decrementVolumePerClass(p0->getVolume());
282  }
283  break; // out of the 'placing' loop (and will leave the 'generating' loop too
284  }
285  }
286  logger(VERBOSE, "failed % times, so breaking out of InsertionBoundary loop for this timestep.", failed);
287  }
288  // logger(INFO, "volumeInserted_ = %", volumeInserted_);
289 }
#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
Logger< MERCURYDPM_LOGLEVEL > logger("MercuryKernel")
Definition of different loggers with certain modules. A user can define its own custom logger here.
@ 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
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
Mdouble getRadius() const
Returns the particle's radius.
Definition: BaseParticle.h:331
virtual Mdouble getVolume() const
Get Particle volume function, which required a reference to the Species vector. It returns the volume...
Definition: BaseParticle.cc:126
void setHandler(ParticleHandler *handler)
Sets the pointer to the particle's ParticleHandler.
Definition: BaseParticle.cc:640
Mdouble getMaxInteractionRadius() const
Returns the particle's interaction radius, which might be different from radius_ (e....
Definition: BaseParticle.h:345
virtual void placeParticle(BaseParticle *p, RNG &random)=0
Purely virtual function that generates the extrinsic properties (position, velocity) of a particle.
bool insertParticle(Mdouble time)
Checks the inserted total volume and returns if a particle is still allowed to be inserted.
Definition: InsertionBoundary.cc:129
virtual BaseParticle * generateParticle(RNG &random)
Sets the properties of the InsertionBoundary for a single particle type ‍/ virtual void set(BaseParti...
Definition: InsertionBoundary.cc:82
BaseParticle * p0
pointer to the next particle that should be inserted (needs to be stored across time steps).
Definition: InsertionBoundary.h:349
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
void copyDataFromParticleToMPIParticle(BaseParticle *p)
Definition: MpiDataClass.cc:110
Mdouble getDensity() const
Allows density_ to be accessed.
Definition: ParticleSpecies.cc:98

References MPIContainer::broadcast(), checkParticleForInteraction_, chosenSpecies_, copyDataFromMPIParticleToParticle(), MPISphericalParticle::copyDataFromParticleToMPIParticle(), generateParticle(), ParticleSpecies::getDensity(), BaseParticle::getMaxInteractionRadius(), BaseInteractable::getPosition(), BaseParticle::getRadius(), BaseInteractable::getSpecies(), BaseInteractable::getVelocity(), BaseParticle::getVolume(), insertParticle(), MPIContainer::Instance(), isActivated_, isManuallyInserting_, logger, massInserted_, maxFailed_, md, NUMBER_OF_PROCESSORS, numberOfParticlesInserted_, p0, PARTICLE, particleSizeDistributionVector_, placeParticle(), PROCESSOR_ID, BaseParticle::setHandler(), VERBOSE, and volumeInserted_.

Referenced by GranuDrum::GranuDrum(), GranuHeap::GranuHeap(), insertParticles(), main(), FreeCooling2DinWalls::setupInitialConditions(), StressStrainControl::setupInitialConditions(), and ConstantMassFlowMaserSelfTest::setupInitialConditions().

◆ deactivate()

void InsertionBoundary::deactivate ( )

Turns off the InsertionBoundary.

Turns off the InsertionBoundary by setting the boolean to FALSE.

351 {
352  isActivated_ = false;
353 }

References isActivated_.

Referenced by Chutebelt::actionsAfterTimeStep(), and Chutebelt::setupInitialConditions().

◆ generateParticle()

BaseParticle * InsertionBoundary::generateParticle ( RNG random)
virtual

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

     \brief Sets the properties of the InsertionBoundary for mutliple different particle types
    &zwj;/

virtual void set(std::vector<BaseParticle*> particleToCopy, unsigned int maxFailed, Vec3D velMin, Vec3D velMax, double radMin, double radMax)=0;

/*!

/*!
   \brief Virtual function that generates the intrinsic properties
   (species, radius) of one particle.
   \param[in] random  Random number generator

The default behaviour will be to return particleToCopy_, but this can be overridden by the children (to get size or species dispersity).

Reimplemented in PolydisperseInsertionBoundary, BidisperseCubeInsertionBoundary, and FixedClusterInsertionBoundary.

83 {
84  double check = random.getRandomNumber(0, 1);
85  for (int i = 0; i < probability_.size(); i++)
86  {
87  if (check < probability_[i])
88  {
89  chosenSpecies_ = i;
90  break;
91  }
92  else
93  {
94  check -= probability_[i];
95  }
96  }
98  if (particleSizeDistributionVector_[chosenSpecies_].getParticleSizeDistribution().empty())
99  {
100  particleSizeDistributionVector_[chosenSpecies_].setDistributionUniform(P->getRadius(), P->getRadius(), 50);
101  logger(INFO, "Assembling a discrete uniform particle size distribution (50 bins) with the radius set for the "
102  "InsertionBoundary.");
103  }
104  // manual insertion routine to insert PSDs as accurate as possible into a given volume
106  {
107  logger.assert_debug(initialVolume_ > 0.0, "Use setInitialVolume to define the particle insertion volume");
108  Mdouble radius;
109  // getVolumeFlowRate() * time + initialVolume_ - volumeInserted_ lead to more inaccurate results, therfore
110  // -volumeInserted was removed.
112  getHandler()->getDPMBase()->getTime() +
114  P->setRadius(radius);
115  return P;
116  }
117  Mdouble radius;
119  P->setRadius(radius);
120  return P;
121 }
@ INFO
BoundaryHandler * getHandler() const
Returns the boundary's BoundaryHandler.
Definition: BaseBoundary.cc:122
Definition: BaseParticle.h:33
Mdouble getVolumeFlowRate() const
Gets the volume flow rate of the insertion routine.
Definition: InsertionBoundary.cc:594
Mdouble getRandomNumber()
This is a random generating routine can be used for initial positions.
Definition: RNG.cc:123
void check(bool b, bool ref)
Definition: fastmath.cpp:12
double P
Uniform pressure.
Definition: TwenteMeshGluing.cpp:77
radius
Definition: UniformPSDSelfTest.py:15

References check(), chosenSpecies_, BaseBoundary::getHandler(), RNG::getRandomNumber(), getVolumeFlowRate(), i, INFO, initialVolume_, isManuallyInserting_, logger, Global_Physical_Variables::P, particleSizeDistributionVector_, particleToCopy_, probability_, and UniformPSDSelfTest::radius.

Referenced by checkBoundaryBeforeTimeStep(), and RandomClusterInsertionBoundary::checkBoundaryBeforeTimeStep().

◆ getCheckParticleForInteraction()

bool InsertionBoundary::getCheckParticleForInteraction ( ) const

Gets the variable that checks if a particle has an interaction.

Gets the variable that checks if a particle has an interaction with a wall or another particle.

Returns
if TRUE the particle has an interaction and if FALSE the particle has no interaction.
704 {
706 }

References checkParticleForInteraction_.

◆ getInitialVolume()

Mdouble InsertionBoundary::getInitialVolume ( ) const

Gets the initialVolume() .

Gets the volume to be inserted by the insertion routine.

Returns
A double which corresponds to volume to be inserted by the insertion routines
612 {
613  return initialVolume_;
614 }

References initialVolume_.

Referenced by NozzleDemo::actionsAfterTimeStep(), RotatingDrumBidisperseInitialise::actionsAfterTimeStep(), Chutebelt::actionsAfterTimeStep(), NozzleSelfTest::actionsAfterTimeStep(), and RotatingDrumBidisperseInitialise::RotatingDrumBidisperseInitialise().

◆ getMassOfParticlesInserted()

Mdouble InsertionBoundary::getMassOfParticlesInserted ( ) const

Gets the mass of particles inserted by the boundary.

Returns the mass of particles inserted in the boundary

Returns
the mass of particles inserted
315 {
316  return massInserted_;
317 }

References massInserted_.

Referenced by RotatingDrumBidisperseInitialise::actionsAfterTimeStep(), Chutebelt::actionsAfterTimeStep(), BoundariesSelfTest::actionsAfterTimeStep(), and FluxBoundarySelfTest::actionsAfterTimeStep().

◆ getMaxFailed()

unsigned int InsertionBoundary::getMaxFailed ( ) const

Gets the number of times that the boundary may fail to insert a particle.

Return maxFailed_ (see InsertionBoundary::set).

Returns
the maximum number of particle insertion trials
369 {
370  return maxFailed_;
371 }

References maxFailed_.

◆ getNumberOfParticlesInserted()

unsigned int InsertionBoundary::getNumberOfParticlesInserted ( ) const

Gets the number of particles inserted by the boundary.

Returns the number of particles inserted in the boundary

Returns
the number of particles inserted
306 {
308 }

References numberOfParticlesInserted_.

Referenced by T_protectiveWall::actionsAfterTimeStep(), BoundariesSelfTest::actionsAfterTimeStep(), FluxBoundarySelfTest::actionsAfterTimeStep(), insertParticles(), RotatingDrumBidisperseInitialise::printTime(), and Chute::write().

◆ getParticleToCopy()

std::vector< BaseParticle * > InsertionBoundary::getParticleToCopy ( )

Gets the particles that will be inserted through the insertion boundary.

returns pointer to the particle copies which are to be inserted

436 {
437  if (particleToCopy_.empty())
438  {
439  logger(ERROR, "particleToCopy not set");
440  }
441  return particleToCopy_;
442 }
@ ERROR

References ERROR, logger, and particleToCopy_.

◆ getPSD()

std::vector< PSD > InsertionBoundary::getPSD ( )

Gets the particle size distributions set by the user.

gets the user defined particle size distributions

Returns
a vector of PSD class objects containing containing the differnt user defined particle size distributions
686 {
688 }

References particleSizeDistributionVector_.

◆ getVolumeFlowRate()

Mdouble InsertionBoundary::getVolumeFlowRate ( ) const

Gets the volume flow rate of the insertion routine.

Gets the volumetric flow rate of the insertion routine.

Returns
A double which corresponds to the flow rate of the insertion routine
595 {
596  return volumeFlowRate_;
597 }

References volumeFlowRate_.

Referenced by generateParticle(), and insertParticle().

◆ getVolumeOfParticlesInserted()

Mdouble InsertionBoundary::getVolumeOfParticlesInserted ( ) const

◆ insertParticle()

bool InsertionBoundary::insertParticle ( Mdouble  time)

Checks the inserted total volume and returns if a particle is still allowed to be inserted.

Checks the inserted total volume by the flowrate and initialVolume and returns if a particle is allowed to be inserted.

Returns
TRUE if the inserted volume is lower than the total volume and FALSE if the inserted volume is higher than the total volume.
130 {
131  // check if the flow rate limit has been reached
133  {
135  }
136  else
137  {
138  const Mdouble iMax = (Mdouble) variableCumulativeVolumeFlowRate_.size() - 2;
139  const Mdouble i = std::min(time / samplingInterval_, iMax);
140  if (i == iMax)
141  {
142  static unsigned count = 0;
143  if (count == 0)
144  {
145  logger(WARN, "Reached end of volume flowrate function");
146  }
147  ++count;
148  }
149  const size_t id = i;
150  const Mdouble allowedVolume = variableCumulativeVolumeFlowRate_[id] +
152  variableCumulativeVolumeFlowRate_[id]) * (i - id);
153  return volumeInserted_ < allowedVolume;
154  }
155 }
double Mdouble
Definition: GeneralDefine.h:13
@ WARN
#define min(a, b)
Definition: datatypes.h:22

References getVolumeFlowRate(), i, initialVolume_, logger, min, samplingInterval_, variableCumulativeVolumeFlowRate_, volumeInserted_, and WARN.

Referenced by checkBoundaryBeforeTimeStep(), and RandomClusterInsertionBoundary::checkBoundaryBeforeTimeStep().

◆ insertParticles()

void InsertionBoundary::insertParticles ( DPMBase md)

Fill a certain domain with particles.

\detail calls the function checkBoundaryBeforeTimeStep() to fill a domain with particles; also reports how many particles where inserted at the end of the routine.

296 {
298  logger(INFO, "Inserted % particles", getNumberOfParticlesInserted());
299 }
unsigned int getNumberOfParticlesInserted() const
Gets the number of particles inserted by the boundary.
Definition: InsertionBoundary.cc:305
void checkBoundaryBeforeTimeStep(DPMBase *md) override
Fills the boundary with particles.
Definition: InsertionBoundary.cc:163

References checkBoundaryBeforeTimeStep(), getNumberOfParticlesInserted(), INFO, logger, and md.

Referenced by RotatingDrumWet::setupInitialConditions().

◆ isActivated()

bool InsertionBoundary::isActivated ( )

Returns whether the InsertionBoundary is activated.

checks the activation status of the InsertionBoundary by checking the respective boolean variable.

Returns
TRUE for an activated InsertionBoundary and FALSE for a deactivated InsertionBoundary
360 {
361  return isActivated_;
362 }

References isActivated_.

◆ placeParticle()

virtual void InsertionBoundary::placeParticle ( BaseParticle p,
RNG random 
)
pure virtual

Purely virtual function that generates the extrinsic properties (position, velocity) of a particle.

Parameters
[in]pThe particle to be placed
[in]randomRandom number generator

This should be implemented by the children such as CubeInsertionBoundary, as the implementation will be geometry-dependent.

Implemented in SphereInsertionBoundary, RandomClusterInsertionBoundary, PolydisperseInsertionBoundary, HopperInsertionBoundary, CylinderInsertionBoundary, CubeInsertionBoundary, ChuteInsertionBoundary, BaseClusterInsertionBoundary, and FixedClusterInsertionBoundary.

Referenced by checkBoundaryBeforeTimeStep().

◆ read()

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

Reads the boundary's id_ and maxFailed_.

reads the boundary's id_ and maxFailed_ from the given istream

Parameters
[in,out]isstream the data members are read from
Todo:
make theses reads non-optional

Implements BaseBoundary.

Reimplemented in SphereInsertionBoundary, and PolydisperseInsertionBoundary.

449 {
450  BaseBoundary::read(is);
451  std::string dummy, type;
452  is >> dummy >> maxFailed_ >> dummy;
453  if (dummy == "volumeFlowRate")
454  {
455  is >> volumeFlowRate_ >> dummy;
456  }
457  is >> massInserted_;
458  is >> dummy >> volumeInserted_;
459  is >> dummy >> numberOfParticlesInserted_;
460  is >> dummy >> isActivated_;
461  size_t psdVectorSize;
462  is >> dummy >> psdVectorSize;
464  particleSizeDistributionVector_.resize(psdVectorSize);
465  for (auto& particleSizeDistributionVector: particleSizeDistributionVector_)
466  {
467  size_t psdSize;
468  DistributionElements radiusAndProbability{};
469  std::vector<DistributionElements> particleSizeDistribution{};
470  is >> dummy >> psdSize;
471  particleSizeDistribution.clear();
472  particleSizeDistribution.reserve(psdSize);
473  for (size_t i = 0; i < psdSize; i++)
474  {
475  is >> radiusAndProbability.internalVariable;
476  is >> radiusAndProbability.probability;
477  particleSizeDistribution.push_back(radiusAndProbability);
478  }
479  particleSizeDistributionVector.setPSDFromVector(particleSizeDistribution, PSD::TYPE::CUMULATIVE_NUMBER_DISTRIBUTION);
480  }
481  if (psdVectorSize > 1)
482  {
483  is >> dummy;
484  Mdouble psdRatio;
485  probability_.clear();
486  probability_.reserve(psdVectorSize);
487  for (size_t i = 0; i < psdVectorSize; i++)
488  {
489  is >> psdRatio;
490  probability_.push_back(psdRatio);
491  }
492  }
493 
495  helpers::readOptionalVariable(is, "checkParticleForInteraction", checkParticleForInteraction_);
496  helpers::readOptionalVariable(is, "initialVolume", initialVolume_);
497  if (helpers::readOptionalVariable(is, "samplingInterval", samplingInterval_))
498  {
499  size_t n;
500  Mdouble flowRate;
501  is >> dummy >> n;
502  //variableCumulativeVolumeFlowRate_.clear();
504  for (size_t i = 0; i < n; ++i)
505  {
506  is >> flowRate;
507  variableCumulativeVolumeFlowRate_.push_back(flowRate);
508  }
509  }
510  is >> dummy;
511  if (dummy != "noParticleToCopy")
512  {
513  size_t particleToCopySize;
514  for (auto& particleToCopy: particleToCopy_)
515  {
516  delete particleToCopy;
517  }
518  is >> particleToCopySize;
519  particleToCopy_.resize(particleToCopySize);
520  for (auto& particleToCopy: particleToCopy_)
521  {
522  particleToCopy = getHandler()->getDPMBase()->particleHandler.readAndCreateObject(is);
523  // The .restart file records the index of the particle's species, but
524  // doesn't record the pointer, i.e. the memory address of the species within
525  // the speciesHandler. The latter needs to be reset now.
526  particleToCopy->setSpecies(getHandler()->getDPMBase()->speciesHandler.getObject(
527  particleToCopy->getIndSpecies()));
528  }
529  }
530 }
const unsigned n
Definition: CG3DPackingUnitTest.cpp:11
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
DPMBase * getDPMBase()
Gets the problem that is solved using this handler.
Definition: BaseHandler.h:733
T * getObject(const unsigned int id)
Gets a pointer to the Object at the specified index in the BaseHandler.
Definition: BaseHandler.h:621
virtual void setSpecies(const ParticleSpecies *species)
Definition: BaseParticle.cc:798
ParticleHandler particleHandler
An object of the class ParticleHandler, contains the pointers to all the particles created.
Definition: DPMBase.h:1443
class of DistributionElements which stores internalVariables and probabilities of a distribution....
Definition: DistributionElements.h:13
Mdouble internalVariable
Definition: DistributionElements.h:15
@ CUMULATIVE_NUMBER_DISTRIBUTION
BaseParticle * readAndCreateObject(std::istream &is)
Create a new particle, based on the information provided in a restart file.
Definition: ParticleHandler.cc:1063
type
Definition: compute_granudrum_aor.py:141
bool readOptionalVariable(std::istream &is, const std::string &name, T &variable)
Reads optional variables in the restart file.
Definition: FileIOHelpers.h:68
std::string string(const unsigned &i)
Definition: oomph_definitions.cc:286

References checkParticleForInteraction_, PSD::CUMULATIVE_NUMBER_DISTRIBUTION, BaseHandler< T >::getDPMBase(), BaseBoundary::getHandler(), BaseHandler< T >::getObject(), i, initialVolume_, DistributionElements::internalVariable, isActivated_, massInserted_, maxFailed_, n, numberOfParticlesInserted_, DPMBase::particleHandler, particleSizeDistributionVector_, particleToCopy_, probability_, BaseBoundary::read(), ParticleHandler::readAndCreateObject(), helpers::readOptionalVariable(), samplingInterval_, BaseParticle::setSpecies(), oomph::Global_string_for_annotation::string(), compute_granudrum_aor::type, variableCumulativeVolumeFlowRate_, volumeFlowRate_, and volumeInserted_.

Referenced by BaseClusterInsertionBoundary::read(), ChuteInsertionBoundary::read(), CubeInsertionBoundary::read(), CylinderInsertionBoundary::read(), HopperInsertionBoundary::read(), PolydisperseInsertionBoundary::read(), and SphereInsertionBoundary::read().

◆ reset()

void InsertionBoundary::reset ( )

resets particle property counter variables.

set all particle property counter variables to zero. reset() does not activate or deactivate the InsertionBoundary.

333 {
335  massInserted_ = 0;
336  volumeInserted_ = 0;
337 }

References massInserted_, numberOfParticlesInserted_, and volumeInserted_.

◆ rotateBoundary()

void InsertionBoundary::rotateBoundary ( Vec3D  angle)
virtual

virtual function that rotates the boundary.

Parameters
[in]angleThe angles by which the boundary should be rotated.

This should be implemented by the children such as CylinderInsertionBoundary, as the implementation will be geometry-dependent.

Reimplemented in CylinderInsertionBoundary.

404 {
405 
406 }

◆ setCheckParticleForInteraction()

void InsertionBoundary::setCheckParticleForInteraction ( bool  checkParticleForInteraction)

Sets the variable that checks if a particle has an interaction.

Sets the distribution type from the Distribution class.

Parameters
[in]checkParticleForInteractionboolean which determines if a particle has an interaction.
713 {
714  checkParticleForInteraction_ = checkParticleForInteraction;
715 }

References checkParticleForInteraction_.

Referenced by GranuDrum::GranuDrum().

◆ setInitialVolume()

◆ setManualInsertion()

void InsertionBoundary::setManualInsertion ( bool  isManuallyInserting)

Set the flag for a manual PSD insertion routine.

sets the isManuallyInserting_ to TRUE, resulting in a top-down class-by-class insertion routine to insert PSDs as accurate as possible.

695 {
696  isManuallyInserting_ = isManuallyInserting;
697 }

References isManuallyInserting_.

Referenced by PSDManualInsertionSelfTest::setupInitialConditions().

◆ setParticleToCopy() [1/2]

void InsertionBoundary::setParticleToCopy ( BaseParticle particleToCopy)

Sets the particle that will be inserted through the insertion boundary.

Sets the vector of pointers to particles which will be inserted by the insertion boundary.

Parameters
[in]particleToCopypointer to the particle to be inserted
413 {
414  if (particleToCopy == nullptr)
415  {
416  logger(ERROR, "Setting particleToCopy to be a null pointer?");
417  }
418  else
419  {
420  if (!particleToCopy_.empty())
421  {
422  for (auto& particleToCopy: particleToCopy_)
423  {
424  delete particleToCopy;
425  }
426  }
427  particleToCopy_.resize(1);
428  particleToCopy_[0] = particleToCopy->copy();
429  }
430 }
virtual BaseParticle * copy() const =0
Particle copy method. It calls to copy constructor of this Particle, useful for polymorphism.

References BaseParticle::copy(), ERROR, logger, and particleToCopy_.

◆ setParticleToCopy() [2/2]

void InsertionBoundary::setParticleToCopy ( std::vector< BaseParticle * >  particleToCopy)

Sets multiple different particles that will be inserted through the insertion boundary.

Sets the vector of pointers to particles which will be inserted by the insertion boundary. This is mainly used to insert particles with different intrinsic properties (such as PSD, mechanical properties, etc.)

Parameters
[in]particleToCopyvector of pointers to the particles which are to be inserted
379 {
380  if (particleToCopy.empty())
381  {
382  logger(ERROR, "Setting particleToCopy to be empty?");
383  }
384  if (!particleToCopy_.empty())
385  {
386  for (auto& ParticleToCopy: particleToCopy_)
387  {
388  delete ParticleToCopy;
389  }
390  }
391  for (int i = 0; i < particleToCopy.size(); i++)
392  {
393  particleToCopy_.resize(particleToCopy.size());
394  particleToCopy_[i] = particleToCopy[i]->copy();
395  }
396 }

References ERROR, i, logger, and particleToCopy_.

Referenced by RandomClusterInsertionBoundary::set(), FixedClusterInsertionBoundary::set(), HopperInsertionBoundary::set(), CylinderInsertionBoundary::set(), SphereInsertionBoundary::set(), ChuteInsertionBoundary::set(), and CubeInsertionBoundary::set().

◆ setPSD() [1/2]

void InsertionBoundary::setPSD ( const PSD  psd)

◆ setPSD() [2/2]

void InsertionBoundary::setPSD ( std::vector< PSD psd,
std::vector< Mdouble psdRatio 
)

Sets the ranges of particle radii that may be generated from user defined PSDs.

Sets the ranges of particle radii that may be generated by different PSDs defined by the user.

Todo:
TP: Consider std::move instead of a set function. This would result in a speedup + no one has to set the PSD for insertionBoundaries again as it is set when a PSD is inserted.
663 {
664  particleSizeDistributionVector_.resize(psd.size());
666 
667  // check whether the distribution is normalised
668  double cumRatio = std::accumulate(psdRatio.begin(), psdRatio.end(), 0.0);
669  if (fabs(cumRatio-1.0)>1e-2) {
670  logger(INFO, "PSD probabilities add up to %, not 1. Hence, they will be normalised.");
671  }
672  for (auto& ratio : psdRatio ) {
673  ratio /= cumRatio;
674  }
675 
676  probability_.resize(psdRatio.size());
677  probability_ = psdRatio;
678 
679 }
Array< double, 1, 3 > e(1./3., 0.5, 2.)
Real fabs(const Real &a)
Definition: boostmultiprec.cpp:117

References e(), boost::multiprecision::fabs(), INFO, logger, particleSizeDistributionVector_, and probability_.

◆ setVariableVolumeFlowRate()

void InsertionBoundary::setVariableVolumeFlowRate ( const std::vector< Mdouble > &  variableCumulativeVolumeFlowRate,
Mdouble  samplingInterval 
)

Sets a variable volume flow rate.

See also
variableCumulativeVolumeFlowRate_

Sets a variable volume flow rate taken at fixed sampling intervals; the values are cumulative; thus, we need to ensure the volume inserted before time t=n*samplingInterval is less than variableCumulativeVolumeFlowRate[n].

See also
variableCumulativeVolumeFlowRate_
637 {
638  logger.assert_debug(samplingInterval > 0, "sampling interval needs to be positive");
639  const Mdouble endTime = variableCumulativeVolumeFlowRate.size() * samplingInterval;
640  logger(INFO, "variable flowrate is defined up to %", endTime);
641  logger.assert_always(getHandler()->getDPMBase()->getTimeMax() < endTime,
642  "variable flowrate is defined up to %, but tMax is set to %", endTime,
643  getHandler()->getDPMBase()->getTimeMax());
644  variableCumulativeVolumeFlowRate_ = variableCumulativeVolumeFlowRate;
645  samplingInterval_ = samplingInterval;
646 }

References BaseBoundary::getHandler(), INFO, logger, samplingInterval_, and variableCumulativeVolumeFlowRate_.

◆ setVolumeFlowRate()

void InsertionBoundary::setVolumeFlowRate ( Mdouble  volumeFlowRate)

Sets the volume flow rate of the insertion routine.

Sets the volumetric flow rate of the insertion routine.

603 {
604  volumeFlowRate_ = volumeFlowRate;
605 }

References volumeFlowRate_.

◆ shiftBoundary()

void InsertionBoundary::shiftBoundary ( Vec3D  shift)
virtual

virtual function that shifts the boundary.

Parameters
[in]shiftThe amount by which the boundary should be shifted.

This should be implemented by the children such as CylinderInsertionBoundary, as the implementation will be geometry-dependent.

Reimplemented in SphereInsertionBoundary, and CylinderInsertionBoundary.

399 {
400 
401 }

◆ write()

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

Writes the boundary's id_ and maxFailed_.

adds the boundary's id_ and maxFailed_ to the given ostream

Parameters
[in,out]isstream the data members are to be added to

Implements BaseBoundary.

Reimplemented in SphereInsertionBoundary, and PolydisperseInsertionBoundary.

537 {
538  logger(VERBOSE, "In InsertionBoundary::write\n");
540  os << " maxFailed " << maxFailed_;
542  os << " volumeFlowRate " << volumeFlowRate_;
543  os << " massInserted " << massInserted_;
544  os << " volumeInserted " << volumeInserted_;
545  os << " numberOfParticlesInserted " << numberOfParticlesInserted_;
546  os << " isActivated " << isActivated_;
547  os << " psdCount " << particleSizeDistributionVector_.size();
548  for (auto& particleSizeDistribution: particleSizeDistributionVector_)
549  {
550  os << " psd " << particleSizeDistribution.getParticleSizeDistribution().size();
551  for (auto p: particleSizeDistribution.getParticleSizeDistribution())
552  {
553  os << " " << p.internalVariable
554  << " " << p.probability;
555  }
556  }
557  if (!probability_.empty())
558  {
559  os << " psdRatio";
560  for (auto& psdRatio: probability_)
561  {
562  os << " " << psdRatio;
563  }
564  }
566  {
567  os << " checkParticleForInteraction " << checkParticleForInteraction_;
568  }
569  os << " initialVolume " << initialVolume_;
570  os << " samplingInterval " << samplingInterval_;
571  os << " variableCumulativeVolumeFlowRate " << variableCumulativeVolumeFlowRate_.size();
572  for (const auto flowRate: variableCumulativeVolumeFlowRate_)
573  {
574  os << ' ' << flowRate;
575  }
576  if (!particleToCopy_.empty())
577  {
578  os << " particleToCopy " << particleToCopy_.size();
579  for (auto& particleToCopy: particleToCopy_)
580  {
581  os << " " << *particleToCopy;
582  }
583  }
584  else
585  {
586  os << " noParticleToCopy";
587  }
588 }
float * p
Definition: Tutorial_Map_using.cpp:9
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 checkParticleForInteraction_, initialVolume_, isActivated_, isfinite, logger, massInserted_, maxFailed_, numberOfParticlesInserted_, p, particleSizeDistributionVector_, particleToCopy_, probability_, samplingInterval_, variableCumulativeVolumeFlowRate_, VERBOSE, volumeFlowRate_, volumeInserted_, and BaseBoundary::write().

Referenced by BaseClusterInsertionBoundary::write(), ChuteInsertionBoundary::write(), CubeInsertionBoundary::write(), CylinderInsertionBoundary::write(), HopperInsertionBoundary::write(), PolydisperseInsertionBoundary::write(), and SphereInsertionBoundary::write().

Member Data Documentation

◆ checkParticleForInteraction_

bool InsertionBoundary::checkParticleForInteraction_

Checks if a particle has an interaction with a wall or other particles.

Referenced by checkBoundaryBeforeTimeStep(), getCheckParticleForInteraction(), InsertionBoundary(), read(), setCheckParticleForInteraction(), and write().

◆ chosenSpecies_

int InsertionBoundary::chosenSpecies_

stores the chosen species for each timestep.

Referenced by checkBoundaryBeforeTimeStep(), generateParticle(), and InsertionBoundary().

◆ initialVolume_

Mdouble InsertionBoundary::initialVolume_

◆ isActivated_

bool InsertionBoundary::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).

Todo:
JMFT: This is currently not saved to .restart files.

Referenced by activate(), FixedClusterInsertionBoundary::checkBoundaryBeforeTimeStep(), checkBoundaryBeforeTimeStep(), RandomClusterInsertionBoundary::checkBoundaryBeforeTimeStep(), deactivate(), InsertionBoundary(), isActivated(), read(), and write().

◆ isManuallyInserting_

bool InsertionBoundary::isManuallyInserting_

A flag to enable a top-down class-by-class manual insertion of a PSD; default is FALSE.

Referenced by checkBoundaryBeforeTimeStep(), generateParticle(), InsertionBoundary(), and setManualInsertion().

◆ massInserted_

◆ maxFailed_

◆ numberOfParticlesInserted_

◆ p0

BaseParticle* InsertionBoundary::p0 = nullptr

pointer to the next particle that should be inserted (needs to be stored across time steps).

Referenced by FixedClusterInsertionBoundary::checkBoundaryBeforeTimeStep(), checkBoundaryBeforeTimeStep(), and RandomClusterInsertionBoundary::checkBoundaryBeforeTimeStep().

◆ particleSizeDistributionVector_

std::vector<PSD> InsertionBoundary::particleSizeDistributionVector_

Defines a particle size distribution as an object of the PSD class; if particleSizeDistributionVector_ is empty, distribution_ is used instead.

Referenced by checkBoundaryBeforeTimeStep(), generateParticle(), getPSD(), InsertionBoundary(), read(), setPSD(), and write().

◆ particleToCopy_

std::vector<BaseParticle*> InsertionBoundary::particleToCopy_

read Distribution class from file. ‍/ friend std::istream& operator>>(std::istream& is, InsertionBoundary::Distribution& type);

     \brief write Distribution class to file.
    &zwj;/

friend std::ostream& operator<<(std::ostream& os, InsertionBoundary::Distribution type);

/*!

protected:

/*!
   \brief Particle that will be inserted through the insertion boundary.

Referenced by generateParticle(), FixedClusterInsertionBoundary::generateParticle(), getParticleToCopy(), InsertionBoundary(), read(), setParticleToCopy(), write(), and ~InsertionBoundary().

◆ probability_

std::vector<Mdouble> InsertionBoundary::probability_

vector of probabilities in range [0,1] which determine the mixing ratio of partice size distributions.

Referenced by generateParticle(), InsertionBoundary(), read(), setPSD(), and write().

◆ samplingInterval_

Mdouble InsertionBoundary::samplingInterval_
See also
variableCumulativeVolumeFlowRate_

Referenced by InsertionBoundary(), insertParticle(), read(), setVariableVolumeFlowRate(), and write().

◆ variableCumulativeVolumeFlowRate_

std::vector<Mdouble> InsertionBoundary::variableCumulativeVolumeFlowRate_

Defines a variable volume flow rate, taken at fixed sampling intervals; the values are cumulative; thus, we need to ensure the volume inserted before time t=n*samplingInterval is less than variableCumulativeVolumeFlowRate[n].

By default, this vector is empty; in that case, a constant volume flow rate will be used.

See also
volumeFlowRate_.

Referenced by InsertionBoundary(), insertParticle(), read(), setVariableVolumeFlowRate(), and write().

◆ velMax_

◆ velMin_

◆ volumeFlowRate_

Mdouble InsertionBoundary::volumeFlowRate_

The inflow can be controlled by setting a volume flow rate and an initial volume thus, this ensures the volume V inserted before time t is less than V = initialVolume_+volumeFlowRate_*t

The default value is volumeFlowRate_=inf, i.e. the volume is not controlled.

See also
To set a variable flow rate instead, see variableCumulativeVolumeFlowRate_.

Referenced by getVolumeFlowRate(), InsertionBoundary(), read(), setInitialVolume(), setVolumeFlowRate(), and write().

◆ volumeInserted_


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