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

Creates chutes with different bottoms. Inherits from Mercury3D (-> MercuryBase -> DPMBase). More...

#include <Chute.h>

+ Inheritance diagram for Chute:

Public Member Functions

 Chute ()
 This is the default constructor. All it does is set sensible defaults. More...
 
 Chute (const DPMBase &other)
 Copy constructor, converts an existing DPMBase problem into a Chute problem. More...
 
 Chute (const MercuryBase &other)
 Copy constructor, converts an existing MercuryBase problem into a Chute problem. More...
 
 Chute (const Mercury3D &other)
 Copy constructor, converts an existing Mercury3D problem into a Chute problem. More...
 
 Chute (const Chute &other)
 Default copy constructor. More...
 
void constructor ()
 This is the actual constructor METHOD; it is called by all constructors above (except the default copy constructor). More...
 
bool readNextArgument (int &i, int argc, char *argv[])
 This method can be used for reading object properties from a string. More...
 
void setupSideWalls ()
 Creates chute side walls (either solid or periodic) More...
 
void makeChutePeriodic ()
 This makes the chute periodic in Y. More...
 
bool getIsPeriodic () const
 Returns whether the chute is periodic in Y. More...
 
void setupInitialConditions ()
 Creates bottom, side walls and a particle insertion boundary. More...
 
void read (std::istream &is)
 Reads all chute properties from an istream. More...
 
void write (std::ostream &os, bool writeAllParticles=true) const
 This function writes the Chute properties to an ostream, and adds the properties of ALL chute particles as well. More...
 
void setFixedParticleRadius (Mdouble fixedParticleRadius)
 Sets the particle radius of the fixed particles which constitute the (rough) chute bottom. More...
 
Mdouble getFixedParticleRadius () const
 Returns the particle radius of the fixed particles which constitute the (rough) chute bottom. More...
 
void setRoughBottomType (RoughBottomType roughBottomType)
 Sets the type of rough bottom of the chute. More...
 
void setRoughBottomType (std::string roughBottomTypeString)
 Sets the type of rough bottom of the chute, using a string with the EXACT enum type as input. More...
 
RoughBottomType getRoughBottomType () const
 Returns the type of (rough) bottom of the chute. More...
 
void setChuteAngle (Mdouble chuteAngle)
 Sets gravity vector according to chute angle (in degrees) More...
 
void setChuteAngleAndMagnitudeOfGravity (Mdouble chuteAngle, Mdouble gravity)
 Sets gravity vector according to chute angle (in degrees) More...
 
Mdouble getChuteAngle () const
 Returns the chute angle (in radians) More...
 
Mdouble getChuteAngleDegrees () const
 Returns the chute angle (in degrees) More...
 
void setMaxFailed (unsigned int maxFailed)
 Sets the number of times a particle will be tried to be added to the insertion boundary. More...
 
unsigned int getMaxFailed () const
 Returns the number of times a particle will be tried to be added to the insertion boundary. More...
 
void setInflowParticleRadius (Mdouble inflowParticleRadius)
 Sets the radius of the inflow particles to a single one (i.e. ensures a monodisperse inflow). More...
 
void setInflowParticleRadius (Mdouble minInflowParticleRadius, Mdouble maxInflowParticleRadius)
 Sets the minimum and maximum radius of the inflow particles. More...
 
void setMinInflowParticleRadius (Mdouble minInflowParticleRadius)
 sets the minimum radius of inflow particles More...
 
void setMaxInflowParticleRadius (Mdouble maxInflowParticleRadius)
 Sets the maximum radius of inflow particles. More...
 
Mdouble getInflowParticleRadius () const
 Returns the average radius of inflow particles. More...
 
Mdouble getMinInflowParticleRadius () const
 returns the minimum radius of inflow particles More...
 
Mdouble getMaxInflowParticleRadius () const
 Returns the maximum radius of inflow particles. More...
 
void setInflowHeight (Mdouble inflowHeight)
 Sets maximum inflow height (Z-direction) More...
 
Mdouble getInflowHeight () const
 Returns the maximum inflow height (Z-direction) More...
 
void setInflowVelocity (Mdouble inflowVelocity)
 Sets the average inflow velocity. More...
 
Mdouble getInflowVelocity () const
 Returns the average inflow velocity. More...
 
void setInflowVelocityVariance (Mdouble inflowVelocityVariance)
 Sets the inflow velocity variance. More...
 
Mdouble getInflowVelocityVariance () const
 Returns the inflow velocity variance. More...
 
void setChuteWidth (Mdouble chuteWidth)
 Sets the chute width (Y-direction) More...
 
Mdouble getChuteWidth () const
 Returns the chute width (Y-direction) More...
 
virtual void setChuteLength (Mdouble chuteLength)
 Sets the chute length (X-direction) More...
 
Mdouble getChuteLength () const
 Returns the chute length (X-direction) More...
 
int getNCreated () const
 
void increaseNCreated ()
 
void setInsertionBoundary (InsertionBoundary *insertionBoundary)
 Sets the chute insertion boundary. More...
 
- Public Member Functions inherited from Mercury3D
 Mercury3D ()
 This is the default constructor. All it does is set sensible defaults. More...
 
 Mercury3D (const DPMBase &other)
 Copy-constructor for creates an Mercury3D problem from an existing MD problem. More...
 
 Mercury3D (const Mercury3D &other)
 Copy-constructor. More...
 
void constructor ()
 Function that sets the SystemDimension and ParticleDimension to 3. More...
 
- Public Member Functions inherited from MercuryBase
 MercuryBase ()
 This is the default constructor. It sets sensible defaults. More...
 
 ~MercuryBase ()
 This is the default destructor. More...
 
 MercuryBase (const MercuryBase &mercuryBase)
 Copy-constructor. More...
 
void constructor ()
 This is the actual constructor, it is called do both constructors above. More...
 
void hGridActionsBeforeTimeLoop () override
 This sets up the broad phase information, has to be done at this stage because it requires the particle size. More...
 
void hGridActionsBeforeTimeStep () override
 Performs all necessary actions before a time-step, like updating the particles and resetting all the bucket information, etc. More...
 
void read (std::istream &is) override
 Reads the MercuryBase from an input stream, for example a restart file. More...
 
void write (std::ostream &os, bool writeAllParticles=true) const override
 Writes the MercuryBase to an output stream, for example a restart file. More...
 
Mdouble getHGridCurrentMaxRelativeDisplacement () const
 Returns hGridCurrentMaxRelativeDisplacement_. More...
 
Mdouble getHGridTotalCurrentMaxRelativeDisplacement () const
 Returns hGridTotalCurrentMaxRelativeDisplacement_. More...
 
void setHGridUpdateEachTimeStep (bool updateEachTimeStep)
 Sets whether or not the HGrid must be updated every time step. More...
 
bool getHGridUpdateEachTimeStep () const override
 Gets whether or not the HGrid is updated every time step. More...
 
void setHGridMaxLevels (unsigned int HGridMaxLevels)
 Sets the maximum number of levels of the HGrid in this MercuryBase. More...
 
unsigned int getHGridMaxLevels () const
 Gets the maximum number of levels of the HGrid in this MercuryBase. More...
 
HGridMethod getHGridMethod () const
 Gets whether the HGrid in this MercuryBase is BOTTOMUP or TOPDOWN. More...
 
void setHGridMethod (HGridMethod hGridMethod)
 Sets the HGridMethod to either BOTTOMUP or TOPDOWN. More...
 
HGridDistribution getHGridDistribution () const
 Gets how the sizes of the cells of different levels are distributed. More...
 
void setHGridDistribution (HGridDistribution hGridDistribution)
 Sets how the sizes of the cells of different levels are distributed. More...
 
Mdouble getHGridCellOverSizeRatio () const
 Gets the ratio of the smallest cell over the smallest particle. More...
 
void setHGridCellOverSizeRatio (Mdouble cellOverSizeRatio)
 Sets the ratio of the smallest cell over the smallest particle. More...
 
bool hGridNeedsRebuilding ()
 Gets if the HGrid needs rebuilding before anything else happens. More...
 
virtual unsigned int getHGridTargetNumberOfBuckets () const
 Gets the desired number of buckets, which is the maximum of the number of particles and 10. More...
 
virtual Mdouble getHGridTargetMinInteractionRadius () const
 Gets the desired size of the smallest cells of the HGrid. More...
 
virtual Mdouble getHGridTargetMaxInteractionRadius () const
 Gets the desired size of the largest cells of the HGrid. More...
 
bool checkParticleForInteraction (const BaseParticle &P) override
 Checks if given BaseParticle has an interaction with a BaseWall or other BaseParticle. More...
 
virtual Mdouble userHGridCellSize (unsigned int level)
 Virtual function that enables inheriting classes to implement a function to let the user set the cell size of the HGrid. More...
 
void hGridInfo () const
 Writes the info of the HGrid to the screen in a nice format. More...
 
- Public Member Functions inherited from DPMBase
void constructor ()
 A function which initialises the member variables to default values, so that the problem can be solved off the shelf; sets up a basic two dimensional problem which can be solved off the shelf. It is called in the constructor DPMBase(). More...
 
 DPMBase ()
 Constructor that calls the "void constructor()". More...
 
 DPMBase (const FilesAndRunNumber &other)
 Copy constructor type-1. More...
 
 DPMBase (const DPMBase &other)
 Copy constructor type-2. More...
 
virtual ~DPMBase ()
 virtual destructor More...
 
void solve ()
 The work horse of the code. More...
 
void checkSettings ()
 Checks if the essentials are set properly to go ahead with solving the problem. More...
 
virtual void writeOutputFiles ()
 Writes the simulation data onto all the files i.e. .data, .ene, .fstat ... More...
 
void solve (int argc, char *argv[])
 The solve function is the work horse of the code with the user input. More...
 
virtual void writeXBallsScript () const
 This writes a script which can be used to load the xballs problem to display the data just generated. More...
 
virtual double getInfo (const BaseParticle &P) const
 A virtual method that allows the user to overrride and set what is written into the info column in the data file. By default it returns the Species ID number. More...
 
virtual void writeRestartFile ()
 Stores all the particle data for current save time step. Calls the write function. More...
 
int readRestartFile ()
 Reads all the particle data corresponding to the current saved time step. Which is what the restart file basically stores. The problem description with the latest particle data. More...
 
int readRestartFile (std::string fileName)
 Also reads all the particle data corresponding to the current saved time step. More...
 
virtual void readOld (std::istream &is)
 Reads all particle data into a restart file; old version. More...
 
bool readDataFile (const std::string fileName, unsigned int format=0)
 This allows particle data to be reloaded from data files. More...
 
bool readParAndIniFiles (const std::string fileName)
 Allows the user to read par.ini files (useful to read MDCLR files) More...
 
bool readNextDataFile (unsigned int format=0)
 Reads the next data file with default format=0. However, one can modify the format based on whether the particle data corresponds to 3D or 2D data. See XBalls/xballs.txt. More...
 
bool findNextExistingDataFile (Mdouble tMin, bool verbose=true)
 Useful when fileType is chosen as Multiple Files or Multiple files with padded. More...
 
bool readArguments (int argc, char *argv[])
 Can interpret main function input arguments that are passed by the driver codes. More...
 
Mdouble getTime () const
 Access function for the time. More...
 
unsigned int getNtimeSteps () const
 Returns the current counter of time steps. More...
 
void setTime (Mdouble time)
 Access function for the time. More...
 
void setTimeMax (Mdouble newTMax)
 Allows the upper time limit to be changed. More...
 
Mdouble getTimeMax () const
 Allows the user to access the total simulation time during the simulation. Cannot change it though. More...
 
void setDoCGAlways (bool newDoCGFlag)
 
void setRotation (bool newRotFlag)
 Allows to set the flag for enabling or disabling particle rotation in the simulations. More...
 
bool getRotation () const
 Returns a flag indicating if particle rotation is enabled or disabled. More...
 
bool getDoCGAlways () const
 
Mdouble getXMin () const
 If the length of the problem domain in x-direction is XMax - XMin, then getXMin() returns XMin,. More...
 
Mdouble getXMax () const
 If the length of the problem domain in x-direction is XMax - XMin, then getXMax() returns XMax,. More...
 
Mdouble getYMin () const
 If the length of the problem domain in y-direction is YMax - YMin, then getYMin() returns YMin,. More...
 
Mdouble getYMax () const
 If the length of the problem domain in y-direction is YMax - YMin, then getYMax() returns XMax,. More...
 
Mdouble getZMin () const
 If the length of the problem domain in z-direction is ZMax - ZMin, then getZMin() returns ZMin,. More...
 
Mdouble getZMax () const
 If the length of the problem domain in z-direction is ZMax - ZMin, then getZMax() returns ZMax,. More...
 
void setXMin (Mdouble newXMin)
 If the length of the problem domain in x-direction is XMax - XMin, this method sets XMin. More...
 
void setYMin (Mdouble newYMin)
 If the length of the problem domain in y-direction is YMax - YMin, this method sets YMin. More...
 
void setZMin (Mdouble newZMin)
 If the length of the problem domain in z-direction is ZMax - ZMin, this method sets ZMin. More...
 
void setXMax (Mdouble newXMax)
 If the length of the problem domain in x-direction is XMax - XMin, this method sets XMax. More...
 
void setYMax (Mdouble newYMax)
 If the length of the problem domain in y-direction is YMax - YMin, this method sets YMax. More...
 
void setZMax (Mdouble newZMax)
 If the length of the problem domain in z-direction is XMax - XMin, this method sets ZMax. More...
 
void setTimeStep (Mdouble newDt)
 Allows the time step dt to be changed. More...
 
Mdouble getTimeStep () const
 Allows the time step dt to be accessed. More...
 
void setXBallsColourMode (int newCMode)
 Set the xball output mode. More...
 
int getXBallsColourMode () const
 Get the xball colour mode (CMode) More...
 
void setXBallsVectorScale (double newVScale)
 Set the scale of vectors in xballs. More...
 
double getXBallsVectorScale () const
 Returns the scale of vectors used in xballs. More...
 
void setXBallsAdditionalArguments (std::string newXBArgs)
 Set the additional arguments for xballs. More...
 
std::string getXBallsAdditionalArguments () const
 
void setXBallsScale (Mdouble newScale)
 Sets the scale of the view (either normal, zoom in or zoom out) to display in xballs. The default is fit to screen. More...
 
double getXBallsScale () const
 Returns the scale of the view in xballs. More...
 
void setGravity (Vec3D newGravity)
 Allows to modify the gravity vector. More...
 
Vec3D getGravity () const
 Returns the gravity vector. More...
 
void setDimension (unsigned int newDim)
 Sets the system and particle dimension. More...
 
void setSystemDimensions (unsigned int newDim)
 Allows for the dimension of the simulation to be changed. More...
 
unsigned int getSystemDimensions () const
 Returns the dimension of the simulation. Note there is also a particle dimension. More...
 
void setParticleDimensions (unsigned int particleDimensions)
 Allows the dimension of the particle (f.e. for mass) to be changed. e.g. discs or spheres. More...
 
unsigned int getParticleDimensions () const
 Returns the particle dimensions. More...
 
std::string getRestartVersion () const
 This is to take into account for different Mercury versions. Returns the version of the restart file. More...
 
void setRestartVersion (std::string newRV)
 Sets restart_version. More...
 
bool getRestarted () const
 Returns the flag denoting if the simulation was restarted or not. More...
 
void setRestarted (bool newRestartedFlag)
 Allows to set the flag stating if the simulation is to be restarted or not. More...
 
bool getAppend () const
 Returns the flag denoting if the append option is on or off. More...
 
void setAppend (bool newAppendFlag)
 Allows to set the append option. More...
 
Mdouble getElasticEnergy () const
 Returns the global elastic energy within the system. More...
 
Mdouble getKineticEnergy () const
 Returns the global kinetic energy stored in the system. More...
 
bool areInContact (const BaseParticle *pI, const BaseParticle *pJ) const
 Checks if two particle are in contact or is there any positive overlap. More...
 
virtual void hGridInsertParticle (BaseParticle *obj UNUSED)
 no implementation but can be overidden in its derived classes. More...
 
virtual void hGridUpdateParticle (BaseParticle *obj UNUSED)
 no implementation but can be overidden in its derived classes. More...
 
virtual void hGridRemoveParticle (BaseParticle *obj UNUSED)
 no implementation but can be overidden in its derived classes. More...
 
virtual void gatherContactStatistics (unsigned int index1 UNUSED, int index2 UNUSED, Vec3D Contact UNUSED, Mdouble delta UNUSED, Mdouble ctheta UNUSED, Mdouble fdotn UNUSED, Mdouble fdott UNUSED, Vec3D P1_P2_normal_ UNUSED, Vec3D P1_P2_tangential UNUSED)
 //Not unsigned index because of possible wall collisions. More...
 
- Public Member Functions inherited from FilesAndRunNumber
 FilesAndRunNumber ()
 Constructor. More...
 
 FilesAndRunNumber (const FilesAndRunNumber &other)
 Copy constructor. More...
 
virtual ~FilesAndRunNumber ()
 Constructor. More...
 
void constructor ()
 a function called by the FilesAndRunNumber() (constructor) More...
 
void incrementRunNumberInFile ()
 Increment the run Number (counter value) stored in the file_counter (COUNTER_DONOTDEL) by 1 and store the new value in the counter file. More...
 
int readRunNumberFromFile ()
 Read the run number or the counter from the counter file (COUNTER_DONOTDEL) More...
 
void autoNumber ()
 The autoNumber() function is the trigger. It calls three functions. setRunNumber(), readRunNumberFromFile() and incrementRunNumberInFile(). More...
 
std::vector< int > get2DParametersFromRunNumber (int size_x, int size_y)
 This turns a counter into two indices which is an amazing feature for doing two dimensional parameter studies. The indices run from 1:size_x and 1:size_y, while the study number starts at 0 ( initially the counter=1 in COUNTER_DONOTDEL) More...
 
int launchNewRun (const char *name, bool quick=false)
 This launches a code from within this code. Please pass the name of the code to run. More...
 
void setRunNumber (int runNumber)
 This sets the counter/Run number, overriding the defaults. More...
 
int getRunNumber () const
 This returns the current value of the counter (runNumber_) More...
 
void read (std::istream &is)
 Accepts an input stream std::istream. More...
 
void write (std::ostream &os) const
 Accepts an output stream read function, which accepts an input stream std::ostream. More...
 
- Public Member Functions inherited from Files
 Files ()
 A constructor. More...
 
virtual ~Files ()
 A destructor, watch out its a virtual destructor. More...
 
 Files (const Files &other)
 Copy constructor. More...
 
MERCURY_DEPRECATED FilegetDataFile ()
 The non const version. Allows one to edit the File::dataFile. More...
 
MERCURY_DEPRECATED FilegetEneFile ()
 The non const version. Allows to edit the File::eneFile. More...
 
MERCURY_DEPRECATED FilegetFStatFile ()
 The non const version. Allows to edit the File::fStatFile. More...
 
MERCURY_DEPRECATED FilegetRestartFile ()
 The non const version. Allows to edit the File::restartFile. More...
 
MERCURY_DEPRECATED FilegetStatFile ()
 The non const version. Allows to edit the File::statFile. More...
 
MERCURY_DEPRECATED const FilegetDataFile () const
 The const version. Does not allow for any editing of the File::dataFile. More...
 
MERCURY_DEPRECATED const FilegetEneFile () const
 The const version. Does not allow for any editing of the File::eneFile. More...
 
MERCURY_DEPRECATED const FilegetFStatFile () const
 The const version. Does not allow for any editing of the File::fStatFile. More...
 
MERCURY_DEPRECATED const FilegetRestartFile () const
 The const version. Does not allow for any editing of the File::restartFile. More...
 
MERCURY_DEPRECATED const FilegetStatFile () const
 The const version. Does not allow for any editing of the File::statFile. More...
 
const std::string & getName () const
 Returns the name of the file. Does not allow to change it though. More...
 
void setName (const std::string &name)
 Allows to set the name of all the files (ene, data, fstat, restart, stat) More...
 
void setName (const char *name)
 Calls setName(std::string) More...
 
void setSaveCount (unsigned int saveCount)
 Sets File::saveCount_ for all files (ene, data, fstat, restart, stat) More...
 
void setFileType (FileType fileType)
 Sets File::fileType_ for all files (ene, data, fstat, restart, stat) More...
 
void setOpenMode (std::fstream::openmode openMode)
 Sets File::openMode_ for all files (ene, data, fstat, restart, stat) More...
 
void resetFileCounter ()
 Resets the file counter for each file i.e. for ene, data, fstat, restart, stat) More...
 
void read (std::istream &is)
 Extracts data from the input stream (which is basically a file you want to read from) into name_, restartFile .... More...
 
void write (std::ostream &os) const
 Writes data into a file from the member variables name_, restartFile, dataFile etc. More...
 
void openFiles ()
 Opens all the files (ene, data, fstat, restart, stat) for reading and writing purposes. More...
 
void closeFiles ()
 Closes all files (ene, data, fstat, restart, stat) that were opened to read or write. More...
 
void setNextSavedTimeStep (unsigned int nextSavedTimeStep)
 Sets the next time step for all the files (ene, data, fstat, restart, stat) at which the data is to be written or saved. More...
 

Protected Member Functions

void actionsBeforeTimeStep ()
 Calls Chute::cleanChute(). More...
 
void cleanChute ()
 Deletes all outflow particles once every 100 time steps. More...
 
virtual void createBottom ()
 Creates the chute bottom, which can be either flat or one of three flavours of rough. More...
 
void printTime () const
 prints time, max time and number of particles More...
 
- Protected Member Functions inherited from Mercury3D
virtual void hGridFindContactsWithinTargetCell (int x, int y, int z, unsigned int l)
 Finds contacts between particles in the target cell. More...
 
virtual void hGridFindContactsWithTargetCell (int x, int y, int z, unsigned int l, BaseParticle *obj)
 Finds contacts between the BaseParticle and the target cell. More...
 
void hGridFindOneSidedContacts (BaseParticle *obj) override
 Finds contacts with the BaseParticle; avoids multiple checks. More...
 
bool hGridHasContactsInTargetCell (int x, int y, int z, unsigned int l, const BaseParticle *obj) const
 Tests if the BaseParticle has contacts with other Particles in the target cell. More...
 
bool hGridHasParticleContacts (const BaseParticle *obj) override
 Tests if a BaseParticle has any contacts in the HGrid. More...
 
void hGridRemoveParticle (BaseParticle *obj)
 Removes a BaseParticle from the HGrid. More...
 
void hGridUpdateParticle (BaseParticle *obj) override
 Updates the cell (not the level) of a BaseParticle. More...
 
- Protected Member Functions inherited from MercuryBase
void hGridRebuild ()
 This sets up the parameters required for the contact model. More...
 
void hGridInsertParticle (BaseParticle *obj) override
 Inserts a single Particle to current grid. More...
 
void broadPhase (BaseParticle *i) override
 This checks particles in the HGRID to see if for closer enough for possible contact. More...
 
void hGridUpdateMove (BaseParticle *iP, Mdouble move) override
 Computes the relative displacement of the given BaseParticle and updates the currentMaxRelativeDisplacement_ accordingly. More...
 
void hGridActionsBeforeIntegration () override
 Resets the currentMaxRelativeDisplacement_ to 0. More...
 
void hGridActionsAfterIntegration () override
 Sets the totalCurrentMaxRelativeDisplacement_ as 2*currentMaxRelativeDisplacement_. More...
 
HGridgetHGrid ()
 Gets the HGrid used by this problem. More...
 
const HGridgetHGrid () const
 Gets the HGrid used by this problem, const version. More...
 
bool readNextArgument (int &i, int argc, char *argv[]) override
 Reads the next command line argument. More...
 
- Protected Member Functions inherited from DPMBase
virtual void computeAllForces ()
 Computes all the forces acting on the particles by using the setTorque and setForce methods. See BaseInteractible.cc. More...
 
virtual void computeInternalForces (BaseParticle *i)
 Computes the forces between particles (internal in the sense that the sum over all these forces is zero i.e. fully modelled forces) More...
 
virtual void computeInternalForces (BaseParticle *P1, BaseParticle *P2)
 Computes the forces between particles (internal in the sense that the sum over all these forces is zero i.e. fully modelled forces) More...
 
virtual void computeExternalForces (BaseParticle *PI)
 Computes the external forces acting on particles (e.g. gravitational) More...
 
virtual void computeForcesDueToWalls (BaseParticle *PI)
 Computes the forces on the particles due to the walls (normals are outward normals) More...
 
virtual void actionsOnRestart ()
 A virtual function where the users can add extra code which is executed only when the code is restarted. More...
 
virtual void actionsBeforeTimeLoop ()
 A virtual function. Allows one to carry out any operations before the start of the time loop. More...
 
virtual void actionsAfterSolve ()
 A virtual function which allows to define operations to be executed after the solve(). More...
 
virtual void actionsAfterTimeStep ()
 A virtual function which allows to define operations to be executed after time step. More...
 
virtual void outputXBallsData (std::ostream &os) const
 This function writes the location of the walls and particles in a format the XBalls program can read. See XBalls/xballs.txt. However, MercuryDPM supports a much better viewer now called Paraview. See the tutorials section in the documentation. More...
 
virtual void outputXBallsDataParticle (const unsigned int i, const unsigned int format, std::ostream &os) const
 This function writes out the particle locations into an output stream in a format the XBalls program can read. More...
 
virtual void writeEneHeader (std::ostream &os) const
 Writes a header with a certain format for ENE file. More...
 
virtual void writeFstatHeader (std::ostream &os) const
 Writes a header with a certain format for FStat file. More...
 
virtual void writeEneTimestep (std::ostream &os) const
 This function enables one to write the global energy available in the system after each time step. The default is to compute the rotational and translational kinetic energy, potential energy and the centre of mass. More...
 
virtual void initialiseStatistics ()
 no implementation but can be overidden in its derived classes. More...
 
virtual void outputStatistics ()
 no implementation but can be overidden in its derived classes. More...
 
void gatherContactStatistics ()
 
virtual void processStatistics (bool usethese UNUSED)
 no implementation but can be overidden in its derived classes. More...
 
virtual void finishStatistics ()
 no implementation but can be overidden in its derived classes. More...
 
virtual void integrateBeforeForceComputation ()
 This is were the integration is done, at the moment it is velocity Verlet integration and is done before the forces are computed. See http://en.wikipedia.org/wiki/Verlet_integration#Velocity_Verlet. More...
 
virtual void integrateAfterForceComputation ()
 Integration is done after force computations. We apply the Velocity verlet scheme. See http://en.wikipedia.org/wiki/Verlet_integration#Velocity_Verlet. More...
 
virtual void checkInteractionWithBoundaries ()
 There are a range of boundaries one could implement depending on ones' problem. This methods checks for interactions between particles and such range of boundaries. See BaseBoundary.h and all the boundaries in the Boundaries folder. More...
 
void setFixedParticles (unsigned int n)
 
void initialiseTangentialSprings ()
 
virtual bool continueSolve () const
 
void outputInteractionDetails () const
 Displays the interaction details corresponding to the pointer objects in the interaction handler. More...
 
bool isTimeEqualTo (Mdouble time) const
 Checks if the input variable "time" is the current time in the simulation. More...
 
void removeDuplicatePeriodicParticles ()
 Removes periodic duplicate Particles. More...
 
void checkAndDuplicatePeriodicParticles ()
 In case of periodic boundaries, the below methods checks and adds particles when necessary into the particle handler. See DPMBase.cc and PeriodicBoundary.cc for more details. More...
 

Private Attributes

Mdouble chuteAngle_
 chute angle in degrees More...
 
Mdouble fixedParticleRadius_
 radius of the fixed particles at the bottom More...
 
Mdouble minInflowParticleRadius_
 minimal radius of inflowing particles More...
 
Mdouble maxInflowParticleRadius_
 maximal radius of inflowing particles More...
 
Mdouble inflowVelocity_
 Average inflow velocity in x-direction. More...
 
Mdouble inflowVelocityVariance_
 Inflow velocity variance in x-direction (in ratio of inflowVelocity_) More...
 
Mdouble inflowHeight_
 Height of inflow. More...
 
RoughBottomType roughBottomType_
 Determines the type of rough bottom created (if any). See also the enum RoughBottomType at the beginning of this header file. More...
 
unsigned int maxFailed_
 indicates how many attempts are made to insert a new particle into the insertion boundary before the boundary is considered filled. More...
 
InsertionBoundaryinsertionBoundary_
 (Pointer to) the Chute's insertion boundary More...
 
bool isChutePeriodic_
 Determines whether the chute has periodic (TRUE) or solid (FALSE) walls in the Y-direction. More...
 

Additional Inherited Members

- Public Attributes inherited from DPMBase
SpeciesHandler speciesHandler
 A handler to that stores the species type i.e. elastic, linear visco-elastic... et cetera. More...
 
RNG random
 This is a random generator, often used for setting up the initial conditions etc... More...
 
ParticleHandler particleHandler
 An object of the class ParticleHandler, contains the pointers to all the particles created. More...
 
WallHandler wallHandler
 An object of the class WallHandler. Contains pointers to all the walls created. More...
 
BoundaryHandler boundaryHandler
 An object of the class BoundaryHandler which concerns insertion and deletion of particles into or from regions. More...
 
InteractionHandler interactionHandler
 An object of the class InteractionHandler. More...
 
- Public Attributes inherited from Files
File dataFile
 An instance of class File to handle in- and output into a .data file. More...
 
File fStatFile
 An instance of class File to handle in- and output into a .fstat file. More...
 
File eneFile
 An instance of class File to handle in- and output into a .ene file. More...
 
File restartFile
 An instance of class File to handle in- and output into a .restart file. More...
 
File statFile
 An instance of class File to handle in- and output into a .stat file. More...
 

Detailed Description

Creates chutes with different bottoms. Inherits from Mercury3D (-> MercuryBase -> DPMBase).

Chute adds three new effects as compared to a 'normal' Mercury3D object: the gravity direction can be set using the ChuteAngle variable, a (smooth or rough) bottom wall is created by default, and some basic inflow and outflow routines are added.

Definition at line 62 of file Chute.h.

Constructor & Destructor Documentation

Chute::Chute ( )

This is the default constructor. All it does is set sensible defaults.

Default constructor.

Definition at line 42 of file Chute.cc.

References constructor(), logger, and VERBOSE.

43 {
44  constructor();
45  logger(VERBOSE,"[Chute::Chute()] constructor finished");
46 }
Logger< MERCURY_LOGLEVEL > logger("MercuryKernel")
void constructor()
This is the actual constructor METHOD; it is called by all constructors above (except the default cop...
Definition: Chute.cc:114
Chute::Chute ( const DPMBase other)

Copy constructor, converts an existing DPMBase problem into a Chute problem.

Copy constructor with a DPMBase object as an argument. This constructor basically 'upgrades' a DPMBase object to one of the Chute class. NB: The copy constructor of DPMBase has to be called because the link from DPMBase to MercuryBase is virtual.

Parameters
[in]otherobject of DPMBase class

Definition at line 55 of file Chute.cc.

References constructor(), DEBUG, and logger.

56  : DPMBase(other), Mercury3D(other)
57 {
58  constructor();
59  logger(DEBUG,"[Chute::Chute(const DPMBase& other)] copy constructor finished");
60 }
Logger< MERCURY_LOGLEVEL > logger("MercuryKernel")
Mercury3D()
This is the default constructor. All it does is set sensible defaults.
Definition: Mercury3D.cc:29
void constructor()
This is the actual constructor METHOD; it is called by all constructors above (except the default cop...
Definition: Chute.cc:114
DPMBase()
Constructor that calls the "void constructor()".
Definition: DPMBase.cc:135
Chute::Chute ( const MercuryBase other)

Copy constructor, converts an existing MercuryBase problem into a Chute problem.

Copy constructor with a MercuryBase object as an argument. This constructor basically 'upgrades' a MercuryBase object to one of the Chute class. NB: The copy constructor of DPMBase has to be called because the link from DPMBase to MercuryBase is virtual.

Parameters
[in]otherobject of MercuryBase class

Definition at line 69 of file Chute.cc.

References constructor(), DEBUG, and logger.

70  : DPMBase(other), Mercury3D(other)
71 {
72  constructor();
73  logger(DEBUG,"[Chute::Chute(const MercuryBase& other)] copy constructor finished");
74 }
Logger< MERCURY_LOGLEVEL > logger("MercuryKernel")
Mercury3D()
This is the default constructor. All it does is set sensible defaults.
Definition: Mercury3D.cc:29
void constructor()
This is the actual constructor METHOD; it is called by all constructors above (except the default cop...
Definition: Chute.cc:114
DPMBase()
Constructor that calls the "void constructor()".
Definition: DPMBase.cc:135
Chute::Chute ( const Mercury3D other)

Copy constructor, converts an existing Mercury3D problem into a Chute problem.

Copy constructor with a Mercury3D object as an argument. This constructor basically 'upgrades' a Mercury3D object to one of the Chute class. NB: The copy constructor of DPMBase has to be called because the link from DPMBase to MercuryBase is virtual.

Parameters
[in]otherobject of DPMBase class

Definition at line 83 of file Chute.cc.

References constructor(), DEBUG, and logger.

84  : DPMBase(other), Mercury3D(other)
85 {
86  constructor();
87  logger(DEBUG,"[Chute::Chute(const Mercury3D& other) copy constructor finished");
88 }
Logger< MERCURY_LOGLEVEL > logger("MercuryKernel")
Mercury3D()
This is the default constructor. All it does is set sensible defaults.
Definition: Mercury3D.cc:29
void constructor()
This is the actual constructor METHOD; it is called by all constructors above (except the default cop...
Definition: Chute.cc:114
DPMBase()
Constructor that calls the "void constructor()".
Definition: DPMBase.cc:135
Chute::Chute ( const Chute other)

Default copy constructor.

'normal' copy constructor

Parameters
[in]otherChute object to be copied

Definition at line 94 of file Chute.cc.

References DEBUG, and logger.

95  : DPMBase(other), Mercury3D(other),
96  chuteAngle_(other.chuteAngle_),
104  maxFailed_(other.maxFailed_),
107 {
108  logger(DEBUG,"[Chute::Chute(const Chute& other)] copy constructor finished");
109 }
unsigned int maxFailed_
indicates how many attempts are made to insert a new particle into the insertion boundary before the ...
Definition: Chute.h:355
Logger< MERCURY_LOGLEVEL > logger("MercuryKernel")
Mdouble minInflowParticleRadius_
minimal radius of inflowing particles
Definition: Chute.h:329
bool isChutePeriodic_
Determines whether the chute has periodic (TRUE) or solid (FALSE) walls in the Y-direction.
Definition: Chute.h:364
Mercury3D()
This is the default constructor. All it does is set sensible defaults.
Definition: Mercury3D.cc:29
RoughBottomType roughBottomType_
Determines the type of rough bottom created (if any). See also the enum RoughBottomType at the beginn...
Definition: Chute.h:350
Mdouble inflowVelocity_
Average inflow velocity in x-direction.
Definition: Chute.h:337
Mdouble inflowHeight_
Height of inflow.
Definition: Chute.h:345
InsertionBoundary * insertionBoundary_
(Pointer to) the Chute's insertion boundary
Definition: Chute.h:359
Mdouble chuteAngle_
chute angle in degrees
Definition: Chute.h:321
Mdouble fixedParticleRadius_
radius of the fixed particles at the bottom
Definition: Chute.h:325
Mdouble inflowVelocityVariance_
Inflow velocity variance in x-direction (in ratio of inflowVelocity_)
Definition: Chute.h:341
DPMBase()
Constructor that calls the "void constructor()".
Definition: DPMBase.cc:135
Mdouble maxInflowParticleRadius_
maximal radius of inflowing particles
Definition: Chute.h:333

Member Function Documentation

void Chute::actionsBeforeTimeStep ( )
protectedvirtual

Calls Chute::cleanChute().

Applies all necessary actions before the next time step. In this case, calls Chute::cleanChute().

Reimplemented from DPMBase.

Reimplemented in ChuteBottom.

Definition at line 207 of file Chute.cc.

References cleanChute().

208 {
209  cleanChute();
210 }
void cleanChute()
Deletes all outflow particles once every 100 time steps.
Definition: Chute.cc:409
void Chute::cleanChute ( )
protected

Deletes all outflow particles once every 100 time steps.

Removes all particles which are outside the horizontal window, i.e. all particles with an x-direction position greater than xMax_ or smaller than xMin_. The removal operation is performed once every 100 time steps.

Definition at line 409 of file Chute.cc.

References DEBUG, BaseHandler< T >::getNumberOfObjects(), BaseHandler< T >::getObject(), BaseInteractable::getPosition(), DPMBase::getXMax(), DPMBase::getXMin(), logger, DPMBase::particleHandler, ParticleHandler::removeObject(), and Vec3D::X.

Referenced by actionsBeforeTimeStep().

410 {
411  //clean outflow every 100 timesteps
412  static int count = 0, maxcount = 100; // please note: static variables are only initialised once, and their values
413  // are stored even after the method returns. I.e., next time the method is
414  // called, the initialisation is ignored and the previously assigned value is used.
415  if (count > maxcount)
416  {
417  // reset counter
418  count = 0;
419 
420  // check all particles
421  for (unsigned int i = 0; i < particleHandler.getNumberOfObjects();)
422  {
423  // check if particle is outside the problem window
424  if (particleHandler.getObject(i)->getPosition().X > getXMax() || particleHandler.getObject(i)->getPosition().X < getXMin()) //||particleHandler.getObject(i)->Position.Z+particleHandler.getObject(i)->Radius<zMin_)
425  {
426  // if so, delete the particle
427  logger(DEBUG,"[Chute::cleanChute()] erased: %", particleHandler.getObject(i));
429  }
430  else
431  i++;
432  }
433  }
434  else
435  count++;
436 }
Mdouble X
the vector components
Definition: Vector.h:52
Logger< MERCURY_LOGLEVEL > logger("MercuryKernel")
Mdouble getXMin() const
If the length of the problem domain in x-direction is XMax - XMin, then getXMin() returns XMin...
Definition: DPMBase.cc:224
const Vec3D & getPosition() const
Returns the position of this BaseInteractable.
Mdouble getXMax() const
If the length of the problem domain in x-direction is XMax - XMin, then getXMax() returns XMax...
Definition: DPMBase.cc:231
ParticleHandler particleHandler
An object of the class ParticleHandler, contains the pointers to all the particles created...
Definition: DPMBase.h:878
T * getObject(const unsigned int id)
Gets a pointer to the Object at the specified index in the BaseHandler.
Definition: BaseHandler.h:415
unsigned int getNumberOfObjects() const
Gets the number of Object in this BaseHandler.
Definition: BaseHandler.h:464
virtual void removeObject(unsigned const int id)
Removes a BaseParticle from the ParticleHandler.
void Chute::constructor ( )

This is the actual constructor METHOD; it is called by all constructors above (except the default copy constructor).

constructor METHOD, which sets all chute properties to something sensible.

Definition at line 114 of file Chute.cc.

References insertionBoundary_, isChutePeriodic_, MONOLAYER_DISORDERED, setChuteAngle(), setFixedParticleRadius(), setInflowHeight(), setInflowParticleRadius(), setInflowVelocity(), setInflowVelocityVariance(), setMaxFailed(), and setRoughBottomType().

Referenced by Chute().

115 {
116  insertionBoundary_ = nullptr;
117  isChutePeriodic_ = false;
118  setFixedParticleRadius(0.001);
120  setChuteAngle(0.0);
121 
122  setMaxFailed(1);
124  setInflowVelocity(0.1);
126  setInflowHeight(0.02);
127 }
void setInflowVelocity(Mdouble inflowVelocity)
Sets the average inflow velocity.
Definition: Chute.cc:825
void setInflowHeight(Mdouble inflowHeight)
Sets maximum inflow height (Z-direction)
Definition: Chute.cc:799
bool isChutePeriodic_
Determines whether the chute has periodic (TRUE) or solid (FALSE) walls in the Y-direction.
Definition: Chute.h:364
void setMaxFailed(unsigned int maxFailed)
Sets the number of times a particle will be tried to be added to the insertion boundary.
Definition: Chute.cc:671
void setChuteAngle(Mdouble chuteAngle)
Sets gravity vector according to chute angle (in degrees)
Definition: Chute.cc:616
void setRoughBottomType(RoughBottomType roughBottomType)
Sets the type of rough bottom of the chute.
Definition: Chute.cc:567
void setInflowParticleRadius(Mdouble inflowParticleRadius)
Sets the radius of the inflow particles to a single one (i.e. ensures a monodisperse inflow)...
Definition: Chute.cc:691
void setInflowVelocityVariance(Mdouble inflowVelocityVariance)
Sets the inflow velocity variance.
Definition: Chute.cc:852
void setFixedParticleRadius(Mdouble fixedParticleRadius)
Sets the particle radius of the fixed particles which constitute the (rough) chute bottom...
Definition: Chute.cc:540
InsertionBoundary * insertionBoundary_
(Pointer to) the Chute's insertion boundary
Definition: Chute.h:359
void Chute::createBottom ( )
protectedvirtual

Creates the chute bottom, which can be either flat or one of three flavours of rough.

Creates the bottom of the chute; either:

  • smooth: fixedParticleRadius_ smaller than 1e-12 or roughBottomType_ == FLAT, monolayered:
  • grid-like: roughBottomType_ == MONOLAYER_ORDERED,
  • random: roughBottomType_ == MONOLAYER_DISORDERED, or
  • multilayer: 'else' (roughBottomType_ == MULTILAYER), with by default contains all particles with a center within a depth band of 2.4 (= ChuteBottom::thickness_) * maxInflowParticleRadius_.
Todo:
Does the bottom we always has to be this particle? Maybe add a BaseParticle* argument, and add a default value with particle radius < 1e-12.

Definition at line 288 of file Chute.cc.

References BaseHandler< T >::begin(), MercuryBase::checkParticleForInteraction(), BaseHandler< T >::copyAndAddObject(), BaseHandler< T >::end(), FLAT, getFixedParticleRadius(), BaseParticle::getRadius(), RNG::getRandomNumber(), DPMBase::getXMax(), DPMBase::getXMin(), DPMBase::getYMax(), DPMBase::getYMin(), DPMBase::getZMin(), MercuryBase::hGridActionsBeforeTimeLoop(), MercuryBase::hGridActionsBeforeTimeStep(), INFO, logger, ChuteBottom::makeRoughBottom(), MONOLAYER_DISORDERED, MONOLAYER_ORDERED, DPMBase::particleHandler, DPMBase::random, roughBottomType_, InfiniteWall::set(), BaseParticle::setHandler(), setInflowParticleRadius(), BaseInteractable::setPosition(), BaseParticle::setRadius(), DPMBase::wallHandler, Vec3D::X, and Vec3D::Y.

Referenced by ChuteBottom::setupInitialConditions(), setupInitialConditions(), and ChuteWithHopper::setupInitialConditions().

289 {
290 
291  if (fabs(getFixedParticleRadius()) < 1e-12 || roughBottomType_ == FLAT) // smooth bottom
292  {
293  // flat wall as bottom
294  logger(INFO,"[Chute::createBottom()] create perfectly flat chute bottom");
295 
296  //bottom wall
297  InfiniteWall w0;
298  w0.set(Vec3D(0.0, 0.0, -1.0), Vec3D(0, 0, getZMin()));
300  }
301  else //rough bottom
302  {
303  // Define standard fixed particle
309  BaseParticle F0;
312  F0.setPosition(Vec3D(0.0, 0.0, 0.0));
313 
315  {
316  // grid-like fixed-particle bottom
317  logger(INFO,"[Chute::createBottom()] create monolayered, ordered rough chute bottom");
318 
319  // allowed space for each particle in each direction
320  Mdouble dx = 2.0 * F0.getRadius();
321  Mdouble dy = 2.0 * F0.getRadius();
322 
323  // number of particles that fit in each direction
324  unsigned int nx = static_cast<unsigned int>(std::max(1, static_cast<int>(std::floor((getXMax() - getXMin()) / dx))));
325  unsigned int ny = static_cast<unsigned int>(std::max(1, static_cast<int>(std::floor((getYMax() - getYMin()) / dy))));
326 
327  // adjust particle spacing (in case total space available in given direction
328  // is not a multiple of 2*F0.getRadius() )
329  dx = (getXMax() - getXMin()) / nx;
330  dy = (getYMax() - getYMin()) / ny;
331 
332  for (unsigned int i = 0; i < nx; i++)
333  {
334  for (unsigned int j = 0; j < ny; j++)
335  {
336  // placing of particles on rectangular grid points
337  F0.setPosition(Vec3D(F0.getRadius() + dx * i, F0.getRadius() + dy * j, 0.0));
339  }
340  }
341  }
343  {
344  // random fixed-particle bottom
345  logger(INFO,"[Chute::createBottom()] create monolayered disordered rough chute bottom");
346 
347  Vec3D position;
348  position.X = random.getRandomNumber(F0.getRadius(), getXMax() - F0.getRadius());
349  position.Y = random.getRandomNumber(getYMin() + F0.getRadius(), getYMax() - F0.getRadius());
350  F0.setPosition(position);
352 
355 
356  //now add more particles
357  int failed = 0;
358  while (failed < 500)
359  {
360  //The position components are first stored in a Vec3D, because
361  //if you pass them directly into setPosition the compiler is
362  //allowed to change the order in which the numbers are generated
363  position.X = random.getRandomNumber(F0.getRadius(), getXMax() - F0.getRadius());
364  position.Y = random.getRandomNumber(getYMin() + F0.getRadius(), getYMax() - F0.getRadius());
365  F0.setPosition(position);
367  {
369  failed = 0;
370  }
371  else
372  {
373  failed++;
374  }
375  }
376 
377  //bottom wall (create after particle creation, as
378  //checkParticleForInteraction also checks against walls)
379  InfiniteWall w0;
380  w0.set(Vec3D(0.0, 0.0, -1.0), Vec3D(0, 0, getZMin() - .5 * F0.getRadius()));
382  }
383  else //if (roughBottomType_ == MULTILAYER)
384  {
385  // multilayered particle bottom
386  logger(INFO,"[Chute::createBottom()] create multilayered rough chute bottom");
387 
388  //'this' points to the current Chute object, the class of which is inherited
389  // by the ChuteBottom class. I.e., the bottom is created with the particle
390  // properties from the current class.
391  // ChuteBottom::makeRoughBottom() creates a randomly filled, multilayered
392  // chute bottom.
393  ChuteBottom bottom(*this);
394  bottom.setInflowParticleRadius(getFixedParticleRadius());
395  bottom.makeRoughBottom(*this);
396  }
397  //finally, fix particles to the floor
398  for (std::vector<BaseParticle*>::iterator it = particleHandler.begin(); it != particleHandler.end(); ++it)
399  (*it)->fixParticle();
400  }
401 }
bool checkParticleForInteraction(const BaseParticle &P) override
Checks if given BaseParticle has an interaction with a BaseWall or other BaseParticle.
Definition: MercuryBase.cc:609
Mdouble X
the vector components
Definition: Vector.h:52
Logger< MERCURY_LOGLEVEL > logger("MercuryKernel")
Mdouble getXMin() const
If the length of the problem domain in x-direction is XMax - XMin, then getXMin() returns XMin...
Definition: DPMBase.cc:224
Used by Chute::createBottom to create an unordered particle layer.
Definition: ChuteBottom.h:39
void setHandler(ParticleHandler *handler)
Sets the pointer to the particle's ParticleHandler.
Mdouble getYMin() const
If the length of the problem domain in y-direction is YMax - YMin, then getYMin() returns YMin...
Definition: DPMBase.cc:238
const std::vector< T * >::const_iterator end() const
Gets the end of the const_iterator over all BaseBoundary in this BaseHandler.
Definition: BaseHandler.h:494
double Mdouble
void hGridActionsBeforeTimeStep() override
Performs all necessary actions before a time-step, like updating the particles and resetting all the ...
Definition: MercuryBase.cc:324
void setRadius(const Mdouble radius)
Sets the particle's radius_ (and adjusts the mass_ accordingly, based on the particle's species) ...
Definition: Chute.h:52
const std::vector< T * >::const_iterator begin() const
Gets the begin of the const_iterator over all Object in this BaseHandler.
Definition: BaseHandler.h:482
Mdouble getXMax() const
If the length of the problem domain in x-direction is XMax - XMin, then getXMax() returns XMax...
Definition: DPMBase.cc:231
U * copyAndAddObject(const U &O)
Creates a copy of a Object and adds it to the BaseHandler.
Definition: BaseHandler.h:268
Mdouble getFixedParticleRadius() const
Returns the particle radius of the fixed particles which constitute the (rough) chute bottom...
Definition: Chute.cc:552
ParticleHandler particleHandler
An object of the class ParticleHandler, contains the pointers to all the particles created...
Definition: DPMBase.h:878
RoughBottomType roughBottomType_
Determines the type of rough bottom created (if any). See also the enum RoughBottomType at the beginn...
Definition: Chute.h:350
Mdouble getRadius() const
Returns the particle's radius_.
void hGridActionsBeforeTimeLoop() override
This sets up the broad phase information, has to be done at this stage because it requires the partic...
Definition: MercuryBase.cc:95
Mdouble getYMax() const
If the length of the problem domain in y-direction is YMax - YMin, then getYMax() returns XMax...
Definition: DPMBase.cc:245
Mdouble Y
Definition: Vector.h:52
WallHandler wallHandler
An object of the class WallHandler. Contains pointers to all the walls created.
Definition: DPMBase.h:883
RNG random
This is a random generator, often used for setting up the initial conditions etc...
Definition: DPMBase.h:873
void setPosition(const Vec3D &position)
Sets the position of this BaseInteractable.
void set(Vec3D normal, Vec3D point)
Defines a standard wall, given an outward normal vector s.t. normal*x=normal*point for all x of the w...
Definition: InfiniteWall.cc:70
Mdouble getZMin() const
If the length of the problem domain in z-direction is ZMax - ZMin, then getZMin() returns ZMin...
Definition: DPMBase.cc:252
This is a class defining walls.
Definition: InfiniteWall.h:43
Implementation of a 3D vector (by Vitaliy).
Definition: Vector.h:45
Mdouble getRandomNumber(Mdouble min, Mdouble max)
This is a random generating routine can be used for initial positions.
Definition: RNG.cc:69
Mdouble Chute::getChuteAngle ( ) const

Returns the chute angle (in radians)

Returns the chute angle (as compared to the horizontal plane) in RADIANS

Returns
the chute angle in RADIANS

Definition at line 653 of file Chute.cc.

References chuteAngle_.

Referenced by ChuteWithHopper::addHopper(), ChuteWithHopper::getMaximumVelocityInducedByGravity(), ChuteWithHopper::setHopper(), and ChuteWithHopper::setupInitialConditions().

654 {
655  return chuteAngle_;
656 }
Mdouble chuteAngle_
chute angle in degrees
Definition: Chute.h:321
Mdouble Chute::getChuteAngleDegrees ( ) const

Returns the chute angle (in degrees)

Returns the chute angle (as compared to the horizontal plane) in DEGREES

Returns
the chute angle in DEGREES (for writing to the terminal/an output stream)

Definition at line 662 of file Chute.cc.

References chuteAngle_, and constants::pi.

663 {
664  return chuteAngle_ * 180.0 / constants::pi;
665 }
const Mdouble pi
Definition: ExtendedMath.h:42
Mdouble chuteAngle_
chute angle in degrees
Definition: Chute.h:321
Mdouble Chute::getChuteLength ( ) const

Returns the chute length (X-direction)

Returns the length of the chute. Actually returns xMax_, while xMin_ is assumed to have stayed 0.

Returns
length of the chute

Definition at line 911 of file Chute.cc.

References DPMBase::getXMax().

912 {
913  return getXMax();
914 }
Mdouble getXMax() const
If the length of the problem domain in x-direction is XMax - XMin, then getXMax() returns XMax...
Definition: DPMBase.cc:231
Mdouble Chute::getChuteWidth ( ) const

Returns the chute width (Y-direction)

Returns the width of the chute. Actually returns yMax_, while it assumes yMin_ to have stayed 0.

Returns
width of the chute

Definition at line 891 of file Chute.cc.

References DPMBase::getYMax().

892 {
893  return getYMax();
894 }
Mdouble getYMax() const
If the length of the problem domain in y-direction is YMax - YMin, then getYMax() returns XMax...
Definition: DPMBase.cc:245
Mdouble Chute::getFixedParticleRadius ( ) const

Returns the particle radius of the fixed particles which constitute the (rough) chute bottom.

Returns the radius of the fixed particles at the bottom (in case of a rough bottom; see also Chute::createBottom() ).

Definition at line 552 of file Chute.cc.

References fixedParticleRadius_.

Referenced by createBottom(), ChuteBottom::setupInitialConditions(), and ChuteWithHopper::setupInitialConditions().

553 {
554  return fixedParticleRadius_;
555 }
Mdouble fixedParticleRadius_
radius of the fixed particles at the bottom
Definition: Chute.h:325
Mdouble Chute::getInflowHeight ( ) const

Returns the maximum inflow height (Z-direction)

Returns the maximum height at which particles are introduced into the chute

Returns
the inflowHeight_

Definition at line 816 of file Chute.cc.

References inflowHeight_.

817 {
818  return inflowHeight_;
819 }
Mdouble inflowHeight_
Height of inflow.
Definition: Chute.h:345
Mdouble Chute::getInflowParticleRadius ( ) const

Returns the average radius of inflow particles.

Returns the mean of the min. and max. inflow particle radius.

Returns
the mean of the min. and max. inflow particle radius.

Definition at line 771 of file Chute.cc.

References maxInflowParticleRadius_, and minInflowParticleRadius_.

Referenced by ChuteBottom::makeRoughBottom(), and ChuteBottom::setupInitialConditions().

772 {
774 }
Mdouble minInflowParticleRadius_
minimal radius of inflowing particles
Definition: Chute.h:329
Mdouble maxInflowParticleRadius_
maximal radius of inflowing particles
Definition: Chute.h:333
Mdouble Chute::getInflowVelocity ( ) const

Returns the average inflow velocity.

Returns the mean velocity at which the particles enter the chute

Returns
the mean velocity at which the particles enter the chute

Definition at line 842 of file Chute.cc.

References inflowVelocity_.

843 {
844  return inflowVelocity_;
845 }
Mdouble inflowVelocity_
Average inflow velocity in x-direction.
Definition: Chute.h:337
Mdouble Chute::getInflowVelocityVariance ( ) const

Returns the inflow velocity variance.

Returns the variance of the velocities of the inflow particles around the mean

Returns
the variance of the velocities of the inflow particles around the mean (expressed in ratio of the mean, i.e. the inflowVelocity_).

Definition at line 871 of file Chute.cc.

References inflowVelocityVariance_.

872 {
874 }
Mdouble inflowVelocityVariance_
Inflow velocity variance in x-direction (in ratio of inflowVelocity_)
Definition: Chute.h:341
bool Chute::getIsPeriodic ( ) const

Returns whether the chute is periodic in Y.

Returns isChutePeriodic_, which is TRUE if the side walls (i.e. the walls in the Y-direction) of the chute are periodic

Definition at line 531 of file Chute.cc.

References isChutePeriodic_.

532 {
533  return isChutePeriodic_;
534 }
bool isChutePeriodic_
Determines whether the chute has periodic (TRUE) or solid (FALSE) walls in the Y-direction.
Definition: Chute.h:364
unsigned int Chute::getMaxFailed ( ) const

Returns the number of times a particle will be tried to be added to the insertion boundary.

Returns the number of times that the boundary may fail to insert a particle, before the boundary is considered filled.

Definition at line 680 of file Chute.cc.

References maxFailed_.

Referenced by ChuteWithHopper::setupInitialConditions().

681 {
682  return maxFailed_;
683 }
unsigned int maxFailed_
indicates how many attempts are made to insert a new particle into the insertion boundary before the ...
Definition: Chute.h:355
Mdouble Chute::getMaxInflowParticleRadius ( ) const

Returns the maximum radius of inflow particles.

Returns the maximum inflow particle radius

Returns
the maximum inflow particle radius

Definition at line 789 of file Chute.cc.

References maxInflowParticleRadius_.

Referenced by ChuteBottom::makeRoughBottom(), ChuteBottom::setupInitialConditions(), and ChuteWithHopper::setupInitialConditions().

790 {
792 }
Mdouble maxInflowParticleRadius_
maximal radius of inflowing particles
Definition: Chute.h:333
Mdouble Chute::getMinInflowParticleRadius ( ) const

returns the minimum radius of inflow particles

returns the minimum inflow particle radius

Returns
the minimum inflow particle radius

Definition at line 780 of file Chute.cc.

References minInflowParticleRadius_.

Referenced by ChuteWithHopper::getTimeStepRatio(), ChuteBottom::makeRoughBottom(), ChuteBottom::setupInitialConditions(), and ChuteWithHopper::setupInitialConditions().

781 {
783 }
Mdouble minInflowParticleRadius_
minimal radius of inflowing particles
Definition: Chute.h:329
int Chute::getNCreated ( ) const
RoughBottomType Chute::getRoughBottomType ( ) const

Returns the type of (rough) bottom of the chute.

Returns the roughBottomType_, which determines the type of rough bottom of the chute.

Definition at line 605 of file Chute.cc.

References roughBottomType_.

606 {
607  return roughBottomType_;
608 }
RoughBottomType roughBottomType_
Determines the type of rough bottom created (if any). See also the enum RoughBottomType at the beginn...
Definition: Chute.h:350
void Chute::increaseNCreated ( )
void Chute::makeChutePeriodic ( )

This makes the chute periodic in Y.

Sets the side walls (i.e. the walls in the Y-direction) of the chute to be made periodic

Definition at line 521 of file Chute.cc.

References isChutePeriodic_.

522 {
523  isChutePeriodic_ = true;
524 }
bool isChutePeriodic_
Determines whether the chute has periodic (TRUE) or solid (FALSE) walls in the Y-direction.
Definition: Chute.h:364
void Chute::printTime ( ) const
protectedvirtual

prints time, max time and number of particles

Prints the current simulation time, the maximum simulation time, and the current number of particles in the chute.

Reimplemented from DPMBase.

Definition at line 216 of file Chute.cc.

References BaseHandler< T >::getNumberOfObjects(), DPMBase::getTime(), DPMBase::getTimeMax(), and DPMBase::particleHandler.

217 {
218  std::cout << "\rt=" << std::setprecision(3) << std::left << std::setw(6) << getTime()
219  << ", tmax=" << std::setprecision(3) << std::left << std::setw(6) << getTimeMax()
220  << ", N=" << std::setprecision(3) << std::left << std::setw(6) << particleHandler.getNumberOfObjects()
221  << std::endl;
222  std::cout.flush();
223 }
ParticleHandler particleHandler
An object of the class ParticleHandler, contains the pointers to all the particles created...
Definition: DPMBase.h:878
unsigned int getNumberOfObjects() const
Gets the number of Object in this BaseHandler.
Definition: BaseHandler.h:464
Mdouble getTime() const
Access function for the time.
Definition: DPMBase.cc:158
Mdouble getTimeMax() const
Allows the user to access the total simulation time during the simulation. Cannot change it though...
Definition: DPMBase.cc:194
void Chute::read ( std::istream &  is)
virtual

Reads all chute properties from an istream.

Reads the object properties from an istream

Parameters
[in,out]isthe istream

Reimplemented from DPMBase.

Reimplemented in ChuteWithHopper.

Definition at line 133 of file Chute.cc.

References chuteAngle_, fixedParticleRadius_, DPMBase::getRestartVersion(), inflowHeight_, inflowVelocity_, inflowVelocityVariance_, maxFailed_, maxInflowParticleRadius_, minInflowParticleRadius_, constants::pi, MercuryBase::read(), and setRoughBottomType().

Referenced by ChuteWithHopper::read().

134 {
135  MercuryBase::read(is);
136  //read out the full line first, so if there is an error it does not affect
137  //the read of the next line
138  std::string line_string;
139  getline(is, line_string);
140  std::cout << "Chuteline=" << line_string << std::endl;
141  std::stringstream line(std::stringstream::in | std::stringstream::out);
142  line << line_string;
143 
144  if (getRestartVersion().compare("1"))
145  {
146  std::string dummy;
147  unsigned int roughBottomType;
148  line >> fixedParticleRadius_ >> roughBottomType >> chuteAngle_
151  setRoughBottomType(static_cast<RoughBottomType>(roughBottomType));
152  }
153  else
154  {
155  std::string dummy;
156  unsigned int roughBottomType;
157  line >> dummy >> fixedParticleRadius_
158  >> dummy >> minInflowParticleRadius_
159  >> dummy >> maxInflowParticleRadius_
160  >> dummy >> roughBottomType
161  >> dummy >> chuteAngle_ >> dummy >> maxFailed_ >> dummy >> dummy
162  >> dummy >> inflowVelocity_ >> dummy >> inflowVelocityVariance_
163  >> dummy >> inflowHeight_;
164  setRoughBottomType(static_cast<RoughBottomType>(roughBottomType));
165  }
166  //if the Chute Angle is given in degrees, move to radians;
167  if (chuteAngle_ > 1.0)
168  chuteAngle_ *= constants::pi / 180.;
169 }
unsigned int maxFailed_
indicates how many attempts are made to insert a new particle into the insertion boundary before the ...
Definition: Chute.h:355
Mdouble minInflowParticleRadius_
minimal radius of inflowing particles
Definition: Chute.h:329
void setRoughBottomType(RoughBottomType roughBottomType)
Sets the type of rough bottom of the chute.
Definition: Chute.cc:567
const Mdouble pi
Definition: ExtendedMath.h:42
Mdouble inflowVelocity_
Average inflow velocity in x-direction.
Definition: Chute.h:337
void read(std::istream &is) override
Reads the MercuryBase from an input stream, for example a restart file.
Definition: MercuryBase.cc:105
Mdouble inflowHeight_
Height of inflow.
Definition: Chute.h:345
Mdouble chuteAngle_
chute angle in degrees
Definition: Chute.h:321
Mdouble fixedParticleRadius_
radius of the fixed particles at the bottom
Definition: Chute.h:325
Mdouble inflowVelocityVariance_
Inflow velocity variance in x-direction (in ratio of inflowVelocity_)
Definition: Chute.h:341
std::string getRestartVersion() const
This is to take into account for different Mercury versions. Returns the version of the restart file...
Definition: DPMBase.cc:501
Mdouble maxInflowParticleRadius_
maximal radius of inflowing particles
Definition: Chute.h:333
bool Chute::readNextArgument ( int &  i,
int  argc,
char *  argv[] 
)
virtual

This method can be used for reading object properties from a string.

this reads chute parameters from a string.

Parameters
[in]ithe index of the input parameter to be read
[in]argcnumber of input parameters
[in]argv[]pointer to the (first character of the) actual string

Reimplemented from DPMBase.

Reimplemented in ChuteWithHopper.

Definition at line 444 of file Chute.cc.

References MercuryBase::readNextArgument(), setChuteAngle(), setChuteLength(), setChuteWidth(), setFixedParticleRadius(), setInflowHeight(), setInflowParticleRadius(), setInflowVelocity(), setMaxFailed(), setRoughBottomType(), and DPMBase::setZMax().

Referenced by ChuteWithHopper::readNextArgument().

445 {
446  if (!strcmp(argv[i], "-inflowHeight"))
447  {
448  setInflowHeight(atof(argv[i + 1]));
449  setZMax(atof(argv[i + 1]));
450  }
451  else if (!strcmp(argv[i], "-inflowVelocity"))
452  {
453  setInflowVelocity(atof(argv[i + 1]));
454  }
455  else if (!strcmp(argv[i], "-chuteAngle"))
456  {
457  setChuteAngle(atof(argv[i + 1]));
458  }
459  else if (!strcmp(argv[i], "-chuteLength"))
460  {
461  setChuteLength(atof(argv[i + 1]));
462  }
463  else if (!strcmp(argv[i], "-chuteWidth"))
464  {
465  setChuteWidth(atof(argv[i + 1]));
466  }
467  else if (!strcmp(argv[i], "-fixedParticleRadius"))
468  {
469  setFixedParticleRadius(atof(argv[i + 1]));
470  }
471  else if (!strcmp(argv[i], "-max_failed"))
472  {
473  setMaxFailed(static_cast<unsigned int>(atoi(argv[i + 1])));
474  }
475  else if (!strcmp(argv[i], "-inflowParticleRadiusRange"))
476  {
477  setInflowParticleRadius(atof(argv[i + 1]), atof(argv[i + 2]));
478  i++;
479  }
480  else if (!strcmp(argv[i], "-inflowParticleRadius"))
481  {
482  setInflowParticleRadius(atof(argv[i + 1]));
483  }
484  else if (!strcmp(argv[i], "-roughBottomType"))
485  {
486  std::string str(argv[i + 1]);
487  setRoughBottomType(str);
488  }
489 // else if (!strcmp(argv[i], "-k_eps"))
490 // {
491 // Mdouble Mass = getLightestParticleMass();
492 // //~ Mdouble Mass = particleHandler.get_LightestParticle()->getMass();
493 // speciesHandler.getObject(0)->setStiffnessAndRestitutionCoefficient(atof(argv[i + 1]), atof(argv[i + 2]), Mass);
494 // std::cout << "reset contact properties of lightest Particle (mass=" << Mass << ") to k=" << speciesHandler.getObject(0)->getStiffness() << " and dissipation_=" << speciesHandler.getObject(0)->getDissipation() << std::endl;
495 // i += 1;
496 // }
497 // else if (!strcmp(argv[i], "-tc_eps"))
498 // {
499 // Mdouble Mass = getLightestParticleMass();
500 // speciesHandler.getObject(0)->setCollisionTimeAndRestitutionCoefficient(atof(argv[i + 1]), atof(argv[i + 2]), Mass);
501 // std::cout << "reset contact properties of lightest Particle (mass=" << Mass << ") to k=" << speciesHandler.getObject(0)->getStiffness() << " and dissipation_=" << speciesHandler.getObject(0)->getDissipation() << std::endl;
502 // i += 1;
503 // }
504 // else if (!strcmp(argv[i], "-tc_eps_beta"))
505 // {
506 // Mdouble Mass = getLightestParticleMass();
507 // FrictionalSpecies* S = dynamic_cast<FrictionalSpecies*>(speciesHandler.getObject(0));
508 // S->setCollisionTimeAndNormalAndTangentialRestitutionCoefficient(atof(argv[i + 1]), atof(argv[i + 2]), atof(argv[i + 3]), Mass);
509 // std::cout << "reset contact properties of lightest Particle (mass=" << Mass << ") to k=" << S->getStiffness() << ", dissipation_=" << S->getDissipation() << ", kt=" << S->getSlidingStiffness() << " and dispt=" << S->getSlidingDissipation() << std::endl;
510 // i += 2;
511 // }
512  else
513  return Mercury3D::readNextArgument(i, argc, argv); //if argv[i] is not found, check the commands in Mercury3D
514  return true; //returns true if argv[i] is found
515 }
void setInflowVelocity(Mdouble inflowVelocity)
Sets the average inflow velocity.
Definition: Chute.cc:825
void setInflowHeight(Mdouble inflowHeight)
Sets maximum inflow height (Z-direction)
Definition: Chute.cc:799
void setChuteWidth(Mdouble chuteWidth)
Sets the chute width (Y-direction)
Definition: Chute.cc:881
void setMaxFailed(unsigned int maxFailed)
Sets the number of times a particle will be tried to be added to the insertion boundary.
Definition: Chute.cc:671
void setZMax(Mdouble newZMax)
If the length of the problem domain in z-direction is XMax - XMin, this method sets ZMax...
Definition: DPMBase.cc:338
void setChuteAngle(Mdouble chuteAngle)
Sets gravity vector according to chute angle (in degrees)
Definition: Chute.cc:616
void setRoughBottomType(RoughBottomType roughBottomType)
Sets the type of rough bottom of the chute.
Definition: Chute.cc:567
bool readNextArgument(int &i, int argc, char *argv[]) override
Reads the next command line argument.
Definition: MercuryBase.cc:419
void setInflowParticleRadius(Mdouble inflowParticleRadius)
Sets the radius of the inflow particles to a single one (i.e. ensures a monodisperse inflow)...
Definition: Chute.cc:691
void setFixedParticleRadius(Mdouble fixedParticleRadius)
Sets the particle radius of the fixed particles which constitute the (rough) chute bottom...
Definition: Chute.cc:540
virtual void setChuteLength(Mdouble chuteLength)
Sets the chute length (X-direction)
Definition: Chute.cc:901
void Chute::setChuteAngle ( Mdouble  chuteAngle)

Sets gravity vector according to chute angle (in degrees)

Sets the angle of the chute as compared to the horizontal (i.e., the normal to gravity). NB: since the X and Z directions are defined to be parallel and normal to the chute bottom, respectively, this function effectively sets the GRAVITY angle.

Parameters
[in]chuteAnglethe angle of the chute relative to the horizontal plane in DEGREES

Definition at line 616 of file Chute.cc.

References DPMBase::getGravity(), Vec3D::getLength(), logger, setChuteAngleAndMagnitudeOfGravity(), and WARN.

Referenced by constructor(), ChuteBottom::makeRoughBottom(), and readNextArgument().

617 {
618  // retrieve the magnitude of gravity
619  Mdouble gravity = getGravity().getLength();
620  if (gravity == 0)
621  {
622  logger(WARN, "[Chute::setChuteAngle()] zero gravity");
623  }
624 
625  // reset the gravity vector, with the given angle
626  setChuteAngleAndMagnitudeOfGravity(chuteAngle, gravity);
627 }
void setChuteAngleAndMagnitudeOfGravity(Mdouble chuteAngle, Mdouble gravity)
Sets gravity vector according to chute angle (in degrees)
Definition: Chute.cc:637
Logger< MERCURY_LOGLEVEL > logger("MercuryKernel")
double Mdouble
static Mdouble getLength(const Vec3D &a)
Calculates the length of a Vec3D: .
Definition: Vector.cc:427
Vec3D getGravity() const
Returns the gravity vector.
Definition: DPMBase.cc:438
void Chute::setChuteAngleAndMagnitudeOfGravity ( Mdouble  chuteAngle,
Mdouble  gravity 
)

Sets gravity vector according to chute angle (in degrees)

Sets the angle of the chute as compared to the horizontal (i.e., the normal to gravity), as well as the magnitude of gravity. NB: since the X and Z directions are defined to be parallel and normal to the chute bottom, respectively, this function effectively sets the GRAVITY angle.

Parameters
[in]chuteAnglethe angle of the chute relative to the horizontal plane in DEGREES
[in]gravitymagnitude of the gravity vector

Definition at line 637 of file Chute.cc.

References chuteAngle_, logger, constants::pi, DPMBase::setGravity(), and WARN.

Referenced by setChuteAngle().

638 {
639  if (chuteAngle >= -90.0 && chuteAngle <= 90.0)
640  {
641  chuteAngle_ = chuteAngle * constants::pi / 180.0;
642  setGravity(Vec3D(sin(chuteAngle_), 0.0, -cos(chuteAngle_)) * gravity);
643  }
644  else
645  logger(WARN,"[Chute::setChuteAngleAndMagnitudeOfGravity()] Chute angle "
646  "must be within [-90,90]");
647 }
Logger< MERCURY_LOGLEVEL > logger("MercuryKernel")
void setGravity(Vec3D newGravity)
Allows to modify the gravity vector.
Definition: DPMBase.cc:431
const Mdouble pi
Definition: ExtendedMath.h:42
Implementation of a 3D vector (by Vitaliy).
Definition: Vector.h:45
Mdouble chuteAngle_
chute angle in degrees
Definition: Chute.h:321
void Chute::setChuteLength ( Mdouble  chuteLength)
virtual

Sets the chute length (X-direction)

Sets the length of the chute. Actually sets xMax_, while xMin_ is assumed to have stayed 0.

Parameters
[in]chuteLengthlength of the chute

Reimplemented in ChuteWithHopper.

Definition at line 901 of file Chute.cc.

References DPMBase::setXMax().

Referenced by readNextArgument().

902 {
903  setXMax(chuteLength);
904 }
void setXMax(Mdouble newXMax)
If the length of the problem domain in x-direction is XMax - XMin, this method sets XMax...
Definition: DPMBase.cc:309
void Chute::setChuteWidth ( Mdouble  chuteWidth)

Sets the chute width (Y-direction)

Sets the width of the chute. Actually sets yMax_, while it assumes yMin_ to have stayed 0.

Parameters
[in]chuteWidthwidth of the chute

Definition at line 881 of file Chute.cc.

References DPMBase::setYMax().

Referenced by readNextArgument().

882 {
883  setYMax(chuteWidth);
884 }
void setYMax(Mdouble newYMax)
If the length of the problem domain in y-direction is YMax - YMin, this method sets YMax...
Definition: DPMBase.cc:324
void Chute::setFixedParticleRadius ( Mdouble  fixedParticleRadius)

Sets the particle radius of the fixed particles which constitute the (rough) chute bottom.

Sets the radius of the fixed particles at the bottom (in case of a rough bottom; see also Chute::createBottom() ).

Definition at line 540 of file Chute.cc.

References fixedParticleRadius_, logger, and WARN.

Referenced by constructor(), ChuteBottom::makeRoughBottom(), and readNextArgument().

541 {
542  if (fixedParticleRadius >= 0.0)
543  fixedParticleRadius_ = fixedParticleRadius;
544  else
545  logger(WARN,"[Chute::setFixedParticleRadius()] Fixed particle radius must be greater than or equal to zero.");
546 }
Logger< MERCURY_LOGLEVEL > logger("MercuryKernel")
Mdouble fixedParticleRadius_
radius of the fixed particles at the bottom
Definition: Chute.h:325
void Chute::setInflowHeight ( Mdouble  inflowHeight)

Sets maximum inflow height (Z-direction)

Sets the maximum height in Z-direction at which particles are introduced into the chute.

Parameters
[in]inflowHeightthe maximum inflow height to be set

Definition at line 799 of file Chute.cc.

References inflowHeight_, and DPMBase::setZMax().

Referenced by constructor(), ChuteBottom::makeRoughBottom(), and readNextArgument().

800 {
801  //if (inflowHeight >= minInflowParticleRadius_ + maxInflowParticleRadius_)
802  {
803  inflowHeight_ = inflowHeight;
804  setZMax(1.2 * inflowHeight_);
805  }
806 // else
807 // {
808 // std::cerr << "WARNING : Inflow height not changed to " << inflowHeight << ", value must be greater than or equal to diameter of inflow particle" << std::endl;
809 // }
810 }
void setZMax(Mdouble newZMax)
If the length of the problem domain in z-direction is XMax - XMin, this method sets ZMax...
Definition: DPMBase.cc:338
Mdouble inflowHeight_
Height of inflow.
Definition: Chute.h:345
void Chute::setInflowParticleRadius ( Mdouble  inflowParticleRadius)

Sets the radius of the inflow particles to a single one (i.e. ensures a monodisperse inflow).

Sets the radius of particles flowing in at the start of the chute to be constant and the given one (i.e., the minimum and maximum allowed radius are set equal to each other and the argument).

Parameters
[in]inflowParticleRadiusthe radius of the particles entering the chute

Definition at line 691 of file Chute.cc.

References logger, maxInflowParticleRadius_, minInflowParticleRadius_, and WARN.

Referenced by constructor(), createBottom(), and readNextArgument().

692 {
693  if (inflowParticleRadius >= 0.0)
694  {
695  minInflowParticleRadius_ = inflowParticleRadius;
696  maxInflowParticleRadius_ = inflowParticleRadius;
697  }
698  else
699  {
700  logger(WARN, "[Chute::setInflowParticleRadius(Mdouble)] Inflow "
701  "particle must be greater than or equal to zero");
702  }
703 }
Logger< MERCURY_LOGLEVEL > logger("MercuryKernel")
Mdouble minInflowParticleRadius_
minimal radius of inflowing particles
Definition: Chute.h:329
Mdouble maxInflowParticleRadius_
maximal radius of inflowing particles
Definition: Chute.h:333
void Chute::setInflowParticleRadius ( Mdouble  minInflowParticleRadius,
Mdouble  maxInflowParticleRadius 
)

Sets the minimum and maximum radius of the inflow particles.

Sets the minimum and maximum radius possible of particles entering the chute.

Parameters
[in]minInflowParticleRadiusthe minimum radius
[in]maxInflowParticleRadiusthe maximum radius

Definition at line 710 of file Chute.cc.

References logger, maxInflowParticleRadius_, minInflowParticleRadius_, and WARN.

711 {
712  if (minInflowParticleRadius >= 0.0)
713  {
714  minInflowParticleRadius_ = minInflowParticleRadius;
715  }
716  else
717  {
718  logger(WARN, "[Chute::setInflowParticleRadius(Mdouble,Mdouble)] Min."
719  "inflow particle radius must be nonnegative");
720  }
721  if (maxInflowParticleRadius >= minInflowParticleRadius)
722  {
723  maxInflowParticleRadius_ = maxInflowParticleRadius;
724  }
725  else
726  {
727  logger(WARN, "[Chute::setInflowParticleRadius(Mdouble,Mdouble)] Max."
728  " inflow particle radius must be >= min. inflow particle "
729  "radius");
730  }
731 }
Logger< MERCURY_LOGLEVEL > logger("MercuryKernel")
Mdouble minInflowParticleRadius_
minimal radius of inflowing particles
Definition: Chute.h:329
Mdouble maxInflowParticleRadius_
maximal radius of inflowing particles
Definition: Chute.h:333
void Chute::setInflowVelocity ( Mdouble  inflowVelocity)

Sets the average inflow velocity.

Sets the mean velocity at which the particles enter the chute

Parameters
[in]inflowVelocitythe mean velocity at which the particles enter the chute

Definition at line 825 of file Chute.cc.

References inflowVelocity_, logger, and WARN.

Referenced by constructor(), and readNextArgument().

826 {
827  if (inflowVelocity >= 0.0)
828  {
829  inflowVelocity_ = inflowVelocity;
830  }
831  else
832  {
833  logger(WARN,"[Chute::setInflowVelocity()] Inflow velocity not changed, "
834  "value must be greater than or equal to zero");
835  }
836 }
Logger< MERCURY_LOGLEVEL > logger("MercuryKernel")
Mdouble inflowVelocity_
Average inflow velocity in x-direction.
Definition: Chute.h:337
void Chute::setInflowVelocityVariance ( Mdouble  inflowVelocityVariance)

Sets the inflow velocity variance.

Sets the variance of the velocities of the inflow particles around the mean

Parameters
[in]inflowVelocityVariancethe variance of the velocities of the inflow particles around the mean (expressed in ratio of the mean, i.e. the inflowVelocity_).

Definition at line 852 of file Chute.cc.

References ERROR, inflowVelocityVariance_, and logger.

Referenced by constructor().

853 {
854  if (inflowVelocityVariance >= 0.0 && inflowVelocityVariance <= 1.0)
855  {
856  inflowVelocityVariance_ = inflowVelocityVariance;
857  }
858  else
859  {
860  logger(ERROR, "[Chute::setInflowVelocityVariance()] Inflow velocity "
861  "variance not changed, value must be within [0,1]");
862  exit(-1);
863  }
864 }
Logger< MERCURY_LOGLEVEL > logger("MercuryKernel")
Mdouble inflowVelocityVariance_
Inflow velocity variance in x-direction (in ratio of inflowVelocity_)
Definition: Chute.h:341
void Chute::setInsertionBoundary ( InsertionBoundary insertionBoundary)

Sets the chute insertion boundary.

Sets the insertion boundary of the chute.

Parameters
[in]insertionBoundarythe insertion boundary of the chute

Definition at line 920 of file Chute.cc.

References insertionBoundary_.

Referenced by ChuteWithHopper::setupInitialConditions().

921 {
922  insertionBoundary_ = insertionBoundary;
923 }
InsertionBoundary * insertionBoundary_
(Pointer to) the Chute's insertion boundary
Definition: Chute.h:359
void Chute::setMaxFailed ( unsigned int  maxFailed)

Sets the number of times a particle will be tried to be added to the insertion boundary.

Sets the number of times that the boundary may fail to insert a particle, before the boundary is considered filled.

Definition at line 671 of file Chute.cc.

References maxFailed_.

Referenced by constructor(), and readNextArgument().

672 {
673  maxFailed_ = maxFailed;
674 }
unsigned int maxFailed_
indicates how many attempts are made to insert a new particle into the insertion boundary before the ...
Definition: Chute.h:355
void Chute::setMaxInflowParticleRadius ( Mdouble  maxInflowParticleRadius)

Sets the maximum radius of inflow particles.

Sets the maximum radius possible of particles entering the chute.

Parameters
[in]maxInflowParticleRadiusthe maximum radius

Definition at line 754 of file Chute.cc.

References logger, maxInflowParticleRadius_, minInflowParticleRadius_, and WARN.

755 {
756  if (maxInflowParticleRadius >= minInflowParticleRadius_)
757  {
758  maxInflowParticleRadius_ = maxInflowParticleRadius;
759  }
760  else
761  {
762  logger(WARN,"[Chute::setMaxInflowParticleRadius()] Max. inflow particle"
763  " radius must be >= min. inflow particle radius");
764  }
765 }
Logger< MERCURY_LOGLEVEL > logger("MercuryKernel")
Mdouble minInflowParticleRadius_
minimal radius of inflowing particles
Definition: Chute.h:329
Mdouble maxInflowParticleRadius_
maximal radius of inflowing particles
Definition: Chute.h:333
void Chute::setMinInflowParticleRadius ( Mdouble  minInflowParticleRadius)

sets the minimum radius of inflow particles

Sets the minimum radius possible of particles entering the chute.

Parameters
[in]minInflowParticleRadiusthe minimum radius

Definition at line 737 of file Chute.cc.

References logger, maxInflowParticleRadius_, minInflowParticleRadius_, and WARN.

738 {
739  if (minInflowParticleRadius <= maxInflowParticleRadius_)
740  {
741  minInflowParticleRadius_ = minInflowParticleRadius;
742  }
743  else
744  {
745  logger(WARN,"[Chute::setMinInflowParticleRadius()] Min. inflow particle"
746  " radius must be <= max. inflow particle radius");
747  }
748 }
Logger< MERCURY_LOGLEVEL > logger("MercuryKernel")
Mdouble minInflowParticleRadius_
minimal radius of inflowing particles
Definition: Chute.h:329
Mdouble maxInflowParticleRadius_
maximal radius of inflowing particles
Definition: Chute.h:333
void Chute::setRoughBottomType ( RoughBottomType  roughBottomType)

Sets the type of rough bottom of the chute.

Sets the roughBottomType_. Possible choices are defined by the enum RoughBottomType, which is defined in Chute.h:

  • MONOLAYER_ORDERED: Bottom will be a rectangularly ordered monolayer of particles
  • MONOLAYER_DISORDERED: Bottom will be a disordered monolayer of particles
  • MULTILAYER: Bottom will be a multilayer of particles
  • FLAT: Flat bottom. See also the documentation of Chute::createBottom().
    Parameters
    [in]roughBottomTypeThe bottom type to be set

Definition at line 567 of file Chute.cc.

References roughBottomType_.

Referenced by constructor(), ChuteBottom::makeRoughBottom(), read(), and readNextArgument().

568 {
569  roughBottomType_ = roughBottomType;
570 }
RoughBottomType roughBottomType_
Determines the type of rough bottom created (if any). See also the enum RoughBottomType at the beginn...
Definition: Chute.h:350
void Chute::setRoughBottomType ( std::string  roughBottomTypeString)

Sets the type of rough bottom of the chute, using a string with the EXACT enum type as input.

Same as Chute::setRoughBottomType(RoughBottomType roughBottomType), but takes a string identical to the RoughBottomType as an argument instead.

Definition at line 576 of file Chute.cc.

References FATAL, FLAT, logger, MONOLAYER_ORDERED, and roughBottomType_.

577 {
578  if (!roughBottomTypeString.compare("MONOLAYER_ORDERED"))
579  {
581  }
582  else if (!roughBottomTypeString.compare("MONOLAYER_DISORDERED"))
583  {
585  }
586  else if (!roughBottomTypeString.compare("MULTILAYER"))
587  {
589  }
590  else if (roughBottomTypeString == "FLAT")
591  {
593  }
594  else
595  {
596  logger(FATAL, "[Chute::setRoughBottomType(std::string)] Invalid "
597  "argument in setRoughBottomType. Given: %", roughBottomTypeString);
598  }
599 }
Logger< MERCURY_LOGLEVEL > logger("MercuryKernel")
Definition: Chute.h:52
RoughBottomType roughBottomType_
Determines the type of rough bottom created (if any). See also the enum RoughBottomType at the beginn...
Definition: Chute.h:350
void Chute::setupInitialConditions ( )
virtual

Creates bottom, side walls and a particle insertion boundary.

Adds side walls, a bottom and a particle insertion boundary

Reimplemented from DPMBase.

Reimplemented in ChuteWithHopper, and ChuteBottom.

Definition at line 228 of file Chute.cc.

References DPMBase::boundaryHandler, BaseHandler< T >::copyAndAddObject(), createBottom(), FATAL, fixedParticleRadius_, Files::getName(), BaseHandler< T >::getNumberOfObjects(), BaseHandler< T >::getObject(), DPMBase::getXMax(), DPMBase::getXMin(), DPMBase::getYMax(), DPMBase::getYMin(), DPMBase::getZMax(), DPMBase::getZMin(), inflowVelocity_, inflowVelocityVariance_, insertionBoundary_, logger, maxFailed_, maxInflowParticleRadius_, minInflowParticleRadius_, ChuteInsertionBoundary::set(), BaseParticle::setSpecies(), setupSideWalls(), and DPMBase::speciesHandler.

229 {
231  logger(FATAL, "[Chute::setupInitialConditions()] Chute % cannot complete because no species have been "
232  "defined.", getName());
233 
234  // create the chute's side walls in Y-direction (which are solid if the chute is not periodic)
235  setupSideWalls();
236 
237  // create a particle of which (altered) copies will fill the chute insertion boundary
238  BaseParticle* p = new BaseParticle;
239  p->setSpecies(speciesHandler.getObject(0)); // by default, insert particles of species 0
240 
241  // set up the insertion boundary and add to handler
245 
246  //creates the bottom of the chute
247  createBottom();
248 }
unsigned int maxFailed_
indicates how many attempts are made to insert a new particle into the insertion boundary before the ...
Definition: Chute.h:355
Logger< MERCURY_LOGLEVEL > logger("MercuryKernel")
Mdouble minInflowParticleRadius_
minimal radius of inflowing particles
Definition: Chute.h:329
Mdouble getZMax() const
If the length of the problem domain in z-direction is ZMax - ZMin, then getZMax() returns ZMax...
Definition: DPMBase.cc:259
Mdouble getXMin() const
If the length of the problem domain in x-direction is XMax - XMin, then getXMin() returns XMin...
Definition: DPMBase.cc:224
Mdouble getYMin() const
If the length of the problem domain in y-direction is YMax - YMin, then getYMin() returns YMin...
Definition: DPMBase.cc:238
void setSpecies(const ParticleSpecies *species)
Mdouble getXMax() const
If the length of the problem domain in x-direction is XMax - XMin, then getXMax() returns XMax...
Definition: DPMBase.cc:231
U * copyAndAddObject(const U &O)
Creates a copy of a Object and adds it to the BaseHandler.
Definition: BaseHandler.h:268
BoundaryHandler boundaryHandler
An object of the class BoundaryHandler which concerns insertion and deletion of particles into or fro...
Definition: DPMBase.h:888
void setupSideWalls()
Creates chute side walls (either solid or periodic)
Definition: Chute.cc:254
T * getObject(const unsigned int id)
Gets a pointer to the Object at the specified index in the BaseHandler.
Definition: BaseHandler.h:415
unsigned int getNumberOfObjects() const
Gets the number of Object in this BaseHandler.
Definition: BaseHandler.h:464
SpeciesHandler speciesHandler
A handler to that stores the species type i.e. elastic, linear visco-elastic... et cetera...
Definition: DPMBase.h:868
Mdouble getYMax() const
If the length of the problem domain in y-direction is YMax - YMin, then getYMax() returns XMax...
Definition: DPMBase.cc:245
virtual void createBottom()
Creates the chute bottom, which can be either flat or one of three flavours of rough.
Definition: Chute.cc:288
Mdouble getZMin() const
If the length of the problem domain in z-direction is ZMax - ZMin, then getZMin() returns ZMin...
Definition: DPMBase.cc:252
Mdouble inflowVelocity_
Average inflow velocity in x-direction.
Definition: Chute.h:337
Used for modeling chute inflow. Inherits from InsertionBoundary.
Implementation of a 3D vector (by Vitaliy).
Definition: Vector.h:45
InsertionBoundary * insertionBoundary_
(Pointer to) the Chute's insertion boundary
Definition: Chute.h:359
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.
Mdouble fixedParticleRadius_
radius of the fixed particles at the bottom
Definition: Chute.h:325
Mdouble inflowVelocityVariance_
Inflow velocity variance in x-direction (in ratio of inflowVelocity_)
Definition: Chute.h:341
const std::string & getName() const
Returns the name of the file. Does not allow to change it though.
Definition: Files.cc:131
Mdouble maxInflowParticleRadius_
maximal radius of inflowing particles
Definition: Chute.h:333
void Chute::setupSideWalls ( )

Creates chute side walls (either solid or periodic)

Create side walls (i.e., in the Y-direction), which can be either periodic (if isChutePeriodic_ is TRUE), or solid (if isChutePeriodic_ is FALSE).

Definition at line 254 of file Chute.cc.

References DPMBase::boundaryHandler, BaseHandler< T >::copyAndAddObject(), DPMBase::getYMax(), DPMBase::getYMin(), isChutePeriodic_, PeriodicBoundary::set(), InfiniteWall::set(), and DPMBase::wallHandler.

Referenced by setupInitialConditions(), and ChuteWithHopper::setupInitialConditions().

255 {
256  // check if walls should be periodic or solid
257  if (isChutePeriodic_)
258  {
259  // create a periodic boundary with walls at yMin_ and yMax_.
260  PeriodicBoundary b0;
261  b0.set(Vec3D(0.0, 1.0, 0.0), getYMin(), getYMax());
263  }
264  else
265  {
266  // create two infinite solid walls; one at yMin_...
267  InfiniteWall w0;
268  w0.set(Vec3D(0.0,-1.0, 0.0), Vec3D(0, getYMin(), 0));
270  // ... and one at yMax_.
271  w0.set(Vec3D(0.0, 1.0, 0.0), Vec3D(0, getYMax(), 0));
273  }
274 }
void set(Vec3D normal, Mdouble distanceLeft, Mdouble distanceRight)
Defines a periodic wall.
bool isChutePeriodic_
Determines whether the chute has periodic (TRUE) or solid (FALSE) walls in the Y-direction.
Definition: Chute.h:364
Mdouble getYMin() const
If the length of the problem domain in y-direction is YMax - YMin, then getYMin() returns YMin...
Definition: DPMBase.cc:238
Defines a pair of periodic walls. Inherits from BaseBoundary.
U * copyAndAddObject(const U &O)
Creates a copy of a Object and adds it to the BaseHandler.
Definition: BaseHandler.h:268
BoundaryHandler boundaryHandler
An object of the class BoundaryHandler which concerns insertion and deletion of particles into or fro...
Definition: DPMBase.h:888
Mdouble getYMax() const
If the length of the problem domain in y-direction is YMax - YMin, then getYMax() returns XMax...
Definition: DPMBase.cc:245
WallHandler wallHandler
An object of the class WallHandler. Contains pointers to all the walls created.
Definition: DPMBase.h:883
void set(Vec3D normal, Vec3D point)
Defines a standard wall, given an outward normal vector s.t. normal*x=normal*point for all x of the w...
Definition: InfiniteWall.cc:70
This is a class defining walls.
Definition: InfiniteWall.h:43
Implementation of a 3D vector (by Vitaliy).
Definition: Vector.h:45
void Chute::write ( std::ostream &  os,
bool  writeAllParticles = true 
) const
virtual

This function writes the Chute properties to an ostream, and adds the properties of ALL chute particles as well.

Writes object's properties to an ostream

Parameters
[in]osthe ostream
[in]writeAllParticlesIf TRUE, the properties of ALL particles in the particleHandler are written to the ostream. If FALSE, only the properties of the first two particles in the handler are written to the ostream (see DPMBase::write(std::ostream& os, bool writeAllParticles)).

Reimplemented from DPMBase.

Reimplemented in ChuteWithHopper.

Definition at line 180 of file Chute.cc.

References chuteAngle_, fixedParticleRadius_, InsertionBoundary::getNumberOfParticlesInserted(), inflowHeight_, inflowVelocity_, inflowVelocityVariance_, insertionBoundary_, maxFailed_, maxInflowParticleRadius_, minInflowParticleRadius_, constants::pi, roughBottomType_, and MercuryBase::write().

Referenced by ChuteWithHopper::write().

181 {
182  MercuryBase::write(os, writeAllParticles);
183  os << " FixedParticleRadius:" << fixedParticleRadius_
184  << ", InflowParticleRadius: [" << minInflowParticleRadius_ << ","
185  << maxInflowParticleRadius_ << "]," << std::endl
186  << " RandomisedBottom:" << roughBottomType_
187  << ", ChuteAngle:" << chuteAngle_ / constants::pi * 180.
188  << ", max_failed:" << maxFailed_ << ", num_created:" << std::endl;
189  if (insertionBoundary_)
190  {
192  }
193  else
194  {
195  os << 0;
196  }
197  os << "," << std::endl
198  << " InflowVelocity:" << inflowVelocity_
199  << ", InflowVelocityVariance:" << inflowVelocityVariance_
200  << ", InflowHeight:" << inflowHeight_ << std::endl;
201 }
unsigned int maxFailed_
indicates how many attempts are made to insert a new particle into the insertion boundary before the ...
Definition: Chute.h:355
Mdouble minInflowParticleRadius_
minimal radius of inflowing particles
Definition: Chute.h:329
void write(std::ostream &os, bool writeAllParticles=true) const override
Writes the MercuryBase to an output stream, for example a restart file.
Definition: MercuryBase.cc:132
const Mdouble pi
Definition: ExtendedMath.h:42
unsigned int getNumberOfParticlesInserted() const
Gets the number of particles inserted by the boundary.
RoughBottomType roughBottomType_
Determines the type of rough bottom created (if any). See also the enum RoughBottomType at the beginn...
Definition: Chute.h:350
Mdouble inflowVelocity_
Average inflow velocity in x-direction.
Definition: Chute.h:337
Mdouble inflowHeight_
Height of inflow.
Definition: Chute.h:345
InsertionBoundary * insertionBoundary_
(Pointer to) the Chute's insertion boundary
Definition: Chute.h:359
Mdouble chuteAngle_
chute angle in degrees
Definition: Chute.h:321
Mdouble fixedParticleRadius_
radius of the fixed particles at the bottom
Definition: Chute.h:325
Mdouble inflowVelocityVariance_
Inflow velocity variance in x-direction (in ratio of inflowVelocity_)
Definition: Chute.h:341
Mdouble maxInflowParticleRadius_
maximal radius of inflowing particles
Definition: Chute.h:333

Member Data Documentation

Mdouble Chute::chuteAngle_
private

chute angle in degrees

Definition at line 321 of file Chute.h.

Referenced by getChuteAngle(), getChuteAngleDegrees(), read(), setChuteAngleAndMagnitudeOfGravity(), and write().

Mdouble Chute::fixedParticleRadius_
private

radius of the fixed particles at the bottom

Definition at line 325 of file Chute.h.

Referenced by getFixedParticleRadius(), read(), setFixedParticleRadius(), setupInitialConditions(), and write().

Mdouble Chute::inflowHeight_
private

Height of inflow.

Definition at line 345 of file Chute.h.

Referenced by getInflowHeight(), read(), setInflowHeight(), and write().

Mdouble Chute::inflowVelocity_
private

Average inflow velocity in x-direction.

Definition at line 337 of file Chute.h.

Referenced by getInflowVelocity(), read(), setInflowVelocity(), setupInitialConditions(), and write().

Mdouble Chute::inflowVelocityVariance_
private

Inflow velocity variance in x-direction (in ratio of inflowVelocity_)

Definition at line 341 of file Chute.h.

Referenced by getInflowVelocityVariance(), read(), setInflowVelocityVariance(), setupInitialConditions(), and write().

InsertionBoundary* Chute::insertionBoundary_
private

(Pointer to) the Chute's insertion boundary

Definition at line 359 of file Chute.h.

Referenced by constructor(), setInsertionBoundary(), setupInitialConditions(), and write().

bool Chute::isChutePeriodic_
private

Determines whether the chute has periodic (TRUE) or solid (FALSE) walls in the Y-direction.

Definition at line 364 of file Chute.h.

Referenced by constructor(), getIsPeriodic(), makeChutePeriodic(), and setupSideWalls().

unsigned int Chute::maxFailed_
private

indicates how many attempts are made to insert a new particle into the insertion boundary before the boundary is considered filled.

Definition at line 355 of file Chute.h.

Referenced by getMaxFailed(), read(), setMaxFailed(), setupInitialConditions(), and write().

Mdouble Chute::maxInflowParticleRadius_
private
Mdouble Chute::minInflowParticleRadius_
private
RoughBottomType Chute::roughBottomType_
private

Determines the type of rough bottom created (if any). See also the enum RoughBottomType at the beginning of this header file.

Definition at line 350 of file Chute.h.

Referenced by createBottom(), getRoughBottomType(), setRoughBottomType(), and write().


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