MercuryDPM  Trunk
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
CubeInsertionBoundary Class Reference

It's an insertion boundary which has cuboidal shape (yes, 'CuboidalInsertionBoundary' would have been the correct name). More...

#include <CubeInsertionBoundary.h>

+ Inheritance diagram for CubeInsertionBoundary:

Public Member Functions

 CubeInsertionBoundary ()
 Constructor; sets everything to 0. More...
 
 CubeInsertionBoundary (const CubeInsertionBoundary &other)
 Copy constructor with deep copy. More...
 
 ~CubeInsertionBoundary () override
 Destructor: default destructor. More...
 
CubeInsertionBoundarycopy () 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)
 Sets the properties of the InsertionBoundary for mutliple different particle types. More...
 
void set (BaseParticle &particleToCopy, unsigned int maxFailed, Vec3D posMin, Vec3D posMax, Vec3D velMin, Vec3D velMax)
 
void set (std::vector< BaseParticle * > particleToCopy, unsigned int maxFailed, Vec3D posMin, Vec3D posMax, Vec3D velMin, Vec3D velMax)
 Sets the properties of the InsertionBoundary for a single particle type. More...
 
void set (BaseParticle *particleToCopy, unsigned int maxFailed, Vec3D posMin, Vec3D posMax, Vec3D velMin, Vec3D velMax, Mdouble rMin, Mdouble rMax)
 old style set function which also assumes a uniform psd. Note if you want a general PSD do not use but this is quicker for a uniform in size PSD More...
 
void set (BaseParticle &particleToCopy, unsigned int maxFailed, Vec3D posMin, Vec3D posMax, Vec3D velMin, Vec3D velMax, Mdouble rMin, Mdouble rMax)
 old style set function which also assumes a uniform psd. Note if you want a general PSD do not use but this is quicker for a uniform in size PSD More...
 
void setGeometry (Vec3D posMin, Vec3D posMax)
 Sets the geometry (position and velocity distribution) of the CubeInsertionBoundary. More...
 
void placeParticle (BaseParticle *p, RNG &random) override
 Generates a random position, velocity for the particle p. 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 ()
 Defines a custom particle size distribution; distribution_ will always be used, unless particleSizeDistributionVector_ is non-empty. More...
 
 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 mutliple different particle types. 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 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
 

Protected Attributes

Vec3D posMin_
 Minimal and maximal positions defining the boundary's boundaries, and minimum and maximum velocity of the particles to be inserted. More...
 
Vec3D posMax_
 
- Protected Attributes inherited from InsertionBoundary
std::vector< BaseParticle * > particleToCopy_
 write Distribution class to file. 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...
 

Private Member Functions

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

Detailed Description

It's an insertion boundary which has cuboidal shape (yes, 'CuboidalInsertionBoundary' would have been the correct name).

Definition at line 42 of file CubeInsertionBoundary.h.

Constructor & Destructor Documentation

CubeInsertionBoundary::CubeInsertionBoundary ( )

Constructor; sets everything to 0.

Default constructor; sets every data member to 0.

Definition at line 34 of file CubeInsertionBoundary.cc.

References posMax_, and posMin_.

Referenced by copy().

35 {
36  posMin_ = Vec3D(0.0, 0.0, 0.0);
37  posMax_ = Vec3D(0.0, 0.0, 0.0);
38 }
Vec3D posMin_
Minimal and maximal positions defining the boundary's boundaries, and minimum and maximum velocity of...
InsertionBoundary()
Defines a custom particle size distribution; distribution_ will always be used, unless particleSizeDi...
Definition: Vector.h:49
CubeInsertionBoundary::CubeInsertionBoundary ( const CubeInsertionBoundary other)

Copy constructor with deep copy.

Copy constructor

Definition at line 43 of file CubeInsertionBoundary.cc.

References posMax_, and posMin_.

44  : InsertionBoundary(other)
45 {
46  posMin_ = other.posMin_;
47  posMax_ = other.posMax_;
48 }
Vec3D posMin_
Minimal and maximal positions defining the boundary's boundaries, and minimum and maximum velocity of...
InsertionBoundary()
Defines a custom particle size distribution; distribution_ will always be used, unless particleSizeDi...
CubeInsertionBoundary::~CubeInsertionBoundary ( )
overridedefault

Destructor: default destructor.

Destructor. Since there are no pointers in this class, there is no need for any actions here.

Member Function Documentation

CubeInsertionBoundary * CubeInsertionBoundary::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

Implements BaseBoundary.

Definition at line 61 of file CubeInsertionBoundary.cc.

References CubeInsertionBoundary().

62 {
63 #ifdef DEBUG_CONSTRUCTOR
64  std::cout << "CubeInsertionBoundary::copy() const finished" << std::endl;
65 #endif
66  return new CubeInsertionBoundary(*this);
67 }
CubeInsertionBoundary()
Constructor; sets everything to 0.
std::string CubeInsertionBoundary::getName ( ) const
overrideprivatevirtual

Returns the name of the object.

Returns the name of the object class

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

Implements BaseObject.

Definition at line 195 of file CubeInsertionBoundary.cc.

196 {
197  return "CubeInsertionBoundary";
198 }
void CubeInsertionBoundary::placeParticle ( BaseParticle p,
RNG random 
)
overridevirtual

Generates a random position, velocity for the particle p.

places a particle with random position (although within the boundary, of course), velocity and radius and returns its pointer.

Parameters
[in]randomRandom number generator

Implements InsertionBoundary.

Definition at line 151 of file CubeInsertionBoundary.cc.

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

152 {
153  Vec3D pos, vel;
154  pos.X = random.getRandomNumber(posMin_.X, posMax_.X);
155  pos.Y = random.getRandomNumber(posMin_.Y, posMax_.Y);
156  pos.Z = random.getRandomNumber(posMin_.Z, posMax_.Z);
157  vel.X = random.getRandomNumber(velMin_.X, velMax_.X);
158  vel.Y = random.getRandomNumber(velMin_.Y, velMax_.Y);
159  vel.Z = random.getRandomNumber(velMin_.Z, velMax_.Z);
160  p->setPosition(pos);
161  p->setVelocity(vel);
162 }
Mdouble X
the vector components
Definition: Vector.h:65
Vec3D posMin_
Minimal and maximal positions defining the boundary's boundaries, and minimum and maximum velocity of...
void setVelocity(const Vec3D &velocity)
set the velocity of the BaseInteractable.
Mdouble getRandomNumber()
This is a random generating routine can be used for initial positions.
Definition: RNG.cc:143
Vec3D velMin_
Minimum and maximum velocity of the particles to be inserted.
Mdouble Y
Definition: Vector.h:65
void setPosition(const Vec3D &position)
Sets the position of this BaseInteractable.
Definition: Vector.h:49
Mdouble Z
Definition: Vector.h:65
void CubeInsertionBoundary::read ( std::istream &  is)
overridevirtual

reads boundary properties from istream

Reads the boundary properties from an istream

Parameters
[in,out]isthe istream

Implements BaseBoundary.

Definition at line 168 of file CubeInsertionBoundary.cc.

References posMax_, posMin_, InsertionBoundary::read(), InsertionBoundary::velMax_, and InsertionBoundary::velMin_.

Referenced by BidisperseCubeInsertionBoundary::read().

169 {
171  std::string dummy;
172  is >> dummy >> posMin_
173  >> dummy >> posMax_;
174  is >> dummy >> velMin_
175  >> dummy >> velMax_;
176 }
Vec3D posMin_
Minimal and maximal positions defining the boundary's boundaries, and minimum and maximum velocity of...
Vec3D velMin_
Minimum and maximum velocity of the particles to be inserted.
void read(std::istream &is) override
Reads the boundary's id_ and maxFailed_.
void CubeInsertionBoundary::set ( BaseParticle particleToCopy,
unsigned int  maxFailed,
Vec3D  posMin,
Vec3D  posMax,
Vec3D  velMin,
Vec3D  velMax 
)

Sets the properties of the InsertionBoundary for mutliple different particle types.

Sets all the properties of the cuboidal insertion boundary.

Parameters
[in]particleToCopyPointer to the BaseParticle which is used as a basis for the particles 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

Definition at line 107 of file CubeInsertionBoundary.cc.

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

Referenced by DPMBase::fillDomainWithParticles(), BidisperseCubeInsertionBoundary::set(), and set().

109 {
110  velMin_ = velMin;
111  velMax_ = velMax;
112  maxFailed_ = maxFailed;
113  setParticleToCopy(particleToCopy);
114  setGeometry(posMin, posMax);
115 }
Vec3D velMin_
Minimum and maximum velocity of the particles to be inserted.
unsigned int maxFailed_
Number of times that the wall may fail to insert a particle.
void setParticleToCopy(std::vector< BaseParticle * > particleToCopy)
Sets multiple different particles that will be inserted through the insertion boundary.
void setGeometry(Vec3D posMin, Vec3D posMax)
Sets the geometry (position and velocity distribution) of the CubeInsertionBoundary.
void CubeInsertionBoundary::set ( BaseParticle particleToCopy,
unsigned int  maxFailed,
Vec3D  posMin,
Vec3D  posMax,
Vec3D  velMin,
Vec3D  velMax 
)

Definition at line 117 of file CubeInsertionBoundary.cc.

References set().

119 {
120  set(&particleToCopy, maxFailed, posMin, posMax, velMin, velMax);
121 }
void set(BaseParticle *particleToCopy, unsigned int maxFailed, Vec3D posMin, Vec3D posMax, Vec3D velMin, Vec3D velMax)
Sets the properties of the InsertionBoundary for mutliple different particle types.
void CubeInsertionBoundary::set ( std::vector< BaseParticle * >  particleToCopy,
unsigned int  maxFailed,
Vec3D  posMin,
Vec3D  posMax,
Vec3D  velMin,
Vec3D  velMax 
)

Sets the properties of the InsertionBoundary for a single particle type.

Sets all the properties of the cuboidal insertion boundary.

Parameters
[in]particleToCopyvector of pointers to the BaseParticles which are used as a basis for the particle types (species) 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

Definition at line 83 of file CubeInsertionBoundary.cc.

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

85 {
86  velMin_ = velMin;
87  velMax_ = velMax;
88  maxFailed_ = maxFailed;
89  setParticleToCopy(particleToCopy);
90  setGeometry(posMin, posMax);
91 }
Vec3D velMin_
Minimum and maximum velocity of the particles to be inserted.
unsigned int maxFailed_
Number of times that the wall may fail to insert a particle.
void setParticleToCopy(std::vector< BaseParticle * > particleToCopy)
Sets multiple different particles that will be inserted through the insertion boundary.
void setGeometry(Vec3D posMin, Vec3D posMax)
Sets the geometry (position and velocity distribution) of the CubeInsertionBoundary.
void CubeInsertionBoundary::set ( BaseParticle particleToCopy,
unsigned int  maxFailed,
Vec3D  posMin,
Vec3D  posMax,
Vec3D  velMin,
Vec3D  velMax,
Mdouble  rMin,
Mdouble  rMax 
)
inline

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

Todo:
Check with Timo and Thomas about this.

Definition at line 85 of file CubeInsertionBoundary.h.

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

87  {
88  PSD uniformPSD;
89  uniformPSD.setDistributionUniform(rMin,rMax,1000);
90  setPSD(uniformPSD);
91  set(particleToCopy, maxFailed,posMin, posMax, velMin, velMax);
92  }
void set(BaseParticle *particleToCopy, unsigned int maxFailed, Vec3D posMin, Vec3D posMax, Vec3D velMin, Vec3D velMax)
Sets the properties of the InsertionBoundary for mutliple different particle types.
void setPSD(const PSD psd)
Sets the range of particle radii that may be generated from a user defined PSD.
void setDistributionUniform(Mdouble radMin, Mdouble radMax, int numberOfBins)
create a PSD vector for a uniform distribution.
Definition: PSD.cc:290
Contains a vector with radii and probabilities of a user defined particle size distribution (PSD) ...
Definition: PSD.h:62
void CubeInsertionBoundary::set ( BaseParticle particleToCopy,
unsigned int  maxFailed,
Vec3D  posMin,
Vec3D  posMax,
Vec3D  velMin,
Vec3D  velMax,
Mdouble  rMin,
Mdouble  rMax 
)
inline

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

Todo:
Check with Timo and Thomas about this.

Definition at line 98 of file CubeInsertionBoundary.h.

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

100  {
101  PSD uniformPSD;
102  uniformPSD.setDistributionUniform(rMin,rMax,1000);
103  setPSD(uniformPSD);
104  set(particleToCopy, maxFailed,posMin, posMax, velMin, velMax);
105  }
void set(BaseParticle *particleToCopy, unsigned int maxFailed, Vec3D posMin, Vec3D posMax, Vec3D velMin, Vec3D velMax)
Sets the properties of the InsertionBoundary for mutliple different particle types.
void setPSD(const PSD psd)
Sets the range of particle radii that may be generated from a user defined PSD.
void setDistributionUniform(Mdouble radMin, Mdouble radMax, int numberOfBins)
create a PSD vector for a uniform distribution.
Definition: PSD.cc:290
Contains a vector with radii and probabilities of a user defined particle size distribution (PSD) ...
Definition: PSD.h:62
void CubeInsertionBoundary::setGeometry ( Vec3D  posMin,
Vec3D  posMax 
)

Sets the geometry (position and velocity distribution) of the CubeInsertionBoundary.

Definition at line 124 of file CubeInsertionBoundary.cc.

References posMax_, and posMin_.

Referenced by set().

125 {
126  posMin_ = posMin;
127  posMax_ = posMax;
128 }
Vec3D posMin_
Minimal and maximal positions defining the boundary's boundaries, and minimum and maximum velocity of...
void CubeInsertionBoundary::write ( std::ostream &  os) const
overridevirtual

writes boundary properties to ostream

Writes boundary's properties to an ostream

Parameters
[in]osthe ostream

Implements BaseBoundary.

Definition at line 182 of file CubeInsertionBoundary.cc.

References posMax_, posMin_, InsertionBoundary::velMax_, InsertionBoundary::velMin_, and InsertionBoundary::write().

Referenced by BidisperseCubeInsertionBoundary::write().

183 {
185  os << " posMin " << posMin_
186  << " posMax " << posMax_
187  << " velMin " << velMin_
188  << " velMax " << velMax_;
189 }
Vec3D posMin_
Minimal and maximal positions defining the boundary's boundaries, and minimum and maximum velocity of...
Vec3D velMin_
Minimum and maximum velocity of the particles to be inserted.
void write(std::ostream &os) const override
Writes the boundary's id_ and maxFailed_.

Member Data Documentation

Vec3D CubeInsertionBoundary::posMax_
protected
Vec3D CubeInsertionBoundary::posMin_
protected

Minimal and maximal positions defining the boundary's boundaries, and minimum and maximum velocity of the particles to be inserted.

Definition at line 145 of file CubeInsertionBoundary.h.

Referenced by CubeInsertionBoundary(), BidisperseCubeInsertionBoundary::generateParticle(), placeParticle(), read(), setGeometry(), and write().


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