MercuryDPM  Trunk
 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...
 
ChuteInsertionBoundarycopy () const override
 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...
 
void placeParticle (BaseParticle *p, RNG &random) override
 
void read (std::istream &is) override
 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 override
 writes boundary properties to ostream More...
 
std::string getName () const override
 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...
 
 ~InsertionBoundary () override
 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 BaseParticlegenerateParticle (RNG &random)
 Virtual function that generates the intrinsic properties (species, radius) of one particle. More...
 
void checkBoundaryBeforeTimeStep (DPMBase *md) override
 Fills the boundary with particles. More...
 
void insertParticles (DPMBase *md)
 
unsigned int getNumberOfParticlesInserted () const
 Gets the number of particles inserted by the boundary. More...
 
double getMassOfParticlesInserted () const
 
double getVolumeOfParticlesInserted () const
 
void reset ()
 
void activate ()
 Turns on the InsertionBoundary. More...
 
void deactivate ()
 Turns off the InsertionBoundary. More...
 
bool isActivated ()
 Returns whether the InsertionBoundary is activated. 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) 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
 
void setVolumeFlowRate (Mdouble volumeFlowRate_)
 
Mdouble getInitialVolume () const
 
void setInitialVolume (Mdouble initialVolume)
 
void setPSD (PSD psd)
 Sets the range of particle radii that may be generated from a user defined PSD. More...
 
PSD getPSD ()
 
void setDistribution (Distribution distribution)
 Sets the range of particle radii that may be generated to custom distributions. More...
 
Distribution getDistribution ()
 Gets the range of particle radii that may be generated. More...
 
void setVariableVolumeFlowRate (const std::vector< Mdouble > &variableCumulativeVolumeFlowRate, Mdouble samplingInterval)
 
bool insertParticle (Mdouble time)
 
bool getCheckParticleForInteraction () const
 
void setCheckParticleForInteraction (bool checkParticleForInteraction)
 
void setManualInsertion (bool manualInsertion)
 Set the flag for a manual PSD insertion routine. More...
 
- Public Member Functions inherited from BaseBoundary
 BaseBoundary ()
 default constructor. More...
 
 BaseBoundary (const BaseBoundary &b)
 copy constructor More...
 
 ~BaseBoundary () override
 destructor More...
 
virtual void createPeriodicParticle (BaseParticle *p UNUSED, ParticleHandler &pH UNUSED)
 Creates a periodic particle in case of periodic boundaries in serial build. More...
 
virtual void createPeriodicParticles (ParticleHandler &pH UNUSED)
 Creates periodic copies of given particle in case of periodic boundaries. More...
 
virtual void checkBoundaryAfterParticlesMove (ParticleHandler &pH)
 Virtual function that does things to particles, each time step after particles have moved. More...
 
virtual void actionsBeforeTimeLoop ()
 Virtual function that does something after DPMBase::setupInitialConditions but before the first time step. More...
 
virtual void modifyGhostAfterCreation (BaseParticle *particle, int i)
 
virtual void writeVTK (std::fstream &file)
 
void setHandler (BoundaryHandler *handler)
 Sets the boundary's BoundaryHandler. More...
 
BoundaryHandlergetHandler () const
 Returns the boundary's BoundaryHandler. More...
 
- Public Member Functions inherited from BaseObject
 BaseObject ()=default
 Default constructor. More...
 
 BaseObject (const BaseObject &p)=default
 Copy constructor, copies all the objects BaseObject contains. More...
 
virtual ~BaseObject ()=default
 virtual destructor More...
 
virtual void moveInHandler (unsigned int index)
 Except that it is virtual, it does the same thing as setIndex() does. More...
 
void setIndex (unsigned int index)
 Allows one to assign an index to an object in the handler/container. More...
 
void setId (unsigned long id)
 Assigns a unique identifier to each object in the handler (container) which remains constant even after the object is deleted from the container/handler. More...
 
unsigned int getIndex () const
 Returns the index of the object in the handler. More...
 
unsigned int getId () const
 Returns the unique identifier of any particular object. More...
 
void setGroupId (unsigned groupId)
 
unsigned getGroupId () const
 

Private Attributes

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

Additional Inherited Members

- Public Types inherited from InsertionBoundary
enum  Distribution { Distribution::Uniform, Distribution::Normal_1_5 }
 Defines a custom particle size distribution; distribution_ will always be used, unless particleSizeDistribution_ is non-empty. More...
 
- Protected Attributes inherited from InsertionBoundary
BaseParticleparticleToCopy_
 Particle that will be inserted through the insertion boundary. 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_
 
PSD particleSizeDistribution_
 Defines a particle size distribution as an object of the PSD class; if particleSizeDistribution_ is empty, distribution_ is used instead. More...
 
Mdouble radMin_
 Minimum and maximum radii of the generated particles. More...
 
Mdouble radMax_
 
Distribution distribution_ = Distribution::Uniform
 defines a custom particle size distribution, which by default is uniform More...
 
bool isManuallyInserting_
 A flag to enable a top-down class-by-class manual insertion of a PSD; default is FALSE. More...
 

Detailed Description

Used for modeling chute inflow. Inherits from InsertionBoundary.

Definition at line 40 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_, and posMin_.

Referenced by copy().

36 {
37  posMax_ = Vec3D(0.0, 0.0, 0.0);
38  posMin_ = Vec3D(0.0, 0.0, 0.0);
40  inflowVelocity_ = 0.0;
42 }
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.
Definition: Vector.h:49
ChuteInsertionBoundary::ChuteInsertionBoundary ( const ChuteInsertionBoundary other)

Copy constructor.

Copy constructor. Calls InsertionBoundary parent copy constructor.

Definition at line 47 of file ChuteInsertionBoundary.cc.

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

48  : InsertionBoundary(other)
49 {
50  posMax_ = other.posMax_;
51  posMin_ = other.posMin_;
55 }
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
overridevirtual

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 61 of file ChuteInsertionBoundary.cc.

References ChuteInsertionBoundary().

62 {
63 #ifdef DEBUG_CONSTRUCTOR
64  std::cout << "ChuteInsertionBoundary::copy() const finished" << std::endl;
65 #endif
66  return new ChuteInsertionBoundary(*this);
67 }
ChuteInsertionBoundary()
Default constructor.
std::string ChuteInsertionBoundary::getName ( ) const
overridevirtual

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 209 of file ChuteInsertionBoundary.cc.

210 {
211  return "ChuteInsertionBoundary";
212 }
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 173 of file ChuteInsertionBoundary.cc.

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

174 {
175  unsigned int maxFailed;
176  std::string dummy;
177  is >> dummy >> maxFailed
178  >> dummy >> posMin_
179  >> dummy >> posMax_
180  >> dummy >> radMin_
181  >> dummy >> radMax_
182  >> dummy >> fixedParticleRadius_
183  >> dummy >> inflowVelocity_
184  >> dummy >> inflowVelocityVariance_;
185  setMaxFailed(maxFailed);
186 }
Mdouble 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::placeParticle ( BaseParticle p,
RNG random 
)
overridevirtual

place 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 122 of file ChuteInsertionBoundary.cc.

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

123 {
124  Vec3D position, velocity;
125 
126  position.X = posMin_.X + p->getRadius();
127 
128  if (mathsFunc::isEqual(posMax_.Y - posMin_.Y, 2.0 * radMax_, 1e-10))
129  {
130  position.Y = posMin_.Y + p->getRadius();
131  }
132  else
133  {
134  position.Y = random.getRandomNumber(posMin_.Y - p->getRadius(), posMax_.Y + p->getRadius());
135  }
136  position.Z = random.getRandomNumber(posMin_.Z - p->getRadius(), posMax_.Z + p->getRadius() + fixedParticleRadius_);
137 
138  // The velocity components are first stored in a Vec3D, because if you pass them
139  // directly into setVelocity the compiler is allowed to change the order in
140  // which the numbers are generated
145 
146  p->setPosition(position);
147  p->setVelocity(velocity);
148 
149 
150 }
Mdouble X
the vector components
Definition: Vector.h:65
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
bool isEqual(Mdouble v1, Mdouble v2, Mdouble absError)
Compares the difference of two Mdouble with an absolute error, useful in UnitTests.
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.
Mdouble getRadius() const
Returns the particle's radius.
Definition: BaseParticle.h:345
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 ChuteInsertionBoundary::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 156 of file ChuteInsertionBoundary.cc.

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

157 {
159  std::string dummy;
160  is >> dummy >> posMin_
161  >> dummy >> posMax_
162  >> dummy >> radMin_
163  >> dummy >> radMax_
164  >> dummy >> fixedParticleRadius_
165  >> dummy >> inflowVelocity_
166  >> dummy >> inflowVelocityVariance_;
167 }
Mdouble 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) override
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 91 of file ChuteInsertionBoundary.cc.

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

Referenced by Chute::setupInitialConditions().

94 {
95  if (particleToCopy != nullptr)
96  {
97  setParticleToCopy(particleToCopy);
98  }
99  setMaxFailed(maxFailed);
100  posMin_ = posMin;
101  posMax_ = posMax;
102  radMin_ = radMin;
103  radMax_ = radMax;
104  fixedParticleRadius_ = fixedParticleRadius;
105  inflowVelocity_ = inflowVelocity;
106  inflowVelocityVariance_ = inflowVelocityVariance;
107 }
Mdouble 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
overridevirtual

writes boundary properties to ostream

Writes boundary's properties to an ostream

Parameters
[in]osthe ostream

Implements BaseBoundary.

Definition at line 192 of file ChuteInsertionBoundary.cc.

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

193 {
195  os << " posMin " << posMin_
196  << " posMax " << posMax_
197  << " radMin " << radMin_
198  << " radMax " << radMax_
199  << " fixedParticleRadius " << fixedParticleRadius_
200  << " inflowVelocity " << inflowVelocity_
201  << " inflowVelocityVariance " << inflowVelocityVariance_;
202 
203 }
Mdouble 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 override
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/subtracted velocities in all three directions while generating particles (expressed as % of inflowVelocity_). NB: see also documentation of ChuteInsertionBoundary::generateParticle().

Definition at line 100 of file ChuteInsertionBoundary.h.

Referenced by ChuteInsertionBoundary(), oldRead(), placeParticle(), 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(), oldRead(), placeParticle(), read(), set(), and write().


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