SegregationPeriodic Class Reference

This class does segregation problems in a periodic chute. More...

+ Inheritance diagram for SegregationPeriodic:

Public Member Functions

void actionsBeforeTimeStep () override
 A virtual function which allows to define operations to be executed before the new time step. More...
 
void write (std::ostream &os, bool print_all=false)
 This is the info call. More...
 
void setupInitialConditions () override
 
double getInfo (const BaseParticle &P) const override
 Allows the user to set what is written into the info column in the data file. More...
 
void actionsBeforeTimeStep () override
 This code requires you do not nothing special after each time step. More...
 
void write (std::ostream &os, bool print_all=false) const override
 This is the info call. More...
 
void setupInitialConditions () override
 
double getInfo (const BaseParticle &P) const override
 Allows the user to set what is written into the info column in the data file. More...
 
void actionsBeforeTimeStep () override
 This code requires you do not nothing special after each time step. More...
 
void write (std::ostream &os, bool print_all=false) const override
 This is the info call. More...
 
void setupInitialConditions () override
 
void setSizeRatio (double sizeRatio)
 
void setDensityRatio (double densityRatio)
 
double getSizeRatio ()
 
double getDensityRatio ()
 
double getInfo (const BaseParticle &P) const override
 Allows the user to set what is written into the info column in the data file. More...
 
void actionsBeforeTimeStep () override
 This code requires you do not nothing special after each time step. More...
 
void write (std::ostream &os, bool print_all=false) const override
 This is the info call. More...
 
void setupInitialConditions () override
 
void actionsBeforeTimeStep () override
 This code requires you do not nothing special after each time step. More...
 
void setupInitialConditions () override
 This is the info call. More...
 
void setSpeciesProperties ()
 
void createWalls ()
 
void createParticles (int numberOfSmallParticles, int numberOfLargeParticles)
 
void setChuteProperties ()
 
- Public Member Functions inherited from Chute
 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[]) override
 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 () override
 Creates bottom, side walls and a particle insertion boundary. More...
 
void read (std::istream &is, ReadOptions opt=ReadOptions::ReadAll) override
 Reads all chute properties from an istream. More...
 
void write (std::ostream &os, bool writeAllParticles=true) const override
 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 setFixedParticleSpacing (Mdouble fixedParticleSpacing)
 Sets the spacing of the fixed particles which constitute the (rough) chute bottom; used in triangular packing only. More...
 
Mdouble getFixedParticleSpacing () const
 Returns the particle radius of the fixed particles which constitute the (rough) chute bottom; used in triangular packing only. 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...
 
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...
 
std::vector< BaseParticle * > hGridFindParticleContacts (const BaseParticle *obj) override
 Returns all particles that have a contact with a given particle. More...
 
- Public Member Functions inherited from MercuryBase
 MercuryBase ()
 This is the default constructor. It sets sensible defaults. More...
 
 ~MercuryBase () override
 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, ReadOptions opt=ReadOptions::ReadAll) 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 all data into 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 final
 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) final
 Checks if given BaseParticle has an interaction with a BaseWall or other BaseParticle. More...
 
bool checkParticleForInteractionLocal (const BaseParticle &P) final
 Checks if the given BaseParticle has an interaction with a BaseWall or other BaseParticles in a local domain. 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 (std::ostream &os=std::cout) 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 DPMBase &other)
 Copy constructor type-2. More...
 
virtual ~DPMBase ()
 virtual destructor More...
 
void autoNumber ()
 The autoNumber() function calls three functions: setRunNumber(), readRunNumberFromFile() and incrementRunNumberInFile(). More...
 
std::vector< int > get1DParametersFromRunNumber (int size_x) const
 This turns a counter into 1 index, which is a useful feature for performing 1D parameter study. The index run from 1:size_x, while the study number starts at 0 (initially the counter=1 in COUNTER_DONOTDEL) More...
 
std::vector< int > get2DParametersFromRunNumber (int size_x, int size_y) const
 This turns a counter into 2 indices which is a very useful feature for performing a 2D study. 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...
 
std::vector< int > get3DParametersFromRunNumber (int size_x, int size_y, int size_z) const
 This turns a counter into 3 indices, which is a useful feature for performing a 3D parameter study. The indices run from 1:size_x, 1:size_y and 1:size_z, 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...
 
virtual void decompose ()
 Sends particles from processorId to the root processor. More...
 
void solve ()
 The work horse of the code. More...
 
void initialiseSolve ()
 Beginning of the solve routine, before time stepping. More...
 
void finaliseSolve ()
 End of the solve routine, after time stepping. More...
 
virtual void computeOneTimeStep ()
 Performs everything needed for one time step, used in the time-loop of solve(). More...
 
void checkSettings ()
 Checks if the essentials are set properly to go ahead with solving the problem. More...
 
void forceWriteOutputFiles ()
 Writes output files immediately, even if the current time step was not meant to be written. Also resets the last saved time step. More...
 
virtual void writeOutputFiles ()
 Writes simulation data to all the main Mercury files: .data, .ene, .fstat, .xballs and .restart (see the Mercury website for more details regarding these files). More...
 
void solve (int argc, char *argv[])
 The work horse of the code. Can handle flags from the command line. 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...
 
ParticleVtkWritergetVtkWriter () const
 
virtual void writeRestartFile ()
 Stores all the particle data for current save time step to a "restart" file, which is a file simply intended to store all the information necessary to "restart" a simulation from a given time step (see also MercuryDPM.org for more information on restart files). More...
 
void writeDataFile ()
 
void writeEneFile ()
 
void writeFStatFile ()
 
void fillDomainWithParticles (unsigned N=50)
 
bool readRestartFile (ReadOptions opt=ReadOptions::ReadAll)
 Reads all the particle data corresponding to a given, existing . restart file (for more details regarding restart files, refer to the training materials on the MercuryDPM website).Returns true if it is successful, false otherwise. More...
 
int readRestartFile (std::string fileName, ReadOptions opt=ReadOptions::ReadAll)
 The same as readRestartFile(bool), but also reads all the particle data corresponding to the current saved time step. More...
 
virtual BaseWallreadUserDefinedWall (const std::string &type) const
 Allows you to read in a wall defined in a Driver directory; see USER/Luca/ScrewFiller. More...
 
virtual void readOld (std::istream &is)
 Reads all data from a restart file, e.g. domain data and particle data; old version. More...
 
bool readDataFile (std::string fileName="", unsigned int format=0)
 This allows particle data to be reloaded from data files. More...
 
bool readParAndIniFiles (std::string fileName)
 Allows the user to read par.ini files (useful to read files produced by the MDCLR simulation code - external to MercuryDPM) 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 Visualising data in xballs. More...
 
void readNextFStatFile ()
 Reads the next fstat file. More...
 
bool findNextExistingDataFile (Mdouble tMin, bool verbose=true)
 Finds and opens the next data file, if such a file exists. More...
 
bool readArguments (int argc, char *argv[])
 Can interpret main function input arguments that are passed by the driver codes. More...
 
bool checkParticleForInteractionLocalPeriodic (const BaseParticle &P)
 
void readSpeciesFromDataFile (bool read=true)
 
void importParticlesAs (ParticleHandler &particleHandler, InteractionHandler &interactionHandler, const ParticleSpecies *species)
 Copies particles, interactions assigning species from a local simulation to a global one. Useful for the creation of a cluster. More...
 
MERCURYDPM_DEPRECATED FilegetDataFile ()
 The non const version. Allows one to edit the File::dataFile. More...
 
MERCURYDPM_DEPRECATED FilegetEneFile ()
 The non const version. Allows to edit the File::eneFile. More...
 
MERCURYDPM_DEPRECATED FilegetFStatFile ()
 The non const version. Allows to edit the File::fStatFile. More...
 
MERCURYDPM_DEPRECATED FilegetRestartFile ()
 The non const version. Allows to edit the File::restartFile. More...
 
MERCURYDPM_DEPRECATED FilegetStatFile ()
 The non const version. Allows to edit the File::statFile. More...
 
FilegetInteractionFile ()
 Return a reference to the file InteractionsFile. More...
 
MERCURYDPM_DEPRECATED const FilegetDataFile () const
 The const version. Does not allow for any editing of the File::dataFile. More...
 
MERCURYDPM_DEPRECATED const FilegetEneFile () const
 The const version. Does not allow for any editing of the File::eneFile. More...
 
MERCURYDPM_DEPRECATED const FilegetFStatFile () const
 The const version. Does not allow for any editing of the File::fStatFile. More...
 
MERCURYDPM_DEPRECATED const FilegetRestartFile () const
 The const version. Does not allow for any editing of the File::restartFile. More...
 
MERCURYDPM_DEPRECATED const FilegetStatFile () const
 The const version. Does not allow for any editing of the File::statFile. More...
 
const FilegetInteractionFile () const
 
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 closeFiles ()
 Closes all files (ene, data, fstat, restart, stat) that were opened to read or write. More...
 
void setLastSavedTimeStep (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...
 
Mdouble getTime () const
 Returns the current simulation time. More...
 
Mdouble getNextTime () const
 Returns the current simulation time. More...
 
unsigned int getNumberOfTimeSteps () const
 Returns the current counter of time-steps, i.e. the number of time-steps that the simulation has undergone so far. More...
 
void setTime (Mdouble time)
 Sets a new value for the current simulation time. More...
 
void setTimeMax (Mdouble newTMax)
 Sets a new value for the maximum simulation duration. More...
 
Mdouble getTimeMax () const
 Returns the maximum simulation duration. More...
 
void setLogarithmicSaveCount (Mdouble logarithmicSaveCountBase)
 Sets File::logarithmicSaveCount_ for all files (ene, data, fstat, restart, stat) More...
 
void setNToWrite (int nToWrite)
 set the number of elements to write to the screen More...
 
int getNToWrite () const
 get the number of elements to write to the More...
 
void setRotation (bool rotation)
 Sets whether particle rotation is enabled or disabled. More...
 
bool getRotation () const
 Indicates whether particle rotation is enabled or disabled. More...
 
MERCURYDPM_DEPRECATED void setWallsWriteVTK (FileType writeWallsVTK)
 Sets whether walls are written into a VTK file. More...
 
MERCURYDPM_DEPRECATED void setWallsWriteVTK (bool)
 Sets whether walls are written into a VTK file. More...
 
MERCURYDPM_DEPRECATED void setInteractionsWriteVTK (bool)
 Sets whether interactions are written into a VTK file. More...
 
void setParticlesWriteVTK (bool writeParticlesVTK)
 Sets whether particles are written in a VTK file. More...
 
void setSuperquadricParticlesWriteVTK (bool writeSuperquadricParticlesVTK)
 
MERCURYDPM_DEPRECATED FileType getWallsWriteVTK () const
 Returns whether walls are written in a VTK file. More...
 
bool getParticlesWriteVTK () const
 Returns whether particles are written in a VTK file. More...
 
bool getSuperquadricParticlesWriteVTK () 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...
 
Mdouble getXCenter () const
 
Mdouble getYCenter () const
 
Mdouble getZCenter () const
 
Vec3D getMin () const
 
Vec3D getMax () const
 
void setXMin (Mdouble newXMin)
 Sets the value of XMin, the lower bound of the problem domain in the x-direction. More...
 
void setYMin (Mdouble newYMin)
 Sets the value of YMin, the lower bound of the problem domain in the y-direction. More...
 
void setZMin (Mdouble newZMin)
 Sets the value of ZMin, the lower bound of the problem domain in the z-direction. More...
 
void setXMax (Mdouble newXMax)
 Sets the value of XMax, the upper bound of the problem domain in the x-direction. More...
 
void setYMax (Mdouble newYMax)
 Sets the value of YMax, the upper bound of the problem domain in the y-direction. More...
 
void setZMax (Mdouble newZMax)
 Sets the value of ZMax, the upper bound of the problem domain in the z-direction. More...
 
void setMax (const Vec3D &max)
 Sets the maximum coordinates of the problem domain. More...
 
void setMax (Mdouble, Mdouble, Mdouble)
 Sets the maximum coordinates of the problem domain. More...
 
void setDomain (const Vec3D &min, const Vec3D &max)
 Sets the minimum coordinates of the problem domain. More...
 
void setMin (const Vec3D &min)
 Sets the minimum coordinates of the problem domain. More...
 
void setMin (Mdouble, Mdouble, Mdouble)
 Sets the minimum coordinates of the problem domain. More...
 
void setTimeStep (Mdouble newDt)
 Sets a new value for the simulation time step. More...
 
Mdouble getTimeStep () const
 Returns the simulation time step. More...
 
void setNumberOfOMPThreads (int numberOfOMPThreads)
 
int getNumberOfOMPThreads () const
 
void setXBallsColourMode (int newCMode)
 Set the xballs output mode. More...
 
int getXBallsColourMode () const
 Get the xballs 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
 Returns the additional arguments for xballs. More...
 
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)
 Sets a new value for the gravitational acceleration. More...
 
Vec3D getGravity () const
 Returns the gravitational acceleration. More...
 
void setBackgroundDrag (Mdouble backgroundDrag)
 Simple access function to turn on a background drag. The force of particleVelocity*drag is applied (note, it allowd to be negaitve i.e. create energy) More...
 
const Mdouble getBackgroundDrag () const
 Return the background drag. More...
 
void setDimension (unsigned int newDim)
 Sets both the system dimensions and the particle dimensionality. More...
 
void setSystemDimensions (unsigned int newDim)
 Sets the system dimensionality. More...
 
unsigned int getSystemDimensions () const
 Returns the system dimensionality. More...
 
void setParticleDimensions (unsigned int particleDimensions)
 Sets the particle dimensionality. More...
 
unsigned int getParticleDimensions () const
 Returns the particle dimensionality. 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 whether the "append" option is on or off. More...
 
void setAppend (bool newAppendFlag)
 Sets whether the "append" option is on or off. 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...
 
Mdouble getGravitationalEnergy () const
 Returns the global gravitational potential energy stored in the system. More...
 
Mdouble getRotationalEnergy () const
 JMFT Returns the global rotational energy stored in the system. More...
 
Mdouble getTotalEnergy () const
 
Mdouble getTotalMass () const
 JMFT: Return the total mass of the system, excluding fixed particles. More...
 
Vec3D getCentreOfMass () const
 JMFT: Return the centre of mass of the system, excluding fixed particles. More...
 
Vec3D getTotalMomentum () const
 JMFT: Return the total momentum of the system, excluding fixed particles. More...
 
double getCPUTime ()
 
double getWallTime ()
 
virtual void hGridInsertParticle (BaseParticle *obj UNUSED)
 
virtual void hGridUpdateParticle (BaseParticle *obj UNUSED)
 
virtual void hGridRemoveParticle (BaseParticle *obj UNUSED)
 
bool mpiIsInCommunicationZone (BaseParticle *particle)
 Checks if the position of the particle is in an mpi communication zone or not. More...
 
bool mpiInsertParticleCheck (BaseParticle *P)
 Function that checks if the mpi particle should really be inserted by the current domain. More...
 
void insertGhostParticle (BaseParticle *P)
 This function inserts a particle in the mpi communication boundaries. More...
 
void updateGhostGrid (BaseParticle *P)
 Checks if the Domain/periodic interaction distance needs to be updated and updates it accordingly. More...
 
virtual void gatherContactStatistics (unsigned int index1, int index2, Vec3D Contact, Mdouble delta, Mdouble ctheta, Mdouble fdotn, Mdouble fdott, Vec3D P1_P2_normal_, Vec3D P1_P2_tangential)
 //Not unsigned index because of possible wall collisions. More...
 
void setNumberOfDomains (std::vector< unsigned > direction)
 Sets the number of domains in x-,y- and z-direction. Required for parallel computations. More...
 
void splitDomain (DomainSplit domainSplit)
 
std::vector< unsigned > getNumberOfDomains ()
 returns the number of domains More...
 
DomaingetCurrentDomain ()
 Function that returns a pointer to the domain corresponding to the processor. More...
 
void removeOldFiles () const
 
void setMeanVelocity (Vec3D V_mean_goal)
 This function will help you set a fixed kinetic energy and mean velocity in your system. More...
 
void setMeanVelocityAndKineticEnergy (Vec3D V_mean_goal, Mdouble Ek_goal)
 This function will help you set a fixed kinetic energy and mean velocity in your system. More...
 
Mdouble getTotalVolume () const
 Get the total volume of the cuboid system. More...
 
Matrix3D getKineticStress () const
 Calculate the kinetic stress tensor in the system averaged over the whole volume. More...
 
Matrix3D getStaticStress () const
 Calculate the static stress tensor in the system averaged over the whole volume. More...
 
Matrix3D getTotalStress () const
 Calculate the total stress tensor in the system averaged over the whole volume. More...
 
virtual void handleParticleRemoval (unsigned int id)
 Handles the removal of particles from the particleHandler. More...
 
virtual void handleParticleAddition (unsigned int id, BaseParticle *p)
 
void writePythonFileForVTKVisualisation () const
 
void setWritePythonFileForVTKVisualisation (bool forceWritePythonFileForVTKVisualisation)
 
bool getWritePythonFileForVTKVisualisation () const
 
WallVTKWritergetWallVTKWriter ()
 

Private Attributes

double radius_s
 
double radius_l
 
double rho_0
 
double rho_1
 
double rho_2
 
double radius_0
 
double radius_1
 
double radius_2
 
SphericalParticle inflowParticle_
 
double sizeRatio_
 
double densityRatio_
 

Additional Inherited Members

- Public Types inherited from DPMBase
enum class  ReadOptions : int { ReadAll , ReadNoInteractions , ReadNoParticlesAndInteractions }
 
enum class  DomainSplit {
  X , Y , Z , XY ,
  XZ , YZ , XYZ
}
 
- Static Public Member Functions inherited from DPMBase
static 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...
 
static int readRunNumberFromFile ()
 Read the run number or the counter from the counter file (COUNTER_DONOTDEL) More...
 
static bool areInContact (const BaseParticle *pI, const BaseParticle *pJ)
 Checks if two particle are in contact or is there any positive overlap. More...
 
- Public Attributes inherited from DPMBase
SpeciesHandler speciesHandler
 A handler to that stores the species type i.e. LinearViscoelasticSpecies, etc. 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...
 
ParticleHandler paoloParticleHandler
 Fake particleHandler created by Paolo needed temporary by just Paolo. 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...
 
PeriodicBoundaryHandler periodicBoundaryHandler
 Internal handler that deals with periodic boundaries, especially in a parallel build. More...
 
DomainHandler domainHandler
 An object of the class DomainHandler which deals with parallel code. More...
 
InteractionHandler interactionHandler
 An object of the class InteractionHandler. More...
 
CGHandler cgHandler
 Object of the class cgHandler. More...
 
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...
 
File interactionFile
 File class to handle in- and output into .interactions file. This file hold information about interactions. More...
 
Time clock_
 record when the simulation started More...
 
- Protected Member Functions inherited from Chute
void actionsBeforeTimeStep () override
 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...
 
virtual void addFlowParticlesCompactly ()
 Add initial flow particles in a dense packing. More...
 
virtual SphericalParticle createFlowParticle ()
 
void printTime () const override
 prints time, max time and number of particles More...
 
- Protected Member Functions inherited from Mercury3D
void hGridFindContactsWithinTargetCell (int x, int y, int z, unsigned int l)
 Finds contacts between particles in the target cell. More...
 
void hGridFindContactsWithTargetCell (int x, int y, int z, unsigned int l, BaseParticle *obj)
 Finds contacts between the BaseParticle and the target cell. More...
 
void computeWallForces (BaseWall *w) override
 Compute contacts with a wall. More...
 
void hGridFindParticlesWithTargetCell (int x, int y, int z, unsigned int l, BaseParticle *obj, std::vector< BaseParticle * > &list)
 Finds particles within target cell and stores them in a list. More...
 
void hGridGetInteractingParticleList (BaseParticle *obj, std::vector< BaseParticle * > &list) override
 Obtains all neighbour particles of a given object, obtained from the hgrid. More...
 
void computeInternalForces (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) override
 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) final
 Inserts a single Particle to current grid. More...
 
void hGridUpdateMove (BaseParticle *iP, Mdouble move) final
 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
 This function has to be called before integrateBeforeForceComputation. 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 using the BaseInteractable::setForce() and BaseInteractable::setTorque() More...
 
virtual void computeInternalForce (BaseParticle *, BaseParticle *)
 Computes the forces between two particles (internal in the sense that the sum over all these forces is zero i.e. fully modelled forces) More...
 
virtual void computeExternalForces (BaseParticle *)
 Computes the external forces, such as gravity, acting on particles. More...
 
virtual void computeForcesDueToWalls (BaseParticle *, BaseWall *)
 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 computeAdditionalForces ()
 A virtual function which allows to define operations to be executed prior to the OMP force collect. 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...
 
void writeVTKFiles () const
 
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. For more information on the XBalls program, see Visualising data in xballs. More...
 
virtual void outputXBallsDataParticle (unsigned int i, 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. For more information on the XBalls program, see Visualising data in xballs. 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
 Write the global kinetic, potential energy, etc. in the system. More...
 
virtual void initialiseStatistics ()
 
virtual void outputStatistics ()
 
void gatherContactStatistics ()
 
virtual void processStatistics (bool)
 
virtual void finishStatistics ()
 
virtual void integrateBeforeForceComputation ()
 Update particles' and walls' positions and velocities before force computation. More...
 
virtual void integrateAfterForceComputation ()
 Update particles' and walls' positions and velocities after force computation. 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)
 Sets a number, n, of particles in the particleHandler as "fixed particles". More...
 
virtual bool continueSolve () const
 A virtual function for deciding whether to continue the simulation, based on a user-specified criterion. More...
 
void outputInteractionDetails () const
 Displays the interaction details corresponding to the pointer objects in the interaction handler. More...
 
bool isTimeEqualTo (Mdouble time) const
 Checks whether the input variable "time" is the current time in the simulation. More...
 
void removeDuplicatePeriodicParticles ()
 Removes periodic duplicate Particles. More...
 
void checkAndDuplicatePeriodicParticles ()
 For simulations using periodic boundaries, checks and adds particles when necessary into the particle handler. See DPMBase.cc and PeriodicBoundary.cc for more details. More...
 
void performGhostParticleUpdate ()
 When the Verlet scheme updates the positions and velocities of particles, ghost particles will need an update as wel. Their status will also be updated accordingly. More...
 
void deleteGhostParticles (std::set< BaseParticle * > &particlesToBeDeleted)
 
void synchroniseParticle (BaseParticle *, unsigned fromProcessor=0)
 
void performGhostVelocityUpdate ()
 updates the final time-step velocity of the ghost particles More...
 
void setSoftStop ()
 function for setting sigaction constructor. More...
 
- Static Protected Member Functions inherited from DPMBase
static void signalHandler (int signal)
 signal handler function. More...
 

Detailed Description

This class does segregation problems in a periodic chute.

This class does segregation problems in a periodic chute It uses species to create two type of particles. One for the large and one for the small It the sets contact properties of the collisions such that coefficient of restitution and contact time are the same for all collisions.

This class does segregation problems in a periodic chute It uses species to create two type of partices. It the sets contact properties of the collisions such that coefficient of resitution and contact time are the same for all collisions.

Member Function Documentation

◆ actionsBeforeTimeStep() [1/5]

void SegregationPeriodic::actionsBeforeTimeStep ( )
inlineoverridevirtual

A virtual function which allows to define operations to be executed before the new time step.

no implementation but can be overidden in its derived classes.

Reimplemented from DPMBase.

44 {};

◆ actionsBeforeTimeStep() [2/5]

void SegregationPeriodic::actionsBeforeTimeStep ( )
inlineoverridevirtual

This code requires you do not nothing special after each time step.

Reimplemented from DPMBase.

57 {};

◆ actionsBeforeTimeStep() [3/5]

void SegregationPeriodic::actionsBeforeTimeStep ( )
inlineoverridevirtual

This code requires you do not nothing special after each time step.

Reimplemented from DPMBase.

58 {};

◆ actionsBeforeTimeStep() [4/5]

void SegregationPeriodic::actionsBeforeTimeStep ( )
inlineoverridevirtual

This code requires you do not nothing special after each time step.

Reimplemented from DPMBase.

57 {};

◆ actionsBeforeTimeStep() [5/5]

void SegregationPeriodic::actionsBeforeTimeStep ( )
inlineoverridevirtual

This code requires you do not nothing special after each time step.

Reimplemented from DPMBase.

51  {
52  }

◆ createParticles()

void SegregationPeriodic::createParticles ( int  numberOfSmallParticles,
int  numberOfLargeParticles 
)
inline
173  {
174  //Generate a large particle: set radius to large radius subtract one of the list of large particles to be generated
177  numberOfLargeParticles--;
178 
179  //randomize particle position, zero initial velocity
183  inflowParticle_.setVelocity(Vec3D(0.0, 0.0, 0.0));
184 
185  //Add the new particle to the list of current particles
187  hGridRebuild();
188 
189  while ((numberOfSmallParticles > 0) && (numberOfLargeParticles > 0))
190  {
191  //random to see if want to generate a large or small particles, helps makes the initial conditions homogeneous
192  if (random.getRandomNumber(1.0, numberOfLargeParticles + numberOfSmallParticles) > numberOfLargeParticles)
193  {
194  //Generate a small particle: set radius to small radius subtract one off the list of small particles to be generated
197  numberOfSmallParticles--;
198  }
199  else
200  {
201  //Generate a large particle: set radius to large radius subtract one of the list of large particles to be generated
204  numberOfLargeParticles--;
205  }
206 
207  //randomize particle position, zero initial velocity
211  inflowParticle_.setVelocity(Vec3D(0.0, 0.0, 0.0));
212 
213  //Add the new particle to the list of current particles
215  }
216  }
std::enable_if<!std::is_pointer< U >::value, U * >::type copyAndAddObject(const U &object)
Creates a copy of a Object and adds it to the BaseHandler.
Definition: BaseHandler.h:379
T * getObject(const unsigned int id)
Gets a pointer to the Object at the specified index in the BaseHandler.
Definition: BaseHandler.h:613
void setVelocity(const Vec3D &velocity)
set the velocity of the BaseInteractable.
Definition: BaseInteractable.cc:350
virtual void setPosition(const Vec3D &position)
Sets the position of this BaseInteractable.
Definition: BaseInteractable.h:239
virtual void setRadius(Mdouble radius)
Sets the particle's radius_ (and adjusts the mass_ accordingly, based on the particle's species)
Definition: BaseParticle.cc:553
void setSpecies(const ParticleSpecies *species)
Definition: BaseParticle.cc:818
Mdouble getXMin() const
If the length of the problem domain in x-direction is XMax - XMin, then getXMin() returns XMin.
Definition: DPMBase.h:619
Mdouble getXMax() const
If the length of the problem domain in x-direction is XMax - XMin, then getXMax() returns XMax.
Definition: DPMBase.h:626
SpeciesHandler speciesHandler
A handler to that stores the species type i.e. LinearViscoelasticSpecies, etc.
Definition: DPMBase.h:1427
Mdouble getYMin() const
If the length of the problem domain in y-direction is YMax - YMin, then getYMin() returns YMin.
Definition: DPMBase.h:632
ParticleHandler particleHandler
An object of the class ParticleHandler, contains the pointers to all the particles created.
Definition: DPMBase.h:1437
RNG random
This is a random generator, often used for setting up the initial conditions etc.....
Definition: DPMBase.h:1432
Mdouble getYMax() const
If the length of the problem domain in y-direction is YMax - YMin, then getYMax() returns XMax.
Definition: DPMBase.h:638
Mdouble getZMax() const
If the length of the problem domain in z-direction is ZMax - ZMin, then getZMax() returns ZMax.
Definition: DPMBase.h:650
Mdouble getZMin() const
If the length of the problem domain in z-direction is ZMax - ZMin, then getZMin() returns ZMin.
Definition: DPMBase.h:644
void hGridRebuild()
This sets up the parameters required for the contact model.
Definition: MercuryBase.cc:204
Mdouble getRandomNumber()
This is a random generating routine can be used for initial positions.
Definition: RNG.cc:143
double radius_s
Definition: Chute/segregation.cpp:166
double radius_l
Definition: Chute/segregation.cpp:167
SphericalParticle inflowParticle_
Definition: TunuguntlaBokhoveThornton2014.cpp:357
Definition: Vector.h:51

◆ createWalls()

void SegregationPeriodic::createWalls ( )
inline
166  {
167  PeriodicBoundary B0;
168  B0.set(Vec3D(1, 0, 0), getXMin(), getXMax());
170  }
BoundaryHandler boundaryHandler
An object of the class BoundaryHandler which concerns insertion and deletion of particles into or fro...
Definition: DPMBase.h:1452
Defines a pair of periodic walls. Inherits from BaseBoundary.
Definition: PeriodicBoundary.h:41
void set(Vec3D normal, Mdouble distanceLeft, Mdouble distanceRight)
Defines a PeriodicBoundary by its normal and positions.
Definition: PeriodicBoundary.cc:84

References PeriodicBoundary::set().

◆ getDensityRatio()

double SegregationPeriodic::getDensityRatio ( )
inline
362 {return densityRatio_;}
double densityRatio_
Definition: DensitySizeSeg_Belt_WarreJan_25_75.cpp:374

Referenced by main().

◆ getInfo() [1/3]

double SegregationPeriodic::getInfo ( const BaseParticle P) const
inlineoverridevirtual

Allows the user to set what is written into the info column in the data file.

Reimplemented from DPMBase.

51  {
52  return P.getIndSpecies();
53  }
double P
Uniform pressure.
Definition: TwenteMeshGluing.cpp:73

References Global_Physical_Variables::P.

◆ getInfo() [2/3]

double SegregationPeriodic::getInfo ( const BaseParticle P) const
inlineoverridevirtual

Allows the user to set what is written into the info column in the data file.

Reimplemented from DPMBase.

52  {
53  return P.getIndSpecies();
54  }

References Global_Physical_Variables::P.

◆ getInfo() [3/3]

double SegregationPeriodic::getInfo ( const BaseParticle P) const
inlineoverridevirtual

Allows the user to set what is written into the info column in the data file.

Reimplemented from DPMBase.

51  {
52  return P.getIndSpecies();
53  }

References Global_Physical_Variables::P.

◆ getSizeRatio()

double SegregationPeriodic::getSizeRatio ( )
inline
361 {return sizeRatio_;}
double sizeRatio_
Definition: DensitySizeSeg_Belt_WarreJan_25_75.cpp:373

Referenced by main().

◆ setChuteProperties()

void SegregationPeriodic::setChuteProperties ( )
inline
219  {
220  // Chute properties
224  setChuteLength(20.0);
225  setChuteWidth(10.0);
226  setZMax(10.0);
227  setMaxFailed(6);
229  }
@ MONOLAYER_DISORDERED
Definition: Chute.h:53
void setChuteWidth(Mdouble chuteWidth)
Sets the chute width (Y-direction)
Definition: Chute.cc:1039
void setRoughBottomType(RoughBottomType roughBottomType)
Sets the type of rough bottom of the chute.
Definition: Chute.cc:714
virtual void setChuteLength(Mdouble chuteLength)
Sets the chute length (X-direction)
Definition: Chute.cc:1059
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:827
void setChuteAngleAndMagnitudeOfGravity(Mdouble chuteAngle, Mdouble gravity)
Sets gravity vector according to chute angle (in degrees)
Definition: Chute.cc:789
void makeChutePeriodic()
This makes the chute periodic in Y.
Definition: Chute.cc:632
void setFixedParticleRadius(Mdouble fixedParticleRadius)
Sets the particle radius of the fixed particles which constitute the (rough) chute bottom.
Definition: Chute.cc:653
void setZMax(Mdouble newZMax)
Sets the value of ZMax, the upper bound of the problem domain in the z-direction.
Definition: DPMBase.cc:1217

References MONOLAYER_DISORDERED.

◆ setDensityRatio()

void SegregationPeriodic::setDensityRatio ( double  densityRatio)
inline
360 {densityRatio_ = densityRatio;}

Referenced by main().

◆ setSizeRatio()

void SegregationPeriodic::setSizeRatio ( double  sizeRatio)
inline
359 {sizeRatio_ = sizeRatio;}

Referenced by main().

◆ setSpeciesProperties()

void SegregationPeriodic::setSpeciesProperties ( )
inline
139  {
140  //Set the contact time (tc), restitution coefficient (r) and density (rho) for small for all particles
141  double tc = 1e-5;
142  double r = 0.88;
143  double rho = 6 / constants::pi;
144 
145  double mass_small = 4 / 3 * constants::pi * pow(radius_s, 3.0) * rho;
146  double mass_large = 4 / 3 * constants::pi * pow(radius_l, 3.0) * rho;
147 
149  auto S1 = speciesHandler.copyAndAddObject(S0);
150  auto S01 = speciesHandler.getMixedObject(S0, S1);
151 
152  S0->setDensity(rho);
153  S0->setCollisionTimeAndRestitutionCoefficient(tc, r, mass_small);
154  S0->setSlidingDissipation(S0->getDissipation()); // Set the tangential dissipation equal to the normal dissipation for small-small collisions
155  setInflowParticleRadius(0.5, 1.0);
156  S0->setSlidingFrictionCoefficient(0.5);
157  S1->setCollisionTimeAndRestitutionCoefficient(tc, r, mass_large);
158 
159  S1->setSlidingDissipation(S1->getDissipation()); // Set the tangential dissipation equal to the normal dissipation for large-large collision
160  S01->setCollisionTimeAndRestitutionCoefficient(tc, r, mass_small, mass_large);
161  S01->setSlidingDissipation(S01->getDissipation()); // Set the tangential dissipation equal to the normal dissipation for mixed collision
162 
163  }
Species< LinearViscoelasticNormalSpecies, FrictionSpecies > LinearViscoelasticFrictionSpecies
Definition: LinearViscoelasticFrictionSpecies.h:34
void setInflowParticleRadius(Mdouble inflowParticleRadius)
Sets the radius of the inflow particles to a single one (i.e. ensures a monodisperse inflow).
Definition: Chute.cc:848
std::enable_if<!std::is_pointer< typename U::MixedSpeciesType >::value, typename U::MixedSpeciesType * >::type getMixedObject(const U *S, const U *T)
Definition: SpeciesHandler.h:74
const Mdouble pi
Definition: ExtendedMath.h:45

References constants::pi.

◆ setupInitialConditions() [1/5]

void SegregationPeriodic::setupInitialConditions ( )
inlineoverridevirtual

This setup the intial conditions, generates small volume fraction of particles. Sets the program to be periodic in x.

Bug:
This code is not non-dimensionalised at the moment, should do this shortly, but at the moment

Reimplemented from DPMBase.

67 {
68 
69  //Check if the run has been done before. If yes, skip and start next run
70  if (FileExists(data_filename.str()))
71  {
72  //If it has move on to teh next run immedently
73  cout << "This run has been done " << endl;
74  launchNewRun("segregation",true);
75  exit(0);
76  }
77 
78 
79  //Set up a 10 by 10 study
80  vector<int> study_num=get2DParametersFromRunNumber(10,1);
81 
82 
83  //If study 0 is complete quit
84  if (study_num[0] > 0)
85  {
86  cout << "Study is complete " << endl;
87  exit(0);
88  }
89  else
90  //If the study is not complete save the data to disk and move on
91  {
93  launchNewRun("segregation");
94  }
95 
96  //Now setup the particles
97 
98  //Setup the base i.e. the chute particles
100 
101 
102 
103 
104 
105  //Set up the walls
106  set_NWallPeriodic(2);
107  WallsPeriodic[1].set(Vec3D( 1.0, 0.0, 0.0), getXMin(), xmax);
108 
109 
110  //Number of small particles
111  int Ns=5000;
112  //Small partilce radius
113  radius_s=0.3e-3;
114  //Radius of large particles, changes from study to study.
115  radius_l=radius_s*(1.0+study_num[1]/10.0);
116  //Number of large partices, fixed to the keep the volume fraction of large and small paritlces equal.
117  int Nl=pow(radius_s/radius_l,3)*Ns;
118 
119 
120 
121 
122  while ((Ns>0) && (Nl>0))
123  {
124 
125 
126  //random to see if want to generate a large or small particles, helps makes the initial conditions homogenious
127  if (random(1.0,Nl+Ns) > Nl)
128  {
129  //Generate a small particle: set radius to small radius subtract one off the list of small particles to be generated
130  P0.Radius=radius_s;
131  Ns--;
132  }
133  else
134  {
135  //Generate a large particle: set radius to large radius subtract one of the list of large particles to be generated
136  P0.Radius=radius_l;
137  Nl--;
138  }
139 
140 
141  //P0.Radius = 0.3e-3*(1.0+(sqrt(2)-1.0)*temp);
142  P0.Angle.set_zero();
143  P0.AngularVelocity.set_zero();
144  P0.computeMass(Species);
145 
146  //randomize particle position, zero intial velocity
147  P0.Position.X = random(getXMin(),getXMax());
148  P0.Position.Y = random(getYMin(),getYMax());
149  P0.Position.Z = random(getZMin(),getZMax());
150  P0.Velocity = Vec3D(0.0,0.0,0.0);
151 
152 
153  //Add the new particle to the list of current particles
154  Particles.push_back (P0);
155 
156 
157  }
158 
159  //Write the info to the screen and save a copy to the disk
160  write(std::cout,false);
162 
163 }
void setupInitialConditions() override
Creates bottom, side walls and a particle insertion boundary.
Definition: Chute.cc:242
std::vector< int > get2DParametersFromRunNumber(int size_x, int size_y) const
This turns a counter into 2 indices which is a very useful feature for performing a 2D study....
Definition: DPMBase.cc:698
virtual void writeRestartFile()
Stores all the particle data for current save time step to a "restart" file, which is a file simply i...
Definition: DPMBase.cc:2942
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.
Definition: DPMBase.cc:775
void write(std::ostream &os, bool print_all=false)
This is the info call.
Definition: Chute/segregation.cpp:47
Contains material and contact force properties.
Definition: Species.h:35

References Chute::setupInitialConditions().

Referenced by main().

◆ setupInitialConditions() [2/5]

void SegregationPeriodic::setupInitialConditions ( )
inlineoverridevirtual

This setup the intial conditions, generates volume fraction of particle 1. Sets the program to be periodic in x.

Bug:
This code is not non-dimensionalised at the moment, should do this shortly, but at the moment. Should swap this to Silbert particles shortly

Reimplemented from DPMBase.

81 {
82  setTime(4500.0);
83  logger(DEBUG,"Entering the Initial Conditions");
84  //Check if the run has been done before. If yes, skip and start next run
86  {
87  //If it has move on to teh next run immedently
88  logger(INFO, "This run has been done ");
89  //launch_new("density-size-segregation",true);
90  exit(0);
91  }
92 
93  //Set up a 12 by 12 study
94 
95  vector<int> study_num=get2DParametersFromRunNumber(12,12);
96 
97 
98  //If study 0 is complete quit
99  if (study_num[0] > 0)
100  {
101  logger(VERBOSE, "Study is complete ");
102  exit(0);
103  }
104  else
105 
106  //If the study is not complete save the data to disk and move on
107  {
108 
110  launchNewRun("segregation");
111  }
112 
113 
114 
115 
116  // PARTICLE PROPERTIES//
118 
119 
120  double shat = (0.2 + 0.1*study_num[1]); // d2/d1
121  double rhat = (0.2 + 0.1*study_num[2]); // rho2/rho1
122 
123 
124  //
125  // All the parameters are non-dimensional
126  // mean particle dia = 1 , mean particle mass = 1 and gravity g=1
127  // implying the mean particle density = 6/pi
128 
129  // Box dimensions, Volume of the box = L*W*H
130  double Vbox = 20.0*10.0*10.0;
131 
132  // volume fraction of species type-1
133  double phi = 0.5;
134 
135  // total volume occupied by the particles
136  //double Vp = Vbox*(constants::pi/6.);
137 
138  // particle diameters
139  double dm = 1.0; // mean particle
140  double d1 = 1./(phi + (1-phi)*shat); // species type-1
141  double d2 = d1*shat; // species type-2
142  double tolo = 1.e-12;
143  if (abs(d1 - d2) <= tolo)
144  {
145  d2 = d1 - 0.0001;
146  }
147 
148  // particle species radii
149  radius_0 = 0.5*dm; // mean particle
150  radius_1 = 0.5*d1;
151  radius_2 = 0.5*d2;
152 
153  // particle densities
154  rho_0 = 6./constants::pi;
155  rho_1 = (6./constants::pi)/(phi + (1-phi)*rhat);
156  rho_2 = rhat*rho_1;
157 
158  // no of particles
159  int N1 = (phi*Vbox)/pow(d1,3);
160  int N2 = ((1-phi)*Vbox)/pow(d2,3);
161 
162  //
163  double tc = 5.e-3;//0.005*pow(d,0.5);//1.e-2;//2.e-1;//1e-2;//5e-2;//5e-3;
164  double r = 0.88249690258;
165 
166  //
167  double mass_0 = 1.0;// mean particle mass
168  double mass_1 = 4./3.*constants::pi*pow(radius_1,3.0)*rho_1;
169  double mass_2 = 4./3.*constants::pi*pow(radius_2,3.0)*rho_2;
170  //
171 
172  double mass_00 = (mass_0*mass_0)/(mass_0 + mass_0);
173  double mass_10 = (mass_1*mass_0)/(mass_1 + mass_0);
174  double mass_20 = (mass_2*mass_0)/(mass_2 + mass_0);
175  double mass_11 = (mass_1*mass_1)/(mass_1 + mass_1);
176  double mass_22 = (mass_2*mass_2)/(mass_2 + mass_2);
177  double mass_12 = (mass_1*mass_2)/(mass_1 + mass_2);
178  //
179 
180  double gamma_n00 = -2.0*mass_00*log(r)/tc;
181  double gamma_n11 = -2.0*mass_11*log(r)/tc;
182  double gamma_n22 = -2.0*mass_22*log(r)/tc;
183  double gamma_n12 = -2.0*mass_12*log(r)/tc;
184  double gamma_n10 = -2.0*mass_10*log(r)/tc;
185  double gamma_n20 = -2.0*mass_20*log(r)/tc;
186  //
187  double const1 = pow(tc/constants::pi,2.0);
188  double k_n00 = mass_00*(1./const1 + pow(gamma_n00/(2*mass_00),2.0));
189  double k_n11 = mass_11*(1./const1 + pow(gamma_n11/(2*mass_11),2.0));
190  double k_n22 = mass_22*(1./const1 + pow(gamma_n22/(2*mass_22),2.0));
191  double k_n12 = mass_12*(1./const1 + pow(gamma_n12/(2*mass_12),2.0));
192  double k_n10 = mass_10*(1./const1 + pow(gamma_n10/(2*mass_10),2.0));
193  double k_n20 = mass_20*(1./const1 + pow(gamma_n20/(2*mass_20),2.0));
194  //
195 
197  auto S1 = speciesHandler.copyAndAddObject(S0);
198  auto S2 = speciesHandler.copyAndAddObject(S1);
199  auto S01 = speciesHandler.getMixedObject(S0, S1);
200  auto S02 = speciesHandler.getMixedObject(S0, S2);
201  auto S12 = speciesHandler.getMixedObject(S1, S2);
202  S0->setDensity(rho_0);
203  //MD::setCollisionTimeAndRestitutionCoefficient(tc, r, mass_1);
204  S0->setStiffness(k_n00);
205  S0->setSlidingStiffness((2.0/7.0)*k_n00);
206  S0->setDissipation(gamma_n00);
207  S0->setSlidingDissipation(S0->getDissipation());// Set the tangential dissipation equal to the normal disipation for 1-1 collsions
209  //set_HGRID_cell_to_cell_ratio(1.00001*max(radius_1,radius_2)/min(radius_1,radius_2));
210  //set_HGRID_num_buckets_to_power(particleHandler.getNumberOfObjects());
211  S0->setSlidingFrictionCoefficient(0.5);
212  //
213  S1->setDensity(rho_1);
214  S1->setStiffness(k_n11);
215  double k_t=2.0/7.0*k_n11;
216  //setCollisionTimeAndRestitutionCoefficient(tc,r, mass_2);
217  S1->setSlidingStiffness(k_t);
218  S1->setDissipation(gamma_n11);
219  S1->setSlidingFrictionCoefficient(0.5);
220  S1->setSlidingDissipation(S1->getDissipation());// Set the tangential dissipation equal to the normal disipation for 2-2 c
221  //
222  S2->setDensity(rho_2);
223  S2->setStiffness(k_n22);
224  k_t=2.0/7.0*k_n22;
225  //setCollisionTimeAndRestitutionCoefficient(tc,r, mass_2);
226  S2->setSlidingStiffness(k_t);
227  S2->setDissipation(gamma_n22);
228  S2->setSlidingFrictionCoefficient(0.5);
229  S2->setSlidingDissipation(S2->getDissipation());// Set the tangential dissipation equal to the normal disipation for 2-2 collision
230  //
231  S01->setStiffness(k_n10);
232  k_t=2.0/7.0*k_n10;
233  S01->setSlidingStiffness(k_t);
234  S01->setDissipation(gamma_n10);
235  S01->setSlidingDissipation(S01->getDissipation());
236  S01->setSlidingFrictionCoefficient(0.5);
237  //
238  S12->setStiffness(k_n12);
239  k_t=2.0/7.0*k_n12;
240  S12->setSlidingStiffness(k_t);
241  S12->setDissipation(gamma_n12);
242  S12->setSlidingDissipation(S12->getDissipation());
243  S12->setSlidingFrictionCoefficient(0.5);
244 //
245  S02->setStiffness(k_n20);
246  k_t=2.0/7.0*k_n20;
247  S02->setSlidingStiffness(k_t);
248  S02->setDissipation(gamma_n20);
249  S02->setSlidingDissipation(S02->getDissipation());
250  S02->setSlidingFrictionCoefficient(0.5);
251 
252  /*
253  setDensity(rho_1);
254  //MD::setCollisionTimeAndRestitutionCoefficient(tc, r, mass_1);
255  setStiffness(k_n11);//1978//2e5
256  setSlidingStiffness((2.0/7.0)*k_n11);
257  setDissipation(gamma_n11);//2.55//25
258  setSlidingDissipation(get_dissipation());// Set the tangential dissipation equal to the normal disipation for 1-1 collsions
259  setInflowParticleRadius(0.5,1.0);
260  setSlidingFrictionCoefficient(0.5);
261  //
262  S1->setDensity(rho_2);
263  S1->setStiffness(k_n22);
264  double k_t=2.0/7.0*k_n22;
265  //setCollisionTimeAndRestitutionCoefficient(tc,r, mass_2);
266  S1->setSlidingStiffness(k_t);
267  S1->setDissipation(gamma_n22);
268  S1->setSlidingFrictionCoefficient(0.5);
269  S1->setSlidingDissipation(S1->get_dissipation());// Set the tangential dissipation equal to the normal disipation for 2-2 collision
270  //
271  S01->setStiffness(k_n12);
272  k_t=2.0/7.0*k_n12;
273  S01->setSlidingStiffness(k_t);
274  S01->set_dissipation(gamma_n12);
275  S01->setSlidingDissipation(speciesHandler.getMixedObject(1,0)->get_dissipation());
276  S01->setSlidingFrictionCoefficient(0.5);
277  //S01->setCollisionTimeAndRestitutionCoefficient(tc,r, mass_1,mass_2);
278  //S01->setSlidingDissipation(speciesHandler.getMixedObject(1,0)->getDissipation());// Set the tangential dissipation equal to the normal disipation for mixed collision
279  */
280  //Setup the base i.e. the chute particles - This has to be done after the particle properties are set, but the inflow partilces are created.
281  //Chute::setupInitialConditions();
282 
283 // Walls.resize(Walls.size()+1);
284 // Walls.back().addObject(Vec3D(0.0,0.0,-1.0),-(getZMin()-0.5));
285  InfiniteWall w0;
286  w0.set(Vec3D(0.0,0.0,-1.0), Vec3D(0,0,getZMin()-0.5));
288 
289 
290  PeriodicBoundary b0;
291  b0.set(Vec3D(1.0,0.0,0.0), getXMin(), getXMax());
293 
294 // set_NWallPeriodic(2);
295 // WallsPeriodic[1].set(Vec3D( 1.0, 0.0, 0.0), getXMin(), getXMax());
296 
297  // CREATE THE PARTICLES
298  while ((N1>0) && (N2>0))
299  {
300 
301 
302  //random to see if want to generate a large or small particles, helps makes the initial conditions homogenious
303  if (random.getRandomNumber(1.0,N1+N2) > N2)
304  {
305  //Generate a small particle: set radius to small radius subtract one off the list of small particles to be generated
308  N1--;
309  }
310  else
311  {
312  //Generate a large particle: set radius to large radius subtract one of the list of large particles to be generated
315  N2--;
316  }
317 
318 
319  //P0.get_Angle().set_zero();
320  //P0.setAngularVelocity(Vec3D(0.0,0.0,0.0));
321  //inflowParticle_.computeMass();
322 
323  //randomize particle position, zero intial velocity
327 
328  inflowParticle_.setVelocity(Vec3D(0.0, 0.0, 0.0));
329 
330 
331  //Add the new particle to the list of current particles
332  //d Particles.push_back (P0);
334 
335  logger(VERBOSE, "Create a particle ");
336 
337 
338  }
339 
340  //Write the info to the screen and save a copy to the disk
341 
342  logger(VERBOSE, "Finished creating particles");
343 
344 
345  write(std::cout, false);
347 
348  }
Logger< MERCURYDPM_LOGLEVEL > logger("MercuryKernel")
Definition of different loggers with certain modules. A user can define its own custom logger here.
@ INFO
@ DEBUG
@ VERBOSE
File dataFile
An instance of class File to handle in- and output into a .data file.
Definition: DPMBase.h:1478
WallHandler wallHandler
An object of the class WallHandler. Contains pointers to all the walls created.
Definition: DPMBase.h:1447
void setTime(Mdouble time)
Sets a new value for the current simulation time.
Definition: DPMBase.cc:836
const std::string & getName() const
Allows to access the file name, e.g., "problem.data".
Definition: File.cc:165
A infinite wall fills the half-space {point: (position_-point)*normal_<=0}.
Definition: InfiniteWall.h:48
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:118
double radius_1
Definition: TunuguntlaBokhoveThornton2014.cpp:355
double rho_2
Definition: TunuguntlaBokhoveThornton2014.cpp:353
double rho_1
Definition: TunuguntlaBokhoveThornton2014.cpp:352
double radius_0
Definition: TunuguntlaBokhoveThornton2014.cpp:354
double rho_0
Definition: TunuguntlaBokhoveThornton2014.cpp:351
double radius_2
Definition: TunuguntlaBokhoveThornton2014.cpp:356
bool fileExists(std::string strFilename)
Function to check if a file exists, is used to check if a run has already need done.
Definition: FileIOHelpers.cc:107
Mdouble log(Mdouble Power)
Definition: ExtendedMath.cc:104

References DEBUG, helpers::fileExists(), INFO, mathsFunc::log(), logger, constants::pi, PeriodicBoundary::set(), InfiniteWall::set(), and VERBOSE.

◆ setupInitialConditions() [3/5]

void SegregationPeriodic::setupInitialConditions ( )
inlineoverridevirtual

This setup the intial conditions, generates volume fraction of particle 1. Sets the program to be periodic in x.

Bug:
This code is not non-dimensionalised at the moment, should do this shortly, but at the moment. Should swap this to Silbert particles shortly

Reimplemented from DPMBase.

82 {
83 /*
84  //Check if the run has been done before. If yes, skip and start next run
85  if (helpers::fileExists(dataFile.getName()))
86  {
87  //If it has move on to teh next run immedently
88  cout << "This run has been done " << endl;
89  //launch_new("density-size-segregation",true);
90  exit(0);
91  }
92 
93  //Set up a 12 by 12 study
94 
95  vector<int> study_num=get2DParametersFromRunNumber(12,12);
96 
97 
98  //If study 0 is complete quit
99  if (study_num[0] > 0)
100  {
101  cout << "Study is complete " << endl;
102  exit(0);
103  }
104  else
105 
106  //If the study is not complete save the data to disk and move on
107  {
108 
109  writeRestartFile();
110  launchNewRun("segregation");
111  }
112  */
113 
114 
115 
116  // PARTICLE PROPERTIES//
118 
119 
120  double shat = getSizeRatio(); // d2/d1
121  double rhat = getDensityRatio(); // rho2/rho1
122 
123 
124  //
125  // All the parameters are non-dimensional
126  // mean particle dia = 1 , mean particle mass = 1 and gravity g=1
127  // implying the mean particle density = 6/pi
128 
129  // Box dimensions, Volume of the box = L*W*H
130  double Vbox = 20.0*10.0*10.0;
131 
132  // volume fraction of species type-1
133  double phi = 0.75;
134 
135  // total volume occupied by the particles
136  //double Vp = Vbox*(constants::pi/6.);
137 
138  // particle diameters
139  double dm = 1.0; // mean particle
140  double d1 = 1./(phi + (1-phi)*shat); // species type-1
141  double d2 = d1*shat; // species type-2
142  double tolo = 1.e-12;
143  if (abs(d1 - d2) <= tolo)
144  {
145  d2 = d1 - 0.0001;
146  }
147 
148  // particle species radii
149  radius_0 = 0.5*dm; // mean particle
150  radius_1 = 0.5*d1;
151  radius_2 = 0.5*d2;
152 
153  // particle densities
154  rho_0 = 6./constants::pi;
155  rho_1 = (6./constants::pi)/(phi + (1-phi)*rhat);
156  rho_2 = rhat*rho_1;
157 
158  // no of particles
159  int N1 = (phi*Vbox)/pow(d1,3);
160  int N2 = ((1-phi)*Vbox)/pow(d2,3);
161 
162  //
163  double tc = 5.e-3;//0.005*pow(d,0.5);//1.e-2;//2.e-1;//1e-2;//5e-2;//5e-3;
164  double r = 0.88249690258;
165 
166  //
167  double mass_0 = 1.0;// mean particle mass
168  double mass_1 = 4./3.*constants::pi*pow(radius_1,3.0)*rho_1;
169  double mass_2 = 4./3.*constants::pi*pow(radius_2,3.0)*rho_2;
170  //
171 
172  double mass_00 = (mass_0*mass_0)/(mass_0 + mass_0);
173  double mass_10 = (mass_1*mass_0)/(mass_1 + mass_0);
174  double mass_20 = (mass_2*mass_0)/(mass_2 + mass_0);
175  double mass_11 = (mass_1*mass_1)/(mass_1 + mass_1);
176  double mass_22 = (mass_2*mass_2)/(mass_2 + mass_2);
177  double mass_12 = (mass_1*mass_2)/(mass_1 + mass_2);
178  //
179 
180  double gamma_n00 = -2.0*mass_00*log(r)/tc;
181  double gamma_n11 = -2.0*mass_11*log(r)/tc;
182  double gamma_n22 = -2.0*mass_22*log(r)/tc;
183  double gamma_n12 = -2.0*mass_12*log(r)/tc;
184  double gamma_n10 = -2.0*mass_10*log(r)/tc;
185  double gamma_n20 = -2.0*mass_20*log(r)/tc;
186  //
187  double const1 = pow(tc/constants::pi,2.0);
188  double k_n00 = mass_00*(1./const1 + pow(gamma_n00/(2*mass_00),2.0));
189  double k_n11 = mass_11*(1./const1 + pow(gamma_n11/(2*mass_11),2.0));
190  double k_n22 = mass_22*(1./const1 + pow(gamma_n22/(2*mass_22),2.0));
191  double k_n12 = mass_12*(1./const1 + pow(gamma_n12/(2*mass_12),2.0));
192  double k_n10 = mass_10*(1./const1 + pow(gamma_n10/(2*mass_10),2.0));
193  double k_n20 = mass_20*(1./const1 + pow(gamma_n20/(2*mass_20),2.0));
194  //
195 
197  auto S1 = speciesHandler.copyAndAddObject(S0);
198  auto S2 = speciesHandler.copyAndAddObject(S1);
199  auto S01 = speciesHandler.getMixedObject(S0, S1);
200  auto S02 = speciesHandler.getMixedObject(S0, S2);
201  auto S12 = speciesHandler.getMixedObject(S1, S2);
202  S0->setDensity(rho_0);
203  //MD::setCollisionTimeAndRestitutionCoefficient(tc, r, mass_1);
204  S0->setStiffness(k_n00);
205  S0->setSlidingStiffness((2.0/7.0)*k_n00);
206  S0->setDissipation(gamma_n00);
207  S0->setSlidingDissipation(S0->getDissipation());// Set the tangential dissipation equal to the normal disipation for 1-1 collsions
209  //set_HGRID_cell_to_cell_ratio(1.00001*max(radius_1,radius_2)/min(radius_1,radius_2));
210  //set_HGRID_num_buckets_to_power(particleHandler.getNumberOfObjects());
211  S0->setSlidingFrictionCoefficient(0.5);
212  //
213  S1->setDensity(rho_1);
214  S1->setStiffness(k_n11);
215  double k_t=2.0/7.0*k_n11;
216  //setCollisionTimeAndRestitutionCoefficient(tc,r, mass_2);
217  S1->setSlidingStiffness(k_t);
218  S1->setDissipation(gamma_n11);
219  S1->setSlidingFrictionCoefficient(0.5);
220  S1->setSlidingDissipation(S1->getDissipation());// Set the tangential dissipation equal to the normal disipation for 2-2 c
221  //
222  S2->setDensity(rho_2);
223  S2->setStiffness(k_n22);
224  k_t=2.0/7.0*k_n22;
225  //setCollisionTimeAndRestitutionCoefficient(tc,r, mass_2);
226  S2->setSlidingStiffness(k_t);
227  S2->setDissipation(gamma_n22);
228  S2->setSlidingFrictionCoefficient(0.5);
229  S2->setSlidingDissipation(S2->getDissipation());// Set the tangential dissipation equal to the normal disipation for 2-2 collision
230  //
231  S01->setStiffness(k_n10);
232  k_t=2.0/7.0*k_n10;
233  S01->setSlidingStiffness(k_t);
234  S01->setDissipation(gamma_n10);
235  S01->setSlidingDissipation(S01->getDissipation());
236  S01->setSlidingFrictionCoefficient(0.5);
237  //
238  S12->setStiffness(k_n12);
239  k_t=2.0/7.0*k_n12;
240  S12->setSlidingStiffness(k_t);
241  S12->setDissipation(gamma_n12);
242  S12->setSlidingDissipation(S12->getDissipation());
243  S12->setSlidingFrictionCoefficient(0.5);
244 //
245  S02->setStiffness(k_n20);
246  k_t=2.0/7.0*k_n20;
247  S02->setSlidingStiffness(k_t);
248  S02->setDissipation(gamma_n20);
249  S02->setSlidingDissipation(S02->getDissipation());
250  S02->setSlidingFrictionCoefficient(0.5);
251 
252  /*
253  setDensity(rho_1);
254  //MD::setCollisionTimeAndRestitutionCoefficient(tc, r, mass_1);
255  setStiffness(k_n11);//1978//2e5
256  setSlidingStiffness((2.0/7.0)*k_n11);
257  setDissipation(gamma_n11);//2.55//25
258  setSlidingDissipation(get_dissipation());// Set the tangential dissipation equal to the normal disipation for 1-1 collsions
259  setInflowParticleRadius(0.5,1.0);
260  setSlidingFrictionCoefficient(0.5);
261  //
262  S1->setDensity(rho_2);
263  S1->setStiffness(k_n22);
264  double k_t=2.0/7.0*k_n22;
265  //setCollisionTimeAndRestitutionCoefficient(tc,r, mass_2);
266  S1->setSlidingStiffness(k_t);
267  S1->setDissipation(gamma_n22);
268  S1->setSlidingFrictionCoefficient(0.5);
269  S1->setSlidingDissipation(S1->get_dissipation());// Set the tangential dissipation equal to the normal disipation for 2-2 collision
270  //
271  S01->setStiffness(k_n12);
272  k_t=2.0/7.0*k_n12;
273  S01->setSlidingStiffness(k_t);
274  S01->set_dissipation(gamma_n12);
275  S01->setSlidingDissipation(speciesHandler.getMixedObject(1,0)->get_dissipation());
276  S01->setSlidingFrictionCoefficient(0.5);
277  //S01->setCollisionTimeAndRestitutionCoefficient(tc,r, mass_1,mass_2);
278  //S01->setSlidingDissipation(speciesHandler.getMixedObject(1,0)->getDissipation());// Set the tangential dissipation equal to the normal disipation for mixed collision
279  */
280  //Setup the base i.e. the chute particles - This has to be done after the particle properties are set, but the inflow partilces are created.
281 
282 
285  setParticlesWriteVTK(true);
286 
287 // Walls.resize(Walls.size()+1);
288 // Walls.back().addObject(Vec3D(0.0,0.0,-1.0),-(getZMin()-0.5));
289  InfiniteWall w0;
290  w0.set(Vec3D(0.0,0.0,-1.0), Vec3D(0,0,getZMin()-0.5));
292 
293 
294  PeriodicBoundary b0;
295  b0.set(Vec3D(1.0,0.0,0.0), getXMin(), getXMax());
297 
298 // set_NWallPeriodic(2);
299 // WallsPeriodic[1].set(Vec3D( 1.0, 0.0, 0.0), getXMin(), getXMax());
300 
301  // CREATE THE PARTICLES
302  int failCount = 0;
303  while ((N1>0) && (N2>0))
304  {
305  //random to see if want to generate a large or small particles, helps makes the initial conditions homogenious
306  if (random.getRandomNumber(1.0,N1+N2) > N2)
307  {
308  //Generate a small particle: set radius to small radius subtract one off the list of small particles to be generated
311  N1--;
312  }
313  else
314  {
315  //Generate a large particle: set radius to large radius subtract one of the list of large particles to be generated
318  N2--;
319  }
320 
321  // Initialise the velocity at zero
322  inflowParticle_.setVelocity(Vec3D(0.0,0.0,0.0));
323 
324  // insert particles only if they are not in contact, break out of the loop at failCount fails
325  do
326  {
327  //randomize particle position, zero intial velocity
331 
332  if (failCount > 1e3) // At 1e3 failed new positions we break out of the do-while loop
333  {
334  break;
335  }
336  failCount++;
337 
339  if (failCount > 1e3) // At 1e3 failed new positions we break out of the while loop
340  {
341  break;
342  }
343 
345  failCount = 0; // Reset the failCount to 0
346 
347  logger(DEBUG,"Created a single particle");
348  }
349  logger(INFO,"Finished creating particles");
350 
351 
352  //Write the info to the screen and save a copy to the disk
353  write(std::cout, false);
354 
356 
357  }
virtual void clear()
Empties the whole BaseHandler by removing all Objects and setting all other variables to 0.
Definition: BaseHandler.h:528
void setParticlesWriteVTK(bool writeParticlesVTK)
Sets whether particles are written in a VTK file.
Definition: DPMBase.cc:942
bool checkParticleForInteraction(const BaseParticle &P) final
Checks if given BaseParticle has an interaction with a BaseWall or other BaseParticle.
Definition: MercuryBase.cc:594
double getDensityRatio()
Definition: DensitySizeSeg_Belt_WarreJan_25_75.cpp:362
double getSizeRatio()
Definition: DensitySizeSeg_Belt_WarreJan_25_75.cpp:361

References DEBUG, INFO, mathsFunc::log(), logger, constants::pi, PeriodicBoundary::set(), InfiniteWall::set(), and Chute::setupInitialConditions().

◆ setupInitialConditions() [4/5]

void SegregationPeriodic::setupInitialConditions ( )
inlineoverridevirtual

This setup the intial conditions, generates volume fraction of particle 1. Sets the program to be periodic in x.

Bug:
This code is not non-dimensionalised at the moment, should do this shortly, but at the moment. Should swap this to Silbert particles shortly

Reimplemented from DPMBase.

81 {
82 
83  //Check if the run has been done before. If yes, skip and start next run
85  {
86  //If it has move on to teh next run immedently
87  logger(INFO, "This run has been done ");
88  //launch_new("density-size-segregation",true);
89  exit(0);
90  }
91 
92  //Set up a 12 by 12 study
93 
94  vector<int> study_num=get2DParametersFromRunNumber(12,12);
95 
96 
97  //If study 0 is complete quit
98  if (study_num[0] > 0)
99  {
100  logger(INFO, "Study is complete ");
101  exit(0);
102  }
103  else
104 
105  //If the study is not complete save the data to disk and move on
106  {
107 
109  launchNewRun("segregation");
110  }
111 
112 
113 
114 
115  // PARTICLE PROPERTIES//
117 
118 
119  double shat = (0.2 + 0.1*study_num[1]); // d2/d1
120  double rhat = (0.2 + 0.1*study_num[2]); // rho2/rho1
121 
122 
123  //
124  // All the parameters are non-dimensional
125  // mean particle dia = 1 , mean particle mass = 1 and gravity g=1
126  // implying the mean particle density = 6/pi
127 
128  // Box dimensions, Volume of the box = L*W*H
129  double Vbox = 20.0*10.0*10.0;
130 
131  // volume fraction of species type-1
132  double phi = 0.5;
133 
134  // total volume occupied by the particles
135  //double Vp = Vbox*(constants::pi/6.);
136 
137  // particle diameters
138  double dm = 1.0; // mean particle
139  double d1 = 1./(phi + (1-phi)*shat); // species type-1
140  double d2 = d1*shat; // species type-2
141  double tolo = 1.e-12;
142  if (abs(d1 - d2) <= tolo)
143  {
144  d2 = d1 - 0.0001;
145  }
146 
147  // particle species radii
148  radius_0 = 0.5*dm; // mean particle
149  radius_1 = 0.5*d1;
150  radius_2 = 0.5*d2;
151 
152  // particle densities
153  rho_0 = 6./constants::pi;
154  rho_1 = (6./constants::pi)/(phi + (1-phi)*rhat);
155  rho_2 = rhat*rho_1;
156 
157  // no of particles
158  int N1 = (phi*Vbox)/pow(d1,3);
159  int N2 = ((1-phi)*Vbox)/pow(d2,3);
160 
161  //
162  double tc = 5.e-3;//0.005*pow(d,0.5);//1.e-2;//2.e-1;//1e-2;//5e-2;//5e-3;
163  double r = 0.88249690258;
164 
165  //
166  double mass_0 = 1.0;// mean particle mass
167  double mass_1 = 4./3.*constants::pi*pow(radius_1,3.0)*rho_1;
168  double mass_2 = 4./3.*constants::pi*pow(radius_2,3.0)*rho_2;
169  //
170 
171  double mass_00 = (mass_0*mass_0)/(mass_0 + mass_0);
172  double mass_10 = (mass_1*mass_0)/(mass_1 + mass_0);
173  double mass_20 = (mass_2*mass_0)/(mass_2 + mass_0);
174  double mass_11 = (mass_1*mass_1)/(mass_1 + mass_1);
175  double mass_22 = (mass_2*mass_2)/(mass_2 + mass_2);
176  double mass_12 = (mass_1*mass_2)/(mass_1 + mass_2);
177  //
178 
179  double gamma_n00 = -2.0*mass_00*log(r)/tc;
180  double gamma_n11 = -2.0*mass_11*log(r)/tc;
181  double gamma_n22 = -2.0*mass_22*log(r)/tc;
182  double gamma_n12 = -2.0*mass_12*log(r)/tc;
183  double gamma_n10 = -2.0*mass_10*log(r)/tc;
184  double gamma_n20 = -2.0*mass_20*log(r)/tc;
185  //
186  double const1 = pow(tc/constants::pi,2.0);
187  double k_n00 = mass_00*(1./const1 + pow(gamma_n00/(2*mass_00),2.0));
188  double k_n11 = mass_11*(1./const1 + pow(gamma_n11/(2*mass_11),2.0));
189  double k_n22 = mass_22*(1./const1 + pow(gamma_n22/(2*mass_22),2.0));
190  double k_n12 = mass_12*(1./const1 + pow(gamma_n12/(2*mass_12),2.0));
191  double k_n10 = mass_10*(1./const1 + pow(gamma_n10/(2*mass_10),2.0));
192  double k_n20 = mass_20*(1./const1 + pow(gamma_n20/(2*mass_20),2.0));
193  //
194 
196  auto S1 = speciesHandler.copyAndAddObject(S0);
197  auto S2 = speciesHandler.copyAndAddObject(S1);
198  auto S01 = speciesHandler.getMixedObject(S0, S1);
199  auto S02 = speciesHandler.getMixedObject(S0, S2);
200  auto S12 = speciesHandler.getMixedObject(S1, S2);
201  S0->setDensity(rho_0);
202  //MD::setCollisionTimeAndRestitutionCoefficient(tc, r, mass_1);
203  S0->setStiffness(k_n00);
204  S0->setSlidingStiffness((2.0/7.0)*k_n00);
205  S0->setDissipation(gamma_n00);
206  S0->setSlidingDissipation(S0->getDissipation());// Set the tangential dissipation equal to the normal disipation for 1-1 collsions
208  //set_HGRID_cell_to_cell_ratio(1.00001*max(radius_1,radius_2)/min(radius_1,radius_2));
209  //set_HGRID_num_buckets_to_power(particleHandler.getNumberOfObjects());
210  S0->setSlidingFrictionCoefficient(0.5);
211  //
212  S1->setDensity(rho_1);
213  S1->setStiffness(k_n11);
214  double k_t=2.0/7.0*k_n11;
215  //setCollisionTimeAndRestitutionCoefficient(tc,r, mass_2);
216  S1->setSlidingStiffness(k_t);
217  S1->setDissipation(gamma_n11);
218  S1->setSlidingFrictionCoefficient(0.5);
219  S1->setSlidingDissipation(S1->getDissipation());// Set the tangential dissipation equal to the normal disipation for 2-2 c
220  //
221  S2->setDensity(rho_2);
222  S2->setStiffness(k_n22);
223  k_t=2.0/7.0*k_n22;
224  //setCollisionTimeAndRestitutionCoefficient(tc,r, mass_2);
225  S2->setSlidingStiffness(k_t);
226  S2->setDissipation(gamma_n22);
227  S2->setSlidingFrictionCoefficient(0.5);
228  S2->setSlidingDissipation(S2->getDissipation());// Set the tangential dissipation equal to the normal disipation for 2-2 collision
229  //
230  S01->setStiffness(k_n10);
231  k_t=2.0/7.0*k_n10;
232  S01->setSlidingStiffness(k_t);
233  S01->setDissipation(gamma_n10);
234  S01->setSlidingDissipation(S01->getDissipation());
235  S01->setSlidingFrictionCoefficient(0.5);
236  //
237  S12->setStiffness(k_n12);
238  k_t=2.0/7.0*k_n12;
239  S12->setSlidingStiffness(k_t);
240  S12->setDissipation(gamma_n12);
241  S12->setSlidingDissipation(S12->getDissipation());
242  S12->setSlidingFrictionCoefficient(0.5);
243 //
244  S02->setStiffness(k_n20);
245  k_t=2.0/7.0*k_n20;
246  S02->setSlidingStiffness(k_t);
247  S02->setDissipation(gamma_n20);
248  S02->setSlidingDissipation(S02->getDissipation());
249  S02->setSlidingFrictionCoefficient(0.5);
250 
251  /*
252  setDensity(rho_1);
253  //MD::setCollisionTimeAndRestitutionCoefficient(tc, r, mass_1);
254  setStiffness(k_n11);//1978//2e5
255  setSlidingStiffness((2.0/7.0)*k_n11);
256  setDissipation(gamma_n11);//2.55//25
257  setSlidingDissipation(get_dissipation());// Set the tangential dissipation equal to the normal disipation for 1-1 collsions
258  setInflowParticleRadius(0.5,1.0);
259  setSlidingFrictionCoefficient(0.5);
260  //
261  S1->setDensity(rho_2);
262  S1->setStiffness(k_n22);
263  double k_t=2.0/7.0*k_n22;
264  //setCollisionTimeAndRestitutionCoefficient(tc,r, mass_2);
265  S1->setSlidingStiffness(k_t);
266  S1->setDissipation(gamma_n22);
267  S1->setSlidingFrictionCoefficient(0.5);
268  S1->setSlidingDissipation(S1->get_dissipation());// Set the tangential dissipation equal to the normal disipation for 2-2 collision
269  //
270  S01->setStiffness(k_n12);
271  k_t=2.0/7.0*k_n12;
272  S01->setSlidingStiffness(k_t);
273  S01->set_dissipation(gamma_n12);
274  S01->setSlidingDissipation(speciesHandler.getMixedObject(1,0)->get_dissipation());
275  S01->setSlidingFrictionCoefficient(0.5);
276  //S01->setCollisionTimeAndRestitutionCoefficient(tc,r, mass_1,mass_2);
277  //S01->setSlidingDissipation(speciesHandler.getMixedObject(1,0)->getDissipation());// Set the tangential dissipation equal to the normal disipation for mixed collision
278  */
279  //Setup the base i.e. the chute particles - This has to be done after the particle properties are set, but the inflow partilces are created.
281 
282 // Walls.resize(Walls.size()+1);
283 // Walls.back().addObject(Vec3D(0.0,0.0,-1.0),-(getZMin()-0.5));
284  InfiniteWall w0;
285  w0.set(Vec3D(0.0,0.0,-1.0), Vec3D(0,0,getZMin()-0.5));
287 
288 
289  PeriodicBoundary b0;
290  b0.set(Vec3D(1.0, 0.0, 0.0), getXMin(), getXMax());
292 
293 // set_NWallPeriodic(2);
294 // WallsPeriodic[1].set(Vec3D( 1.0, 0.0, 0.0), getXMin(), getXMax());
295 
296  // CREATE THE PARTICLES
297  while ((N1 > 0) && (N2 > 0))
298  {
299 
300 
301  //random to see if want to generate a large or small particles, helps makes the initial conditions homogenious
302  if (random.getRandomNumber(1.0, N1 + N2) > N2)
303  {
304  //Generate a small particle: set radius to small radius subtract one off the list of small particles to be generated
307  N1--;
308  }
309  else
310  {
311  //Generate a large particle: set radius to large radius subtract one of the list of large particles to be generated
314  N2--;
315  }
316 
317 
318  //P0.get_Angle().set_zero();
319  //P0.setAngularVelocity(Vec3D(0.0,0.0,0.0));
320  //inflowParticle_.computeMass();
321 
322  //randomize particle position, zero intial velocity
326 
327  inflowParticle_.setVelocity(Vec3D(0.0, 0.0, 0.0));
328 
329 
330  //Add the new particle to the list of current particles
331  //d Particles.push_back (P0);
333 
334  logger(INFO, "Create a particle ");
335 
336 
337  }
338 
339  //Write the info to the screen and save a copy to the disk
340 
341  logger(INFO, "Finished creating particles");
342 
343 
344  write(std::cout, false);
346 
347  }

References helpers::fileExists(), INFO, mathsFunc::log(), logger, constants::pi, PeriodicBoundary::set(), InfiniteWall::set(), and Chute::setupInitialConditions().

◆ setupInitialConditions() [5/5]

void SegregationPeriodic::setupInitialConditions ( )
inlineoverridevirtual

This is the info call.

This setup the initial conditions, generates small volume fraction of particles. Sets the program to be periodic in x.

Bug:
This code is not non-dimensionalised at the moment, should do this shortly, but at the moment. Should swap this to Silbert particles shortly

Reimplemented from DPMBase.

75  {
76 
77  //Check if the run has been done before. If yes, skip and start next run
79  {
80  //If it has move on to the next run immediately
81  logger(INFO, "This run has been done ");
82  launchNewRun("./segregation", true);
83  exit(0);
84  }
85 
86  //Set up a 10 by 10 study
87  vector<int> study_num = get2DParametersFromRunNumber(10, 1);
88 
89 
90  /*
91  This part was in setupInitialConditions, but then creates an infinite loop of setting up initial conditions.
92  It might be better to put it in tasksAfterSolve, or something like that.
93  //If study 0 is complete quit
94  if (study_num[0] > 0)
95  {
96  cout << "Study is complete " << endl;
97  exit(0);
98  }
99  else //If the study is not complete save the data to disk and move on
100  {
101  writeRestartFile();
102  launchNewRun("./segregation");
103  }*/
104 
105  //CREATE THE WALLS//
107  createWalls();
108 
109  // PARTICLE PROPERTIES//
111 
112  //Number of small particles
113  int numberOfSmallParticles = 10;
114  //Small particle radius
115  radius_s = 0.5;
116  //Radius of large particles, changes from study to study.
117  radius_l = radius_s * (1.0 + study_num[1] / 10.0);
118  //Number of large particles, fixed to the keep the volume fraction of large and small particles equal.
119  int numberOfLargeParticles = pow(radius_s / radius_l, 3) * numberOfSmallParticles;
120 
122 
123  //Setup the base i.e. the chute particles - This has to be done after the particle properties are set, but before the inflow particles are created.
125 
126  // CREATE THE PARTICLES
127  createParticles(numberOfSmallParticles, numberOfLargeParticles);
128 
129  //Write the info to the screen and save a copy to the disk
130  logger(INFO, "Finished creating particles");
131  write(std::cout, false);
133 
135 
136  }
void setSpeciesProperties()
Definition: Segregation/segregation.cpp:138
void createWalls()
Definition: Segregation/segregation.cpp:165
void createParticles(int numberOfSmallParticles, int numberOfLargeParticles)
Definition: Segregation/segregation.cpp:172
void setChuteProperties()
Definition: Segregation/segregation.cpp:218

References helpers::fileExists(), INFO, logger, and Chute::setupInitialConditions().

◆ write() [1/4]

void SegregationPeriodic::write ( std::ostream &  os,
bool  print_all = false 
)
inline

This is the info call.

48 {
49  os << "This is a segregation chute code problem " << endl;
50  os << "\n \n \n"<< endl;
51 
52 
53  MercuryBase::write(os, print_all);
54 
55  os << "Large particle size : " << radius_l << endl;
56  os << "Small particle size : " << radius_s << endl;
57 
58 
59 
60 }
void write(std::ostream &os, bool writeAllParticles=true) const override
Writes all data into a restart file.
Definition: MercuryBase.cc:147

References MercuryBase::write().

◆ write() [2/4]

void SegregationPeriodic::write ( std::ostream &  os,
bool  print_all = false 
) const
inlineoverridevirtual

This is the info call.

Reimplemented from DPMBase.

61 {
62  os << "This is a density size-segregation chute code problem" << endl;
63  os << "\n \n \n"<< endl;
64 
65 
66  MercuryBase::write(os, print_all);
67  os << "particle specie-0 size : " << radius_0 << endl;
68  os << "particle specie-1 size : " << radius_1 << endl;
69  os << "particle specie-2 size : " << radius_2 << endl;
70  os << "particle specie-0 rho : " << rho_0 << endl;
71  os << "particle specie-1 rho : " << rho_1 << endl;
72  os << "particle specie-2 rho : " << rho_2 << endl;
73  os << "particle size-ratio : " << radius_2/radius_1 << endl;
74  os << "particle density-ratio : " << rho_2/rho_1 << endl;
75 }

References MercuryBase::write().

◆ write() [3/4]

void SegregationPeriodic::write ( std::ostream &  os,
bool  print_all = false 
) const
inlineoverridevirtual

This is the info call.

Reimplemented from DPMBase.

62 {
63  os << "This is a density size-segregation chute code problem" << "\n";
64  os << "\n \n \n" << "\n";
65 
66 
67  MercuryBase::write(os, print_all);
68  os << "particle specie-0 size : " << radius_0 << "\n";
69  os << "particle specie-1 size : " << radius_1 << "\n";
70  os << "particle specie-2 size : " << radius_2 << "\n";
71  os << "particle specie-0 rho : " << rho_0 << "\n";
72  os << "particle specie-1 rho : " << rho_1 << "\n";
73  os << "particle specie-2 rho : " << rho_2 << "\n";
74  os << "particle size-ratio : " << radius_2 / radius_1 << "\n";
75  os << "particle density-ratio : " << rho_2 / rho_1 << endl;
76 }

References MercuryBase::write().

◆ write() [4/4]

void SegregationPeriodic::write ( std::ostream &  os,
bool  print_all = false 
) const
inlineoverridevirtual

This is the info call.

Reimplemented from DPMBase.

61 {
62  os << "This is a density size-segregation chute code problem" << "\n";
63  os << "\n \n \n" << "\n";
64 
65 
66  MercuryBase::write(os, print_all);
67  os << "particle specie-0 size : " << radius_0 << "\n";
68  os << "particle specie-1 size : " << radius_1 << "\n";
69  os << "particle specie-2 size : " << radius_2 << "\n";
70  os << "particle specie-0 rho : " << rho_0 << "\n";
71  os << "particle specie-1 rho : " << rho_1 << "\n";
72  os << "particle specie-2 rho : " << rho_2 << "\n";
73  os << "particle size-ratio : " << radius_2 / radius_1 << "\n";
74  os << "particle density-ratio : " << rho_2 / rho_1 << endl;
75 }

References MercuryBase::write().

Member Data Documentation

◆ densityRatio_

double SegregationPeriodic::densityRatio_
private

◆ inflowParticle_

SphericalParticle SegregationPeriodic::inflowParticle_
private

◆ radius_0

double SegregationPeriodic::radius_0
private

◆ radius_1

double SegregationPeriodic::radius_1
private

◆ radius_2

double SegregationPeriodic::radius_2
private

◆ radius_l

double SegregationPeriodic::radius_l
private

◆ radius_s

double SegregationPeriodic::radius_s
private

◆ rho_0

double SegregationPeriodic::rho_0
private

◆ rho_1

double SegregationPeriodic::rho_1
private

◆ rho_2

double SegregationPeriodic::rho_2
private

◆ sizeRatio_

double SegregationPeriodic::sizeRatio_
private

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