MercuryDPM  Beta
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ChuteInsertionBoundary Class Reference

Used for modeling chute inflow. Inherits from InsertionBoundary. More...

#include <ChuteInsertionBoundary.h>

+ Inheritance diagram for ChuteInsertionBoundary:

Public Member Functions

 ChuteInsertionBoundary ()
 Default constructor. More...
 
 ChuteInsertionBoundary (const ChuteInsertionBoundary &other)
 Copy constructor. More...
 
virtual ChuteInsertionBoundarycopy () const
 Copy method; creates a copy on the heap. More...
 
void set (BaseParticle *particleToCopy, unsigned int maxFailed, Vec3D posMin, Vec3D posMax, double radMin, double radMax, double fixedParticleRadius, double inflowVelocity, double inflowVelocityVariance)
 Sets all boundary properties at once. More...
 
virtual BaseParticlegenerateParticle (RNG &random)
 Generates a random particle. More...
 
void read (std::istream &is)
 reads boundary properties from istream More...
 
MERCURY_DEPRECATED void oldRead (std::istream &is)
 deprecated version of CubeInsertionBoundary::read(). More...
 
void write (std::ostream &os) const
 writes boundary properties to ostream More...
 
virtual std::string getName () const
 Returns the name of the object. More...
 
- Public Member Functions inherited from InsertionBoundary
 InsertionBoundary ()
 Default constructor: set everything to 0/nullptr. More...
 
 InsertionBoundary (const InsertionBoundary &other)
 Copy constructor (with deep copy) More...
 
virtual ~InsertionBoundary ()
 Destructor: delete the particle that has to be copied at every insertion. More...
 
void set (BaseParticle *particleToCopy, unsigned int maxFailed)
 Sets the particle that will be inserted and the maximum number of times for which insertion may fail. More...
 
virtual void checkBoundaryBeforeTimeStep (DPMBase *md)
 Fills the boundary with particles. More...
 
unsigned int getNumberOfParticlesInserted () const
 Gets the number of particles inserted by the boundary. More...
 
void setMaxFailed (unsigned int maxFailed)
 Sets the number of times that the wall may fail to insert a particle. More...
 
unsigned int getMaxFailed () const
 Gets the number of times that the boundary may fail to insert a particle. More...
 
void setParticleToCopy (BaseParticle *particleToCopy)
 Sets the particle that will be inserted through the insertion boundary. More...
 
BaseParticlegetParticleToCopy () const
 Gets the particle that will be inserted through the insertion boundary. More...
 
void read (std::istream &is)
 Reads the boundary's id_ and maxFailed_. More...
 
void write (std::ostream &os) const
 Writes the boundary's id_ and maxFailed_. More...
 
- Public Member Functions inherited from BaseBoundary
 BaseBoundary ()
 default constructor. More...
 
 BaseBoundary (const BaseBoundary &b)
 copy constructor More...
 
virtual ~BaseBoundary ()
 destructor More...
 
virtual void createPeriodicParticles (BaseParticle *P UNUSED, ParticleHandler &pH UNUSED)
 Creates periodic copies of given particle in case of periodic boundaries. More...
 
virtual bool checkBoundaryAfterParticleMoved (BaseParticle *P UNUSED, ParticleHandler &pH UNUSED)
 Checks if given particle passed the boundary. More...
 
virtual void checkBoundaryBeforeTimeStep (DPMBase *md UNUSED)
 Fills a (3D) boundary with particles. More...
 
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 constructor. More...
 
 BaseObject (const BaseObject &p)
 Copy constructor, copies all the objects BaseObject contains. More...
 
virtual ~BaseObject ()
 virtual destructor More...
 
virtual void moveInHandler (const unsigned int index)
 Except that it is virtual, it does the same thing as setIndex() does. More...
 
void setIndex (const unsigned int index)
 Allows one to assign an index to an object in the handler/container. More...
 
void setId (const unsigned int 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...
 

Private Attributes

Vec3D posMin_
 The two extremal corners of the cuboidal insertion boundary. More...
 
Vec3D posMax_
 
double radMin_
 Minimum and maximum radii of the generated particles. More...
 
double radMax_
 
double fixedParticleRadius_
 radius of the fixed bottom particles, mean particle velocity in X-direction, and allowed maximum randomly added/substracted velocities in all three directions while generating particles (expressed as % of inflowVelocity_). NB: see also documentation of ChuteInsertionBoundary::generateParticle(). More...
 
double inflowVelocity_
 
double inflowVelocityVariance_
 

Detailed Description

Used for modeling chute inflow. Inherits from InsertionBoundary.

Definition at line 39 of file ChuteInsertionBoundary.h.

Constructor & Destructor Documentation

ChuteInsertionBoundary::ChuteInsertionBoundary ( )

Default constructor.

Default constructor. Initiates all properties with 0 value.

Definition at line 35 of file ChuteInsertionBoundary.cc.

References fixedParticleRadius_, inflowVelocity_, inflowVelocityVariance_, posMax_, posMin_, radMax_, and radMin_.

Referenced by copy().

36 {
37  posMax_ = Vec3D(0.0, 0.0, 0.0);
38  posMin_ = Vec3D(0.0, 0.0, 0.0);
39  radMax_ = 0.0;
40  radMin_ = 0.0;
42  inflowVelocity_ = 0.0;
44 }
double radMin_
Minimum and maximum radii of the generated particles.
InsertionBoundary()
Default constructor: set everything to 0/nullptr.
double fixedParticleRadius_
radius of the fixed bottom particles, mean particle velocity in X-direction, and allowed maximum rand...
Vec3D posMin_
The two extremal corners of the cuboidal insertion boundary.
Implementation of a 3D vector (by Vitaliy).
Definition: Vector.h:45
ChuteInsertionBoundary::ChuteInsertionBoundary ( const ChuteInsertionBoundary other)

Copy constructor.

Copy constructor. Calls InsertionBoundary parent copy constructor.

Definition at line 49 of file ChuteInsertionBoundary.cc.

References fixedParticleRadius_, inflowVelocity_, inflowVelocityVariance_, posMax_, posMin_, radMax_, and radMin_.

50  : InsertionBoundary(other)
51 {
52  posMax_ = other.posMax_;
53  posMin_ = other.posMin_;
54  radMax_ = other.radMax_;
55  radMin_ = other.radMin_;
59 }
double radMin_
Minimum and maximum radii of the generated particles.
InsertionBoundary()
Default constructor: set everything to 0/nullptr.
double fixedParticleRadius_
radius of the fixed bottom particles, mean particle velocity in X-direction, and allowed maximum rand...
Vec3D posMin_
The two extremal corners of the cuboidal insertion boundary.

Member Function Documentation

ChuteInsertionBoundary * ChuteInsertionBoundary::copy ( ) const
virtual

Copy method; creates a copy on the heap.

Copy method. Creates a copy on the heap.

Returns
Pointer to the copy.

Implements BaseBoundary.

Definition at line 65 of file ChuteInsertionBoundary.cc.

References ChuteInsertionBoundary().

66 {
67 #ifdef DEBUG_CONSTRUCTOR
68  std::cout << "ChuteInsertionBoundary::copy() const finished" << std::endl;
69 #endif
70  return new ChuteInsertionBoundary(*this);
71 }
ChuteInsertionBoundary()
Default constructor.
BaseParticle * ChuteInsertionBoundary::generateParticle ( RNG random)
virtual

Generates a random particle.

Generates a particle within the boundary with random radius, position and velocity (within the allowed intervals). Notable properties:

  • The minimal Z-position is fixedParticleRadius_ (the radius of the particles fixed at the bottom) above the minimal Z-value of the boundary
  • The particles have an mean velocity of inflowVelocity_ in the X-direction. Furthermore, each particle has a velocity added in all three directions, based on a given inflowVelocityVariance_, which is expressed as a percentage of the inflowVelocity_.
    Parameters
    [in]randoma random number generator
    Returns
    pointer to the generated particle

Implements InsertionBoundary.

Definition at line 124 of file ChuteInsertionBoundary.cc.

References BaseParticle::copy(), fixedParticleRadius_, InsertionBoundary::getParticleToCopy(), BaseParticle::getRadius(), RNG::getRandomNumber(), inflowVelocity_, inflowVelocityVariance_, mathsFunc::isEqual(), posMax_, posMin_, radMax_, radMin_, BaseInteractable::setPosition(), BaseParticle::setRadius(), BaseInteractable::setVelocity(), Vec3D::X, Vec3D::Y, and Vec3D::Z.

125 {
127 
129 
130  Vec3D position, velocity;
131 
132  position.X = posMin_.X + P->getRadius();
133 
134  if (mathsFunc::isEqual(posMax_.Y - posMin_.Y , 2.0 * radMax_, 1e-10))
135  {
136  position.Y = posMin_.Y + P->getRadius();
137  }
138  else
139  {
140  position.Y = random.getRandomNumber(posMin_.Y + P->getRadius(), posMax_.Y - P->getRadius());
141  }
142  position.Z = random.getRandomNumber(posMin_.Z + fixedParticleRadius_ + P->getRadius(), posMax_.Z - P->getRadius());
143 
144  // The velocity components are first stored in a Vec3D, because if you pass them
145  // directly into setVelocity the compiler is allowed to change the order in
146  // which the numbers are generated
150 
151  P->setPosition(position);
152  P->setVelocity(velocity);
153 
154  return P;
155 }
Mdouble X
the vector components
Definition: Vector.h:52
double radMin_
Minimum and maximum radii of the generated particles.
void setVelocity(const Vec3D &velocity)
set the velocity of the BaseInteractable.
void setRadius(const Mdouble radius)
Sets the particle's radius_ (and adjusts the mass_ accordingly, based on the particle's species) ...
double fixedParticleRadius_
radius of the fixed bottom particles, mean particle velocity in X-direction, and allowed maximum rand...
Vec3D posMin_
The two extremal corners of the cuboidal insertion boundary.
BaseParticle * getParticleToCopy() const
Gets the particle that will be inserted through the insertion boundary.
Mdouble getRadius() const
Returns the particle's radius_.
bool isEqual(Mdouble v1, Mdouble v2, double absError)
Compares the difference of two Mdouble with an absolute error, useful in UnitTests.
Mdouble Y
Definition: Vector.h:52
void setPosition(const Vec3D &position)
Sets the position of this BaseInteractable.
Implementation of a 3D vector (by Vitaliy).
Definition: Vector.h:45
Mdouble Z
Definition: Vector.h:52
Mdouble getRandomNumber(Mdouble min, Mdouble max)
This is a random generating routine can be used for initial positions.
Definition: RNG.cc:69
virtual BaseParticle * copy() const
Particle copy method. It calls to copy constructor of this Particle, useful for polymorfism.
std::string ChuteInsertionBoundary::getName ( ) const
virtual

Returns the name of the object.

Returns the name of the object class

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

Implements BaseObject.

Definition at line 214 of file ChuteInsertionBoundary.cc.

215 {
216  return "ChuteInsertionBoundary";
217 }
void ChuteInsertionBoundary::oldRead ( std::istream &  is)

deprecated version of CubeInsertionBoundary::read().

Deprecated version of read().

Deprecated:
Should be gone by Mercury 2.0. Instead, use CubeInsertionBoundary::read().

Definition at line 178 of file ChuteInsertionBoundary.cc.

References fixedParticleRadius_, inflowVelocity_, inflowVelocityVariance_, posMax_, posMin_, radMax_, radMin_, and InsertionBoundary::setMaxFailed().

179 {
180  unsigned int maxFailed;
181  std::string dummy;
182  is >> dummy >> maxFailed
183  >> dummy >> posMin_
184  >> dummy >> posMax_
185  >> dummy >> radMin_
186  >> dummy >> radMax_
187  >> dummy >> fixedParticleRadius_
188  >> dummy >> inflowVelocity_
189  >> dummy >> inflowVelocityVariance_;
190  setMaxFailed(maxFailed);
191 }
double radMin_
Minimum and maximum radii of the generated particles.
void setMaxFailed(unsigned int maxFailed)
Sets the number of times that the wall may fail to insert a particle.
double fixedParticleRadius_
radius of the fixed bottom particles, mean particle velocity in X-direction, and allowed maximum rand...
Vec3D posMin_
The two extremal corners of the cuboidal insertion boundary.
void ChuteInsertionBoundary::read ( std::istream &  is)
virtual

reads boundary properties from istream

Reads the boundary properties from an istream

Parameters
[in,out]isthe istream

Implements BaseBoundary.

Definition at line 161 of file ChuteInsertionBoundary.cc.

References fixedParticleRadius_, inflowVelocity_, inflowVelocityVariance_, posMax_, posMin_, radMax_, radMin_, and InsertionBoundary::read().

162 {
164  std::string dummy;
165  is >> dummy >> posMin_
166  >> dummy >> posMax_
167  >> dummy >> radMin_
168  >> dummy >> radMax_
169  >> dummy >> fixedParticleRadius_
170  >> dummy >> inflowVelocity_
171  >> dummy >> inflowVelocityVariance_;
172 }
double radMin_
Minimum and maximum radii of the generated particles.
double fixedParticleRadius_
radius of the fixed bottom particles, mean particle velocity in X-direction, and allowed maximum rand...
Vec3D posMin_
The two extremal corners of the cuboidal insertion boundary.
void read(std::istream &is)
Reads the boundary's id_ and maxFailed_.
void ChuteInsertionBoundary::set ( BaseParticle particleToCopy,
unsigned int  maxFailed,
Vec3D  posMin,
Vec3D  posMax,
double  radMin,
double  radMax,
double  fixedParticleRadius,
double  inflowVelocity,
double  inflowVelocityVariance 
)

Sets all boundary properties at once.

Sets all the properties of the chute 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 the chute insertion boundary
[in]posMaxSecond defining corner of the chute insertion boundary
[in]radMinMinimum radius of inserted particles
[in]radMaxMaximum radius of inserted particles
[in]fixedParticleRadiusradius of the fixed bottom (i.e., positioned at the minimal Z-position) particles
[in]inflowVelocitythe mean particle velocity, which is in the X-direction
[in]inflowVelocityVariancevalue of minimum (minus ~) and maximum added velocities which are added to the given mean in each of the three dimensions. Expressed as a percentage of inflowVelocity_. See also the documentation of ChuteInsertionBoundary::generateParticle().

Definition at line 95 of file ChuteInsertionBoundary.cc.

References fixedParticleRadius_, inflowVelocity_, inflowVelocityVariance_, posMax_, posMin_, radMax_, radMin_, InsertionBoundary::setMaxFailed(), and InsertionBoundary::setParticleToCopy().

Referenced by Chute::setupInitialConditions().

96 {
97  if (particleToCopy != nullptr)
98  {
99  setParticleToCopy(particleToCopy);
100  }
101  setMaxFailed(maxFailed);
102  posMin_ = posMin;
103  posMax_ = posMax;
104  radMin_ = radMin;
105  radMax_ = radMax;
106  fixedParticleRadius_ = fixedParticleRadius;
107  inflowVelocity_ = inflowVelocity;
108  inflowVelocityVariance_ = inflowVelocityVariance;
109 }
double radMin_
Minimum and maximum radii of the generated particles.
void setMaxFailed(unsigned int maxFailed)
Sets the number of times that the wall may fail to insert a particle.
void setParticleToCopy(BaseParticle *particleToCopy)
Sets the particle that will be inserted through the insertion boundary.
double fixedParticleRadius_
radius of the fixed bottom particles, mean particle velocity in X-direction, and allowed maximum rand...
Vec3D posMin_
The two extremal corners of the cuboidal insertion boundary.
void ChuteInsertionBoundary::write ( std::ostream &  os) const
virtual

writes boundary properties to ostream

Writes boundary's properties to an ostream

Parameters
[in]osthe ostream

Implements BaseBoundary.

Definition at line 197 of file ChuteInsertionBoundary.cc.

References fixedParticleRadius_, inflowVelocity_, inflowVelocityVariance_, posMax_, posMin_, radMax_, radMin_, and InsertionBoundary::write().

198  {
200  os << " posMin " << posMin_
201  << " posMax " << posMax_
202  << " radMin " << radMin_
203  << " radMax " << radMax_
204  << " fixedParticleRadius " << fixedParticleRadius_
205  << " inflowVelocity " << inflowVelocity_
206  << " inflowVelocityVariance " << inflowVelocityVariance_;
207 
208 }
double radMin_
Minimum and maximum radii of the generated particles.
double fixedParticleRadius_
radius of the fixed bottom particles, mean particle velocity in X-direction, and allowed maximum rand...
Vec3D posMin_
The two extremal corners of the cuboidal insertion boundary.
void write(std::ostream &os) const
Writes the boundary's id_ and maxFailed_.

Member Data Documentation

double ChuteInsertionBoundary::fixedParticleRadius_
private

radius of the fixed bottom particles, mean particle velocity in X-direction, and allowed maximum randomly added/substracted velocities in all three directions while generating particles (expressed as % of inflowVelocity_). NB: see also documentation of ChuteInsertionBoundary::generateParticle().

Definition at line 105 of file ChuteInsertionBoundary.h.

Referenced by ChuteInsertionBoundary(), generateParticle(), oldRead(), read(), set(), and write().

double ChuteInsertionBoundary::inflowVelocity_
private
double ChuteInsertionBoundary::inflowVelocityVariance_
private
Vec3D ChuteInsertionBoundary::posMax_
private
Vec3D ChuteInsertionBoundary::posMin_
private

The two extremal corners of the cuboidal insertion boundary.

Definition at line 92 of file ChuteInsertionBoundary.h.

Referenced by ChuteInsertionBoundary(), generateParticle(), oldRead(), read(), set(), and write().

double ChuteInsertionBoundary::radMax_
private
double ChuteInsertionBoundary::radMin_
private

Minimum and maximum radii of the generated particles.

Definition at line 97 of file ChuteInsertionBoundary.h.

Referenced by ChuteInsertionBoundary(), generateParticle(), oldRead(), read(), set(), and write().


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