revision: v0.14
DPMBase Class Reference

The DPMBase header includes quite a few header files, defining all the handlers, which are essential. Moreover, it defines and solves a DPM problem. It is inherited from FilesAndRunNumber (public). More...

#include <DPMBase.h>

+ Inheritance diagram for DPMBase:

Public Types

enum  ReadOptions : int { ReadOptions::ReadAll, ReadOptions::ReadNoInteractions, ReadOptions::ReadNoParticlesAndInteractions }
 
enum  DomainSplit {
  DomainSplit::X, DomainSplit::Y, DomainSplit::Z, DomainSplit::XY,
  DomainSplit::XZ, DomainSplit::YZ, DomainSplit::XYZ
}
 

Public Member Functions

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< intget1DParametersFromRunNumber (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< intget2DParametersFromRunNumber (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< intget3DParametersFromRunNumber (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...
 
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 setupInitialConditions ()
 This function allows to set the initial conditions for our problem to be solved, by default particle locations are randomly set. Remember particle properties must also be defined here. More...
 
virtual void writeXBallsScript () const
 This writes a script which can be used to load the xballs problem to display the data just generated. More...
 
virtual Mdouble getInfo (const BaseParticle &P) const
 A virtual function that returns some user-specified information about a particle. 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 void write (std::ostream &os, bool writeAllParticles=true) const
 
virtual void read (std::istream &is, ReadOptions opt=ReadOptions::ReadAll)
 Reads all data from a restart file, e.g. domain data and particle data. 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...
 
virtual bool readNextArgument (int &i, int argc, char *argv[])
 Interprets the i^th command-line argument. More...
 
virtual bool checkParticleForInteraction (const BaseParticle &P)
 Checks whether a particle P has any interaction with walls or other particles. More...
 
virtual bool checkParticleForInteractionLocal (const BaseParticle &P)
 Checks if a particle P has any interaction with walls or other particles in the local domain. 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...
 
MERCURY_DEPRECATED FilegetDataFile ()
 The non const version. Allows one to edit the File::dataFile. More...
 
MERCURY_DEPRECATED FilegetEneFile ()
 The non const version. Allows to edit the File::eneFile. More...
 
MERCURY_DEPRECATED FilegetFStatFile ()
 The non const version. Allows to edit the File::fStatFile. More...
 
MERCURY_DEPRECATED FilegetRestartFile ()
 The non const version. Allows to edit the File::restartFile. More...
 
MERCURY_DEPRECATED FilegetStatFile ()
 The non const version. Allows to edit the File::statFile. More...
 
FilegetInteractionFile ()
 Return a reference to the file InteractionsFile. More...
 
MERCURY_DEPRECATED const FilegetDataFile () const
 The const version. Does not allow for any editing of the File::dataFile. More...
 
MERCURY_DEPRECATED const FilegetEneFile () const
 The const version. Does not allow for any editing of the File::eneFile. More...
 
MERCURY_DEPRECATED const FilegetFStatFile () const
 The const version. Does not allow for any editing of the File::fStatFile. More...
 
MERCURY_DEPRECATED const FilegetRestartFile () const
 The const version. Does not allow for any editing of the File::restartFile. More...
 
MERCURY_DEPRECATED const FilegetStatFile () const
 The const version. Does not allow for any editing of the File::statFile. More...
 
const 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...
 
void setWallsWriteVTK (FileType writeWallsVTK)
 Sets whether walls are written into a VTK file. More...
 
void setWallsWriteVTK (bool)
 Sets whether walls are written into a VTK file. More...
 
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)
 
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...
 
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 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)
 
virtual void hGridUpdateMove (BaseParticle *, Mdouble)
 
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< unsignedgetNumberOfDomains ()
 returns the number of domains More...
 
DomaingetCurrentDomain ()
 Function that returns a pointer to the domain corresponding to the processor. More...
 
void removeOldFiles () const
 
virtual void hGridGetInteractingParticleList (BaseParticle *obj, std::vector< BaseParticle * > &list)
 Creates a list of neighbour particles obtained from the hgrid. More...
 
virtual void computeWallForces (BaseWall *w)
 
virtual bool getHGridUpdateEachTimeStep () 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
 

Static Public Member Functions

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

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

virtual void computeAllForces ()
 Computes all the forces acting on the particles using the BaseInteractable::setForce() and BaseInteractable::setTorque() More...
 
virtual void computeInternalForces (BaseParticle *)
 Computes the internal forces on particle i (internal in the sense that the sum over all these forces is zero i.e. fully modelled forces) 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...
 
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 hGridActionsBeforeTimeLoop ()
 A virtual function that allows one to carry out hGrid operations before the start of the time loop. More...
 
virtual void hGridActionsBeforeTimeStep ()
 A virtual function that allows one to set or execute hGrid parameters or operations before every simulation time step. More...
 
virtual void actionsBeforeTimeStep ()
 A virtual function which allows to define operations to be executed before the new time step. 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...
 
virtual void hGridActionsBeforeIntegration ()
 This function has to be called before integrateBeforeForceComputation. More...
 
virtual void hGridActionsAfterIntegration ()
 This function has to be called after integrateBeforeForceComputation. More...
 
void setFixedParticles (unsigned int n)
 Sets a number, n, of particles in the particleHandler as "fixed particles". More...
 
virtual void printTime () const
 Displays the current simulation time and the maximum simulation duration. 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

static void signalHandler (int signal)
 signal handler function. More...
 

Private Attributes

int numberOfOMPThreads_
 
unsigned int systemDimensions_
 The dimensions of the simulation i.e. 2D or 3D. More...
 
unsigned int particleDimensions_
 determines if 2D or 3D particle volume is used for mass calculations More...
 
Vec3D gravity_
 Gravity vector. More...
 
std::vector< unsignednumberOfDomains_
 Vector containing the number of domains in x-,y- and z-direction, required for parallel computations. More...
 
Vec3D min_
 These vectors are used for the XBalls domain, and occasionally people use it to add walls. More...
 
Vec3D max_
 
Mdouble time_
 Stores the current simulation time. More...
 
unsigned int numberOfTimeSteps_
 Stores the number of time steps. More...
 
Mdouble timeStep_
 Stores the simulation time step. More...
 
Mdouble timeMax_
 Stores the duration of the simulation. More...
 
std::string restartVersion_
 Previous versions of MercuryDPM had a different restart file format, the below member variable allows one to specify the version in order to choose between the available version support. More...
 
bool restarted_
 A bool to check if the simulation was restarted or not, ie. if setupInitialConditionsShould be run and the fileCounters reset. More...
 
bool append_
 A flag to determine if the file has to be appended or not. See DPMBase::Solve() for example. More...
 
bool rotation_
 A flag to turn on/off particle rotation. true will enable particle rotation. false will disable particle rotation. More...
 
FileType writeWallsVTK_
 A flag to turn on/off the vtk writer for walls. More...
 
bool writeParticlesVTK_
 A flag to turn on/off the vtk writer for particles. More...
 
bool writeSuperquadricParticlesVTK_
 
ParticleVtkWritervtkWriter_
 
WallVTKWriter wallVTKWriter_
 
InteractionVTKWriter interactionVTKWriter_
 
BoundaryVTKWriter boundaryVTKWriter_
 
int xBallsColourMode_
 XBalls is a package to view the particle data. As an alternative MercuryDPM also supports ParaView. The below variable is used to set the argument cmode in xballs script (see XBalls/xballs.txt) More...
 
Mdouble xBallsVectorScale_
 sets the xballs argument vscale (see XBalls/xballs.txt) More...
 
Mdouble xBallsScale_
 sets the xballs argument scale (see XBalls/xballs.txt) More...
 
std::string xBallsAdditionalArguments_
 A string of additional arguments for xballs can be specified (see XBalls/xballs.txt). e.g. "-solidf -v0". More...
 
int runNumber_
 This stores the run number for saving. More...
 
std::string name_
 the name of the problem, used, e.g., for the output files More...
 
bool readSpeciesFromDataFile_
 Determines if the last column of the data file is interpreted as the info parameter during restart. More...
 
int nToWrite_
 number of elements to write to a screen More...
 

Static Private Attributes

static volatile sig_atomic_t continueFlag_ = true
 

Detailed Description

The DPMBase header includes quite a few header files, defining all the handlers, which are essential. Moreover, it defines and solves a DPM problem. It is inherited from FilesAndRunNumber (public).

Bug:
When restarting the first time step is not saved, therefore there is a missing time step after a restart

Member Enumeration Documentation

◆ DomainSplit

enum DPMBase::DomainSplit
strong
Enumerator
XY 
XZ 
YZ 
XYZ 
937 {X, Y, Z, XY, XZ, YZ, XYZ};

◆ ReadOptions

enum DPMBase::ReadOptions : int
strong
Enumerator
ReadAll 
ReadNoInteractions 
ReadNoParticlesAndInteractions 
243  : int {
244  ReadAll,
245  ReadNoInteractions,
246  ReadNoParticlesAndInteractions
247  };

Constructor & Destructor Documentation

◆ DPMBase() [1/2]

DPMBase::DPMBase ( )

Constructor that calls the "void constructor()".

Constructor for the DPMBase class. Initialises a set of default parameters allowing a simulation to be created 'off the shelf'. For full details of the parameters initialised and their assigned values, see constructor()

References constructor().

◆ DPMBase() [2/2]

DPMBase::DPMBase ( const DPMBase other)

Copy constructor type-2.

A copy constructor which takes a "DPMBase"-type object and creates a "copy" - i.e. creates a new instance of a class possessing the same properties as the original.
The argument "other" is the "original", i.e. the instance to be copied from.

The first set of actions performed, which follow the general form:
[variable] = other.[variable])
simply copy the relevant variables (i.e. information such as particle details, system details, simulation details...) from the original ("other").

The various handlers belonging to the original instance, however, are not directly copied, as this may cause problems (i.e. the handlers would still "point" to the original object, not the copy).
Rather, new handlers are created (e.g. boundaryHandler.setDPMBase(this);), and the contents of the handlers is then passed over (e.g. boundaryHandler = other.boundaryHandler;). For each handler class, the assignment operator = has been overrided to copy the contents, not just the pointer.

Parameters
[in]other
124 {
125  setName(other.getName());
126  runNumber_ = other.runNumber_;
129  gravity_ = other.gravity_;
130 /* xMin_ = other.xMin_;
131  xMax_ = other.xMax_;
132  yMin_ = other.yMin_;
133  yMax_ = other.yMax_;
134  zMin_ = other.zMin_;
135  zMax_ = other.zMax_;*/
136  min_ = other.min_;
137  max_ = other.max_;
139  time_ = other.time_;
140  timeStep_ = other.timeStep_;
142  timeMax_ = other.timeMax_;
143  restartVersion_ = other.restartVersion_; //to read new and old restart data
144  restarted_ = other.restarted_; //to see if it was restarted or not
145  append_ = other.append_;
146  rotation_ = other.rotation_;
147  xBallsColourMode_ = other.xBallsColourMode_; // sets the xballs argument cmode (see xballs.txt)
148  xBallsVectorScale_ = other.xBallsVectorScale_; // sets the xballs argument vscale (see xballs.txt)
149  xBallsScale_ = other.xBallsScale_; // sets the xballs argument scale (see xballs.txt)
150  xBallsAdditionalArguments_ = other.xBallsAdditionalArguments_; // std::string where additional xballs argument can be specified (see xballs.txt)
154 
155 //effectively saying "if there exists a CONTACT_LIST_HGRID, copy it, if not, ignore.
156 #ifdef CONTACT_LIST_HGRID
157  possibleContactList=other.possibleContactList;
158 #endif
159  random = other.random;
160 
165  wallHandler.setDPMBase(this);
168  //Initialise the handlers
171 
172  //setting contents equal to the other handlers!
175  cgHandler = other.cgHandler;
176  //cgHandler = other.cgHandler.copy(); //todo
177  //cgHandler.setDPMBase(this);
178  wallHandler = other.wallHandler;
181  vtkWriter_ = other.vtkWriter_;
186 }

References append_, boundaryHandler, cgHandler, domainHandler, getName(), gravity_, DomainHandler::initialise(), PeriodicBoundaryHandler::initialise(), interactionHandler, max_, min_, numberOfDomains_, numberOfOMPThreads_, numberOfTimeSteps_, particleDimensions_, particleHandler, periodicBoundaryHandler, random, readSpeciesFromDataFile_, restarted_, restartVersion_, rotation_, runNumber_, BaseHandler< T >::setDPMBase(), setName(), speciesHandler, systemDimensions_, time_, timeMax_, timeStep_, vtkWriter_, wallHandler, writeParticlesVTK_, writeSuperquadricParticlesVTK_, writeWallsVTK_, xBallsAdditionalArguments_, xBallsColourMode_, xBallsScale_, and xBallsVectorScale_.

◆ ~DPMBase()

DPMBase::~DPMBase ( )
virtual

virtual destructor

A simple destructor for "DPMBase"-type objects, used to free-up memory when an object is no longer necessary.

296 {
297  delete vtkWriter_;
298 }

References vtkWriter_.

Member Function Documentation

◆ actionsAfterSolve()

void DPMBase::actionsAfterSolve ( )
protectedvirtual

A virtual function which allows to define operations to be executed after the solve().

no implementation but can be overidden in its derived classes.

Reimplemented in BaseCluster, SpeciesTest, VisualisationTest, SphericalSuperQuadricCollision, EllipticalSuperQuadricCollision, EllipticalSuperQuadricCollision, EllipsoidsBouncingOnWallDemo, Contact, PSDManualInsertionSelfTest, ParameterStudy3DDemo, ParameterStudy2DDemo, ParameterStudy1DDemo, MaserRepeatedOutInMPI2Test, ForceLawsMPI2Test, and DPM.

1863 {
1864 }

Referenced by solve(), and Mercury3DRestart::writeOutputFiles().

◆ actionsAfterTimeStep()

◆ actionsBeforeTimeLoop()

void DPMBase::actionsBeforeTimeLoop ( )
protectedvirtual

A virtual function. Allows one to carry out any operations before the start of the time loop.

no implementation but can be overriden in its derived classes.

Reimplemented in SphericalIndenter, ParameterStudy3DDemo, ParameterStudy2DDemo, ParameterStudy1DDemo, GranularJet, Slide, statistics_while_running< T >, and GranularJet.

1661 {
1662 }

Referenced by solve().

◆ actionsBeforeTimeStep()

◆ actionsOnRestart()

void DPMBase::actionsOnRestart ( )
protectedvirtual

A virtual function where the users can add extra code which is executed only when the code is restarted.

no implementation but can be overidden in its derived classes.

Reimplemented in BaseCluster, FreeFall, DrumRot, ChuteRestartDemo, AirySavageHutter, and Chutebelt.

1675 {
1676 }

Referenced by solve().

◆ areInContact()

bool DPMBase::areInContact ( const BaseParticle pI,
const BaseParticle pJ 
)
static

Checks if two particle are in contact or is there any positive overlap.

Determines whether two particles are distinct and in contact by comparing the separation of their centres to their (interaction) radii.

Firstly, checks if the two particles are different (if pI == pJ, the result is "false"). Secondly, if the two particles are distinct, finds the distance between the two particles' centres (getDistanceSquared(pI->getPosition(), pJ->getPosition()))) and tests whether the separation of the particles is less than the sum of their radii (pI->getInteractionRadius() + pJ->getInteractionRadius()). If so, the bool returns "true", i.e. the particles are in contact.

Parameters
[in]pIA pointer to a particle
[in]pJA pointer to a second particle
Returns
bool (True or False) - lets the user know whether two particles are in contact
1653 {
1654  return (pI != pJ && pI->isInContactWith(pJ));
1655 }

References BaseParticle::isInContactWith().

Referenced by Mercury2D::hGridFindParticleContacts(), Mercury3D::hGridFindParticleContacts(), and Mercury3D::hGridHasContactsInTargetCell().

◆ autoNumber()

void DPMBase::autoNumber ( )

The autoNumber() function calls three functions: setRunNumber(), readRunNumberFromFile() and incrementRunNumberInFile().

Using the three functions named above, the autoNumber() function acts to:

1) Use the readRunNumberFromFile() function toead the current run number from the file COUNTER_DONOTDEL created by any script which utilises auto-numbering.

2) Set the runNumber_ counter to the value obtained from the above using the setRunNumber() function.

3) Increment the value stored in the COUNTER_DONOTDEL file by one once the current value has been read using the incrementRunNumberInFile() function.

537 {
539 
540  if (!getRestarted())
541  {
543  }
544 }

References getRestarted(), incrementRunNumberInFile(), readRunNumberFromFile(), and setRunNumber().

Referenced by main(), readNextArgument(), and ChutePeriodic::setup().

◆ checkAndDuplicatePeriodicParticles()

void DPMBase::checkAndDuplicatePeriodicParticles ( )
protected

For simulations using periodic boundaries, checks and adds particles when necessary into the particle handler. See DPMBase.cc and PeriodicBoundary.cc for more details.

For all particles in the system, checks their proximity to all periodic boundaries. If a particle is found to be near a periodic boundary, creates and adds a periodic ("ghost") particle.

4866 {
4867  //Looping over all boundaries in the boundaryHandler
4868  for (BaseBoundary* boundary : boundaryHandler)
4869  {
4870  //Calls the createPeriodicParticles() function which checks if a particle is adequately
4871  //close to a periodic particle that a periodic (ghost) particle should be created and,
4872  //if so, creates one and adds it to the system (hence the necessity to keep "N" variable).
4873  //
4874  // (The loop is over all boundaries, but if a boundary is not a PeriodicBoundary, then
4875  // this does nothing.)
4876  boundary->createPeriodicParticles(particleHandler);
4877  }
4878 
4879  // OMP parallelism
4880  /*#pragma omp parallel for num_threads(getNumberOfOMPThreads()) //schedule(dynamic)
4881  for (int k = 0; k < boundaryHandler.getNumberOfObjects(); k++)
4882  {
4883  //Calls the createPeriodicParticles() function which checks if a particle is adequately
4884  //close to a periodic particle that a periodic (ghost) particle should be created and,
4885  //if so, creates one and adds it to the system (hence the necessity to keep "N" variable).
4886  //
4887  // (The loop is over all boundaries, but if a boundary is not a PeriodicBoundary, then
4888  // this does nothing.)
4889 
4890  BaseBoundary* boundary = boundaryHandler.getObject(k);
4891  #pragma omp critical
4892  boundary->createPeriodicParticles(particleHandler);
4893  }*/
4894 }

References boundaryHandler, and particleHandler.

Referenced by SilbertPeriodic::add_flow_particles(), computeOneTimeStep(), and solve().

◆ checkInteractionWithBoundaries()

void DPMBase::checkInteractionWithBoundaries ( )
protectedvirtual

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.

For each boundary, checks whether each particle in the system has "passed" it and performs an action according to the type of boundary involved.

For instance, if the boundary is a periodic boundary, the periodic boundary version of "checkBoundaryAfterParticleMoved" will be called ( PeriodicBoundary::checkBoundaryAfterParticleMoved()) and in turn apply the shiftPosition() function to the particle. If the boundary is a deletion boundary ( DeletionBoundary::checkBoundaryAfterParticleMoved ()), any particle passing the boundary will be deleted. Further details can be seen in the in-code comments below.

3178 {
3179 
3180  //Cycling over all boundaries within the system...
3181  for (BaseBoundary* b : boundaryHandler)
3182  {
3183  //check all boundaries...
3184  b->checkBoundaryAfterParticlesMove(particleHandler);
3185 
3186 
3187 #ifdef MERCURY_USE_MPI
3188  //When ghost particles are deleted by deletion boundaries they need to be removed
3189  //from their communication lists to avoid segfaults
3190  if (NUMBER_OF_PROCESSORS > 1)
3191  {
3192  //Flush deleted particles from mpi communication zones
3193  getCurrentDomain()->flushParticles(b->getParticlesToBeDeleted());
3195  periodicBoundaryHandler.flushParticles(b->getParticlesToBeDeleted());
3197  }
3198 
3199  //Delete particles that were in communication zone
3200  for (auto p_it = b->getParticlesToBeDeleted().begin(); p_it != b->getParticlesToBeDeleted().end(); p_it++)
3201  {
3202  particleHandler.removeGhostObject((*p_it)->getIndex());
3203  }
3204 #endif
3205  }
3206 }

References boundaryHandler, Domain::cleanCommunicationLists(), PeriodicBoundaryHandler::cleanCommunicationLists(), PeriodicBoundaryHandler::flushParticles(), Domain::flushParticles(), getCurrentDomain(), NUMBER_OF_PROCESSORS, particleHandler, periodicBoundaryHandler, and ParticleHandler::removeGhostObject().

Referenced by computeOneTimeStep().

◆ checkParticleForInteraction()

bool DPMBase::checkParticleForInteraction ( const BaseParticle p)
virtual

Checks whether a particle P has any interaction with walls or other particles.

A very useful feature. For example, when one wants to have an initial condition with particles free of interactions with other particles or walls, one could use this to see if a particle about to be inserted would have interactions. If yes, then the particle would not be considered for insertion.

However can prove expensive if the number of particles is large.

Parameters
[in]pThe particle for which one wants to detect collisions (or the lack thereof).
Returns
true if and only if there are no interactions with other particles or walls.

Reimplemented in MercuryBase.

4640 {
4641 #ifdef MERCURY_USE_MPI
4642  if (NUMBER_OF_PROCESSORS == 1)
4643  {
4645  }
4646 
4647  int localInteraction = checkParticleForInteractionLocal(p);
4648  //The root gathers all values and computes the global value
4649  int *interactionList = nullptr;
4650  if (PROCESSOR_ID == 0)
4651  {
4652  interactionList = new int [NUMBER_OF_PROCESSORS];
4653  }
4654 
4655  //Gather all local values
4656  MPIContainer::Instance().gather(localInteraction,interactionList);
4657 
4658  //Compute the global value
4659  int globalInteraction = 1;
4660  if (PROCESSOR_ID == 0)
4661  {
4662  for (int i = 0; i < NUMBER_OF_PROCESSORS; i++)
4663  {
4664  if (interactionList[i] == 0)
4665  {
4666  globalInteraction = 0;
4667  break;
4668  }
4669  }
4670  }
4671  //The root now tells the other processors what the global value for the interaction is
4672  MPIContainer::Instance().broadcast(globalInteraction);
4673 
4674  //Convert the result back to bool
4675  bool interaction = globalInteraction;
4676 #else
4677  bool interaction = checkParticleForInteractionLocalPeriodic(p);
4678 #endif
4679  return interaction;
4680 }

References MPIContainer::broadcast(), checkParticleForInteractionLocal(), checkParticleForInteractionLocalPeriodic(), MPIContainer::gather(), constants::i, MPIContainer::Instance(), NUMBER_OF_PROCESSORS, and PROCESSOR_ID.

Referenced by InsertionBoundary::checkBoundaryBeforeTimeStep(), and RandomClusterInsertionBoundary::checkBoundaryBeforeTimeStep().

◆ checkParticleForInteractionLocal()

bool DPMBase::checkParticleForInteractionLocal ( const BaseParticle p)
virtual

Checks if a particle P has any interaction with walls or other particles in the local domain.

A very useful feature. For example, when one wants to have an initial condition with particles free of interactions with other particles or walls, one could use this method and whether particles are interacting. If yes, then it would not consider this particle for insertion and continue onto the next particle. However can prove expensive if the number of particles is large.

Returns true if and only if there are no interactions with other particles in the local domain or walls.

Parameters
[in]pThe particle for which one wants to detect collisions (or the lack thereof).
Returns
bool - true if particle P has no interactions, false if P has one or more interactions with other particles or walls.
Todo:
tw check against periodic copies (see ShearCell3DInitialConditions.cpp)

Reimplemented in MercuryBase.

4739 {
4740  Mdouble distance;
4741  Vec3D normal;
4742 
4743  //Check if it has no collision with walls
4744  for (BaseWall* w : wallHandler)
4745  {
4746  //returns false if the function getDistanceAndNormal returns true,
4747  //i.e. if there exists an interaction between wall and particle
4748  //\todo TW getDistanceAndNormal(p,distance,normal) should ideally be replaced by a inContact(p) function, as it doesn't require distance and normal for anything (and walls now can have multiple contacts, soon particles can have it too.)
4749  if (w->getDistanceAndNormal(p, distance, normal))
4750  {
4751  //std::cout<<"failure: Collision with wall: "<<**it<<std::endl;
4752  return false;
4753  }
4754  else
4755  {
4756  //std::cout<<"No collision with wall: "<<**it<<std::endl;
4757  }
4758  }
4759 
4760  //Check if it has no collision with other particles
4761  for (BaseParticle* q : particleHandler)
4762  {
4763  //returns false if the particle separation is less than the relevant sum of interaction radii
4764  //(i.e. another particle is in contact with P)
4765  if (Vec3D::getDistanceSquared(q->getPosition(), p.getPosition())
4767  {
4768  //std::cout<<"failure: Collision with particle "<<**it<<std::endl;
4769  return false;
4770  }
4771  else
4772  {
4773  //std::cout<<"No collision with particle "<<**it<<std::endl;
4774  }
4775  }
4776  return true;
4778 }

References Vec3D::getDistanceSquared(), BaseInteractable::getPosition(), BaseParticle::getSumOfInteractionRadii(), particleHandler, mathsFunc::square(), and wallHandler.

Referenced by checkParticleForInteraction(), and checkParticleForInteractionLocalPeriodic().

◆ checkParticleForInteractionLocalPeriodic()

bool DPMBase::checkParticleForInteractionLocalPeriodic ( const BaseParticle p)

Extends the capability of detecting intersecting particles to periodic systems

Todo:
TW the implementation of this function is not very efficient and should be improved
Parameters
p
Returns
4689 {
4690  //A vector of ghost particles of the particle that is to be inserted (empty if no periodic boundaries are present)
4691  std::vector<Vec3D> pPeriodic;
4692  for (BaseBoundary* b : boundaryHandler)
4693  {
4694  PeriodicBoundary* pb = dynamic_cast<PeriodicBoundary*>(b);
4695  if (pb && particleHandler.getNumberOfObjects() > 0 )
4696  {
4698  for (int i = pPeriodic.size() - 1; i >= 0; --i)
4699  {
4700  if (pb->getDistance(pPeriodic[i]) < maxDistance)
4701  {
4702  pPeriodic.push_back(pPeriodic[i]);
4703  pb->shiftPosition(pPeriodic.back());
4704  }
4705  }
4706  if (pb->getDistance(p) < maxDistance)
4707  {
4708  pPeriodic.push_back(p.getPosition());
4709  pb->shiftPosition(pPeriodic.back());
4710  }
4711  }
4712  }
4713  //check the particle AND the ghost particles for intersection problems
4714  bool insertable = checkParticleForInteractionLocal(p);
4715  if (!pPeriodic.empty()) {
4716  BaseParticle* q = p.copy();
4717  for (const Vec3D& pos : pPeriodic) {
4718  q->setPosition(pos);
4719  insertable &= checkParticleForInteractionLocal(*q);
4720  }
4721  delete q;
4722  }
4723  return insertable;
4724 }

References boundaryHandler, checkParticleForInteractionLocal(), BaseParticle::copy(), PeriodicBoundary::getDistance(), ParticleHandler::getLargestParticle(), BaseParticle::getMaxInteractionRadius(), ParticleHandler::getNumberOfObjects(), BaseInteractable::getPosition(), constants::i, particleHandler, BaseInteractable::setPosition(), and PeriodicBoundary::shiftPosition().

Referenced by checkParticleForInteraction().

◆ checkSettings()

void DPMBase::checkSettings ( )

Checks if the essentials are set properly to go ahead with solving the problem.

  1. Checks if at least one species exists in the SpeciesHandler.
  2. Checks if the time step is set or not.

    If any of the above checks fail, gives an error message to the user and terminates the program.
3832 {
3833  //check if name is set
3834  logger.assert_always(getName() != "",
3835  "File name not set: use setName()");
3836  //check if time step is set
3837  logger.assert_always(getTimeStep() != 0,
3838  "Time step undefined: use setTimeStep()");
3839  //check if domain is set
3840  logger.assert_always(getXMax() > getXMin(),
3841  "Domain size not set: use setXMin() and setXMax()");
3842  logger.assert_always(getYMax() > getYMin(),
3843  "Domain size not set: use setYMin() and setYMax()");
3844  logger.assert_always(systemDimensions_ == 3 ? (getZMax() > getZMin()) : (getZMax() >= getZMin()),
3845  "Domain size not set: use setZMin() and setZMax()", systemDimensions_);
3846 
3847  //check for species parameters
3848  logger.assert_always(speciesHandler.getNumberOfObjects() > 0,
3849  "No species defined: use speciesHandler.copyAndAddObject()");
3850  for (BaseParticle* p : particleHandler)
3851  {
3852  logger.assert_always(p->getSpecies() != nullptr, "particle % has no species", p->getId());
3853  }
3854  for (BaseWall* w : wallHandler)
3855  {
3856  logger.assert_always(w->getSpecies() != nullptr, "% with index % has no species", w->getName(), w->getId());
3857  }
3858 }

References getName(), BaseHandler< T >::getNumberOfObjects(), getTimeStep(), getXMax(), getXMin(), getYMax(), getYMin(), getZMax(), getZMin(), logger, particleHandler, speciesHandler, systemDimensions_, and wallHandler.

Referenced by solve().

◆ closeFiles()

void DPMBase::closeFiles ( )

Closes all files (ene, data, fstat, restart, stat) that were opened to read or write.

501 {
502  dataFile.close();
503  fStatFile.close();
504  restartFile.close();
505  statFile.close();
506  eneFile.close();
508 }

References File::close(), dataFile, eneFile, fStatFile, interactionFile, restartFile, and statFile.

Referenced by solve(), and Mercury3DRestart::writeOutputFiles().

◆ computeAdditionalForces()

virtual void DPMBase::computeAdditionalForces ( )
inlineprotectedvirtual

A virtual function which allows to define operations to be executed prior to the OMP force collect.

no implementation but can be overidden in its derived classes. This function is called by DPMBase::computeAllForces. It may be used to add additional user defined forces to any MercuryObject. Within this function, OMP parallelization may be used, as it is called prior to sumForceTorqueOMP.

Reimplemented in MembraneDemo.

1068 {}

Referenced by computeAllForces().

◆ computeAllForces()

void DPMBase::computeAllForces ( )
protectedvirtual

Computes all the forces acting on the particles using the BaseInteractable::setForce() and BaseInteractable::setTorque()

Initially, resets all forces to zero for all particles and all walls. For each particle in turn, the function searches for particle interactions, and computes the relevant internal forces, followed by the relevant external forces (e.g. gravity).

Now loop over all particles contacts computing force contributions

Reimplemented in DPM.

3303 {
3304  //Resetting all forces on both particles and walls to zero
3305  #pragma omp parallel num_threads(getNumberOfOMPThreads())
3306  {
3307  #pragma omp for
3308  for (int k = 0; k < particleHandler.getSize(); ++k) {
3310  }
3311  #pragma omp for
3312  for (int k = 0; k < wallHandler.getSize(); k++) {
3314  }
3315  }
3316  logger(DEBUG,"All forces set to zero");
3317 
3318  // for omp simulations, reset the newObjects_ variable (used for reduction)
3320 
3321  // compute all internal and external forces; for omp simulations, this can be done in parallel
3322  #pragma omp parallel num_threads(getNumberOfOMPThreads())
3323  {
3324  //logger(INFO, "Number of omp threads = %", getNumberOfOMPThreads());
3326  #pragma omp for schedule(dynamic)
3327  for (int k = 0; k < particleHandler.getSize(); ++k) {
3329  //computing both internal forces (e.g. due to collisions)
3330  //and external forces (e.g. gravity)
3331  //(compute internal forces compares the current particle p
3332  //with all others in the handler!)
3334  // body forces
3336  }
3337 
3338  // wall-forces
3339  #pragma omp for schedule(dynamic)
3340  for (int k = 0; k < wallHandler.getSize(); k++) {
3341  BaseWall *w = wallHandler.getObject(k);
3342  computeWallForces(w);
3343  }
3344 
3345  }
3346 
3347 #ifdef CONTACT_LIST_HGRID
3348  PossibleContact* Curr=possibleContactList.getFirstPossibleContact();
3349  while(Curr)
3350  {
3351  computeInternalForces(Curr->getP1(),Curr->getP2());
3352  Curr=Curr->getNext();
3353  }
3354 #endif
3355 
3356  // Check wall forces
3357  #pragma omp for schedule(dynamic)
3358  for (int k = 0; k < wallHandler.getNumberOfObjects(); k++) {
3359  BaseWall *w = wallHandler.getObject(k);
3361  }
3362 
3364 
3365  // for omp simulations, sum up all forces and add all newObjects_ (needed since both are using reduction)
3366  #ifdef MERCURY_USE_OMP
3367  if (getNumberOfOMPThreads()>1) {
3369  }
3370  //Resetting all forces on both particles and walls to zero
3371  #pragma omp parallel num_threads(getNumberOfOMPThreads())
3372  {
3373  #pragma omp for
3374  for (int k = 0; k < particleHandler.getSize(); k++) {
3376  }
3377  #pragma omp for
3378  for (int k = 0; k < wallHandler.getSize(); k++) {
3380  } //end reset forces loop
3381  }
3382  #endif
3383 
3384  //end outer loop over contacts.
3385 }

References InteractionHandler::addNewObjectsOMP(), BaseWall::checkInteractions(), computeAdditionalForces(), computeExternalForces(), computeInternalForces(), computeWallForces(), FATAL, PossibleContact::getNext(), BaseHandler< T >::getNumberOfObjects(), getNumberOfOMPThreads(), getNumberOfTimeSteps(), BaseHandler< T >::getObject(), PossibleContact::getP1(), PossibleContact::getP2(), BaseHandler< T >::getSize(), interactionHandler, logger, particleHandler, BaseInteractable::resetForceTorque(), InteractionHandler::resetNewObjectsOMP(), BaseInteractable::sumForceTorqueOMP(), and wallHandler.

Referenced by DPM::computeAllForces(), computeOneTimeStep(), and solve().

◆ computeExternalForces()

void DPMBase::computeExternalForces ( BaseParticle CI)
protectedvirtual

Computes the external forces, such as gravity, acting on particles.

Todo:
take out computeWalls() from compute External Forces method.
Parameters
[in]CIThe BaseParticle object to which the relevant external forces are applied.

Reimplemented in AngledPeriodicBoundarySecondUnitTest, SphericalIndenter, my_problem, my_problem, PeriodicWalls, and Contact.

3075 {
3076  //Checks that the current particle is not "fixed"
3077  //and hence infinitely massive!
3078  if (!CI->isFixed())
3079  {
3080  // Applying the force due to gravity (F = m.g)
3081  CI->addForce(getGravity() * CI->getMass());
3082  // Still calls this in compute External Forces.
3083  // computeForcesDueToWalls(CI);
3084  }
3085 }

References BaseInteractable::addForce(), getGravity(), BaseParticle::getMass(), and BaseParticle::isFixed().

Referenced by computeAllForces(), DPM::computeAllForcesNoHGrid(), Contact::computeExternalForces(), and SphericalIndenter::computeExternalForces().

◆ computeForcesDueToWalls()

void DPMBase::computeForcesDueToWalls ( BaseParticle pI,
BaseWall w 
)
protected

Computes the forces on the particles due to the walls (normals are outward normals)

Checks if a particle pI is currently in contact - i.e. interacting - with any of the walls within the system using the BaseParticle::getInteractionWith() function. If an interaction is detected, computes the force acting between particle and wall and applies the relevant torques and forces to both particle and wall(s).

Parameters
[in]pIThe BaseParticle object to which the wall forces are applied.
Todo:
TW: I think this torque has the wrong sign
3095 {
3096  //No need to compute interactions between periodic particle images and walls
3097  if (pI->getPeriodicFromParticle() != nullptr)
3098  return;
3099 
3100  //Checks if the particle is interacting with the current wall
3103  if (i!=nullptr) {
3104  //...calculates the forces between the two objects...
3105  i->computeForce();
3106 
3107  //...and applies them to each of the two objects (wall and particle).
3108  pI->addForce(i->getForce());
3109  w->addForce(-i->getForce());
3110 
3111  //If the rotation flag is on, also applies the relevant torques
3112  //(getRotation() returns a boolean).
3113  if (getRotation()) // getRotation() returns a boolean.
3114  {
3115  pI->addTorque(i->getTorque() - Vec3D::cross(pI->getPosition() - i->getContactPoint(), i->getForce()));
3117  w->addTorque(-i->getTorque() + Vec3D::cross(w->getPosition() - i->getContactPoint(), i->getForce()));
3118  }
3119  }
3120 }

References BaseInteractable::addForce(), BaseInteractable::addTorque(), Vec3D::cross(), BaseWall::getInteractionWith(), getNumberOfTimeSteps(), BaseParticle::getPeriodicFromParticle(), BaseInteractable::getPosition(), getRotation(), constants::i, and interactionHandler.

Referenced by DPM::computeAllForcesNoHGrid(), computeWallForces(), Mercury3D::computeWallForces(), and ArcWallUnitTest::setupInitialConditions().

◆ computeInternalForce()

void DPMBase::computeInternalForce ( BaseParticle P1,
BaseParticle P2 
)
protectedvirtual

Computes the forces between two particles (internal in the sense that the sum over all these forces is zero i.e. fully modelled forces)

Firstly, checks the types of particles involved in order to ensure that only viable interactions are counted.

Secondly, if the particle combination is viable, checks if the particles are interacting.

Finally, if the particles are found to be interacting, calculates the relevant forces (as well as torques, if the "rotation" flag is turned "on") acting between the particles, and applies them to each particle.

Parameters
[in]P1
[in]P2
3020 {
3021  //Does not compute forces if particles are fixed
3022  //this is necessary because the rough bottom allows overlapping fixed particles
3023  if (P1->isFixed() && P2->isFixed())
3024  {
3025  return;
3026  }
3027 //Ensures that interactions between the "ghost" particles used to implement periodic behaviour
3028  //are not included in calculations
3029  //i.e. ends the function if both particles are "ghosts".
3030  if ((P1->getPeriodicFromParticle() != nullptr) && (P2->getPeriodicFromParticle() != nullptr))
3031  {
3032  return;
3033  }
3034 //if statement below ensures that the PI has the lower id than PJ
3035  BaseParticle* PI, * PJ;
3036  if (P1->getId() > P2->getId())
3037  {
3038  PI = P2;
3039  PJ = P1;
3040  }
3041  else
3042  {
3043  PI = P1;
3044  PJ = P2;
3045  }
3046  //checks if the two particles are interacting
3047  //("getInteractionWith" returns the relevant pointer if PI and PJ are interacting,
3048  //zero if not)
3049  //if statement above ensures that the PI has the lower id than PJ
3052  if (i!= nullptr) {
3053  //calculates the force corresponding to the interaction
3054  i->computeForce();
3055 
3056  //Applies the relevant calculated forces to PI and PJ
3057  PI->addForce(i->getForce());
3058  PJ->addForce(-i->getForce());
3059 
3060  //checks if particle rotation is turned on...
3061  if (getRotation()) {
3062  //...and, if so, performs equivalent calculations for the torque as were
3063  //performed for the force.
3064  PI->addTorque(i->getTorque() - Vec3D::cross(PI->getPosition() - i->getContactPoint(), i->getForce()));
3065  PJ->addTorque(-i->getTorque() + Vec3D::cross(PJ->getPosition() - i->getContactPoint(), i->getForce()));
3066  }
3067  }
3068 }

References BaseInteractable::addForce(), BaseInteractable::addTorque(), Vec3D::cross(), BaseObject::getId(), BaseParticle::getInteractionWith(), getNumberOfTimeSteps(), BaseParticle::getPeriodicFromParticle(), BaseInteractable::getPosition(), getRotation(), constants::i, interactionHandler, and BaseParticle::isFixed().

Referenced by DPM::computeAllForcesNoHGrid(), SphericalIndenter::computeExternalForces(), computeInternalForces(), Mercury3D::hGridFindContactsWithinTargetCell(), Mercury2D::hGridFindContactsWithinTargetCell(), Mercury3D::hGridFindContactsWithTargetCell(), and Mercury2D::hGridFindContactsWithTargetCell().

◆ computeInternalForces()

void DPMBase::computeInternalForces ( BaseParticle i)
protectedvirtual

Computes the internal forces on particle i (internal in the sense that the sum over all these forces is zero i.e. fully modelled forces)

Taking a single BaseParticle object as an argument, passes it to the broadPhase() function which then loops over all other particles in the particleHandler and computes the relevant forces for any particle pairing found to be in contact.

Parameters
[in]iA BaseParticle object for which we want to calculate the internal forces.

Reimplemented in Mercury3D, Mercury2D, my_problem_HGRID, and my_problem.

3394 {
3395  for (auto it = particleHandler.begin(); (*it) != i; ++it)
3396  {
3397  computeInternalForce(i, *it);
3398  }
3399 }

References BaseHandler< T >::begin(), computeInternalForce(), constants::i, and particleHandler.

Referenced by computeAllForces().

◆ computeOneTimeStep()

void DPMBase::computeOneTimeStep ( )
virtual

Performs everything needed for one time step, used in the time-loop of solve().

Todo:
IFCD @AT, TW: please check what should be in here, and whether it should be virtual or not.

Performs one time step in the time loop, including updating the time. It is made public, since this makes coupling multiple DPM simulations easier in the future.

Todo:
MX: this is not true anymore. all boundaries are handled here. particles have received a position update, so here the deletion boundary deletes particles \TODO add particles need a periodic check
Bug:
{In chute particles are added in actions_before_time_set(), however they are not written to the xballs data yet, but can have a collision and be written to the fstat data}
4140 {
4141  logger(DEBUG, "starting computeOneTimeStep()");
4142 
4143  logger(DEBUG, "about to call writeOutputFiles()");
4144  writeOutputFiles(); //everything is written at the beginning of the time step!
4145 
4146  logger(DEBUG, "about to call hGridActionsBeforeIntegration()");
4148 
4149  //Computes the half-time step velocity and full time step position and updates the particles accordingly
4150  logger(DEBUG, "about to call integrateBeforeForceComputation()");
4151 
4153  //New positions require the MPI and parallel periodic boundaries to do things
4154  logger(DEBUG, "about to call performGhostParticleUpdate()");
4156  // Some walls need to be aware of the new positions
4158 
4162 
4163  logger(DEBUG, "about to call checkInteractionWithBoundaries()");
4164  checkInteractionWithBoundaries(); // INSERTION boundaries handled
4165 
4166  logger(DEBUG, "about to call hGridActionsAfterIntegration()");
4168 
4169  // Compute forces
4171  // INSERTION/DELETION boundary flag change
4172  for (BaseBoundary* b : boundaryHandler)
4173  {
4174  b->checkBoundaryBeforeTimeStep(this);
4175  }
4176 
4177  logger(DEBUG, "about to call actionsBeforeTimeStep()");
4179 
4180  logger(DEBUG, "about to call checkAndDuplicatePeriodicParticles()");
4182 
4183  logger(DEBUG, "about to call hGridActionsBeforeTimeStep()");
4185 
4186  //Creates and updates interactions and computes forces based on these
4187  logger(DEBUG, "about to call computeAllForces()");
4188  computeAllForces();
4189 
4190  logger(DEBUG, "about to call removeDuplicatePeriodicParticles()");
4192 
4193  logger(DEBUG, "about to call actionsAfterTimeStep()");
4195 
4196  //Computes new velocities and updates the particles accordingly
4197  logger(DEBUG, "about to call integrateAfterForceComputation()");
4199 
4200  //erase interactions that have not been used during the last time step
4201  //logger(DEBUG, "about to call interactionHandler.eraseOldInteractions(getNumberOfTimeSteps())");
4203  logger(DEBUG, "about to call interactionHandler.actionsAfterTimeStep()");
4206 
4207  time_ += timeStep_;
4209 
4210  logger(DEBUG, "finished computeOneTimeStep()");
4211 }

References WallHandler::actionsAfterParticleGhostUpdate(), actionsAfterTimeStep(), InteractionHandler::actionsAfterTimeStep(), ParticleHandler::actionsAfterTimeStep(), actionsBeforeTimeStep(), boundaryHandler, checkAndDuplicatePeriodicParticles(), checkInteractionWithBoundaries(), computeAllForces(), InteractionHandler::eraseOldInteractions(), FATAL, getNumberOfTimeSteps(), hGridActionsAfterIntegration(), hGridActionsBeforeIntegration(), hGridActionsBeforeTimeStep(), integrateAfterForceComputation(), integrateBeforeForceComputation(), interactionHandler, logger, numberOfTimeSteps_, particleHandler, performGhostParticleUpdate(), removeDuplicatePeriodicParticles(), time_, timeStep_, wallHandler, and writeOutputFiles().

Referenced by solve().

◆ computeWallForces()

void DPMBase::computeWallForces ( BaseWall w)
virtual

Reimplemented in Mercury3D.

5264 {
5265  //compute forces for all particles that are neither fixed or ghosts
5266  for (auto p : particleHandler)
5267  {
5268  if (!p->isFixed() && p->getPeriodicFromParticle() == nullptr)
5269  {
5270  //w->computeForces(p);
5272  }
5273  }
5274 }

References computeForcesDueToWalls(), and particleHandler.

Referenced by computeAllForces(), and Mercury3D::computeWallForces().

◆ constructor()

void DPMBase::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().

A simple vector of vectors for collecting and ordering interactions in the OpenMP parallel environment

Provides all the necessary default values for the DPMBase() constructor. When called, will initialise a two-dimensional simulation (setSystemDimensions(2), setParticleDimensions(2)) with "normal" vertical gravity (gravity_ = Vec3D(0.0, -9.8, 0.0);) as well as defining an arbitrary length (1s) and XBalls viewing domain (0.01 x 0.01) and other relevant viewing parameters (e.g. colourscheme, scale...). The first block of text creates the necessary handlers and sets their content according to the current ("this") instance of the DPMBase superclass.

207 {
208  // sofStop function
209  setSoftStop();
210  //constructor();
211  dataFile.getFstream().precision(10);
212  fStatFile.getFstream().precision(10);
213  eneFile.getFstream().precision(10);
214  restartFile.getFstream().precision(
215  std::numeric_limits<double>::digits10); //highly accurate, so the overlap is accurate
216  statFile.getFstream().precision(10);
217  statFile.getFstream().setf(std::ios::left);
218  interactionFile.getFstream().precision(10);
219  name_ = ""; // needs to be user-specified, otherwise checkSettings throws error
220  //by default, the fileType of all files is ONE_FILE. However, by default we don't want an interaction file since it
221  // is very large.
222  interactionFile.setFileType(FileType::NO_FILE);
223 
224  runNumber_ = 0;
225 
226  //Decomposition direction for MPI
227  numberOfDomains_ = {1, 1, 1};
228 
229  //Check if MPI is already initialised
230  initialiseMPI();
231 
232  //This sets the maximum number of particles
237  cgHandler.setDPMBase(this);
239  wallHandler.setDPMBase(this);
245 
246  //set defaults for DPMBase parameters
249  setRestarted(false);
250  setGravity(Vec3D(0, 0, 0));
251 
252  //This is the parameter of the numerical part
253  setTime(0);
254  numberOfTimeSteps_ = 0;
255  setTimeMax(0);
256  timeStep_ = 0; // needs to be user-specified, otherwise checkSettings throws error
257  setSaveCount(20);
258 
259  //This sets the default xballs domain
260  min_ = Vec3D(0, 0, 0);
261  max_ = Vec3D(0, 0, 0); // needs to be user-specified, otherwise checkSettings throws error
262 
263  //sets the default write particles data in VTK format flag to false
264  writeParticlesVTK_ = false;
266  writeWallsVTK_ = FileType::NO_FILE;
267  vtkWriter_ = nullptr;
268 
269  setName(""); // needs to be user-specified, otherwise checkSettings throws error
270 
271  //Default mode is energy with no scale of the vectors
272  xBallsColourMode_ = 0;
273  xBallsVectorScale_ = -1;
274  xBallsScale_ = -1;
276  setAppend(false);
277 
278  //The default random seed is 0
280 
281  logger(DEBUG, "DPMBase problem constructor finished");
282 
283  readSpeciesFromDataFile_ = false;
284 
286 
287  //Set number of elements to write to the screen if a user wants to output write information to the terminal
288  nToWrite_ = 4;
289 }

References boundaryHandler, cgHandler, dataFile, domainHandler, eneFile, FATAL, fStatFile, File::getFstream(), DomainHandler::initialise(), PeriodicBoundaryHandler::initialise(), initialiseMPI(), interactionFile, interactionHandler, logger, max_, min_, name_, nToWrite_, numberOfDomains_, numberOfOMPThreads_, numberOfTimeSteps_, particleHandler, periodicBoundaryHandler, random, readSpeciesFromDataFile_, restartFile, runNumber_, setAppend(), BaseHandler< T >::setDPMBase(), File::setFileType(), setGravity(), setName(), setParticleDimensions(), RNG::setRandomSeed(), setRestarted(), setSaveCount(), setSoftStop(), setSystemDimensions(), setTime(), setTimeMax(), speciesHandler, statFile, timeStep_, vtkWriter_, wallHandler, writeParticlesVTK_, writeSuperquadricParticlesVTK_, writeWallsVTK_, xBallsAdditionalArguments_, xBallsColourMode_, xBallsScale_, and xBallsVectorScale_.

Referenced by DPMBase().

◆ continueSolve()

bool DPMBase::continueSolve ( ) const
protectedvirtual

A virtual function for deciding whether to continue the simulation, based on a user-specified criterion.

Used within the main loop of the 'solve()' routine to let the code know whether or not the time step should continue to be advanced, i.e. whether the simulation should be continued. By default this is always true but the user may redefine it to return false under certain desired circumstances.

Returns
bool (True or False)

Reimplemented in protectiveWall, ScalingTestInitialConditionsRelax, ScalingTestInitialConditionsRelax, DPM, InitialConditions< SpeciesType >, SilbertHstop, SilbertHstop, SilbertHstop, SilbertHstop, SilbertHstop, T_protectiveWall, CSCWalls, CSCInit, and ClosedCSCWalls.

1982 {
1983  return continueFlag_ != 0;
1984 }

References continueFlag_.

Referenced by solve().

◆ decompose()

void DPMBase::decompose ( )
virtual

Sends particles from processorId to the root processor.

Decomposes the simulation domain in a structured cube mesh of domains for parallel processing

This function takes the simulation domain boundaries and decomposes it into sub domains ready for parallel computations

3921 {
3922 #ifdef MERCURY_USE_MPI
3923 
3924  //If running in parallel build, but just running with one core - no domain decomposition required
3925  int numberOfRequiredProcessors = numberOfDomains_[Direction::XAXIS]*
3928  if (NUMBER_OF_PROCESSORS != numberOfRequiredProcessors)
3929  {
3930  logger(ERROR,"The domain decompositions expects % processors, but only % are requested.\n"
3931  "Either run your process using \"mpirun -np % [executable]\", "
3932  "or change the domain decomposition to e.g. setNumberOfDomains({%,1,1}).", numberOfRequiredProcessors, NUMBER_OF_PROCESSORS, numberOfRequiredProcessors, NUMBER_OF_PROCESSORS);
3933  }
3934 
3935  if (NUMBER_OF_PROCESSORS == 1) {return;}
3936 
3937  //Check if the simulation domain has been set
3938  logger.assert_always(getXMax() - getXMin() > 0,"Please set your simulation domain (setXMax(),setXmin()) before calling solve()");
3939  logger.assert_always(getYMax() - getYMin() > 0,"Please set your simulation domain (setYMax(),setYmin()) before calling solve()");
3940  logger.assert_always(getZMax() - getZMin() > 0,"Please set your simulation domain (setZMax(),setZmin()) before calling solve()");
3941 
3942  //Grab simulation domains
3943  std::vector<Mdouble> simulationMin{getXMin(), getYMin(), getZMin()};
3944  std::vector<Mdouble> simulationMax{getXMax(), getYMax(), getZMax()};
3945 
3946  //Check if the user input decomposition is correct
3947  logger.assert_always(numberOfDomains_[Direction::XAXIS] > 0,"Number of domain in x-direction incorrect: %",numberOfDomains_[Direction::XAXIS]);
3948  logger.assert_always(numberOfDomains_[Direction::YAXIS] > 0,"Number of domain in y-direction incorrect: %",numberOfDomains_[Direction::YAXIS]);
3949  logger.assert_always(numberOfDomains_[Direction::ZAXIS] > 0,"Number of domain in z-direction incorrect: %",numberOfDomains_[Direction::ZAXIS]);
3950 
3951  //Open domain decomposition, closed is not implemented
3952  bool open = true;
3953 
3954  //Check if the number of domains is equal to the number of processors
3956  "Number of Processors is not equal to number of domains. Processors %, domains, %",
3959 
3960  //Create all processor domains
3961 
3962  domainHandler.setDPMBase(this);
3963  domainHandler.createMesh(simulationMin, simulationMax, numberOfDomains_, open);
3964  logger(VERBOSE,"Number of domains: % | Number of processors: %",domainHandler.getNumberOfObjects(), NUMBER_OF_PROCESSORS);
3965  //logger.assert_always(domainHandler.getNumberOfObjects() == numberOfProcessors, "Invalid decomposition: Number of domains and processors are different");
3966 
3967  //Tell the current processor to which domain it belongs
3968  for (Domain* domain : domainHandler)
3969  {
3970  if (domain->getRank() == PROCESSOR_ID)
3971  {
3972  logger(VERBOSE,"processor: %, domain index: %",PROCESSOR_ID, domain->getIndex());
3973  domainHandler.setCurrentDomainIndex(domain->getIndex());
3974  }
3975  }
3976 
3977  //Define the mpi transfer types, which requires a definition of the species already
3979  logger.assert_always(speciesHandler.getNumberOfObjects() > 0, "Please create a particle species before calling solve()");
3981 
3982  //Make sure all processors are done with decomposition before proceeding
3983  logger(VERBOSE,"processor %: #real particles: %, #total particles: %", PROCESSOR_ID, particleHandler.getNumberOfRealObjects(), particleHandler.getSize());
3985 #endif
3986 }

References DomainHandler::createMesh(), domainHandler, ERROR, BaseHandler< T >::getNumberOfObjects(), ParticleHandler::getNumberOfRealObjects(), BaseHandler< T >::getSize(), getXMax(), getXMin(), getYMax(), getYMin(), getZMax(), getZMin(), MPIContainer::initialiseMercuryMPITypes(), MPIContainer::Instance(), logger, NUMBER_OF_PROCESSORS, numberOfDomains_, particleHandler, PROCESSOR_ID, DomainHandler::setCurrentDomainIndex(), BaseHandler< T >::setDPMBase(), speciesHandler, MPIContainer::sync(), VERBOSE, XAXIS, YAXIS, and ZAXIS.

Referenced by read(), and solve().

◆ deleteGhostParticles()

void DPMBase::deleteGhostParticles ( std::set< BaseParticle * > &  particlesToBeDeleted)
protected
Todo:
: doc
4923 {
4924  //Flush mixed particles from lists (MP particles are located in both structures)
4925  if (periodicBoundaryHandler.getSize() > 0)
4926  {
4927  //Flush particles from boundaries
4928  domainHandler.getCurrentDomain()->flushParticles(particlesToBeDeleted);
4929  periodicBoundaryHandler.flushParticles(particlesToBeDeleted);
4930  }
4931 
4932  //Clean communication lists
4935 
4936  //Delete the particles
4937  for (auto particle_it : particlesToBeDeleted)
4938  {
4939  particleHandler.removeGhostObject(particle_it->getIndex());
4940  }
4941 }

References Domain::cleanCommunicationLists(), PeriodicBoundaryHandler::cleanCommunicationLists(), domainHandler, PeriodicBoundaryHandler::flushParticles(), Domain::flushParticles(), DomainHandler::getCurrentDomain(), BaseHandler< T >::getSize(), particleHandler, periodicBoundaryHandler, and ParticleHandler::removeGhostObject().

Referenced by performGhostParticleUpdate().

◆ fillDomainWithParticles()

void DPMBase::fillDomainWithParticles ( unsigned  N = 50)

Inserts particles in the whole domain. THis is useful if you want to check whether the wall visualisation or wall computation is correct: First insert the walls, then the particles, then check in paraview if the walls and particles overlap

Parameters
N
2899  {
2900  logger.assert_always(speciesHandler.getSize()>0,"There needs to be at least one species");
2902  SphericalParticle p(s);
2904  Mdouble r = cbrt(getTotalVolume())/N;
2905  b.set(p, 100, getMin(), getMax(), {0, 0, 0}, {0, 0, 0});
2906  b.insertParticles(this);
2907  logger(INFO,"Inserted % particles",particleHandler.getSize());
2908  //setTimeMax(0);
2909  //solve();
2910 }

References BaseHandler< T >::getLastObject(), getMax(), getMin(), BaseHandler< T >::getSize(), getTotalVolume(), INFO, InsertionBoundary::insertParticles(), logger, particleHandler, CubeInsertionBoundary::set(), and speciesHandler.

◆ findNextExistingDataFile()

bool DPMBase::findNextExistingDataFile ( Mdouble  tMin,
bool  verbose = true 
)

Finds and opens the next data file, if such a file exists.

First, checks to see if the file type is MULTIPLE_FILES or MULTIPLE_FILES_PADDED and, if so, whether the file contains data (ending the function if not). Then, checks if the time corresponding to the current file exceeds the minimum value entered (tMin). If not, keeps looking through subsequent data files. When a data file that satisfies t > tMin is found and successfully opened, the function returns true.

Useful when fileType is chosen as MULTIPLE_FILES or MULTIPLE_FILES_PADDED, which write data corresponding to each time step as a separate, consecutively numbered file (see FileType).

Parameters
[in]tMinCompared with the t value belonging to the file being checked to see if it is viable.
[in]verboseAllows the function to give output to the screen if desired.
Returns
bool - true if the next file is found, false if not.
2564 {
2565  if (dataFile.getFileType() == FileType::MULTIPLE_FILES || dataFile.getFileType() == FileType::MULTIPLE_FILES_PADDED)
2566  {
2567  while (true)// This true corresponds to the if s
2568  {
2569  dataFile.open();
2570  //check if file exists and contains data
2571  int N;
2572  dataFile.getFstream() >> N;
2573  if (dataFile.getFstream().eof() || dataFile.getFstream().peek() == -1)
2574  {
2575  logger(WARN, "file % not found", dataFile.getName());
2576  return false;
2577  }
2578  //check if tmin condition is satisfied
2579  Mdouble t;
2580  dataFile.getFstream() >> t;
2581  if (t > tMin)
2582  {
2583  //set_file_counter(get_file_counter()-1);
2584  return true;
2585  }
2586  if (verbose)
2587  logger(VERBOSE, "Jumping file counter: %", dataFile.getCounter());
2588  }
2589  }
2590  return true;
2591 }

References dataFile, File::getCounter(), File::getFileType(), File::getFstream(), File::getName(), logger, NO_FILE, File::open(), verbose, VERBOSE, and WARN.

◆ finishStatistics()

void DPMBase::finishStatistics ( )
protectedvirtual

This function is overridden by StatisticsVector

Reimplemented in statistics_while_running< T >, and statistics_while_running< T >.

1917 {
1918  cgHandler.finish();
1919 }

References cgHandler, and CGHandler::finish().

Referenced by solve(), and Mercury3DRestart::writeOutputFiles().

◆ forceWriteOutputFiles()

void DPMBase::forceWriteOutputFiles ( )

Writes output files immediately, even if the current time step was not meant to be written. Also resets the last saved time step.

3861 {
3863  writeOutputFiles();
3864 }

References NEVER, setLastSavedTimeStep(), and writeOutputFiles().

Referenced by main(), FileReader::read(), and solve().

◆ gatherContactStatistics() [1/2]

void DPMBase::gatherContactStatistics ( )
protected
1890 {
1892  {
1893  c->gatherContactStatistics();
1894  }
1895 }

References interactionHandler.

Referenced by ChuteWithPeriodicInflow::computeInternalForces().

◆ gatherContactStatistics() [2/2]

void DPMBase::gatherContactStatistics ( unsigned int index1  UNUSED,
int index2  UNUSED,
Vec3D Contact  UNUSED,
Mdouble delta  UNUSED,
Mdouble ctheta  UNUSED,
Mdouble fdotn  UNUSED,
Mdouble fdott  UNUSED,
Vec3D P1_P2_normal_  UNUSED,
Vec3D P1_P2_tangential  UNUSED 
)
virtual

//Not unsigned index because of possible wall collisions.

no implementation but can be overidden in its derived classes.

1903 {
1904 }

Referenced by BaseInteraction::gatherContactStatistics().

◆ get1DParametersFromRunNumber()

std::vector< int > DPMBase::get1DParametersFromRunNumber ( int  sizeX) 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)

Let's say sizeX = 5, counter stored in COUNTER_DONOTDEL = 1. Substituting these values into the algorithm below implies that studyNum = 0 or 1. Everytime the code is executed the counter gets incremented and the values of studyNum and i are updated, which is returned as std::vector<int>

Parameters
[in]sizeXThe (integer) number of values to be tested in 1D parameter space.
Returns
std::vector<int> The current study numbers.
668 {
669  // Declare a vector of integers capable of storing 2 values
670  std::vector<int> temp(2);
671 
672  // Declare and initialise for the current simulation run number
673  int counter = getRunNumber();
674 
675  // Give studyNum value 0 if study is incomplete, otherwise value > 0
676  int studyNum = (counter-1)/sizeX;
677  counter = counter - sizeX*studyNum;
678 
679  int i = ((counter - 1) % sizeX) + 1;
680  logger(INFO,"StudyNum: % \t Counter: % \t i: %", studyNum, counter, i);
681  temp[0] = studyNum;
682  temp[1] = i;
683 
684  return temp;
685 }

References getRunNumber(), constants::i, INFO, and logger.

Referenced by ParameterStudy1DDemo::getCurrentStudyNum().

◆ get2DParametersFromRunNumber()

std::vector< int > DPMBase::get2DParametersFromRunNumber ( int  sizeX,
int  sizeY 
) 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)

Let's say sizeX = 2 and sizeY = 5, counter stored in COUNTER_DONOTDEL =1. The studySize = 10. Substituting these values into the below algorithm implies that studyNum = 0 or 1, everytime the code is executed the counter gets incremented and hence determined the values of studyNum, i and j which is returned as a std::vector<int>

Parameters
[in]sizeXThe (integer) number of values to be tested for one of the 2 parameters forming the 2D parameter space.
[in]sizeYThe (integer) number of values to be tested for the other of the 2 parameters forming the 2D parameter space.
Returns
std::vector<int>
696 {
697  //declares a vector of integers capable of storing 3 values,
698  std::vector<int> temp(3);
699  //declares and initialises an integer variable named "counter"
700  //with the current counter number, runNumber_
701  int counter = getRunNumber();
702  //calculates the total size of the study, i.e. the number of points
703  //in the 2D parameter space explored
704  int studySize = sizeX * sizeY;
705  //(counter - 1) / studySize gives a fraction comparing the number of runs conducted so far
706  //to the total size of the study, i.e. the total number of runs that need to be performed.
707  //since studyNum is an integer, will declare zero until an adequate number of runs has been performed,
708  //at which point it will equal 1
709  int studyNum = (counter - 1) / studySize;
710 
711  counter = counter - studySize * studyNum;
712  int i = ((counter - 1) % sizeX) + 1;
713  int j = ((counter - i) / sizeX) + 1;
714  logger(INFO,"StudyNum: % \t Counter: % \t i: % \t j: %", studyNum, counter, i, j);
715 
716  temp[0] = studyNum;
717  temp[1] = i;
718  temp[2] = j;
719 
720  return (temp);
721 }

References getRunNumber(), constants::i, INFO, and logger.

Referenced by ParameterStudy2DDemo::getCurrentStudyNum().

◆ get3DParametersFromRunNumber()

std::vector< int > DPMBase::get3DParametersFromRunNumber ( int  sizeX,
int  sizeY,
int  sizeZ 
) 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)

Let's say sizeX = 2, sizeY = 5 and sizeZ = 3, counter stored in COUNTER_DONOTDEL =1. The studySize = 30. Substituting these values into the below algorithm implies that studyNum = 0 or 1, everytime the code is executed the counter gets incremented and hence determined the values of studyNum, i,j and k which is returned as a std::vector<int>

Parameters
[in]sizeXThe (integer) number of values to be tested for one of the 3 parameters forming the 3D parameter space.
[in]sizeYThe (integer) number of values to be tested for one of the 3 parameters forming the 3D parameter space.
[in]sizeZThe (integer) number of values to be tested for one of the 3 parameters forming the 3D parameter space.
Returns
std::vector<int>
733 {
734  //declares a vector of integers capable of storing 4 values,
735  std::vector<int> temp(4);
736  //declares and initialises an integer variable named "counter"
737  //with the current counter number, runNumber_
738  int counter = getRunNumber();
739  //calculates the total size of the study, i.e. the number of points
740  //in the 3D parameter space explored
741  int studySize = sizeX * sizeY * sizeZ;
742  //(counter - 1) / studySize gives a fraction comparing the number of runs conducted so far
743  //to the total size of the study, i.e. the total number of runs that need to be performed.
744  //since studyNum is an integer, will declare zero until an adequate number of runs has been performed,
745  //at which point it will equal 1
746  int studyNum = (counter - 1) / studySize;
747 
748  counter = counter - studySize * studyNum;
749  int i = ((counter-1) % sizeX) + 1;
750  int j = static_cast<int>(std::floor((counter-1)/sizeX)) % sizeY + 1;
751  int k = static_cast<int>(std::floor((counter-1)/(sizeX*sizeY))) % sizeZ + 1;
752  logger(INFO,"StudyNum: % \t Counter: % \t i: % \t j: % \t k: %", studyNum, counter, i, j, k);
753 
754  temp[0] = studyNum;
755  temp[1] = i;
756  temp[2] = j;
757  temp[3] = k;
758 
759  return (temp);
760 }

References getRunNumber(), constants::i, INFO, and logger.

Referenced by ParameterStudy3DDemo::getCurrentStudyNum().

◆ getAppend()

bool DPMBase::getAppend ( ) const

Returns whether the "append" option is on or off.

Returns
true if the "append" option is on; false if the "append" option is off.
1502 {
1503  return append_;
1504 }

References append_.

Referenced by solve(), and writeEneHeader().

◆ getCentreOfMass()

Vec3D DPMBase::getCentreOfMass ( ) const

JMFT: Return the centre of mass of the system, excluding fixed particles.

Returns the centre of mass of particles, excluding fixed particles.

1606 {
1608 }

References ParticleHandler::getCentreOfMass(), and particleHandler.

Referenced by VerticalMixer::printTime().

◆ getCPUTime()

double DPMBase::getCPUTime ( )
inline
871 { return clock_.getCPUTime(); }

References clock_, and Time::getCPUTime().

◆ getCurrentDomain()

Domain * DPMBase::getCurrentDomain ( )

Function that returns a pointer to the domain corresponding to the processor.

Function that returns a pointer to the domain correseponding to the processor.

Returns
Pointer to a domain corresponding to the processor
5126 {
5128 }

References domainHandler, and DomainHandler::getCurrentDomain().

Referenced by checkInteractionWithBoundaries(), and PeriodicBoundaryHandler::clearCommunicationLists().

◆ getDataFile() [1/2]

File & DPMBase::getDataFile ( )

The non const version. Allows one to edit the File::dataFile.

Deprecated:
dataFile is now protected, so it can be used by all applications. Please don't use getDataFile() anymore.
Returns
File& (A reference of object type File i.e. File& dataFile)
304 {
305  return dataFile;
306 }

References dataFile.

◆ getDataFile() [2/2]

const File & DPMBase::getDataFile ( ) const

The const version. Does not allow for any editing of the File::dataFile.

Deprecated:
dataFile is now protected, so it can be used by all applications. Please don't use getDataFile() anymore.
Returns
const File& (A const reference of object type File i.e. const File& dataFile)
353 {
354  return dataFile;
355 }

References dataFile.

◆ getElasticEnergy()

◆ getEneFile() [1/2]

File & DPMBase::getEneFile ( )

The non const version. Allows to edit the File::eneFile.

Deprecated:
eneFile is now protected, so it can be used by all applications. Please don't use getEneFile() anymore.
Returns
File& (A reference of object type File i.e. File& eneFile)
312 {
313  return eneFile;
314 }

References eneFile.

◆ getEneFile() [2/2]

const File & DPMBase::getEneFile ( ) const

The const version. Does not allow for any editing of the File::eneFile.

Deprecated:
eneFile is now protected, so it can be used by all applications. Please don't use getEneFile() anymore.
Returns
const File& (A const reference of object type File i.e. const File& eneFile)
361 {
362  return eneFile;
363 }

References eneFile.

◆ getFStatFile() [1/2]

File & DPMBase::getFStatFile ( )

The non const version. Allows to edit the File::fStatFile.

Deprecated:
fStatFile is now protected, so it can be used by all applications. Please don't use getFStatFile() anymore.
Returns
File& (A reference of object type File i.e. File& fStatFile)
320 {
321  return fStatFile;
322 }

References fStatFile.

◆ getFStatFile() [2/2]

const File & DPMBase::getFStatFile ( ) const

The const version. Does not allow for any editing of the File::fStatFile.

Deprecated:
fStatFile is now protected, so it can be used by all applications. Please don't use getFStatFile() anymore.
Returns
const File& (A const reference of object type File i.e. const File& fStatFile)
369 {
370  return fStatFile;
371 }

References fStatFile.

◆ getGravitationalEnergy()

Mdouble DPMBase::getGravitationalEnergy ( ) const

Returns the global gravitational potential energy stored in the system.

Returns
gravitationalEnergy The total gravitational potential energy of all particles (relative to the origin).
1553 {
1554  Mdouble gravitationalEnergy = 0;
1555  for (const BaseParticle* const p : particleHandler)
1556  {
1557  // Don't consider fixed particles. 'Fixed' particles aren't necessarily
1558  // stationary; it just means their position is prescribed.
1559  if (!(p->isFixed()))
1560  {
1561  gravitationalEnergy += p->getMass() * Vec3D::dot((-getGravity()), p->getPosition());
1562  }
1563  }
1564  return gravitationalEnergy;
1565 }

References Vec3D::dot(), getGravity(), and particleHandler.

Referenced by getTotalEnergy().

◆ getGravity()

◆ getHGridUpdateEachTimeStep()

bool DPMBase::getHGridUpdateEachTimeStep ( ) const
virtual
Returns
bool (True or False)

Reimplemented in MercuryBase.

1710 {
1711  return true;
1712 }

Referenced by BaseParticle::integrateBeforeForceComputation().

◆ getInfo()

Mdouble DPMBase::getInfo ( const BaseParticle p) const
virtual

A virtual function that returns some user-specified information about a particle.

Returns
double

Reimplemented in WallSpecies, SegregationPeriodic, SegregationPeriodic, SegregationPeriodic, and ChuteWithPeriodicInflow.

1634 {
1635 // return p.getSpecies()->getId(); // was getIndex()
1636  return p.getInfo();
1637 }

References BaseParticle::getInfo().

◆ getInteractionFile() [1/2]

File & DPMBase::getInteractionFile ( )

Return a reference to the file InteractionsFile.

Returns
A reference of object type File i.e. File* interactionFile_
344 {
345  return interactionFile;
346 }

References interactionFile.

Referenced by BaseInteraction::BaseInteraction(), main(), setName(), solve(), and BaseInteraction::~BaseInteraction().

◆ getInteractionFile() [2/2]

const File & DPMBase::getInteractionFile ( ) const

\bief Returns a constant reference to an Interactions file

Returns
const File& (A const reference of object type std::string i.e. const std::string& name_)
Bug:
The InteractionFile does not work across multifiles.
393 {
394  return interactionFile;
395 }

◆ getKineticEnergy()

◆ getKineticStress()

Matrix3D DPMBase::getKineticStress ( ) const

Calculate the kinetic stress tensor in the system averaged over the whole volume.

The function calculate the kinetic stress tensor based on particle fluctuation velocity.

Returns
The kinetic stress of the whole system (all particles).
5216 {
5217  Matrix3D F; //set the kinetic energy tensor, this is in terms of Sum(m*v^2)
5218  Vec3D J; //set the momentum tensor
5219 
5220  //calculate stress for kinetic part
5221  for (const auto& p : particleHandler)
5222  {
5223  F += Matrix3D::dyadic(p->getVelocity(), p->getVelocity()) * p->getMass();
5224  J += p->getVelocity() * p->getMass();
5225  }
5226 
5227  Matrix3D stressKinetic = F - Matrix3D::dyadic(J, J) / getTotalMass();
5228  stressKinetic /= getTotalVolume();
5229  return stressKinetic;
5230 }

References Matrix3D::dyadic(), getTotalMass(), getTotalVolume(), and particleHandler.

Referenced by getTotalStress().

◆ getMax()

Vec3D DPMBase::getMax ( ) const
inline
644  { return max_; }

References max_.

Referenced by BaseWall::addParticlesAtWall(), RandomClusterInsertionBoundary::checkBoundaryBeforeTimeStep(), ClosedCSCWalls::ClosedCSCWalls(), commandLineCG(), InfiniteWall::createVTK(), CSCWalls::CSCWalls(), SubcriticalMaserBoundaryTEST::extendBottom(), fillDomainWithParticles(), MembraneDemo::fixMembraneEdges(), main(), FileReader::read(), Slide::set_Walls(), Domain::setBounds(), Domain::setRange(), ClosedCSCWalls::setupInitialConditions(), my_problem::setupInitialConditions(), Cstatic2d::setupInitialConditions(), VerticalMixer::setupInitialConditions(), Binary::setupInitialConditions(), FreeCooling2DinWalls::setupInitialConditions(), StressStrainControl::setupInitialConditions(), Penetration::setupInitialConditions(), DistributionToPSDSelfTest::setupInitialConditions(), InsertionBoundarySelfTest::setupInitialConditions(), MultiplePSDSelfTest::setupInitialConditions(), PolydisperseInsertionBoundarySelfTest::setupInitialConditions(), PSDManualInsertionSelfTest::setupInitialConditions(), PSDSelfTest::setupInitialConditions(), DPM::setupInitialConditions(), TwoParticleElasticCollisionInteraction::setupInitialConditions(), TriangulatedWallSelfTest::setupInitialConditions(), Packing::setupInitialConditions(), Packing::test(), TwoByTwoMPIDomainMPI4Test::TwoByTwoMPIDomainMPI4Test(), AxisymmetricIntersectionOfWalls::writeVTK(), HorizontalBaseScrew::writeVTK(), IntersectionOfWalls::writeVTK(), ScrewsymmetricIntersectionOfWalls::writeVTK(), and WallHandler::writeVTKBoundingBox().

◆ getMin()

Vec3D DPMBase::getMin ( ) const
inline

◆ getName()

◆ getNextTime()

Mdouble DPMBase::getNextTime ( ) const

Returns the current simulation time.

Returns
time_
814 {
815  return time_ + timeStep_;
816 }

References time_, and timeStep_.

Referenced by InsertionBoundary::checkBoundaryBeforeTimeStep(), and RandomClusterInsertionBoundary::checkBoundaryBeforeTimeStep().

◆ getNToWrite()

int DPMBase::getNToWrite ( ) const

get the number of elements to write to the

Gets nToWrite. If a user wants to output e.g. particle information to the screen we limit the number of outputs to nToWrite elements to not get an overflow of information in the terminal.

Parameters
[out]nToWrite_Number of elements to write to the screen
862 {
863  return nToWrite_;
864 }

References nToWrite_.

Referenced by write().

◆ getNumberOfDomains()

std::vector< unsigned > DPMBase::getNumberOfDomains ( )

returns the number of domains

number of domains in parallel code in terms of domains in x,y,z direction

Returns
Returns the number of domains in cartesian cooridates of the parallel mesh
5117 {
5118  return numberOfDomains_;
5119 }

References numberOfDomains_.

Referenced by RandomClusterInsertionBoundary::checkBoundaryBeforeTimeStep(), CGHandler::evaluateDataFiles(), CGHandler::evaluateRestartFiles(), and DomainHandler::getParticleDomainGlobalIndex().

◆ getNumberOfOMPThreads()

int DPMBase::getNumberOfOMPThreads ( ) const
1278 {
1279  //logger.assert_debug(numberOfOMPThreads_,"You need to set the number of OMP threads");
1280  return numberOfOMPThreads_;
1281 }

References numberOfOMPThreads_.

Referenced by SphericalIndenter::actionsBeforeTimeStep(), computeAllForces(), setNumberOfOMPThreads(), and write().

◆ getNumberOfTimeSteps()

◆ getParticleDimensions()

unsigned int DPMBase::getParticleDimensions ( ) const

Returns the particle dimensionality.

Returns
particleDimensions_ The dimensionality of the particles. (Note that the system may possess a different dimensionality).
1459 {
1460  return particleDimensions_;
1461 }

References particleDimensions_.

Referenced by BaseParticle::getParticleDimensions(), ParticleSpecies::getVolumeFromRadius(), and write().

◆ getParticlesWriteVTK()

bool DPMBase::getParticlesWriteVTK ( ) const

Returns whether particles are written in a VTK file.

The VTK format is used for visualisation in Paraview.

Todo:
Move this (and the set) to ParticleHandler.
Returns
bool
977 {
978  return writeParticlesVTK_;
979 }

References writeParticlesVTK_.

Referenced by writePythonFileForVTKVisualisation(), and writeVTKFiles().

◆ getRestarted()

bool DPMBase::getRestarted ( ) const

Returns the flag denoting if the simulation was restarted or not.

Returns
restarted_
1485 {
1486  return restarted_;
1487 }

References restarted_.

Referenced by autoNumber(), solve(), and writeOutputFiles().

◆ getRestartFile() [1/2]

File & DPMBase::getRestartFile ( )

The non const version. Allows to edit the File::restartFile.

Deprecated:
restartFile is now protected, so it can be used by all applications. Please don't use getRestartFile() anymore.
Returns
File& (A reference of object type File i.e. File& restartFile)
328 {
329  return restartFile;
330 }

References restartFile.

◆ getRestartFile() [2/2]

const File & DPMBase::getRestartFile ( ) const

The const version. Does not allow for any editing of the File::restartFile.

Deprecated:
restartFile is now protected, so it can be used by all applications. Please don't use getRestartFile() anymore.
Returns
const File& (A const reference of object type File i.e. const File& restartFile)
377 {
378  return restartFile;
379 }

References restartFile.

◆ getRestartVersion()

std::string DPMBase::getRestartVersion ( ) const

This is to take into account for different Mercury versions. Returns the version of the restart file.

Returns
restartVersion_
1467 {
1468  return restartVersion_;
1469 }

References restartVersion_.

Referenced by Chute::read().

◆ getRotation()

bool DPMBase::getRotation ( ) const
inline

Indicates whether particle rotation is enabled or disabled.

Returns
true if particle rotation is enabled; false if particle rotation is disabled.
560  { return rotation_; }

References rotation_.

Referenced by computeForcesDueToWalls(), computeInternalForce(), BaseParticle::integrateBeforeForceComputation(), and SphericalParticleVtkWriter::writeVTKAngularVelocity().

◆ getRotationalEnergy()

Mdouble DPMBase::getRotationalEnergy ( ) const

JMFT Returns the global rotational energy stored in the system.

Todo:
TW why is the ene_rot commented out
1569 {
1570  Mdouble ene_rot = 0;
1571  for (std::vector<BaseParticle*>::const_iterator it = particleHandler.begin(); it != particleHandler.end(); ++it)
1572  {
1573  // See above.
1574  if (!(*it)->isFixed())
1575  {
1576  // ene_rot += .5 * (*it)->getInertia() * (*it)->getAngularVelocity().getLengthSquared();
1577  }
1578  }
1579  return ene_rot;
1580 }

References BaseHandler< T >::begin(), BaseHandler< T >::end(), and particleHandler.

Referenced by getTotalEnergy(), and TangentialSpringEnergyConservationUnitTest::printTime().

◆ getRunNumber()

int DPMBase::getRunNumber ( ) const

This returns the current value of the counter (runNumber_)

A simple "get function" which allows the user to retrieve the current value corresponding to the run number counter, runNumber_

Returns
runNumber_ - the stored value of the current run number, i.e. the number of files corresponding to a given Mercury script that have been produced in a given directory.
615 {
616  return runNumber_;
617 }

References runNumber_.

Referenced by get1DParametersFromRunNumber(), get2DParametersFromRunNumber(), get3DParametersFromRunNumber(), and solve().

◆ getStatFile() [1/2]

File & DPMBase::getStatFile ( )

The non const version. Allows to edit the File::statFile.

Deprecated:
statFile is now protected, so it can be used by all applications. Please don't use getStatFile() anymore.
Returns
File& (A reference of object type File i.e. File& statFile)
336 {
337  return statFile;
338 }

References statFile.

◆ getStatFile() [2/2]

const File & DPMBase::getStatFile ( ) const

The const version. Does not allow for any editing of the File::statFile.

Deprecated:
statFile is now protected, so it can be used by all applications. Please don't use getStatFile() anymore.
Returns
const File& (A const reference of object type File i.e. const File& statFile)
385 {
386  return statFile;
387 }

References statFile.

◆ getStaticStress()

Matrix3D DPMBase::getStaticStress ( ) const

Calculate the static stress tensor in the system averaged over the whole volume.

The function calculate the static stress tensor based on particle contact force and contact normal branch vector.

Returns
The static stress of the whole system (all interactions).
5238 {
5239  //stress components calculation variables
5240  Matrix3D stressStatic;
5241 
5242  //calculate the static stress tensor based on all the interactions
5243  for (const auto i : interactionHandler)
5244  {
5245  stressStatic += Matrix3D::dyadic(i->getForce(), i->getNormal()) * i->getDistance();
5246  }
5247 
5248  stressStatic /= getTotalVolume();
5249  return stressStatic;
5250 }

References Matrix3D::dyadic(), getTotalVolume(), constants::i, and interactionHandler.

Referenced by getTotalStress(), and DPM::printTime().

◆ getSuperquadricParticlesWriteVTK()

bool DPMBase::getSuperquadricParticlesWriteVTK ( ) const
Returns
bool
985 {
987 }

References writeSuperquadricParticlesVTK_.

Referenced by writeVTKFiles().

◆ getSystemDimensions()

unsigned int DPMBase::getSystemDimensions ( ) const

Returns the system dimensionality.

Returns
systemDimensions_ The dimensionality of the system. (Note that particles may possess a different dimensionality.)
1422 {
1423  return systemDimensions_;
1424 }

References systemDimensions_.

Referenced by HGridOptimiser::initialise(), outputXBallsData(), readNextDataFile(), write(), inflowFromPeriodic::writeXBallsScript(), and ChuteWithPeriodicInflow::writeXBallsScript().

◆ getTime()

Mdouble DPMBase::getTime ( ) const

Returns the current simulation time.

Returns
time_
806 {
807  return time_;
808 }

References time_.

Referenced by SilbertHstop::actionAfterTimeStep(), Chutebelt::actionsAfterTimeStep(), MaserRepeatedOutInMPI2Test::actionsAfterTimeStep(), FreeCooling2DinWallsDemo::actionsAfterTimeStep(), FreeCooling3DDemoProblem::actionsAfterTimeStep(), FreeCooling3DinWallsDemo::actionsAfterTimeStep(), FreeCoolingDemoProblem::actionsAfterTimeStep(), HourGlass::actionsAfterTimeStep(), MinimalExampleDrum::actionsAfterTimeStep(), BoundariesSelfTest::actionsAfterTimeStep(), FluxAndPeriodicBoundarySelfTest::actionsAfterTimeStep(), FluxBoundarySelfTest::actionsAfterTimeStep(), DPM::actionsAfterTimeStep(), SphericalIndenter::actionsAfterTimeStep(), BouncingSuperQuadric::actionsAfterTimeStep(), GranularCollapse::actionsAfterTimeStep(), SphericalSuperQuadricCollision::actionsAfterTimeStep(), ContactDetectionNormalSpheresTest::actionsAfterTimeStep(), ContactDetectionRotatedSpheresTest::actionsAfterTimeStep(), Tutorial11::actionsAfterTimeStep(), BaseCluster::actionsAfterTimeStep(), Slide::actionsBeforeTimeStep(), Chutebelt::actionsBeforeTimeStep(), LawinenBox::actionsBeforeTimeStep(), DPM::actionsBeforeTimeStep(), SmoothChute::actionsBeforeTimeStep(), Binary::actionsBeforeTimeStep(), AngleOfRepose::actionsBeforeTimeStep(), ConstantRestitutionSelfTest::actionsBeforeTimeStep(), CoilSelfTest::actionsBeforeTimeStep(), DrumRot::actionsBeforeTimeStep(), RotatingDrum::actionsBeforeTimeStep(), QuaternionWallUnitTest::actionsBeforeTimeStep(), PeriodicWallsWithSlidingFrictionUnitTest::actionsBeforeTimeStep(), SaveCountUnitTest::actionsBeforeTimeStep(), AirySavageHutter::actionsOnRestart(), TimeDependentPeriodicBoundary::checkBoundaryAfterParticlesMove(), commandLineCG(), ChuteWithPeriodicInflow::computeInternalForces(), SilbertHstop::continueSolve(), TimeDependentPeriodicBoundary::createGhostParticle(), BaseCluster::decreaseForce(), CGHandler::evaluateDataFiles(), CGHandler::evaluateRestartFiles(), LeesEdwardsBoundary::getCurrentShift(), LeesEdwardsBoundary::getCurrentVelocity(), HorizontalBaseScrew::getDistanceAndNormal(), vibratedBed::getPrescribedVelocity(), BaseCluster::increaseForce(), integrateAfterForceComputation(), integrateBeforeForceComputation(), isTimeEqualTo(), helpers::loadingTest(), main(), helpers::normalAndTangentialLoadingTest(), helpers::objectivenessTest(), outputXBallsData(), LiquidMigrationMPI2Test::outputXBallsData(), LiquidMigrationSelfTest::outputXBallsData(), SphericalIndenter::outputXBallsData(), inflowFromPeriodic::printTime(), ClosedCSCRestart::printTime(), ClosedCSCRun::printTime(), ClosedCSCWalls::printTime(), CSCInit::printTime(), CSCRestart::printTime(), CSCRun::printTime(), CSCWalls::printTime(), ChuteWithPeriodicInflow::printTime(), printTime(), T_protectiveWall::printTime(), LawinenBox::printTime(), HorizontalMixer::printTime(), NozzleDemo::printTime(), VerticalMixer::printTime(), ForceLawsMPI2Test::printTime(), ParticleInclusion::printTime(), SilbertPeriodic::printTime(), CLiveStatistics< T >::printTime(), statistics_while_running< T >::printTime(), vibratedBed::printTime(), ConstantMassFlowMaserBoundaryMixedSpeciesSelfTest::printTime(), ConstantMassFlowMaserSelfTest::printTime(), CubeDeletionBoundarySelfTest::printTime(), DeletionBoundarySelfTest::printTime(), DistributionToPSDSelfTest::printTime(), InsertionBoundarySelfTest::printTime(), MultiplePSDSelfTest::printTime(), NozzleSelfTest::printTime(), PolydisperseInsertionBoundarySelfTest::printTime(), PSDManualInsertionSelfTest::printTime(), PSDSelfTest::printTime(), LiquidMigrationSelfTest::printTime(), InitialConditions< SpeciesType >::printTime(), SinterPair::printTime(), SphericalIndenter::printTime(), DPM::printTime(), protectiveWall::printTime(), RandomClusterInsertionBoundarySelfTest::printTime(), viscoElasticUnitTest::printTime(), regimeForceUnitTest::printTime(), BaseCluster::printTime(), Chute::printTime(), FileReader::read(), BaseWall::renderWall(), CGHandler::restart(), statistics_while_running< T >::run(), my_problem::setupInitialConditions(), NozzleDemo::setupInitialConditions(), Binary::setupInitialConditions(), NozzleSelfTest::setupInitialConditions(), DrumRot::setupInitialConditions(), RotatingDrum::setupInitialConditions(), BaseCluster::setupInitialConditions(), ShearBoxBoundary::shiftHorizontalPosition(), LeesEdwardsBoundary::shiftVerticalPosition(), solve(), Domain::updateParticles(), LeesEdwardsBoundary::write(), write(), writeEneTimeStep(), LawinenBox::writeEneTimeStep(), Drum::writeEneTimeStep(), Penetration::writeEneTimeStep(), Silo::writeEneTimeStep(), SingleParticle< SpeciesType >::writeEneTimeStep(), Sintering::writeEneTimeStep(), SphericalIndenter::writeEneTimeStep(), SlidingFrictionUnitTest::writeEneTimeStep(), writeFstatHeader(), protectiveWall::writeFstatHeader(), BaseInteraction::writeInteraction(), ClosedCSCRestart::writeOutputFiles(), CSCRestart::writeOutputFiles(), BaseCluster::writeToCdatFile(), BaseCluster::writeToOverlFile(), HorizontalBaseScrew::writeVTK(), and writeVTKFiles().

◆ getTimeMax()

Mdouble DPMBase::getTimeMax ( ) const

Returns the maximum simulation duration.

Returns
timeMax_
886 {
887  return timeMax_;
888 }

References timeMax_.

Referenced by Slide::actionsBeforeTimeStep(), AngleOfRepose::actionsBeforeTimeStep(), AirySavageHutter::actionsOnRestart(), ChutePeriodicDemo::ChutePeriodicDemo(), ForceLawsMPI2Test::ForceLawsMPI2Test(), helpers::loadingTest(), main(), helpers::normalAndTangentialLoadingTest(), helpers::objectivenessTest(), printTime(), T_protectiveWall::printTime(), LawinenBox::printTime(), HorizontalMixer::printTime(), NozzleDemo::printTime(), SilbertPeriodic::printTime(), CLiveStatistics< T >::printTime(), statistics_while_running< T >::printTime(), vibratedBed::printTime(), ConstantMassFlowMaserBoundaryMixedSpeciesSelfTest::printTime(), ConstantMassFlowMaserSelfTest::printTime(), DistributionToPSDSelfTest::printTime(), InsertionBoundarySelfTest::printTime(), MultiplePSDSelfTest::printTime(), NozzleSelfTest::printTime(), PolydisperseInsertionBoundarySelfTest::printTime(), PSDManualInsertionSelfTest::printTime(), PSDSelfTest::printTime(), SinterPair::printTime(), protectiveWall::printTime(), RandomClusterInsertionBoundarySelfTest::printTime(), regimeForceUnitTest::printTime(), Chute::printTime(), readNextArgument(), Mercury3DRestart::readNextArgument(), regimeForceUnitTest::regimeForceUnitTest(), save(), ChutePeriodic::setup(), CSCRun::setupInitialConditions(), MarbleRun::setupInitialConditions(), Drum::setupInitialConditions(), Penetration::setupInitialConditions(), Silo::setupInitialConditions(), UnionOfWalls::setupInitialConditions(), SingleParticle< SpeciesType >::setupInitialConditions(), MovingIntersectionOfWallsUnitTest_Basic::setupInitialConditions(), MovingWall::setupInitialConditions(), SeparateFilesSelfTest::setupInitialConditions(), MercuryProblem::setupMercuryProblem(), Siegen::Siegen(), Slide::Slide(), solve(), write(), and protectiveWall::writeFstatHeader().

◆ getTimeStep()

Mdouble DPMBase::getTimeStep ( ) const

Returns the simulation time step.

Returns
timeStep_ The current (Mdouble) value of the simulation time step.
1242 {
1243  return timeStep_;
1244 }

References timeStep_.

Referenced by ClosedCSCRestart::actionsAfterTimeStep(), ClosedCSCRun::actionsAfterTimeStep(), ClosedCSCWalls::actionsAfterTimeStep(), HorizontalMixer::actionsAfterTimeStep(), CubicCell::actionsAfterTimeStep(), FreeCooling2DinWallsDemo::actionsAfterTimeStep(), FreeCooling3DDemoProblem::actionsAfterTimeStep(), FreeCooling3DinWallsDemo::actionsAfterTimeStep(), FreeCoolingDemoProblem::actionsAfterTimeStep(), HourGlass::actionsAfterTimeStep(), MarbleRun::actionsAfterTimeStep(), SphericalIndenter::actionsAfterTimeStep(), GranularCollapse::actionsAfterTimeStep(), SlidingSpheresUnitTest::actionsAfterTimeStep(), SphericalSuperQuadricCollision::actionsAfterTimeStep(), ContactDetectionNormalSpheresTest::actionsAfterTimeStep(), ContactDetectionRotatedSpheresTest::actionsAfterTimeStep(), Tutorial11::actionsAfterTimeStep(), BaseCluster::actionsAfterTimeStep(), HeatFluidCoupledParticle::actionsAfterTimeStep(), Slide::actionsBeforeTimeStep(), Chutebelt::actionsBeforeTimeStep(), LawinenBox::actionsBeforeTimeStep(), DPM::actionsBeforeTimeStep(), SmoothChute::actionsBeforeTimeStep(), CoilSelfTest::actionsBeforeTimeStep(), BaseCluster::actionsOnRestart(), StressStrainControlBoundary::activateStrainRateControl(), NautaMixer::addSpeciesAndSetTimeStepAndSaveCount(), BaseCluster::calculateTimeStep(), HeaterBoundary::checkBoundaryAfterParticleMoved(), DropletBoundary::checkBoundaryAfterParticlesMove(), checkSettings(), ChutePeriodicDemo::ChutePeriodicDemo(), ClosedCSCRun::ClosedCSCRun(), ClosedCSCWalls::ClosedCSCWalls(), FrictionInteraction::computeFrictionForce(), MindlinInteraction::computeFrictionForce(), MindlinRollingTorsionInteraction::computeFrictionForce(), ChuteWithPeriodicInflow::computeInternalForces(), SinterInteraction::computeNormalForce(), SinterLinInteraction::computeNormalForce(), HertzianSinterInteraction::computeSinterForce(), SlidingFrictionInteraction::computeSlidingSpring(), SlidingFrictionInteraction::computeSlidingSpringSuperQuadric(), StressStrainControlBoundary::computeStrainRate(), SilbertHstop::continueSolve(), CSCWalls::CSCWalls(), StressStrainControlBoundary::determineStressControlledShearBoundaries(), ForceLawsMPI2Test::ForceLawsMPI2Test(), ChuteWithHopper::getTimeStepRatio(), integrateAfterForceComputation(), ChuteWithPeriodicInflow::integrateBeforeForceComputation(), integrateBeforeForceComputation(), inflowFromPeriodic::integrateBeforeForceComputation(), isTimeEqualTo(), LeesEdwardsDemo::LeesEdwardsDemo(), main(), ChuteBottom::makeRoughBottom(), ParticleCreation::ParticleCreation(), readNextArgument(), readParAndIniFiles(), regimeForceUnitTest::regimeForceUnitTest(), Screw::rotate(), save(), Cstatic2d::set_particle_properties(), Cstatic3D::set_particle_properties(), SilbertPeriodic::set_study(), ChutePeriodic::setup(), ChuteWithContraction::setup_particles_initial_conditions(), CSCRun::setupInitialConditions(), ShiftingConstantMassFlowMaserBoundarySelfTest::setupInitialConditions(), ShiftingMaserBoundarySelfTest::setupInitialConditions(), ChutePeriodic::setupInitialConditions(), MarbleRun::setupInitialConditions(), GetDistanceAndNormalForIntersectionOfWalls::setupInitialConditions(), GetDistanceAndNormalForScrew::setupInitialConditions(), GetDistanceAndNormalForTriangleWall::setupInitialConditions(), Drum::setupInitialConditions(), Penetration::setupInitialConditions(), Silo::setupInitialConditions(), ContactDetectionIntersectionOfWallsTest::setupInitialConditions(), GetDistanceAndNormalForTriangleWalls::setupInitialConditions(), UnionOfWalls::setupInitialConditions(), SingleParticle< SpeciesType >::setupInitialConditions(), InitialConditions< SpeciesType >::setupInitialConditions(), EllipticalSuperQuadricCollision::setupInitialConditions(), ParticleParticleInteraction::setupInitialConditions(), ParticleParticleInteractionWithPlasticForces::setupInitialConditions(), ParticleWallInteraction::setupInitialConditions(), Packing::setupInitialConditions(), CreateDataAndFStatFiles::setupInitialConditions(), HertzianSinterForceUnitTest::setupInitialConditions(), MovingIntersectionOfWallsUnitTest_Basic::setupInitialConditions(), MovingWall::setupInitialConditions(), PlasticForceUnitTest::setupInitialConditions(), SeparateFilesSelfTest::setupInitialConditions(), BaseCluster::setupInitialConditions(), MercuryProblem::setupMercuryProblem(), Siegen::Siegen(), SilbertHstop::SilbertHstop(), Slide::Slide(), TangentialSpringEnergyConservationUnitTest::TangentialSpringEnergyConservationUnitTest(), TimeDependentPeriodicBoundary3DSelfTest::TimeDependentPeriodicBoundary3DSelfTest(), TimeDependentPeriodicBoundaryTest::TimeDependentPeriodicBoundaryTest(), TriangulatedScrewSelfTest::TriangulatedScrewSelfTest(), TriangulatedStepSelfTest::TriangulatedStepSelfTest(), TriangulatedStepWallSelfTest::TriangulatedStepWallSelfTest(), TriangulatedWallSelfTest::TriangulatedWallSelfTest(), StressStrainControlBoundary::updateDomainSize(), and write().

◆ getTotalEnergy()

◆ getTotalMass()

Mdouble DPMBase::getTotalMass ( ) const

JMFT: Return the total mass of the system, excluding fixed particles.

Returns
double
1590 {
1591  /*
1592  double mass_sum = 0;
1593  for (std::vector<BaseParticle*>::const_iterator it = particleHandler.begin(); it != particleHandler.end(); ++it)
1594  if (!(*it)->isFixed())
1595  mass_sum += (*it)->getMass();
1596  return mass_sum;
1597  */
1598  return particleHandler.getMass();
1599 }

References ParticleHandler::getMass(), and particleHandler.

Referenced by getKineticStress(), setMeanVelocity(), and setMeanVelocityAndKineticEnergy().

◆ getTotalMomentum()

Vec3D DPMBase::getTotalMomentum ( ) const

JMFT: Return the total momentum of the system, excluding fixed particles.

Returns the total momentum in the system, excluding fixed particles (which will usually, but not always, have velocity 0)

Returns
Vec3D
1616 {
1617  return particleHandler.getMomentum();
1618  /*
1619  Vec3D total_momentum = Vec3D(0,0,0);
1620  for (std::vector<BaseParticle*>::const_iterator it = particleHandler.begin(); it != particleHandler.end(); ++it)
1621  if (!(*it)->isFixed())
1622  total_momentum += (*it)->getMass() * (*it)->getVelocity();
1623  return total_momentum;
1624  */
1625 }

References ParticleHandler::getMomentum(), and particleHandler.

Referenced by setMeanVelocity(), and setMeanVelocityAndKineticEnergy().

◆ getTotalStress()

Matrix3D DPMBase::getTotalStress ( ) const

Calculate the total stress tensor in the system averaged over the whole volume.

The function calculate the total stress tensor which is the sum of kinetic and static stress tensors.

Returns
The total stress of the whole system (all particles and all interactions).
5258 {
5259  return getKineticStress() + getStaticStress();
5260 }

References getKineticStress(), and getStaticStress().

Referenced by StressStrainControlBoundary::computeStrainRate().

◆ getTotalVolume()

Mdouble DPMBase::getTotalVolume ( ) const

Get the total volume of the cuboid system.

Returns
The total volume of the domain.
5207 {
5208  return (getXMax() - getXMin()) * (getYMax() - getYMin()) * (getZMax() - getZMin());
5209 }

References getXMax(), getXMin(), getYMax(), getYMin(), getZMax(), and getZMin().

Referenced by fillDomainWithParticles(), getKineticStress(), and getStaticStress().

◆ getVtkWriter()

ParticleVtkWriter * DPMBase::getVtkWriter ( ) const
5131 {
5132  return vtkWriter_;
5133 }

References vtkWriter_.

◆ getWallsWriteVTK()

FileType DPMBase::getWallsWriteVTK ( ) const

Returns whether walls are written in a VTK file.

The VTK file is used for visualisation in Paraview.

Todo:
Move this (and the set) to WallHandler.
Returns
bool
966 {
967  return writeWallsVTK_;
968 }

References writeWallsVTK_.

Referenced by writePythonFileForVTKVisualisation(), and writeVTKFiles().

◆ getWallTime()

double DPMBase::getWallTime ( )
inline
876 { return clock_.getWallTime(); }

References clock_, and Time::getWallTime().

◆ getXBallsAdditionalArguments()

std::string DPMBase::getXBallsAdditionalArguments ( ) const

Returns the additional arguments for xballs.

Returns
xBallsAdditionalArguments_
1347 {
1349 }

References xBallsAdditionalArguments_.

Referenced by write(), inflowFromPeriodic::writeXBallsScript(), and ChuteWithPeriodicInflow::writeXBallsScript().

◆ getXBallsColourMode()

int DPMBase::getXBallsColourMode ( ) const

Get the xballs colour mode (CMode).

Returns the integer value corresponding to the colour scheme used by the XBalls visualisation software. See also setXBallsColourMode and the Visualising data in xballs

Returns
int xBallsColourMode_ The integer value corresponding to the colour scheme used by the XBalls visualisation software.
1302 {
1303  return xBallsColourMode_;
1304 }

References xBallsColourMode_.

Referenced by inflowFromPeriodic::writeXBallsScript(), and ChuteWithPeriodicInflow::writeXBallsScript().

◆ getXBallsScale()

double DPMBase::getXBallsScale ( ) const

Returns the scale of the view in xballs.

Returns
double xBallsScale_ The scaling or "zoom" - corresponds tol the XBalls "-s" flag. Values > 1 mean a "zoomed out" view, values < 1 give a "zoomed in" view.
1364 {
1365  return xBallsScale_;
1366 }

References xBallsScale_.

Referenced by inflowFromPeriodic::writeXBallsScript(), and ChuteWithPeriodicInflow::writeXBallsScript().

◆ getXBallsVectorScale()

double DPMBase::getXBallsVectorScale ( ) const

Returns the scale of vectors used in xballs.

Returns the length of the vectors which represent particle velocities in XBalls visualisations (see also setXBallsVectorScale and the Visualising data in xballs).

Returns
double xBallsVectorScale_ The value of the vector length used in XBalls visualisations. A value of 100 sets the length to 1 particle radius, 1000 sets it to 10 particle radii etc.
1322 {
1323  return xBallsVectorScale_;
1324 }

References xBallsVectorScale_.

Referenced by inflowFromPeriodic::writeXBallsScript(), and ChuteWithPeriodicInflow::writeXBallsScript().

◆ getXMax()

Mdouble DPMBase::getXMax ( ) const
inline

If the length of the problem domain in x-direction is XMax - XMin, then getXMax() returns XMax.

608  { return max_.x(); }

References max_, and Vec3D::x().

Referenced by LeesEdwardsDemo::actionsAfterTimeStep(), TimeDependentPeriodicBoundary3DSelfTest::actionsAfterTimeStep(), TimeDependentPeriodicBoundaryTest::actionsAfterTimeStep(), Chutebelt::actionsAfterTimeStep(), Chutebelt::actionsBeforeTimeStep(), Chutebelt::actionsOnRestart(), StressStrainControlBoundary::activateStrainRateControl(), ChuteWithPeriodicInflow::AddContinuingBottom(), NautaMixer::addParticles(), NautaMixer::addParticlesAtWall(), Funnel::check_funnel(), checkSettings(), ChutePeriodicDemo::ChutePeriodicDemo(), ChuteWithContraction::ChuteWithContraction(), ChuteWithPeriodicInflowAndContinuingBottom::ChuteWithPeriodicInflowAndContinuingBottom(), ChuteWithPeriodicInflowAndContraction::ChuteWithPeriodicInflowAndContraction(), ChuteWithPeriodicInflowAndVariableBottom::ChuteWithPeriodicInflowAndVariableBottom(), ChuteWithPeriodicInflow::cleanChute(), ChuteWithContraction::cleanChute(), Chute::cleanChute(), ClosedCSCRestart::ClosedCSCRestart(), ClosedCSCRun::ClosedCSCRun(), ClosedCSCWalls::ClosedCSCWalls(), ContractionWithPeriodicInflow::ContractionWithPeriodicInflow(), LawinenBox::create_inflow_particle(), ChutePeriodic::create_inflow_particle(), FlowRule::create_inflow_particle(), SilbertPeriodic::create_inflow_particle(), Chute::createBottom(), Chute::createFlowParticle(), CSCWalls::CSCWalls(), decompose(), StressStrainControlBoundary::determineLengthAndCentre(), StressStrainControlBoundary::determineStressControlledShearBoundaries(), Chute::getChuteLength(), ChuteWithHopper::getChuteLength(), ChuteWithHopper::getMaximumVelocityInducedByGravity(), DomainHandler::getParticleDomainGlobalIndex(), getTotalVolume(), MarbleRun::includeInDomain(), Indenter::Indenter(), inflowFromPeriodic::inflowFromPeriodic(), InitialConditions< SpeciesType >::InitialConditions(), HGridOptimiser::initialise(), HorizontalMixer::introduceParticlesAtWall(), ContactDetectionIntersectionOfWallsTest::introduceParticlesAtWall(), HorizontalMixer::introduceParticlesInDomain(), LawinenBox::LawinenBox(), ChuteWithPeriodicInflow::loadPeriodicBox(), main(), MercuryCGSelfTest::MercuryCGSelfTest(), outputXBallsData(), LiquidMigrationMPI2Test::outputXBallsData(), LiquidMigrationSelfTest::outputXBallsData(), SphericalIndenter::outputXBallsData(), ParticleCreation::ParticleCreation(), protectiveWall::protectiveWall(), readParAndIniFiles(), regimeForceUnitTest::regimeForceUnitTest(), save(), ClosedCSCWalls::saveWalls(), CSCWalls::saveWalls(), StressStrainControlBoundary::set(), ChuteWithHopper::setHopperShift(), SphericalIndenter::setIndenterHeight(), ClosedCSCWalls::setupInitialConditions(), CSCInit::setupInitialConditions(), CSCWalls::setupInitialConditions(), ChutePeriodic::setupInitialConditions(), my_problem::setupInitialConditions(), LeesEdwardsDemo::setupInitialConditions(), TimeDependentPeriodicBoundary3DSelfTest::setupInitialConditions(), TimeDependentPeriodicBoundaryTest::setupInitialConditions(), Cstatic2d::setupInitialConditions(), statistics_while_running< T >::setupInitialConditions(), Chutebelt::setupInitialConditions(), T_protectiveWall::setupInitialConditions(), LawinenBox::setupInitialConditions(), MercuryLogo::setupInitialConditions(), Binary::setupInitialConditions(), LiquidMigrationMPI2Test::setupInitialConditions(), CubicCell::setupInitialConditions(), FreeCooling2DinWalls::setupInitialConditions(), FreeCooling2DinWallsDemo::setupInitialConditions(), FreeCooling3DDemoProblem::setupInitialConditions(), FreeCooling3DinWallsDemo::setupInitialConditions(), FreeCoolingDemoProblem::setupInitialConditions(), HeaterBoundaryTest::setupInitialConditions(), HourGlass2D::setupInitialConditions(), HourGlass::setupInitialConditions(), MarbleRun::setupInitialConditions(), AngleOfRepose::setupInitialConditions(), SilbertPeriodic::setupInitialConditions(), GetDistanceAndNormalForIntersectionOfWalls::setupInitialConditions(), GetDistanceAndNormalForScrew::setupInitialConditions(), GetDistanceAndNormalForTriangleWall::setupInitialConditions(), RotatingDrum::setupInitialConditions(), LeesEdwardsSelfTest::setupInitialConditions(), PolydisperseInsertionBoundarySelfTest::setupInitialConditions(), CGHandlerSelfTest::setupInitialConditions(), NewtonsCradleSelftest::setupInitialConditions(), ParticleCreation::setupInitialConditions(), ChargedBondedParticleUnitTest::setupInitialConditions(), my_problem_HGRID::setupInitialConditions(), FreeFallInteractionSelfTest::setupInitialConditions(), FreeFallSelfTest::setupInitialConditions(), LiquidMigrationSelfTest::setupInitialConditions(), TwoBondedParticleElasticCollision::setupInitialConditions(), TwoParticleElasticCollision::setupInitialConditions(), CoilSelfTest::setupInitialConditions(), GetDistanceAndNormalForTriangleWalls::setupInitialConditions(), TriangulatedScrewSelfTest::setupInitialConditions(), TriangulatedStepWallSelfTest::setupInitialConditions(), TriangulatedWallSelfTest::setupInitialConditions(), DrumRot::setupInitialConditions(), SingleParticle< SpeciesType >::setupInitialConditions(), ScalingTestInitialConditionsRelax::setupInitialConditions(), ScalingTestRun::setupInitialConditions(), Contact::setupInitialConditions(), GranularCollapse::setupInitialConditions(), EllipticalSuperQuadricCollision::setupInitialConditions(), MercuryProblem::setupInitialConditions(), protectiveWall::setupInitialConditions(), Tutorial1::setupInitialConditions(), Tutorial11::setupInitialConditions(), Tutorial12::setupInitialConditions(), Tutorial2::setupInitialConditions(), Tutorial3::setupInitialConditions(), Tutorial4::setupInitialConditions(), Tutorial5::setupInitialConditions(), Tutorial6::setupInitialConditions(), Tutorial7::setupInitialConditions(), Tutorial8::setupInitialConditions(), Tutorial9::setupInitialConditions(), MD_demo::setupInitialConditions(), InclinedPlane::setupInitialConditions(), MpiPeriodicBoundaryUnitTest::setupInitialConditions(), PeriodicWalls::setupInitialConditions(), PeriodicWallsWithSlidingFrictionUnitTest::setupInitialConditions(), SinterForceUnitTest::setupInitialConditions(), Chute::setupInitialConditions(), ChuteBottom::setupInitialConditions(), setXMin(), Siegen::Siegen(), FlowFrontChute::stretch(), T_protectiveWall::T_protectiveWall(), StressStrainControlBoundary::updateDomainSize(), viscoElasticUnitTest::viscoElasticUnitTest(), write(), writeFstatHeader(), inflowFromPeriodic::writeXBallsScript(), and ChuteWithPeriodicInflow::writeXBallsScript().

◆ getXMin()

Mdouble DPMBase::getXMin ( ) const
inline

If the length of the problem domain in x-direction is XMax - XMin, then getXMin() returns XMin.

601  { return min_.x(); }

References min_, and Vec3D::x().

Referenced by LeesEdwardsDemo::actionsAfterTimeStep(), TimeDependentPeriodicBoundary3DSelfTest::actionsAfterTimeStep(), TimeDependentPeriodicBoundaryTest::actionsAfterTimeStep(), Chutebelt::actionsAfterTimeStep(), Chutebelt::actionsBeforeTimeStep(), Chutebelt::actionsOnRestart(), StressStrainControlBoundary::activateStrainRateControl(), NautaMixer::addParticles(), NautaMixer::addParticlesAtWall(), Funnel::check_funnel(), checkSettings(), ChutePeriodicDemo::ChutePeriodicDemo(), Chute::cleanChute(), ClosedCSCRestart::ClosedCSCRestart(), ClosedCSCRun::ClosedCSCRun(), ClosedCSCWalls::ClosedCSCWalls(), MercuryLogo::constructTextAsParticles(), LawinenBox::create_inflow_particle(), ChutePeriodic::create_inflow_particle(), ChuteWithContraction::create_inflow_particle(), ChuteWithVerticalHopper::create_inflow_particle(), FlowRule::create_inflow_particle(), SilbertPeriodic::create_inflow_particle(), Chute::createBottom(), Chute::createFlowParticle(), CSCWalls::CSCWalls(), decompose(), StressStrainControlBoundary::determineLengthAndCentre(), StressStrainControlBoundary::determineStressControlledShearBoundaries(), DomainHandler::getParticleDomainGlobalIndex(), getTotalVolume(), MarbleRun::includeInDomain(), Indenter::Indenter(), InitialConditions< SpeciesType >::InitialConditions(), HGridOptimiser::initialise(), HorizontalMixer::introduceParticlesAtWall(), ContactDetectionIntersectionOfWallsTest::introduceParticlesAtWall(), HorizontalMixer::introduceParticlesInDomain(), main(), MercuryCGSelfTest::MercuryCGSelfTest(), outputXBallsData(), LiquidMigrationMPI2Test::outputXBallsData(), LiquidMigrationSelfTest::outputXBallsData(), SphericalIndenter::outputXBallsData(), ParticleCreation::ParticleCreation(), protectiveWall::protectiveWall(), readParAndIniFiles(), save(), ClosedCSCWalls::saveWalls(), CSCWalls::saveWalls(), StressStrainControlBoundary::set(), SphericalIndenter::setIndenterHeight(), ClosedCSCWalls::setupInitialConditions(), CSCInit::setupInitialConditions(), CSCWalls::setupInitialConditions(), ChutePeriodic::setupInitialConditions(), my_problem::setupInitialConditions(), LeesEdwardsDemo::setupInitialConditions(), TimeDependentPeriodicBoundary3DSelfTest::setupInitialConditions(), TimeDependentPeriodicBoundaryTest::setupInitialConditions(), Cstatic2d::setupInitialConditions(), statistics_while_running< T >::setupInitialConditions(), Chutebelt::setupInitialConditions(), T_protectiveWall::setupInitialConditions(), LawinenBox::setupInitialConditions(), MercuryLogo::setupInitialConditions(), Binary::setupInitialConditions(), ForceLawsMPI2Test::setupInitialConditions(), LiquidMigrationMPI2Test::setupInitialConditions(), CubicCell::setupInitialConditions(), FreeCooling2DinWalls::setupInitialConditions(), FreeCooling2DinWallsDemo::setupInitialConditions(), FreeCooling3DDemoProblem::setupInitialConditions(), FreeCooling3DinWallsDemo::setupInitialConditions(), FreeCoolingDemoProblem::setupInitialConditions(), HeaterBoundaryTest::setupInitialConditions(), HourGlass2D::setupInitialConditions(), HourGlass::setupInitialConditions(), MarbleRun::setupInitialConditions(), SilbertPeriodic::setupInitialConditions(), GetDistanceAndNormalForIntersectionOfWalls::setupInitialConditions(), GetDistanceAndNormalForScrew::setupInitialConditions(), GetDistanceAndNormalForTriangleWall::setupInitialConditions(), RotatingDrum::setupInitialConditions(), ConstantMassFlowMaserSelfTest::setupInitialConditions(), LeesEdwardsSelfTest::setupInitialConditions(), PolydisperseInsertionBoundarySelfTest::setupInitialConditions(), CGHandlerSelfTest::setupInitialConditions(), NewtonsCradleSelftest::setupInitialConditions(), ParticleCreation::setupInitialConditions(), ChargedBondedParticleUnitTest::setupInitialConditions(), my_problem_HGRID::setupInitialConditions(), LiquidMigrationSelfTest::setupInitialConditions(), ObliqueImpactSelfTest::setupInitialConditions(), TwoBondedParticleElasticCollision::setupInitialConditions(), TwoParticleElasticCollision::setupInitialConditions(), CoilSelfTest::setupInitialConditions(), GetDistanceAndNormalForTriangleWalls::setupInitialConditions(), TriangulatedScrewSelfTest::setupInitialConditions(), TriangulatedStepWallSelfTest::setupInitialConditions(), TriangulatedWallSelfTest::setupInitialConditions(), DrumRot::setupInitialConditions(), ScalingTestInitialConditionsRelax::setupInitialConditions(), GranularCollapse::setupInitialConditions(), EllipticalSuperQuadricCollision::setupInitialConditions(), MercuryProblem::setupInitialConditions(), protectiveWall::setupInitialConditions(), Tutorial11::setupInitialConditions(), Tutorial12::setupInitialConditions(), Tutorial6::setupInitialConditions(), Tutorial7::setupInitialConditions(), Tutorial8::setupInitialConditions(), ParticleWallInteraction::setupInitialConditions(), MD_demo::setupInitialConditions(), InclinedPlane::setupInitialConditions(), MpiPeriodicBoundaryUnitTest::setupInitialConditions(), PeriodicWalls::setupInitialConditions(), PeriodicWallsWithSlidingFrictionUnitTest::setupInitialConditions(), Chute::setupInitialConditions(), ChuteBottom::setupInitialConditions(), setXMax(), FlowFrontChute::stretch(), T_protectiveWall::T_protectiveWall(), StressStrainControlBoundary::updateDomainSize(), write(), writeFstatHeader(), inflowFromPeriodic::writeXBallsScript(), and ChuteWithPeriodicInflow::writeXBallsScript().

◆ getYMax()

Mdouble DPMBase::getYMax ( ) const
inline

If the length of the problem domain in y-direction is YMax - YMin, then getYMax() returns XMax.

620  { return max_.y(); }

References max_, and Vec3D::y().

Referenced by LeesEdwardsDemo::actionsAfterTimeStep(), TimeDependentPeriodicBoundary3DSelfTest::actionsAfterTimeStep(), TimeDependentPeriodicBoundaryTest::actionsAfterTimeStep(), T_protectiveWall::actionsAfterTimeStep(), GranularCollapse::actionsAfterTimeStep(), protectiveWall::actionsAfterTimeStep(), SmoothChute::actionsBeforeTimeStep(), Chutebelt::actionsOnRestart(), StressStrainControlBoundary::activateStrainRateControl(), ChuteWithHopper::addHopper(), NautaMixer::addParticles(), NautaMixer::addParticlesAtWall(), Funnel::check_funnel(), checkSettings(), ChuteWithContraction::ChuteWithContraction(), ChuteWithPeriodicInflowAndContraction::ChuteWithPeriodicInflowAndContraction(), ClosedCSCRestart::ClosedCSCRestart(), ClosedCSCRun::ClosedCSCRun(), ClosedCSCWalls::ClosedCSCWalls(), MercuryLogo::constructTextAsParticles(), ContractionWithPeriodicInflow::ContractionWithPeriodicInflow(), LawinenBox::create_inflow_particle(), ChutePeriodic::create_inflow_particle(), ChuteWithContraction::create_inflow_particle(), ChuteWithVerticalHopper::create_inflow_particle(), FlowRule::create_inflow_particle(), SilbertPeriodic::create_inflow_particle(), SegregationWithHopper::create_inflow_particle(), Funnel::create_walls(), Chute::createBottom(), Chute::createFlowParticle(), CSCWalls::CSCWalls(), decompose(), StressStrainControlBoundary::determineLengthAndCentre(), StressStrainControlBoundary::determineStressControlledShearBoundaries(), ChuteWithPeriodicInflow::ExtendInWidth(), Chute::getChuteWidth(), DomainHandler::getParticleDomainGlobalIndex(), getTotalVolume(), MarbleRun::includeInDomain(), Indenter::Indenter(), InitialConditions< SpeciesType >::InitialConditions(), HGridOptimiser::initialise(), HorizontalMixer::introduceParticlesAtWall(), HorizontalMixer::introduceParticlesInDomain(), LawinenBox::LawinenBox(), main(), MercuryCGSelfTest::MercuryCGSelfTest(), outputXBallsData(), LiquidMigrationMPI2Test::outputXBallsData(), LiquidMigrationSelfTest::outputXBallsData(), SphericalIndenter::outputXBallsData(), ParticleCreation::ParticleCreation(), protectiveWall::protectiveWall(), readParAndIniFiles(), regimeForceUnitTest::regimeForceUnitTest(), save(), ClosedCSCWalls::saveWalls(), CSCWalls::saveWalls(), StressStrainControlBoundary::set(), SphericalIndenter::setIndenterHeight(), ClosedCSCWalls::setupInitialConditions(), CSCInit::setupInitialConditions(), CSCWalls::setupInitialConditions(), ChutePeriodic::setupInitialConditions(), my_problem::setupInitialConditions(), LeesEdwardsDemo::setupInitialConditions(), TimeDependentPeriodicBoundary3DSelfTest::setupInitialConditions(), TimeDependentPeriodicBoundaryTest::setupInitialConditions(), statistics_while_running< T >::setupInitialConditions(), Chutebelt::setupInitialConditions(), T_protectiveWall::setupInitialConditions(), LawinenBox::setupInitialConditions(), MercuryLogo::setupInitialConditions(), SmoothChute::setupInitialConditions(), HorizontalMixer::setupInitialConditions(), Binary::setupInitialConditions(), CubicCell::setupInitialConditions(), FreeCooling2DinWalls::setupInitialConditions(), FreeCooling2DinWallsDemo::setupInitialConditions(), FreeCooling3DDemoProblem::setupInitialConditions(), FreeCooling3DinWallsDemo::setupInitialConditions(), FreeCoolingDemoProblem::setupInitialConditions(), HeaterBoundaryTest::setupInitialConditions(), HourGlass::setupInitialConditions(), MarbleRun::setupInitialConditions(), MinimalExampleDrum::setupInitialConditions(), AngleOfRepose::setupInitialConditions(), SilbertPeriodic::setupInitialConditions(), ConstantMassFlowMaserSelfTest::setupInitialConditions(), LeesEdwardsSelfTest::setupInitialConditions(), PolydisperseInsertionBoundarySelfTest::setupInitialConditions(), CGHandlerSelfTest::setupInitialConditions(), NewtonsCradleSelftest::setupInitialConditions(), ParticleCreation::setupInitialConditions(), ChargedBondedParticleUnitTest::setupInitialConditions(), my_problem_HGRID::setupInitialConditions(), FreeFallInteractionSelfTest::setupInitialConditions(), FreeFallSelfTest::setupInitialConditions(), LiquidMigrationSelfTest::setupInitialConditions(), TwoBondedParticleElasticCollision::setupInitialConditions(), TwoParticleElasticCollision::setupInitialConditions(), CoilSelfTest::setupInitialConditions(), TriangulatedScrewSelfTest::setupInitialConditions(), TriangulatedWallSelfTest::setupInitialConditions(), DrumRot::setupInitialConditions(), RotatingDrum::setupInitialConditions(), ScalingTestInitialConditionsRelax::setupInitialConditions(), ScalingTestRun::setupInitialConditions(), Contact::setupInitialConditions(), GranularCollapse::setupInitialConditions(), EllipticalSuperQuadricCollision::setupInitialConditions(), MercuryProblem::setupInitialConditions(), protectiveWall::setupInitialConditions(), Tutorial1::setupInitialConditions(), Tutorial11::setupInitialConditions(), Tutorial12::setupInitialConditions(), Tutorial2::setupInitialConditions(), Tutorial3::setupInitialConditions(), Tutorial4::setupInitialConditions(), Tutorial5::setupInitialConditions(), Tutorial6::setupInitialConditions(), Tutorial7::setupInitialConditions(), Tutorial8::setupInitialConditions(), Tutorial9::setupInitialConditions(), MD_demo::setupInitialConditions(), MpiPeriodicBoundaryUnitTest::setupInitialConditions(), PeriodicWalls::setupInitialConditions(), PeriodicWallsWithSlidingFrictionUnitTest::setupInitialConditions(), SinterForceUnitTest::setupInitialConditions(), Chute::setupInitialConditions(), ChuteBottom::setupInitialConditions(), ChuteWithHopper::setupInitialConditions(), Chute::setupSideWalls(), setYMin(), T_protectiveWall::T_protectiveWall(), StressStrainControlBoundary::updateDomainSize(), viscoElasticUnitTest::viscoElasticUnitTest(), write(), writeFstatHeader(), inflowFromPeriodic::writeXBallsScript(), and ChuteWithPeriodicInflow::writeXBallsScript().

◆ getYMin()

Mdouble DPMBase::getYMin ( ) const
inline

If the length of the problem domain in y-direction is YMax - YMin, then getYMin() returns YMin.

614  { return min_.y(); }

References min_, and Vec3D::y().

Referenced by LeesEdwardsDemo::actionsAfterTimeStep(), TimeDependentPeriodicBoundary3DSelfTest::actionsAfterTimeStep(), TimeDependentPeriodicBoundaryTest::actionsAfterTimeStep(), SmoothChute::actionsBeforeTimeStep(), Chutebelt::actionsOnRestart(), StressStrainControlBoundary::activateStrainRateControl(), ChuteWithHopper::addHopper(), NautaMixer::addParticles(), NautaMixer::addParticlesAtWall(), Funnel::check_funnel(), checkSettings(), ChuteWithContraction::ChuteWithContraction(), ChuteWithPeriodicInflowAndContraction::ChuteWithPeriodicInflowAndContraction(), ClosedCSCRestart::ClosedCSCRestart(), ClosedCSCRun::ClosedCSCRun(), ClosedCSCWalls::ClosedCSCWalls(), ContractionWithPeriodicInflow::ContractionWithPeriodicInflow(), LawinenBox::create_inflow_particle(), ChutePeriodic::create_inflow_particle(), ChuteWithContraction::create_inflow_particle(), ChuteWithVerticalHopper::create_inflow_particle(), FlowRule::create_inflow_particle(), SilbertPeriodic::create_inflow_particle(), SegregationWithHopper::create_inflow_particle(), Funnel::create_walls(), Chute::createBottom(), Chute::createFlowParticle(), CSCWalls::CSCWalls(), decompose(), StressStrainControlBoundary::determineLengthAndCentre(), StressStrainControlBoundary::determineStressControlledShearBoundaries(), ChuteWithPeriodicInflow::ExtendInWidth(), DomainHandler::getParticleDomainGlobalIndex(), getTotalVolume(), MarbleRun::includeInDomain(), Indenter::Indenter(), InitialConditions< SpeciesType >::InitialConditions(), HGridOptimiser::initialise(), HorizontalMixer::introduceParticlesAtWall(), HorizontalMixer::introduceParticlesInDomain(), main(), MercuryCGSelfTest::MercuryCGSelfTest(), outputXBallsData(), LiquidMigrationMPI2Test::outputXBallsData(), LiquidMigrationSelfTest::outputXBallsData(), SphericalIndenter::outputXBallsData(), ParticleCreation::ParticleCreation(), readParAndIniFiles(), save(), ClosedCSCWalls::saveWalls(), CSCWalls::saveWalls(), StressStrainControlBoundary::set(), SphericalIndenter::setIndenterHeight(), ClosedCSCWalls::setupInitialConditions(), CSCInit::setupInitialConditions(), CSCWalls::setupInitialConditions(), ChutePeriodic::setupInitialConditions(), my_problem::setupInitialConditions(), LeesEdwardsDemo::setupInitialConditions(), TimeDependentPeriodicBoundary3DSelfTest::setupInitialConditions(), TimeDependentPeriodicBoundaryTest::setupInitialConditions(), statistics_while_running< T >::setupInitialConditions(), Chutebelt::setupInitialConditions(), T_protectiveWall::setupInitialConditions(), LawinenBox::setupInitialConditions(), MercuryLogo::setupInitialConditions(), SmoothChute::setupInitialConditions(), Binary::setupInitialConditions(), CubicCell::setupInitialConditions(), FreeCooling2DinWalls::setupInitialConditions(), FreeCooling2DinWallsDemo::setupInitialConditions(), FreeCooling3DDemoProblem::setupInitialConditions(), FreeCooling3DinWallsDemo::setupInitialConditions(), FreeCoolingDemoProblem::setupInitialConditions(), HeaterBoundaryTest::setupInitialConditions(), HourGlass::setupInitialConditions(), MarbleRun::setupInitialConditions(), MinimalExampleDrum::setupInitialConditions(), SilbertPeriodic::setupInitialConditions(), ConstantMassFlowMaserSelfTest::setupInitialConditions(), LeesEdwardsSelfTest::setupInitialConditions(), PolydisperseInsertionBoundarySelfTest::setupInitialConditions(), CGHandlerSelfTest::setupInitialConditions(), NewtonsCradleSelftest::setupInitialConditions(), ParticleCreation::setupInitialConditions(), ChargedBondedParticleUnitTest::setupInitialConditions(), my_problem_HGRID::setupInitialConditions(), FreeFallSelfTest::setupInitialConditions(), LiquidMigrationSelfTest::setupInitialConditions(), ObliqueImpactSelfTest::setupInitialConditions(), TwoBondedParticleElasticCollision::setupInitialConditions(), TwoParticleElasticCollision::setupInitialConditions(), CoilSelfTest::setupInitialConditions(), TriangulatedScrewSelfTest::setupInitialConditions(), TriangulatedWallSelfTest::setupInitialConditions(), DrumRot::setupInitialConditions(), RotatingDrum::setupInitialConditions(), ScalingTestInitialConditionsRelax::setupInitialConditions(), GranularCollapse::setupInitialConditions(), EllipticalSuperQuadricCollision::setupInitialConditions(), MercuryProblem::setupInitialConditions(), protectiveWall::setupInitialConditions(), Tutorial11::setupInitialConditions(), Tutorial12::setupInitialConditions(), Tutorial7::setupInitialConditions(), Tutorial8::setupInitialConditions(), FreeFallHertzMindlinUnitTest::setupInitialConditions(), MD_demo::setupInitialConditions(), InclinedPlane::setupInitialConditions(), MpiPeriodicBoundaryUnitTest::setupInitialConditions(), PeriodicWalls::setupInitialConditions(), PeriodicWallsWithSlidingFrictionUnitTest::setupInitialConditions(), Chute::setupInitialConditions(), ChuteBottom::setupInitialConditions(), ChuteWithHopper::setupInitialConditions(), Chute::setupSideWalls(), setYMax(), StressStrainControlBoundary::updateDomainSize(), write(), writeFstatHeader(), inflowFromPeriodic::writeXBallsScript(), and ChuteWithPeriodicInflow::writeXBallsScript().

◆ getZMax()

Mdouble DPMBase::getZMax ( ) const
inline

If the length of the problem domain in z-direction is ZMax - ZMin, then getZMax() returns ZMax.

632  { return max_.z(); }

References max_, and Vec3D::z().

Referenced by SmoothChute::actionsBeforeTimeStep(), Chutebelt::actionsOnRestart(), StressStrainControlBoundary::activateStrainRateControl(), NautaMixer::addParticles(), NautaMixer::addParticlesAtWall(), checkSettings(), ClosedCSCWalls::ClosedCSCWalls(), MercuryLogo::constructTextAsParticles(), Funnel::create_funnel(), LawinenBox::create_inflow_particle(), ChuteWithContraction::create_inflow_particle(), ChuteWithVerticalHopper::create_inflow_particle(), CSCWalls::CSCWalls(), decompose(), StressStrainControlBoundary::determineLengthAndCentre(), StressStrainControlBoundary::determineStressControlledShearBoundaries(), DomainHandler::getParticleDomainGlobalIndex(), getTotalVolume(), MarbleRun::includeInDomain(), HGridOptimiser::initialise(), ContactDetectionIntersectionOfWallsTest::introduceParticlesAtWall(), LawinenBox::LawinenBox(), main(), MercuryCGSelfTest::MercuryCGSelfTest(), outputXBallsData(), LiquidMigrationMPI2Test::outputXBallsData(), LiquidMigrationSelfTest::outputXBallsData(), SphericalIndenter::outputXBallsData(), ParticleCreation::ParticleCreation(), protectiveWall::protectiveWall(), readParAndIniFiles(), regimeForceUnitTest::regimeForceUnitTest(), save(), ClosedCSCWalls::saveWalls(), CSCWalls::saveWalls(), StressStrainControlBoundary::set(), ClosedCSCWalls::setupInitialConditions(), CSCInit::setupInitialConditions(), CSCWalls::setupInitialConditions(), TimeDependentPeriodicBoundary3DSelfTest::setupInitialConditions(), Chutebelt::setupInitialConditions(), T_protectiveWall::setupInitialConditions(), LawinenBox::setupInitialConditions(), MercuryLogo::setupInitialConditions(), SmoothChute::setupInitialConditions(), NozzleDemo::setupInitialConditions(), Binary::setupInitialConditions(), MpiPeriodicBoundaryUnitTest::setupInitialConditions(), CubicCell::setupInitialConditions(), FreeCooling3DDemoProblem::setupInitialConditions(), FreeCooling3DinWallsDemo::setupInitialConditions(), HeaterBoundaryTest::setupInitialConditions(), HourGlass2D::setupInitialConditions(), HourGlass::setupInitialConditions(), MarbleRun::setupInitialConditions(), AngleOfRepose::setupInitialConditions(), SilbertPeriodic::setupInitialConditions(), GetDistanceAndNormalForIntersectionOfWalls::setupInitialConditions(), GetDistanceAndNormalForScrew::setupInitialConditions(), GetDistanceAndNormalForTriangleWall::setupInitialConditions(), RotatingDrum::setupInitialConditions(), ConstantMassFlowMaserSelfTest::setupInitialConditions(), NozzleSelfTest::setupInitialConditions(), CGHandlerSelfTest::setupInitialConditions(), NewtonsCradleSelftest::setupInitialConditions(), ParticleCreation::setupInitialConditions(), ChargedBondedParticleUnitTest::setupInitialConditions(), DPM::setupInitialConditions(), CoilSelfTest::setupInitialConditions(), GetDistanceAndNormalForTriangleWalls::setupInitialConditions(), TriangulatedScrewSelfTest::setupInitialConditions(), TriangulatedStepWallSelfTest::setupInitialConditions(), TriangulatedWallSelfTest::setupInitialConditions(), DrumRot::setupInitialConditions(), ScalingTestInitialConditionsRelax::setupInitialConditions(), ScalingTestRun::setupInitialConditions(), Contact::setupInitialConditions(), EllipticalSuperQuadricCollision::setupInitialConditions(), protectiveWall::setupInitialConditions(), Tutorial1::setupInitialConditions(), Tutorial11::setupInitialConditions(), Tutorial2::setupInitialConditions(), Tutorial3::setupInitialConditions(), Tutorial4::setupInitialConditions(), Tutorial5::setupInitialConditions(), Tutorial6::setupInitialConditions(), ExtremeOverlapWithWallsUnitTest::setupInitialConditions(), FreeFall::setupInitialConditions(), MD_demo::setupInitialConditions(), SinterForceUnitTest::setupInitialConditions(), Chute::setupInitialConditions(), ChuteBottom::setupInitialConditions(), setZMin(), Siegen::Siegen(), SilbertHstop::solve_analytic(), T_protectiveWall::T_protectiveWall(), StressStrainControlBoundary::updateDomainSize(), viscoElasticUnitTest::viscoElasticUnitTest(), write(), writeFstatHeader(), inflowFromPeriodic::writeXBallsScript(), and ChuteWithPeriodicInflow::writeXBallsScript().

◆ getZMin()

Mdouble DPMBase::getZMin ( ) const
inline

If the length of the problem domain in z-direction is ZMax - ZMin, then getZMin() returns ZMin.

626  { return min_.z(); }

References min_, and Vec3D::z().

Referenced by HourGlass2D::actionsAfterTimeStep(), HourGlass::actionsAfterTimeStep(), Tutorial11::actionsAfterTimeStep(), SmoothChute::actionsBeforeTimeStep(), Chutebelt::actionsOnRestart(), StressStrainControlBoundary::activateStrainRateControl(), SilbertPeriodic::add_flow_particles(), NautaMixer::addParticles(), NautaMixer::addParticlesAtWall(), checkSettings(), Funnel::cleanChute(), inflowFromPeriodic::cleanChute(), ClosedCSCWalls::ClosedCSCWalls(), LawinenBox::create_inflow_particle(), ChutePeriodic::create_inflow_particle(), ChuteWithContraction::create_inflow_particle(), ChuteWithVerticalHopper::create_inflow_particle(), FlowRule::create_inflow_particle(), SilbertPeriodic::create_inflow_particle(), Chute::createBottom(), Chute::createFlowParticle(), CSCWalls::CSCWalls(), decompose(), StressStrainControlBoundary::determineLengthAndCentre(), StressStrainControlBoundary::determineStressControlledShearBoundaries(), SphericalIndenter::getBedHeight(), DomainHandler::getParticleDomainGlobalIndex(), getTotalVolume(), MarbleRun::includeInDomain(), InitialConditions< SpeciesType >::InitialConditions(), HGridOptimiser::initialise(), HorizontalMixer::introduceParticlesAtWall(), ContactDetectionIntersectionOfWallsTest::introduceParticlesAtWall(), HorizontalMixer::introduceParticlesInDomain(), main(), MercuryCGSelfTest::MercuryCGSelfTest(), outputXBallsData(), LiquidMigrationMPI2Test::outputXBallsData(), LiquidMigrationSelfTest::outputXBallsData(), SphericalIndenter::outputXBallsData(), ParticleCreation::ParticleCreation(), readParAndIniFiles(), save(), ClosedCSCWalls::saveWalls(), CSCWalls::saveWalls(), StressStrainControlBoundary::set(), HorizontalMixer::setOuterWalls(), ClosedCSCWalls::setupInitialConditions(), CSCInit::setupInitialConditions(), CSCWalls::setupInitialConditions(), my_problem::setupInitialConditions(), TimeDependentPeriodicBoundary3DSelfTest::setupInitialConditions(), Chutebelt::setupInitialConditions(), T_protectiveWall::setupInitialConditions(), LawinenBox::setupInitialConditions(), MercuryLogo::setupInitialConditions(), SmoothChute::setupInitialConditions(), NozzleDemo::setupInitialConditions(), Binary::setupInitialConditions(), Chain::setupInitialConditions(), MpiPeriodicBoundaryUnitTest::setupInitialConditions(), CubicCell::setupInitialConditions(), FreeCooling3DDemoProblem::setupInitialConditions(), FreeCooling3DinWallsDemo::setupInitialConditions(), HeaterBoundaryTest::setupInitialConditions(), HourGlass2D::setupInitialConditions(), HourGlass::setupInitialConditions(), MarbleRun::setupInitialConditions(), AngleOfRepose::setupInitialConditions(), GetDistanceAndNormalForIntersectionOfWalls::setupInitialConditions(), GetDistanceAndNormalForScrew::setupInitialConditions(), GetDistanceAndNormalForTriangleWall::setupInitialConditions(), RotatingDrum::setupInitialConditions(), ConstantMassFlowMaserSelfTest::setupInitialConditions(), NozzleSelfTest::setupInitialConditions(), PolydisperseInsertionBoundarySelfTest::setupInitialConditions(), CGHandlerSelfTest::setupInitialConditions(), NewtonsCradleSelftest::setupInitialConditions(), NewtonsCradleSelfTest::setupInitialConditions(), ParticleCreation::setupInitialConditions(), ChargedBondedParticleUnitTest::setupInitialConditions(), DPM::setupInitialConditions(), CoilSelfTest::setupInitialConditions(), GetDistanceAndNormalForTriangleWalls::setupInitialConditions(), TriangulatedScrewSelfTest::setupInitialConditions(), TriangulatedStepWallSelfTest::setupInitialConditions(), DrumRot::setupInitialConditions(), ScalingTestInitialConditionsRelax::setupInitialConditions(), GranularCollapse::setupInitialConditions(), EllipticalSuperQuadricCollision::setupInitialConditions(), protectiveWall::setupInitialConditions(), Tutorial11::setupInitialConditions(), Tutorial3::setupInitialConditions(), Tutorial4::setupInitialConditions(), Tutorial9::setupInitialConditions(), MD_demo::setupInitialConditions(), WallSpecies::setupInitialConditions(), Chute::setupInitialConditions(), ChuteBottom::setupInitialConditions(), setZMax(), StressStrainControlBoundary::updateDomainSize(), write(), writeFstatHeader(), inflowFromPeriodic::writeXBallsScript(), and ChuteWithPeriodicInflow::writeXBallsScript().

◆ handleParticleAddition()

void DPMBase::handleParticleAddition ( unsigned int  id,
BaseParticle p 
)
virtual

\briefHandles the addition of particles to the particleHandler

This function is called by ParticleHandler::addObject and ParticleHandler::addGhostObject to broadcast the addition of a particle from the handler. It passes the information on to the walls in the wallHandler.

Parameters
[in]idThe id of the removed particle.
[in]pA pointer to the particle.
5314 {
5315  for (auto w: wallHandler)
5316  {
5317  w->handleParticleAddition(id, p);
5318  }
5319 }

References wallHandler.

Referenced by ParticleHandler::addGhostObject(), and ParticleHandler::addObject().

◆ handleParticleRemoval()

void DPMBase::handleParticleRemoval ( unsigned int  id)
virtual

Handles the removal of particles from the particleHandler.

This function is called by ParticleHandler::removeObject and ParticleHandler::removeGhostObject to broadcast the removal of a particle from the handler. It passes the information on to the walls in the wallHandler.

Parameters
[in]idThe id of the removed particle.
5299 {
5300  for (auto w: wallHandler)
5301  {
5302  w->handleParticleRemoval(id);
5303  }
5304 }

References wallHandler.

Referenced by ParticleHandler::clear(), ParticleHandler::removeGhostObject(), ParticleHandler::removeLastObject(), and ParticleHandler::removeObject().

◆ hGridActionsAfterIntegration()

void DPMBase::hGridActionsAfterIntegration ( )
protectedvirtual

This function has to be called after integrateBeforeForceComputation.

no implementation but can be overidden in its derived classes.

Reimplemented in MercuryBase.

1939 {
1940 }

Referenced by computeOneTimeStep().

◆ hGridActionsBeforeIntegration()

void DPMBase::hGridActionsBeforeIntegration ( )
protectedvirtual

This function has to be called before integrateBeforeForceComputation.

no implementation but can be overidden in its derived classes.

Reimplemented in MercuryBase.

1932 {
1933 }

Referenced by computeOneTimeStep().

◆ hGridActionsBeforeTimeLoop()

void DPMBase::hGridActionsBeforeTimeLoop ( )
protectedvirtual

A virtual function that allows one to carry out hGrid operations before the start of the time loop.

no implementation but can be overidden in its derived classes.

Reimplemented in MercuryBase.

1668 {
1669 }

Referenced by solve().

◆ hGridActionsBeforeTimeStep()

void DPMBase::hGridActionsBeforeTimeStep ( )
protectedvirtual

A virtual function that allows one to set or execute hGrid parameters or operations before every simulation time step.

no implementation but can be overidden in its derived classes.

Reimplemented in MercuryBase.

1682 {
1683 }

Referenced by computeOneTimeStep(), and solve().

◆ hGridGetInteractingParticleList()

virtual void DPMBase::hGridGetInteractingParticleList ( BaseParticle obj,
std::vector< BaseParticle * > &  list 
)
inlinevirtual

Creates a list of neighbour particles obtained from the hgrid.

Reimplemented in Mercury3D, and Mercury2D.

962  {};

Referenced by PeriodicBoundaryHandler::processLocalInteractionData(), PeriodicBoundaryHandler::processReceivedInteractionData(), and Domain::processReceivedInteractionData().

◆ hGridInsertParticle()

void DPMBase::hGridInsertParticle ( BaseParticle *obj  UNUSED)
virtual
Bug:
Why are the hGRID actions public, this seems wrong. Someone please comment [Ant].

no implementation but can be overidden in its derived classes.

1689 {
1690 }

Referenced by ParticleHandler::addExistingObject(), ParticleHandler::addGhostObject(), and ParticleHandler::addObject().

◆ hGridRemoveParticle()

void DPMBase::hGridRemoveParticle ( BaseParticle *obj  UNUSED)
virtual

no implementation but can be overidden in its derived classes.

1703 {
1704 }

Referenced by ParticleHandler::removeGhostObject(), ParticleHandler::removeLastObject(), and ParticleHandler::removeObject().

◆ hGridUpdateMove()

void DPMBase::hGridUpdateMove ( BaseParticle ,
Mdouble   
)
virtual

no implementation but can be overidden in its derived classes.

Reimplemented in MercuryBase.

1925 {
1926 }

Referenced by PeriodicBoundary::checkBoundaryAfterParticlesMove(), BaseParticle::integrateBeforeForceComputation(), Domain::updateParticlePosition(), and PeriodicBoundaryHandler::updateParticles().

◆ hGridUpdateParticle()

void DPMBase::hGridUpdateParticle ( BaseParticle *obj  UNUSED)
virtual

◆ importParticlesAs()

void DPMBase::importParticlesAs ( ParticleHandler particleH,
InteractionHandler interactionH,
const ParticleSpecies species 
)

Copies particles, interactions assigning species from a local simulation to a global one. Useful for the creation of a cluster.

Copies particles, interactions assigning species from a local simulation to a global one; useful for the creation of a cluster.

Parameters
[in]particleHthe particle handler from wich particles are copied,
[in]particleHthe interaction handler from wich interactions are copied,
[in]speciesthe species that will be assigned to the particle.
4789 {
4790  size_t nParticlesPreviouslyIn = particleHandler.getSize();
4791  int l = 0;
4792  for (auto k = particleH.begin(); k != particleH.end(); ++k) {
4793  auto p = particleHandler.copyAndAddObject( *k );
4794  p->setSpecies(species);
4795  l++;
4796  }
4797 
4798  for (std::vector<BaseInteraction*>::const_iterator i = interactionH.begin(); i != interactionH.end(); ++i) {
4799  if ( (*i)->getP()->getInvMass() != 0.0 && (*i)->getI()->getInvMass() != 0.0 ) {
4801  j->importP(particleHandler.getObject(nParticlesPreviouslyIn + j->getP()->getIndex()));
4802  j->importI(particleHandler.getObject(nParticlesPreviouslyIn + j->getI()->getIndex()));
4803  j->setTimeStamp(getNumberOfTimeSteps());
4804  }
4805  }
4806 }

References BaseHandler< T >::begin(), BaseHandler< T >::copyAndAddObject(), BaseHandler< T >::end(), getNumberOfTimeSteps(), BaseHandler< T >::getObject(), BaseHandler< T >::getSize(), constants::i, interactionHandler, and particleHandler.

Referenced by FixedClusterInsertionBoundary::checkBoundaryBeforeTimeStep(), and RandomClusterInsertionBoundary::checkBoundaryBeforeTimeStep().

◆ incrementRunNumberInFile()

void DPMBase::incrementRunNumberInFile ( )
static

Increment the run Number (counter value) stored in the file_counter (COUNTER_DONOTDEL) by 1 and store the new value in the counter file.

In order to increment the counter stored in COUNTER_DONOTDEL, we initialise two fstream objects counter_file, counter_file2 and an integer type temp_counter. First we open the file COUNTER_DONOTDEL, check if everything went fine with the opening. If yes, we extract the runNumber (counter) into the temp_counter. Increment the temp_counter and then write it into COUNTER_DONOTDEL. This is how we increment the counter in the file.

626 {
627  //opening two filestreams - counter_file and counter_file2
628  std::fstream counter_file, counter_file2;
629  //declares an integer, temp_counter
630  int temp_counter;
631  //attempts to open the COUNTER_DONOTDEL text file
632  counter_file.open("COUNTER_DONOTDEL", std::ios::in);
633  //gives error message if file could not be successfully opened and ends the program
634  if (counter_file.fail())
635  {
636  fprintf(stderr, "\n\n\tERROR :: Counter File NOT found, please re-create\n\n");
637  counter_file.close();
638  exit(0);
639  }
640  // if opened successfully, reads in the counter corresponding to the current run number
641  //and stored it in the "temp_counter" variable
642  counter_file >> temp_counter;
643  counter_file.close();
644  //Increments the temp_counter
645  temp_counter++;
646  //opens an output stream to the COUNTER_DONOTDEL file
647  counter_file2.open("COUNTER_DONOTDEL", std::ios::out);
648  if (counter_file2.fail())
649  {
650  fprintf(stderr, "\n\n\tERROR :: Counter File NOT found, please re-create2\n\n");
651  counter_file2.close();
652  exit(0);
653  }
654  //writes the new valuer of the counter to COUNTER_DONOTDEL
655  counter_file2 << temp_counter;
656 
657  counter_file2.close();
658 }

Referenced by autoNumber().

◆ initialiseStatistics()

void DPMBase::initialiseStatistics ( )
protectedvirtual

This function is overridden by StatisticsVector

Reimplemented in statistics_while_running< T >, and statistics_while_running< T >.

1877 {
1879 }

References cgHandler, and CGHandler::initialise().

Referenced by solve().

◆ insertGhostParticle()

void DPMBase::insertGhostParticle ( BaseParticle particle)

This function inserts a particle in the mpi communication boundaries.

Parameters
[in]particlePointer to a base particle that needs to be inserted in the communication boundaries
1803 {
1804 #ifdef MERCURY_USE_MPI
1805  //mpi particles only exist when there is more than one domain
1806  if (domainHandler.getSize() > 0)
1807  {
1808  //Add the particle to the mpi domain
1810  }
1811 
1812  //If periodic boundaries are present..
1813  if (periodicBoundaryHandler.getSize() > 0)
1814  {
1816  }
1817 #endif
1818 }

References PeriodicBoundaryHandler::addNewParticle(), Domain::addParticle(), domainHandler, DomainHandler::getCurrentDomain(), BaseHandler< T >::getSize(), and periodicBoundaryHandler.

Referenced by ParticleHandler::addObject().

◆ integrateAfterForceComputation()

void DPMBase::integrateAfterForceComputation ( )
protectedvirtual

Update particles' and walls' positions and velocities after force computation.

Performs integration - i.e. updating particle's positions, velocities and accelerations - for all particles and walls within the system (i.e. in the particleHandler and wallHandler). Integration is performed using the BaseParticle::integrateBeforeForceComputation() function.

The velocity Verlet algorithm requires us to integrate twice each time step: both before and after the force computation. This method is therefore used in conjunction with DPMBase::integrateAfterForceComputation(). See http://en.wikipedia.org/wiki/Verlet_integration#Velocity_Verlet for details.

3220 {
3221  //cycling through all particles, p, in the particleHandler
3222  //for_each(particleHandler.begin(), particleHandler.end(), [this](BaseParticle* p){
3223  #pragma omp parallel for num_threads(getNumberOfOMPThreads()) //schedule(dynamic)
3224  for (int k = 0; k < particleHandler.getSize(); ++k) {
3226 #ifdef MERCURY_USE_MPI
3227  //MPI particles do not require integration - they are updated by the communication step
3228  if (!(p->isMPIParticle() || p->isPeriodicGhostParticle()))
3229  {
3231  }
3232 #else
3233  //using the particle p's internal "integrateAfterForceComputation" function
3234  //to update the relevant parameters concerning the particle's position and motion
3236 #endif
3237  }
3238  //});
3239  //cycling through all walls, w, in the wallHandler
3240  //for_each(wallHandler.begin(), wallHandler.end(), [this](BaseWall* w){
3241  #pragma omp parallel for num_threads(getNumberOfOMPThreads()) //schedule(dynamic)
3242  for (int k = 0; k < wallHandler.getSize(); k++) {
3243  BaseWall *w = wallHandler.getObject(k);
3244  //using the wall's internal "integrateAfterForceComputation" function
3245  //to update the relevant parameters concerning its position and motion
3247  }
3248  //});
3249 }

References BaseHandler< T >::getObject(), BaseHandler< T >::getSize(), getTime(), getTimeStep(), BaseInteractable::integrateAfterForceComputation(), BaseParticle::integrateAfterForceComputation(), BaseParticle::isMPIParticle(), BaseParticle::isPeriodicGhostParticle(), particleHandler, and wallHandler.

Referenced by computeOneTimeStep().

◆ integrateBeforeForceComputation()

void DPMBase::integrateBeforeForceComputation ( )
protectedvirtual

Update particles' and walls' positions and velocities before force computation.

This is where the integration is done, at the moment it is velocity Verlet integration and is done before the forces are computed. See http://en.wikipedia.org/wiki/Verlet_integration#Velocity_Verlet

Performs integration - i.e. updating particle's positions, velocities and accelerations - for all particles and walls within the system (i.e. in the particleHandler and wallHandler). Integration is performed using the BaseParticle::integrateBeforeForceComputation() function.

The velocity Verlet algorithm requires us to integrate twice each time step: both before and after the force computation. This method is therefore used in conjunction with DPMBase::integrateAfterForceComputation(). See http://en.wikipedia.org/wiki/Verlet_integration#Velocity_Verlet for details.

Reimplemented in ChuteWithPeriodicInflow.

3134 {
3135  //cycling through all particles, p, in the particleHandler
3136  //for_each(particleHandler.begin(), particleHandler.end(), [this](BaseParticle* p)
3137  //for (BaseParticle* p : particleHandler) {
3138 
3139  #pragma omp parallel for num_threads(getNumberOfOMPThreads()) //schedule(dynamic)
3140  for (int k = 0; k < particleHandler.getSize(); ++k) {
3142 #ifdef MERCURY_USE_MPI
3143  //MPI particles are not integrated, they are purely ghost particles and get their new velocity and position from an MPI update
3144  if (!(p->isMPIParticle() || p->isPeriodicGhostParticle()))
3145  {
3147  }
3148 #else
3149  //using the particle p's internal "integrateBeforeForceComputation" function
3150  //to update the relevant parameters concerning the particle's position and motion
3152 #endif
3153  }
3154  //});
3155  //cycling through all walls, w, in the wallHandler
3156  //for_each(wallHandler.begin(), wallHandler.end(), [this](BaseWall* w)
3157  //for (BaseWall* w : wallHandler) {
3158  #pragma omp parallel for num_threads(getNumberOfOMPThreads()) //schedule(dynamic)
3159  for (int k = 0; k < wallHandler.getSize(); k++) {
3160  BaseWall *w = wallHandler.getObject(k);
3161  //using the wall's internal "integrateBeforeForceComputation" function
3162  //to update the relevant parameters concerning its position and motion
3164  }
3165  //});
3166 }

References BaseHandler< T >::getObject(), BaseHandler< T >::getSize(), getTime(), getTimeStep(), BaseInteractable::integrateBeforeForceComputation(), BaseParticle::integrateBeforeForceComputation(), BaseParticle::isMPIParticle(), BaseParticle::isPeriodicGhostParticle(), particleHandler, and wallHandler.

Referenced by computeOneTimeStep().

◆ isTimeEqualTo()

bool DPMBase::isTimeEqualTo ( Mdouble  time) const
protected

Checks whether the input variable "time" is the current time in the simulation.

Returns true if and only if the "time" argument passed to the function is equal to the current simulation time i.e. if "time" is either exactly equal to the current simulation time (getTime() ) or at least lies between this time step and the next increment (this nicely avoids rounding errors!)

Returns
true if "time" and getTime() are equal, otherwise false.
5040 {
5041  return getTime() <= time && getTime() + getTimeStep() > time;
5042 }

References getTime(), and getTimeStep().

◆ launchNewRun()

int DPMBase::launchNewRun ( const char name,
bool quick  UNUSED = false 
)

This launches a code from within this code. Please pass the name of the code to run.

Reads in the name of the command (code) to be launched. This name is then converted to a string stream and appended with " &" (such that command is run in the background), before being converted back to a C string and then fed to the system() command which will execute the named code from within the running Mercury program.

Parameters
[in]nameThe name of the code to be launched
[in]quick
Returns
int
773 {
774  //defines an (empty) stringstream named "com"
775  std::stringstream com("");
776  //adds the name of the code to run (fed in as an argument)
777  //to the "com" string and appends the string with " &"
778  com << name << " &";
779  //converts the stringstream "com" to a standard string, and then
780  //converts this string to a C string
781  //the string is then fed to the "system" function, which will run the named command
782  return system(com.str().c_str());
783 }

References units::name.

Referenced by ParameterStudy1DDemo::actionsAfterSolve(), ParameterStudy2DDemo::actionsAfterSolve(), ParameterStudy3DDemo::actionsAfterSolve(), ParameterStudy1DDemo::actionsBeforeTimeLoop(), ParameterStudy2DDemo::actionsBeforeTimeLoop(), ParameterStudy3DDemo::actionsBeforeTimeLoop(), and FlowRule::launch().

◆ mpiInsertParticleCheck()

bool DPMBase::mpiInsertParticleCheck ( BaseParticle P)

Function that checks if the mpi particle should really be inserted by the current domain.

When adding a particle, all domains "add" the particle to enable communication between processors However not very domain should add the particle, only the domain that actually contains the particle There is one exception, if an MPI Particle is added (which is not physically in the current domain), this has already been approved by the domain and hence it should return true.

Parameters
[in]PPointer to a baseParticle that requires an insertion check
Returns
Returns if the baseParticle should be inserted or not
1724 {
1725 #ifdef MERCURY_USE_MPI
1726  //If only one core is used (i.e. domainHandler is empty) then the result is always true
1727  if (domainHandler.getSize() == 0)
1728  {
1729  return true;
1730  }
1731  //Get the current domain
1733 
1734  //Check if the particle is in the current domain
1735  if(domain->containsParticle(P))
1736  {
1737  //When adding a particle inside the domain, this should always be true
1738  return true;
1739  }
1740  else
1741  {
1742  //MPI particles that are inserted in the communication zone should still be inserted
1743  return (P->isMPIParticle());
1744  }
1745 #else
1746  return false;
1747 #endif
1748 }

References Domain::containsParticle(), domainHandler, DomainHandler::getCurrentDomain(), BaseHandler< T >::getSize(), and BaseParticle::isMPIParticle().

Referenced by ParticleHandler::addObject().

◆ mpiIsInCommunicationZone()

bool DPMBase::mpiIsInCommunicationZone ( BaseParticle particle)

Checks if the position of the particle is in an mpi communication zone or not.

Parameters
[in]particlePointer to a base particle
Returns
Returns if the particle is in the communication zone (true) or not (false)
1756 {
1757 
1758  bool insideCommunicationZone = false;
1759 #ifdef MERCURY_USE_MPI
1760  MPIContainer& communicator = MPIContainer::Instance();
1761 
1762  //Check for the current domain if the particle is within the communication domain
1763  int val = domainHandler.getCurrentDomain()->isInCommunicationZone(particle);
1764 
1765  //The root gathers all results
1766  int *list = nullptr;
1767  if (PROCESSOR_ID == 0)
1768  {
1769  list = new int [NUMBER_OF_PROCESSORS];
1770  }
1771  communicator.gather(val,list);
1772 
1773  //Compute the global value
1774  //if on any processor the val is true, we have to do the communcation step
1776  int result = 0;
1777  if (PROCESSOR_ID == 0)
1778  {
1779  for (int i = 0; i< NUMBER_OF_PROCESSORS; i++)
1780  {
1781  if (list[i] == 1)
1782  {
1783  result = 1;
1784  break;
1785  }
1786  }
1787  }
1788 
1789  //The root now tells the other processors what the global value for the interaction is
1790  communicator.broadcast(result);
1791 
1792  //Convert the result back to bool
1793  insideCommunicationZone = result;
1794 #endif
1795  return insideCommunicationZone;
1796 }

References MPIContainer::broadcast(), domainHandler, MPIContainer::gather(), DomainHandler::getCurrentDomain(), constants::i, MPIContainer::Instance(), Domain::isInCommunicationZone(), NUMBER_OF_PROCESSORS, and PROCESSOR_ID.

◆ outputInteractionDetails()

void DPMBase::outputInteractionDetails ( ) const
protected

Displays the interaction details corresponding to the pointer objects in the interaction handler.

Skims through all the object pointers of type BaseInteraction in the interaction handler. Outputs the type of interaction between two particles P and I.

5020 {
5021  logger(INFO, "Interactions currently in the handler:\n", Flusher::NO_FLUSH);
5022  //looping over all individual objects in the interactionHandler
5024  {
5025  p->write(std::cout);
5026  logger(INFO, "\nInteraction % % between % and %",
5027  p->getName(), p->getId(), p->getP()->getId(), p->getI()->getId());
5028  }
5029 }

References FLUSH, INFO, interactionHandler, and logger.

◆ outputStatistics()

void DPMBase::outputStatistics ( )
protectedvirtual

This function is overridden by StatisticsVector

1885 {
1886  //cgHandler.evaluate();
1887 }

◆ outputXBallsData()

void DPMBase::outputXBallsData ( std::ostream &  os) const
protectedvirtual

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.

Parameters
[in]os

Reimplemented in SphericalIndenter, LiquidMigrationSelfTest, and LiquidMigrationMPI2Test.

2269 {
2270 
2271 
2272  //Set the correct formation based of dimension if the formation is not specified by the user
2273 
2274  unsigned int format;
2275  switch (getSystemDimensions())
2276  {
2277  case 2:
2278  format = 8;
2279  break;
2280  case 3:
2281  format = 14;
2282  break;
2283  default:
2284  logger(ERROR, "Unknown system dimension");
2285  }
2286 
2287  unsigned int numberOfParticles = particleHandler.getNumberOfRealObjectsLocal();
2288 
2289  // This outputs the location of walls and how many particles there are to file this is required by the xballs plotting
2290  if (format != 14) // dim = 1 or 2
2291  {
2292  os << numberOfParticles
2293  << " " << getTime()
2294  << " " << getXMin()
2295  << " " << getYMin()
2296  << " " << getXMax()
2297  << " " << getYMax()
2298  << " " << std::endl;
2299  }
2300  else
2301  {
2302  //dim==3
2303  os << numberOfParticles
2304  << " " << getTime()
2305  << " " << getXMin()
2306  << " " << getYMin()
2307  << " " << getZMin()
2308  << " " << getXMax()
2309  << " " << getYMax()
2310  << " " << getZMax()
2311  << " " << std::endl;
2312  }
2313 
2314  // This outputs the particle data
2315  for (unsigned int i = 0; i < particleHandler.getSize(); i++)
2316  {
2317 #ifdef MERCURY_USE_MPI
2319  {
2320  outputXBallsDataParticle(i, format, os);
2321  }
2322 #else
2323  outputXBallsDataParticle(i, format, os);
2324 #endif
2325  }
2326 #ifdef DEBUG_OUTPUT
2327  logger(DEBUG, "Have output the properties of the problem to disk ");
2328 #endif
2329 }

References ERROR, FATAL, ParticleHandler::getNumberOfRealObjectsLocal(), BaseHandler< T >::getObject(), BaseHandler< T >::getSize(), getSystemDimensions(), getTime(), getXMax(), getXMin(), getYMax(), getYMin(), getZMax(), getZMin(), constants::i, BaseParticle::isMPIParticle(), BaseParticle::isPeriodicGhostParticle(), logger, outputXBallsDataParticle(), and particleHandler.

Referenced by CSCInit::save(), ClosedCSCWalls::saveWalls(), CSCWalls::saveWalls(), and writeDataFile().

◆ outputXBallsDataParticle()

virtual void DPMBase::outputXBallsDataParticle ( unsigned int  i,
unsigned int  format,
std::ostream &  os 
) const
protectedvirtual

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.

Referenced by outputXBallsData(), LiquidMigrationMPI2Test::outputXBallsData(), LiquidMigrationSelfTest::outputXBallsData(), and SphericalIndenter::outputXBallsData().

◆ performGhostParticleUpdate()

void DPMBase::performGhostParticleUpdate ( )
protected

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.

Todo:
MX: Under construction
4900 {
4901 #ifdef MERCURY_USE_MPI
4902  //MPIContainer& communicator = MPIContainer::Instance();
4903  if (NUMBER_OF_PROCESSORS == 1) {return;}
4904 
4905  //Update the postion and velocity data of ghosts and perform some bookkeeping
4906  std::set<BaseParticle*> particlesToBeDeleted;
4907  domainHandler.updateStatus(particlesToBeDeleted);
4908  periodicBoundaryHandler.updateStatus(particlesToBeDeleted);
4909 
4910  //Delete particles
4911  deleteGhostParticles(particlesToBeDeleted);
4912 
4913  //Add new particles
4916 #endif
4917 }

References DomainHandler::addNewParticles(), PeriodicBoundaryHandler::addNewParticles(), deleteGhostParticles(), domainHandler, NUMBER_OF_PROCESSORS, periodicBoundaryHandler, PeriodicBoundaryHandler::updateStatus(), and DomainHandler::updateStatus().

Referenced by computeOneTimeStep().

◆ performGhostVelocityUpdate()

void DPMBase::performGhostVelocityUpdate ( )
protected

updates the final time-step velocity of the ghost particles

4965 {
4966 #ifdef MERCURY_USE_MPI
4967  if (NUMBER_OF_PROCESSORS == 1) {return;}
4968  //TODO If required, I can implement this for periodic particles, first discuss with Thomas if it is actually requiredf
4969  //periodicDomainHandler.updateVelocity()
4970  //domainHandler.updateVelocity();
4971 #endif
4972 }

References NUMBER_OF_PROCESSORS.

◆ printTime()

void DPMBase::printTime ( ) const
protectedvirtual

Displays the current simulation time and the maximum simulation duration.

Gets and prints the current simulation time (getTime()) and the currently set maximum simulation time (getTimeMax()) .

Reimplemented in Chute, BaseCluster, TangentialSpringEnergyConservationUnitTest, SpeciesTest, regimeForceUnitTest, RandomClusterInsertionBoundarySelfTest, PeriodicWallsWithSlidingFrictionUnitTest, LiquidMigrationPeriodicBoundaryInteraction, viscoElasticUnitTest, LongHertzianSinterForceUnitTest, RandomClusterInsertionBoundarySelfTest, protectiveWall, DPM, SphericalIndenter, SinterPair, Sintering, InitialConditions< SpeciesType >, SingleParticle< SpeciesType >, LiquidMigrationSelfTest, PSDSelfTest, PSDManualInsertionSelfTest, PolydisperseInsertionBoundarySelfTest, NozzleSelfTest, MultiplePSDSelfTest, InsertionBoundarySelfTest, DistributionToPSDSelfTest, DeletionBoundarySelfTest, CubeDeletionBoundarySelfTest, ConstantMassFlowMaserSelfTest, ConstantMassFlowMaserBoundaryMixedSpeciesSelfTest, Silo, Penetration, Drum, vibratedBed, statistics_while_running< T >, CLiveStatistics< T >, SilbertPeriodic, ParticleInclusion, LiquidMigrationMPI2Test, ForceLawsMPI2Test, VerticalMixer, NozzleDemo, HorizontalMixer, RandomClusterInsertionBoundarySelfTest, LawinenBox, LawinenBox, LawinenBox, T_protectiveWall, SilbertPeriodic, SilbertPeriodic, statistics_while_running< T >, statistics_while_running< T >, ChuteWithPeriodicInflow, Vreman, Vreman, Vreman, VariableBottom, ChutePeriodic, VariableBottom, ChutePeriodic, CSCWalls, CSCRun, CSCRestart, CSCInit, ClosedCSCWalls, ClosedCSCRun, and ClosedCSCRestart.

1962 {
1963 #ifdef MERCURY_USE_MPI
1964  MPIContainer& communicator = MPIContainer::Instance();
1965  if (communicator.getProcessorID() == 0)
1966  {
1967 #endif
1968  logger(INFO, "t=%3.6, tmax=%3.6", getTime(), getTimeMax());
1969 #ifdef MERCURY_USE_MPI
1970  }
1971 #endif
1972 }

References MPIContainer::getProcessorID(), getTime(), getTimeMax(), INFO, MPIContainer::Instance(), and logger.

Referenced by LongHertzianSinterForceUnitTest::printTime(), TangentialSpringEnergyConservationUnitTest::printTime(), Mercury3DRestart::readNextArgument(), and writeOutputFiles().

◆ processStatistics()

void DPMBase::processStatistics ( bool  )
protectedvirtual

This function is overridden by StatisticsVector

1910 {
1911 }

◆ read()

void DPMBase::read ( std::istream &  is,
ReadOptions  opt = ReadOptions::ReadAll 
)
virtual

Reads all data from a restart file, e.g. domain data and particle data.

Todo:
warning: hides non-virtual function from the class 'Files'.

Reads in an existing .restart file line-by-line and passes all relevant parameters to the current instance of DPMBase. The data stream corresponding to the desired input file is passed as an argument.

Parameters
[in]isThe data stream from which the particle data will be read.

\TODO: Bound checking

\TODO: Same order as other file format, please?

todo{Do we want to calculate the mass?}

Reimplemented in MercuryBase, ChuteWithHopper, Chute, BaseCluster, Funnel, and MembraneDemo.

3532 {
3533 #ifdef MERCURY_USE_MPI
3534  int previousNumberOfProcessors;
3535 #endif
3536  //Declares...
3537  std::string dummy;
3538  //...and reads in a dummy variable from the start of the stream "is"
3539  is >> dummy;
3540  //compare the string read in to the phrase "restart_version" to see if the stream corresponds
3541  //to a restart file (all restart files begin with this phrase)
3542  //if both strings match, strcmp(dummy.c_str(), "restart_version") returns 0 (here read as "false")
3543  if (dummy != "restart_version" && dummy != "MercuryDPM")
3544  {
3545  //If the strings do not match, if statement is fulfilled and the error logged
3546  //Note: only very old files did not have a restart_version
3547  logger(FATAL, "Error in DPMBase::read(is): this is not a valid restart file");
3548  }
3549  else
3550  {
3551  //reads in the restart version (earlier versions of Mercury possess different file formats!)
3552  is >> restartVersion_;
3553  //checking which version the current data file corresponds to, and reads the data in
3554  //accordingly
3555  if (restartVersion_ == "1.0" || restartVersion_ == "0.14")
3556  {
3557  //reads in and saves the relevant values from the data file to the current instance of DPMBase
3558  std::stringstream line;
3559 
3560  // Store path (if restart file is nonlocal)
3561  auto slash = restartFile.getName().rfind('/');
3562  std::string path;
3563  if (slash != std::string::npos)
3564  {
3565  path = restartFile.getName().substr(0, slash + 1);
3566  }
3567  if (!path.empty())
3568  {
3569  logger(INFO, "Adding path information (%) to file names", path);
3570  }
3571 
3572  //line 1
3574  //discards the whitespace (ws) at the start of the stream
3575  line >> std::ws;
3576  //uses the "peek" function to access the stream's first
3577  //non-whitespace character, and check if it is an "r"
3578  if (line.peek() == 'r')
3579  //if so, reads in the current run number
3580  line >> dummy >> runNumber_;
3581  //In either case, then uses the "Files" version of the read function
3582  //to read in the rest of the relevant information.
3583  line >> dummy >> name_;
3584  setName(name_);
3585 
3586  //Read line 2-7 (definition of i/o files)
3588  line >> dummy >> dataFile;
3590  line >> dummy >> fStatFile;
3592  line >> dummy >> eneFile;
3594  line >> dummy >> restartFile;
3596  line >> dummy >> statFile;
3597 
3598  // Add the file path from the restart file to the file names
3599  dataFile.setName(path + dataFile.getName());
3600  fStatFile.setName(path + fStatFile.getName());
3601  eneFile.setName(path + eneFile.getName());
3603  statFile.setName(path + statFile.getName());
3604 
3605  // Get current position
3606  //check if the next line starts with 'interactionFile'; otherwise, skip interaction
3607  if (helpers::compare(is, "interactionFile"))
3608  {
3610  line >> interactionFile;
3612  }
3613 
3615  line >> dummy >> min_.x()
3616  >> dummy >> max_.x()
3617  >> dummy >> min_.y()
3618  >> dummy >> max_.y()
3619  >> dummy >> min_.z()
3620  >> dummy >> max_.z();
3621 
3623  line >> dummy >> timeStep_
3624  >> dummy >> time_
3625  >> dummy >> numberOfTimeSteps_
3626  >> dummy >> timeMax_;
3627 
3629  line >> dummy >> systemDimensions_
3630  >> dummy >> particleDimensions_
3631  >> dummy >> gravity_;
3632 
3633  line >> dummy;
3634  if (!dummy.compare("writeVTK"))
3635  {
3636  FileType writeInteractionsVTK = FileType::NO_FILE;
3637  unsigned particlesCounter, wallCounter, interactionCounter, boundaryCounter;
3638  bool writeBoundaryVTK;
3639  line >> writeParticlesVTK_ >> writeWallsVTK_ >> writeInteractionsVTK >> writeBoundaryVTK >> particlesCounter >> wallCounter >> interactionCounter >> boundaryCounter;
3640  line.clear();//because the number of arguments in writeVTK has changed
3641  line >> dummy;
3644  interactionHandler.setWriteVTK(writeInteractionsVTK);
3645  boundaryHandler.setWriteVTK(writeBoundaryVTK);
3646  vtkWriter_->setFileCounter(particlesCounter);
3647  wallVTKWriter_.setFileCounter(particlesCounter);
3648  interactionVTKWriter_.setFileCounter(particlesCounter);
3649  boundaryVTKWriter_.setFileCounter(boundaryCounter);
3650  }
3651  if (!dummy.compare("random"))
3652  {
3653  random.read(line);
3654  line >> dummy;
3655  }
3656 
3657 #ifdef MERCURY_USE_OMP
3658  //Read the number of OMP threads
3659  if (!dummy.compare("numberOfOMPThreads")) {
3660  int numberOfOMPThreads;
3661  line >> numberOfOMPThreads;
3662  setNumberOfOMPThreads(numberOfOMPThreads);
3663  //logger(INFO," Check the number of OMP threads = % ", getNumberOfOMPThreads());
3664  }
3665 #endif
3666 #ifdef MERCURY_USE_MPI
3667  if (!dummy.compare("numberOfProcessors"))
3668  {
3669  line >> previousNumberOfProcessors
3670  >> dummy >> numberOfDomains_[Direction::XAXIS]
3673  }
3674  else
3675  {
3676  logger(INFO,"Reading a serial restart file");
3677  //numberOfDomains_ = {1,1,1};
3678  }
3679 #endif
3680  if (!dummy.compare("xBallsArguments")) {
3682  setXBallsAdditionalArguments(line.str());
3683  }
3684 
3685  speciesHandler.read(is);
3686 
3687 #ifdef MERCURY_USE_MPI
3688  //Initialise MPI structures and perform domain decomposition
3689  decompose();
3690 #endif
3691 
3692  //reading in the various relevant handlers
3693  unsigned int N;
3694  is >> dummy >> N;
3695  if (dummy.compare("Walls"))
3696  logger(ERROR, "DPMBase::read(is): Error during restart: 'Walls' argument could not be found.");
3697  wallHandler.clear();
3700  for (unsigned int i = 0; i < N; i++)
3701  {
3704  }
3705 
3706  is >> dummy >> N;
3709  if (dummy.compare("Boundaries"))
3710  logger(ERROR, "DPMBase::read(is): Error during restart: 'Boundaries' argument could not be found.");
3712  for (unsigned int i = 0; i < N; i++)
3713  {
3716  }
3717 
3719 
3720  is >> dummy >> N;
3721  is.ignore(std::numeric_limits<std::streamsize>::max(), '\n');
3722  //display a message if a large amount o fparticles is read
3723  if (N>2.5e5) logger(INFO, "Reading % particles (may take a while)",N);
3724  logger.assert_always(dummy.compare("Particles")==0, "DPMBase::read(is): Error during restart: 'Particles' argument could not be found. %",dummy);
3727  for (unsigned int i = 0; i < N; i++)
3728  {
3729  //ParticleHandler::readAndCreateObject reads line-by-line
3731  //skip the remaining data in line
3732  is.ignore(std::numeric_limits<std::streamsize>::max(), '\n');
3734  //particleHandler.getLastObject()->computeMass();
3735  }
3736 #ifdef MERCURY_USE_MPI
3737  //Interaction distances of the domainHandler and periodicBoundaryHandler need to be set
3738  Mdouble interactionRadius = particleHandler.getLargestInteractionRadius();
3739  domainHandler.setInteractionDistance(2.0*interactionRadius);
3740  periodicBoundaryHandler.setInteractionDistance(2.0*interactionRadius);
3741 
3742  if (NUMBER_OF_PROCESSORS > 1)
3743  {
3744  //Create ghost particles
3747  }
3748 #endif
3749  //Add interactions to particles and ghost particles
3750  if (opt==ReadOptions::ReadNoInteractions) return;
3752  }
3753  //reading in for older versions of the Mercury restart file.
3754  else if (!restartVersion_.compare("3"))
3755  {
3756  logger(INFO, "DPMBase::read(is): restarting from an old restart file (restart_version %).",
3757  restartVersion_);
3758  readOld(is);
3759  }
3760  //returning an error if there is no restart file to read in due to the use of outdated files.
3761  else
3762  {
3763  //only very old files did not have a restart_version
3764  logger(FATAL,
3765  "Error in DPMBase::read(is): restart_version % cannot be read; use an older version of Mercury to upgrade the file",
3766  restartVersion_);
3767  }
3768  }
3769 }

References DomainHandler::addNewParticles(), PeriodicBoundaryHandler::addNewParticles(), boundaryHandler, boundaryVTKWriter_, BaseHandler< T >::clear(), ParticleHandler::clear(), helpers::compare(), dataFile, decompose(), domainHandler, eneFile, ERROR, FATAL, fStatFile, ParticleHandler::getLargestInteractionRadius(), helpers::getLineFromStringStream(), File::getName(), gravity_, constants::i, INFO, interactionFile, interactionHandler, interactionVTKWriter_, logger, max_, min_, name_, NUMBER_OF_PROCESSORS, numberOfDomains_, numberOfTimeSteps_, particleDimensions_, particleHandler, periodicBoundaryHandler, random, BaseHandler< T >::read(), InteractionHandler::read(), RNG::read(), BoundaryHandler::readAndAddObject(), WallHandler::readAndAddObject(), ParticleHandler::readAndAddObject(), ReadNoInteractions, ReadNoParticlesAndInteractions, readOld(), restartFile, restartVersion_, runNumber_, BaseVTKWriter< H >::setFileCounter(), DomainHandler::setInteractionDistance(), PeriodicBoundaryHandler::setInteractionDistance(), setName(), File::setName(), setNumberOfOMPThreads(), setParticlesWriteVTK(), BaseHandler< T >::setStorageCapacity(), setWallsWriteVTK(), BoundaryHandler::setWriteVTK(), InteractionHandler::setWriteVTK(), setXBallsAdditionalArguments(), speciesHandler, statFile, systemDimensions_, time_, timeMax_, timeStep_, vtkWriter_, wallHandler, wallVTKWriter_, writeParticlesVTK_, writeWallsVTK_, Vec3D::x(), XAXIS, Vec3D::y(), YAXIS, Vec3D::z(), and ZAXIS.

Referenced by MercuryBase::read(), readRestartFile(), and readSpeciesFromDataFile().

◆ readArguments()

bool DPMBase::readArguments ( int  argc,
char argv[] 
)

Can interpret main function input arguments that are passed by the driver codes.

Interprets commands passed in the command line (e.g. -tmin 0 -tmax 100 ...).

argc gives the number of commands passed, while argv stores the commands themselves (as strings).

Outputs the name and value of each flag passed, then calls the readNextArgument() function to actually interpret and implement the relevant arguments. Will raise an error if an unknown flag is passed.

Parameters
[in]argc"Argument count" - number of individual elements that argv will possess
[in]*argv[]An array of length argc - specifically an array of strings (or, in C terminology, a character array)
4226 {
4227  bool isRead = true;
4228  // Cycles over every second element. (Most flags will contain both name labels and actual data.
4229  // Those that don't will have to do i--; some examples in readNextArgument.)
4230  for (int i = 1; i < argc; i += 2)
4231  {
4232  logger(INFO, "interpreting input argument %\n", argv[i], Flusher::NO_FLUSH);
4233  for (int j = i + 1; j < argc; j++)
4234  {
4235  //looks for the next string that starts with a minus sign
4236  //i.e. the next flag, as each flag may take 0, 1 , 2, 3... arguments
4237  //and we need to make sure all are read in!
4238  if (argv[j][0] == '-')
4239  break;
4240  logger(INFO, " %\n", argv[j], Flusher::NO_FLUSH);
4241  }
4242  logger(INFO, "");
4243  //if "isRead"is true and "readNextArgument" is also true...
4244  //(i.e. checking if any argument is false)
4245  isRead &= readNextArgument(i, argc, argv);
4246 
4247  // If the read was unsuccessful, raise an error and quit. (JMFT: Used to just be a warning.)
4248  if (!isRead)
4249  {
4250  logger(ERROR, "Warning: not all arguments read correctly!");
4251  }
4252  }
4253  return isRead;
4254 }

References ERROR, FLUSH, constants::i, INFO, logger, and readNextArgument().

Referenced by main(), FlowRule::run(), vibratedBed::run(), and solve().

◆ readDataFile()

bool DPMBase::readDataFile ( std::string  fileName = "",
unsigned int  format = 0 
)

This allows particle data to be reloaded from data files.

This function reads a .data file, which contains info about each particle's position, velocity, angular velocity, radius ...info. See also MD::readRestartFile For XBalls: Can read in format_ 14 - 8 or format_ 7 data format. This code saves in format_ 8 for 2D and format_ 14 for 3D. So if no extra parameters are specified it will assume many parameters, like density cannot be set using the data file. use of string instead of string& b/c this function is often used with a string literal

Parameters
[in]fileName
[in]format(format for specifying if its for 2D or 3D data)
Returns
bool (True or False)
2347 {
2348  //default value: dataFile.getFullName()
2349  if (!fileName.compare(""))
2350  fileName = dataFile.getFullName();
2351 
2352  std::string oldFileName = dataFile.getName();
2353  unsigned oldCounter = dataFile.getCounter();
2354  //Updates the name of the data file to the user-input from the argument.
2355  dataFile.setName(fileName);
2356  //opens a filestream of the input type
2357  dataFile.open(std::fstream::in);
2358  //Checks if the file has been successfully opened...
2359  if (!dataFile.getFstream().is_open() || dataFile.getFstream().bad())
2360  {
2361  //...and if not, ends the function and returns "false"
2362  logger(WARN, "Loading data file % failed.", fileName);
2363  return false;
2364  }
2365 
2366  //retrieves and saves the "FileType" of the file
2367  FileType fileTypeData = dataFile.getFileType();
2368  dataFile.setFileType(FileType::ONE_FILE);
2369  readNextDataFile(format);
2370  dataFile.setFileType(fileTypeData);
2371  dataFile.close();
2372  dataFile.setName(oldFileName);
2373  dataFile.setCounter(oldCounter);
2374  return true;
2375 }

References File::close(), dataFile, File::getCounter(), File::getFileType(), File::getFstream(), File::getFullName(), File::getName(), logger, File::open(), readNextDataFile(), File::setCounter(), File::setFileType(), File::setName(), and WARN.

Referenced by VariableBottom::add_particles(), VariableBottom::createBottom(), LawinenBox::LawinenBox(), main(), readNextArgument(), my_problem::setupInitialConditions(), free_cooling::setupInitialConditions(), restart::setupInitialConditions(), and DPM::setupInitialConditions().

◆ readNextArgument()

bool DPMBase::readNextArgument ( int i,
int  argc,
char argv[] 
)
virtual

Interprets the i^th command-line argument.

Reads, recognises and applies all valid flags passed when starting or restarting a Mercury simulation.

For all of the N = argc (argument count) command line arguments passed when starting/restarting a code (e.g. -tmax, -tmin ...), compares them to the "known" arguments understood by Mercury (note that further recognised arguments can be added in derived classes). If a match is found, the relevant parameter is set to the corresponding value(s) following the flag and true is returned. Otherwise, false is returned.

For instance, if the flag -xmin 0 is passed, the code's second if statement will recognise the flag, convert the subsequent string in argv to a double, and then call the setXMin() function to implement the new value (0) of XMin.

For developers: note the use of strcmp here. This cannot be replaced with a simpler ==, as we are comparing c-style strings (char*), instead of std::string. Thus, == would return equality of the pointers instead of the contents of the string. strcmp returns 0 if the strings are the same, and another number if they are different. This is then implicitly cast to a bool, where 0->false and other numbers will give true. Finally, the !-operator makes sure that the expression in the if-statements are true if the strings are the same, and false otherwise.

Parameters
[in]ithe position of the element that will be read, note that the count starts at 1, as element 0 is the name of the executable
[in]argcnumber of arguments the user has given
[in]*argv[]the command-line arguments the user has given when calling the executable
Returns
true if the argument is successfully read, and false otherwise.

-gravity_ requires three arguments

-restart or -r loads a restart file. By default, it loads <name>.restart. If an argument "arg" is given it loads the file "arg", or "arg".restart (if the ending is not given).

Reimplemented in MercuryBase, ChuteWithHopper, Chute, FlowRule, Funnel, GranularJet, Mercury3DRestart, SilbertPeriodic, SilbertPeriodic, and AxisymmetricHopper.

4351 {
4352  // The argument argv[i] identifies the label of the flag, and subsequent arguments (usually 1)
4353  // contain the content.
4354  //
4355  // For example...
4356  // Checks if the "-name" flag has been passed
4357  // The strcmp returns 0 if "argv[i]" is "-name" (i.e. !strcmp(argv[i], "-name") --> 1)
4358  // In this case, the setName function is run with the relevant input (i.e. the value which
4359  // immediately follows the "-name" flag
4360  if (!strcmp(argv[i], "-name"))
4361  {
4362  setName(argv[i + 1]);
4363  }
4364  // The above process is repeated for all viable flags.
4365  else if (!strcmp(argv[i], "-xmin"))
4366  {
4367  setXMin(atof(argv[i + 1]));
4368  }
4369  else if (!strcmp(argv[i], "-ymin"))
4370  {
4371  setYMin(atof(argv[i + 1]));
4372  }
4373  else if (!strcmp(argv[i], "-zmin"))
4374  {
4375  setZMin(atof(argv[i + 1]));
4376  }
4377  else if (!strcmp(argv[i], "-xmax"))
4378  {
4379  setXMax(atof(argv[i + 1]));
4380  }
4381  else if (!strcmp(argv[i], "-ymax"))
4382  {
4383  setYMax(atof(argv[i + 1]));
4384  }
4385  else if (!strcmp(argv[i], "-zmax"))
4386  {
4387  setZMax(atof(argv[i + 1]));
4388  //} else if (!strcmp(argv[i],"-svn")) {
4389  // std::cout << "svn version " << SVN_VERSION << std::endl;
4390  // i--;
4391  }
4392  else if (!strcmp(argv[i], "-dt"))
4393  {
4394  Mdouble old = getTimeStep();
4395  setTimeStep(atof(argv[i + 1]));
4396  logger(INFO, " reset dt from % to %", old, getTimeStep());
4397  }
4398 // else if (!strcmp(argv[i], "-Hertz"))
4399 // {
4400 // speciesHandler.getObject(0)->setForceType(ForceType::HERTZ);
4401 // i--;
4402 // }
4403  else if (!strcmp(argv[i], "-tmax"))
4404  {
4405  Mdouble old = getTimeMax();
4406  setTimeMax(atof(argv[i + 1]));
4407  logger(INFO, " reset timeMax from % to %", old, getTimeMax());
4408  }
4409  else if (!strcmp(argv[i], "-saveCount"))
4410  {
4411  Mdouble old = dataFile.getSaveCount();
4412  setSaveCount(static_cast<unsigned int>(atoi(argv[i + 1])));
4413  logger(INFO, " reset saveCount from & to %", old, dataFile.getSaveCount());
4414  }
4415  else if (!strcmp(argv[i], "-saveCountData"))
4416  {
4417  dataFile.setSaveCount(static_cast<unsigned int>(atoi(argv[i + 1])));
4418  }
4419  else if (!strcmp(argv[i], "-saveCountFStat"))
4420  {
4421  fStatFile.setSaveCount(static_cast<unsigned int>(atoi(argv[i + 1])));
4422  }
4423  else if (!strcmp(argv[i], "-saveCountStat"))
4424  {
4425  statFile.setSaveCount(static_cast<unsigned int>(atoi(argv[i + 1])));
4426  }
4427  else if (!strcmp(argv[i], "-saveCountEne"))
4428  {
4429  eneFile.setSaveCount(static_cast<unsigned int>(atoi(argv[i + 1])));
4430  }
4431  else if (!strcmp(argv[i], "-saveCountRestart"))
4432  {
4433  restartFile.setSaveCount(static_cast<unsigned int>(atoi(argv[i + 1])));
4434  }
4435  else if (!strcmp(argv[i], "-dim"))
4436  {
4437  setSystemDimensions(static_cast<unsigned int>(atoi(argv[i + 1])));
4438  }
4439  else if (!strcmp(argv[i], "-gravity"))
4440  {
4442  setGravity(Vec3D(atof(argv[i + 1]), atof(argv[i + 2]), atof(argv[i + 3])));
4443  i += 2;
4444  }
4445  else if (!strcmp(argv[i], "-fileType"))
4446  { //uses int input
4447  setFileType(static_cast<FileType>(atoi(argv[i + 1])));
4448  }
4449  else if (!strcmp(argv[i], "-fileTypeFStat"))
4450  { //uses int input
4451  fStatFile.setFileType(static_cast<FileType>(atoi(argv[i + 1])));
4452  }
4453  else if (!strcmp(argv[i], "-fileTypeRestart"))
4454  {
4455  restartFile.setFileType(static_cast<FileType>(atoi(argv[i + 1])));
4456  }
4457  else if (!strcmp(argv[i], "-fileTypeData"))
4458  {
4459  dataFile.setFileType(static_cast<FileType>(atoi(argv[i + 1])));
4460  }
4461  else if (!strcmp(argv[i], "-fileTypeStat"))
4462  {
4463  statFile.setFileType(static_cast<FileType>(atoi(argv[i + 1])));
4464  }
4465  else if (!strcmp(argv[i], "-fileTypeEne"))
4466  {
4467  eneFile.setFileType(static_cast<