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 class  ReadOptions : int { ReadAll , ReadNoInteractions , ReadNoParticlesAndInteractions }
 
enum class  DomainSplit {
  X , Y , Z , XY ,
  XZ , YZ , 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< int > get1DParametersFromRunNumber (int size_x) const
 This turns a counter into 1 index, which is a useful feature for performing 1D parameter study. The index run from 1:size_x, while the study number starts at 0 (initially the counter=1 in COUNTER_DONOTDEL) More...
 
std::vector< int > get2DParametersFromRunNumber (int size_x, int size_y) const
 This turns a counter into 2 indices which is a very useful feature for performing a 2D study. The indices run from 1:size_x and 1:size_y, while the study number starts at 0 ( initially the counter=1 in COUNTER_DONOTDEL) More...
 
std::vector< int > get3DParametersFromRunNumber (int size_x, int size_y, int size_z) const
 This turns a counter into 3 indices, which is a useful feature for performing a 3D parameter study. The indices run from 1:size_x, 1:size_y and 1:size_z, while the study number starts at 0 ( initially the counter=1 in COUNTER_DONOTDEL) More...
 
int launchNewRun (const char *name, bool quick=false)
 This launches a code from within this code. Please pass the name of the code to run. More...
 
void setRunNumber (int runNumber)
 This sets the counter/Run number, overriding the defaults. More...
 
int getRunNumber () const
 This returns the current value of the counter (runNumber_) More...
 
virtual void decompose ()
 Sends particles from processorId to the root processor. More...
 
void solve ()
 The work horse of the code. More...
 
void initialiseSolve ()
 Beginning of the solve routine, before time stepping. More...
 
void finaliseSolve ()
 End of the solve routine, after time stepping. More...
 
virtual void computeOneTimeStep ()
 Performs everything needed for one time step, used in the time-loop of solve(). More...
 
void checkSettings ()
 Checks if the essentials are set properly to go ahead with solving the problem. More...
 
void forceWriteOutputFiles ()
 Writes output files immediately, even if the current time step was not meant to be written. Also resets the last saved time step. More...
 
virtual void writeOutputFiles ()
 Writes simulation data to all the main Mercury files: .data, .ene, .fstat, .xballs and .restart (see the Mercury website for more details regarding these files). More...
 
void solve (int argc, char *argv[])
 The work horse of the code. Can handle flags from the command line. More...
 
virtual void 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...
 
MERCURYDPM_DEPRECATED FilegetDataFile ()
 The non const version. Allows one to edit the File::dataFile. More...
 
MERCURYDPM_DEPRECATED FilegetEneFile ()
 The non const version. Allows to edit the File::eneFile. More...
 
MERCURYDPM_DEPRECATED FilegetFStatFile ()
 The non const version. Allows to edit the File::fStatFile. More...
 
MERCURYDPM_DEPRECATED FilegetRestartFile ()
 The non const version. Allows to edit the File::restartFile. More...
 
MERCURYDPM_DEPRECATED FilegetStatFile ()
 The non const version. Allows to edit the File::statFile. More...
 
FilegetInteractionFile ()
 Return a reference to the file InteractionsFile. More...
 
MERCURYDPM_DEPRECATED const FilegetDataFile () const
 The const version. Does not allow for any editing of the File::dataFile. More...
 
MERCURYDPM_DEPRECATED const FilegetEneFile () const
 The const version. Does not allow for any editing of the File::eneFile. More...
 
MERCURYDPM_DEPRECATED const FilegetFStatFile () const
 The const version. Does not allow for any editing of the File::fStatFile. More...
 
MERCURYDPM_DEPRECATED const FilegetRestartFile () const
 The const version. Does not allow for any editing of the File::restartFile. More...
 
MERCURYDPM_DEPRECATED const FilegetStatFile () const
 The const version. Does not allow for any editing of the File::statFile. More...
 
const FilegetInteractionFile () const
 
const std::string & getName () const
 Returns the name of the file. Does not allow to change it though. More...
 
void setName (const std::string &name)
 Allows to set the name of all the files (ene, data, fstat, restart, stat) More...
 
void setName (const char *name)
 Calls setName(std::string) More...
 
void setSaveCount (unsigned int saveCount)
 Sets File::saveCount_ for all files (ene, data, fstat, restart, stat) More...
 
void setFileType (FileType fileType)
 Sets File::fileType_ for all files (ene, data, fstat, restart, stat) More...
 
void setOpenMode (std::fstream::openmode openMode)
 Sets File::openMode_ for all files (ene, data, fstat, restart, stat) More...
 
void resetFileCounter ()
 Resets the file counter for each file i.e. for ene, data, fstat, restart, stat) More...
 
void closeFiles ()
 Closes all files (ene, data, fstat, restart, stat) that were opened to read or write. More...
 
void setLastSavedTimeStep (unsigned int nextSavedTimeStep)
 Sets the next time step for all the files (ene, data, fstat, restart, stat) at which the data is to be written or saved. More...
 
Mdouble getTime () const
 Returns the current simulation time. More...
 
Mdouble getNextTime () const
 Returns the current simulation time. More...
 
unsigned int getNumberOfTimeSteps () const
 Returns the current counter of time-steps, i.e. the number of time-steps that the simulation has undergone so far. More...
 
void setTime (Mdouble time)
 Sets a new value for the current simulation time. More...
 
void setTimeMax (Mdouble newTMax)
 Sets a new value for the maximum simulation duration. More...
 
Mdouble getTimeMax () const
 Returns the maximum simulation duration. More...
 
void setLogarithmicSaveCount (Mdouble logarithmicSaveCountBase)
 Sets File::logarithmicSaveCount_ for all files (ene, data, fstat, restart, stat) More...
 
void setNToWrite (int nToWrite)
 set the number of elements to write to the screen More...
 
int getNToWrite () const
 get the number of elements to write to the More...
 
void setRotation (bool rotation)
 Sets whether particle rotation is enabled or disabled. More...
 
bool getRotation () const
 Indicates whether particle rotation is enabled or disabled. More...
 
MERCURYDPM_DEPRECATED void setWallsWriteVTK (FileType writeWallsVTK)
 Sets whether walls are written into a VTK file. More...
 
MERCURYDPM_DEPRECATED void setWallsWriteVTK (bool)
 Sets whether walls are written into a VTK file. More...
 
MERCURYDPM_DEPRECATED void setInteractionsWriteVTK (bool)
 Sets whether interactions are written into a VTK file. More...
 
void setParticlesWriteVTK (bool writeParticlesVTK)
 Sets whether particles are written in a VTK file. More...
 
void setSuperquadricParticlesWriteVTK (bool writeSuperquadricParticlesVTK)
 
MERCURYDPM_DEPRECATED FileType getWallsWriteVTK () const
 Returns whether walls are written in a VTK file. More...
 
bool getParticlesWriteVTK () const
 Returns whether particles are written in a VTK file. More...
 
bool getSuperquadricParticlesWriteVTK () const
 
Mdouble getXMin () const
 If the length of the problem domain in x-direction is XMax - XMin, then getXMin() returns XMin. More...
 
Mdouble getXMax () const
 If the length of the problem domain in x-direction is XMax - XMin, then getXMax() returns XMax. More...
 
Mdouble getYMin () const
 If the length of the problem domain in y-direction is YMax - YMin, then getYMin() returns YMin. More...
 
Mdouble getYMax () const
 If the length of the problem domain in y-direction is YMax - YMin, then getYMax() returns XMax. More...
 
Mdouble getZMin () const
 If the length of the problem domain in z-direction is ZMax - ZMin, then getZMin() returns ZMin. More...
 
Mdouble getZMax () const
 If the length of the problem domain in z-direction is ZMax - ZMin, then getZMax() returns ZMax. More...
 
Mdouble getXCenter () const
 
Mdouble getYCenter () const
 
Mdouble getZCenter () const
 
Vec3D getMin () const
 
Vec3D getMax () const
 
void setXMin (Mdouble newXMin)
 Sets the value of XMin, the lower bound of the problem domain in the x-direction. More...
 
void setYMin (Mdouble newYMin)
 Sets the value of YMin, the lower bound of the problem domain in the y-direction. More...
 
void setZMin (Mdouble newZMin)
 Sets the value of ZMin, the lower bound of the problem domain in the z-direction. More...
 
void setXMax (Mdouble newXMax)
 Sets the value of XMax, the upper bound of the problem domain in the x-direction. More...
 
void setYMax (Mdouble newYMax)
 Sets the value of YMax, the upper bound of the problem domain in the y-direction. More...
 
void setZMax (Mdouble newZMax)
 Sets the value of ZMax, the upper bound of the problem domain in the z-direction. More...
 
void setMax (const Vec3D &max)
 Sets the maximum coordinates of the problem domain. More...
 
void setMax (Mdouble, Mdouble, Mdouble)
 Sets the maximum coordinates of the problem domain. More...
 
void setDomain (const Vec3D &min, const Vec3D &max)
 Sets the minimum coordinates of the problem domain. More...
 
void setMin (const Vec3D &min)
 Sets the minimum coordinates of the problem domain. More...
 
void setMin (Mdouble, Mdouble, Mdouble)
 Sets the minimum coordinates of the problem domain. More...
 
void setTimeStep (Mdouble newDt)
 Sets a new value for the simulation time step. More...
 
Mdouble getTimeStep () const
 Returns the simulation time step. More...
 
void setNumberOfOMPThreads (int numberOfOMPThreads)
 
int getNumberOfOMPThreads () const
 
void setXBallsColourMode (int newCMode)
 Set the xballs output mode. More...
 
int getXBallsColourMode () const
 Get the xballs colour mode (CMode). More...
 
void setXBallsVectorScale (double newVScale)
 Set the scale of vectors in xballs. More...
 
double getXBallsVectorScale () const
 Returns the scale of vectors used in xballs. More...
 
void setXBallsAdditionalArguments (std::string newXBArgs)
 Set the additional arguments for xballs. More...
 
std::string getXBallsAdditionalArguments () const
 Returns the additional arguments for xballs. More...
 
void setXBallsScale (Mdouble newScale)
 Sets the scale of the view (either normal, zoom in or zoom out) to display in xballs. The default is fit to screen. More...
 
double getXBallsScale () const
 Returns the scale of the view in xballs. More...
 
void setGravity (Vec3D newGravity)
 Sets a new value for the gravitational acceleration. More...
 
Vec3D getGravity () const
 Returns the gravitational acceleration. More...
 
void setBackgroundDrag (Mdouble backgroundDrag)
 Simple access function to turn on a background drag. The force of particleVelocity*drag is applied (note, it allowd to be negaitve i.e. create energy) More...
 
const Mdouble getBackgroundDrag () const
 Return the background drag. More...
 
void setDimension (unsigned int newDim)
 Sets both the system dimensions and the particle dimensionality. More...
 
void setSystemDimensions (unsigned int newDim)
 Sets the system dimensionality. More...
 
unsigned int getSystemDimensions () const
 Returns the system dimensionality. More...
 
void setParticleDimensions (unsigned int particleDimensions)
 Sets the particle dimensionality. More...
 
unsigned int getParticleDimensions () const
 Returns the particle dimensionality. More...
 
std::string getRestartVersion () const
 This is to take into account for different Mercury versions. Returns the version of the restart file. More...
 
void setRestartVersion (std::string newRV)
 Sets restart_version. More...
 
bool getRestarted () const
 Returns the flag denoting if the simulation was restarted or not. More...
 
void setRestarted (bool newRestartedFlag)
 Allows to set the flag stating if the simulation is to be restarted or not. More...
 
bool getAppend () const
 Returns whether the "append" option is on or off. More...
 
void setAppend (bool newAppendFlag)
 Sets whether the "append" option is on or off. More...
 
Mdouble getElasticEnergy () const
 Returns the global elastic energy within the system. More...
 
Mdouble getKineticEnergy () const
 Returns the global kinetic energy stored in the system. More...
 
Mdouble getGravitationalEnergy () const
 Returns the global gravitational potential energy stored in the system. More...
 
Mdouble getRotationalEnergy () const
 JMFT Returns the global rotational energy stored in the system. More...
 
Mdouble getTotalEnergy () const
 
Mdouble getTotalMass () const
 JMFT: Return the total mass of the system, excluding fixed particles. More...
 
Vec3D getCentreOfMass () const
 JMFT: Return the centre of mass of the system, excluding fixed particles. More...
 
Vec3D getTotalMomentum () const
 JMFT: Return the total momentum of the system, excluding fixed particles. More...
 
double getCPUTime ()
 
double getWallTime ()
 
virtual void hGridInsertParticle (BaseParticle *obj UNUSED)
 
virtual void hGridUpdateParticle (BaseParticle *obj UNUSED)
 
virtual void hGridRemoveParticle (BaseParticle *obj UNUSED)
 
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< unsigned > getNumberOfDomains ()
 returns the number of domains More...
 
DomaingetCurrentDomain ()
 Function that returns a pointer to the domain corresponding to the processor. More...
 
void removeOldFiles () const
 
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
 
void setWritePythonFileForVTKVisualisation (bool forceWritePythonFileForVTKVisualisation)
 
bool getWritePythonFileForVTKVisualisation () const
 
WallVTKWritergetWallVTKWriter ()
 

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...
 
virtual void computeForcesDueToWalls (BaseParticle *, BaseWall *)
 Computes the forces on the particles due to the walls (normals are outward normals) More...
 
virtual void actionsOnRestart ()
 A virtual function where the users can add extra code which is executed only when the code is restarted. More...
 
virtual void actionsBeforeTimeLoop ()
 A virtual function. Allows one to carry out any operations before the start of the time loop. More...
 
virtual void 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...
 
Mdouble backgroundDrag_
 This is a global background drag to help retard particles, or to do a simple fluid drag. The force particleVeclocity*backgroundDrag is applied. More...
 
std::vector< unsigned > numberOfDomains_
 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...
 
bool writeParticlesVTK_
 A flag to turn on/off the vtk writer for particles. More...
 
bool writeSuperquadricParticlesVTK_
 
ParticleVtkWritervtkWriter_
 
WallVTKWriter wallVTKWriter_
 
InteractionVTKWriter interactionVTKWriter_
 
BoundaryVTKWriter boundaryVTKWriter_
 
WallDetailsVTKWriter wallDetailsVTKWriter_
 
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...
 
bool forceWritePythonFileForVTKVisualisation_ { true }
 

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 
976 {X, Y, Z, XY, XZ, YZ, XYZ};
@ XY
Definition: StatisticsVector.h:42
@ XZ
Definition: StatisticsVector.h:42
@ YZ
Definition: StatisticsVector.h:42
@ Y
Definition: StatisticsVector.h:42
@ X
Definition: StatisticsVector.h:42
@ Z
Definition: StatisticsVector.h:42
@ XYZ
Definition: StatisticsVector.h:42

◆ ReadOptions

enum DPMBase::ReadOptions : int
strong
Enumerator
ReadAll 
ReadNoInteractions 
ReadNoParticlesAndInteractions 
254  : int {
255  ReadAll,
256  ReadNoInteractions,
257  ReadNoParticlesAndInteractions
258  };

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()

196 {
197 constructor();
198 }
InteractionVTKWriter interactionVTKWriter_
Definition: DPMBase.h:1369
WallVTKWriter wallVTKWriter_
Definition: DPMBase.h:1367
WallDetailsVTKWriter wallDetailsVTKWriter_
Definition: DPMBase.h:1373
WallHandler wallHandler
An object of the class WallHandler. Contains pointers to all the walls created.
Definition: DPMBase.h:1447
BoundaryHandler boundaryHandler
An object of the class BoundaryHandler which concerns insertion and deletion of particles into or fro...
Definition: DPMBase.h:1452
InteractionHandler interactionHandler
An object of the class InteractionHandler.
Definition: DPMBase.h:1467
void constructor()
A function which initialises the member variables to default values, so that the problem can be solve...
Definition: DPMBase.cc:208
BoundaryVTKWriter boundaryVTKWriter_
Definition: DPMBase.h:1371

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
126 {
127  setName(other.getName());
128  runNumber_ = other.runNumber_;
131  gravity_ = other.gravity_;
133 /* xMin_ = other.xMin_;
134  xMax_ = other.xMax_;
135  yMin_ = other.yMin_;
136  yMax_ = other.yMax_;
137  zMin_ = other.zMin_;
138  zMax_ = other.zMax_;*/
139  min_ = other.min_;
140  max_ = other.max_;
142  time_ = other.time_;
143  timeStep_ = other.timeStep_;
145  timeMax_ = other.timeMax_;
146  restartVersion_ = other.restartVersion_; //to read new and old restart data
147  restarted_ = other.restarted_; //to see if it was restarted or not
148  append_ = other.append_;
149  rotation_ = other.rotation_;
150  xBallsColourMode_ = other.xBallsColourMode_; // sets the xballs argument cmode (see xballs.txt)
151  xBallsVectorScale_ = other.xBallsVectorScale_; // sets the xballs argument vscale (see xballs.txt)
152  xBallsScale_ = other.xBallsScale_; // sets the xballs argument scale (see xballs.txt)
153  xBallsAdditionalArguments_ = other.xBallsAdditionalArguments_; // std::string where additional xballs argument can be specified (see xballs.txt)
156 
157 //effectively saying "if there exists a CONTACT_LIST_HGRID, copy it, if not, ignore.
158 #ifdef CONTACT_LIST_HGRID
159 possibleContactList=other.possibleContactList;
160 #endif
161  random = other.random;
162 
167  wallHandler.setDPMBase(this);
170  //Initialise the handlers
173 
174  //setting contents equal to the other handlers!
177  cgHandler = other.cgHandler;
178  //cgHandler = other.cgHandler.copy(); //todo
179  //cgHandler.setDPMBase(this);
180  wallHandler = other.wallHandler;
183  vtkWriter_ = other.vtkWriter_;
187 }
void setDPMBase(DPMBase *DPMBase)
Sets the problem that is solved using this handler.
Definition: BaseHandler.h:718
ParticleVtkWriter * vtkWriter_
Definition: DPMBase.h:1365
Vec3D max_
Definition: DPMBase.h:1311
SpeciesHandler speciesHandler
A handler to that stores the species type i.e. LinearViscoelasticSpecies, etc.
Definition: DPMBase.h:1427
Vec3D min_
These vectors are used for the XBalls domain, and occasionally people use it to add walls.
Definition: DPMBase.h:1310
int xBallsColourMode_
XBalls is a package to view the particle data. As an alternative MercuryDPM also supports ParaView....
Definition: DPMBase.h:1381
void setName(const std::string &name)
Allows to set the name of all the files (ene, data, fstat, restart, stat)
Definition: DPMBase.cc:422
unsigned int systemDimensions_
The dimensions of the simulation i.e. 2D or 3D.
Definition: DPMBase.h:1284
std::vector< unsigned > numberOfDomains_
Vector containing the number of domains in x-,y- and z-direction, required for parallel computations.
Definition: DPMBase.h:1305
PeriodicBoundaryHandler periodicBoundaryHandler
Internal handler that deals with periodic boundaries, especially in a parallel build.
Definition: DPMBase.h:1457
const std::string & getName() const
Returns the name of the file. Does not allow to change it though.
Definition: DPMBase.cc:399
int numberOfOMPThreads_
Definition: DPMBase.h:1279
Mdouble timeMax_
Stores the duration of the simulation.
Definition: DPMBase.h:1331
int runNumber_
This stores the run number for saving.
Definition: DPMBase.h:1401
bool restarted_
A bool to check if the simulation was restarted or not, ie. if setupInitialConditionsShould be run an...
Definition: DPMBase.h:1343
Mdouble xBallsScale_
sets the xballs argument scale (see XBalls/xballs.txt)
Definition: DPMBase.h:1391
CGHandler cgHandler
Object of the class cgHandler.
Definition: DPMBase.h:1473
Mdouble backgroundDrag_
This is a global background drag to help retard particles, or to do a simple fluid drag....
Definition: DPMBase.h:1300
Mdouble xBallsVectorScale_
sets the xballs argument vscale (see XBalls/xballs.txt)
Definition: DPMBase.h:1386
ParticleHandler particleHandler
An object of the class ParticleHandler, contains the pointers to all the particles created.
Definition: DPMBase.h:1437
std::string restartVersion_
Previous versions of MercuryDPM had a different restart file format, the below member variable allows...
Definition: DPMBase.h:1338
bool writeParticlesVTK_
A flag to turn on/off the vtk writer for particles.
Definition: DPMBase.h:1361
RNG random
This is a random generator, often used for setting up the initial conditions etc.....
Definition: DPMBase.h:1432
bool rotation_
A flag to turn on/off particle rotation. true will enable particle rotation. false will disable parti...
Definition: DPMBase.h:1356
DomainHandler domainHandler
An object of the class DomainHandler which deals with parallel code.
Definition: DPMBase.h:1462
bool readSpeciesFromDataFile_
Determines if the last column of the data file is interpreted as the info parameter during restart.
Definition: DPMBase.h:1416
bool writeSuperquadricParticlesVTK_
Definition: DPMBase.h:1363
std::string xBallsAdditionalArguments_
A string of additional arguments for xballs can be specified (see XBalls/xballs.txt)....
Definition: DPMBase.h:1396
bool append_
A flag to determine if the file has to be appended or not. See DPMBase::Solve() for example.
Definition: DPMBase.h:1349
Mdouble timeStep_
Stores the simulation time step.
Definition: DPMBase.h:1326
Vec3D gravity_
Gravity vector.
Definition: DPMBase.h:1294
unsigned int numberOfTimeSteps_
Stores the number of time steps.
Definition: DPMBase.h:1321
unsigned int particleDimensions_
determines if 2D or 3D particle volume is used for mass calculations
Definition: DPMBase.h:1289
Mdouble time_
Stores the current simulation time.
Definition: DPMBase.h:1316
void initialise()
Definition: DomainHandler.cc:434
void initialise()
Initialises the communication list vectors as they can not be determined on compile time.
Definition: PeriodicBoundaryHandler.cc:1787

References append_, backgroundDrag_, 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_, 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.

298 {
299 delete vtkWriter_;
300 }

References vtkWriter_.

Member Function Documentation

◆ actionsAfterSolve()

void DPMBase::actionsAfterSolve ( )
protectedvirtual

◆ 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, Slide, statistics_while_running< T >, ParameterStudy3DDemo, ParameterStudy2DDemo, ParameterStudy1DDemo, GranularJet, and GranularJet.

1670 {
1671 }

Referenced by initialiseSolve().

◆ 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, Chutebelt, ChuteRestartDemo, and AirySavageHutter.

1684 {
1685 }

Referenced by initialiseSolve().

◆ 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
1662 {
1663  return (pI != pJ && pI->isInContactWith(pJ));
1664 }
virtual bool isInContactWith(const BaseParticle *P) const
Get whether or not this particle is in contact with the given particle.
Definition: BaseParticle.cc:865

References BaseParticle::isInContactWith().

Referenced by Mercury2D::hGridFindParticleContacts(), Mercury3D::hGridFindParticleContacts(), Mercury3D::hGridHasContactsInTargetCell(), and Mercury2D::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.

540 {
542 
543 if (!getRestarted())
544 {
546 }
547 }
static void incrementRunNumberInFile()
Increment the run Number (counter value) stored in the file_counter (COUNTER_DONOTDEL) by 1 and store...
Definition: DPMBase.cc:628
bool getRestarted() const
Returns the flag denoting if the simulation was restarted or not.
Definition: DPMBase.cc:1493
void setRunNumber(int runNumber)
This sets the counter/Run number, overriding the defaults.
Definition: DPMBase.cc:606
static int readRunNumberFromFile()
Read the run number or the counter from the counter file (COUNTER_DONOTDEL)
Definition: DPMBase.cc:553

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.

5030 {
5031  //Looping over all boundaries in the boundaryHandler
5032  for (BaseBoundary* boundary : boundaryHandler)
5033  {
5034  //Calls the createPeriodicParticles() function which checks if a particle is adequately
5035  //close to a periodic particle that a periodic (ghost) particle should be created and,
5036  //if so, creates one and adds it to the system (hence the necessity to keep "N" variable).
5037  //
5038  // (The loop is over all boundaries, but if a boundary is not a PeriodicBoundary, then
5039  // this does nothing.)
5040  boundary->createPeriodicParticles(particleHandler);
5041  }
5042 
5043  // OMP parallelism
5044  /*#pragma omp parallel for num_threads(getNumberOfOMPThreads()) //schedule(dynamic)
5045  for (int k = 0; k < boundaryHandler.getNumberOfObjects(); k++)
5046  {
5047  //Calls the createPeriodicParticles() function which checks if a particle is adequately
5048  //close to a periodic particle that a periodic (ghost) particle should be created and,
5049  //if so, creates one and adds it to the system (hence the necessity to keep "N" variable).
5050  //
5051  // (The loop is over all boundaries, but if a boundary is not a PeriodicBoundary, then
5052  // this does nothing.)
5053 
5054  BaseBoundary* boundary = boundaryHandler.getObject(k);
5055  #pragma omp critical
5056  boundary->createPeriodicParticles(particleHandler);
5057  }*/
5058 }
Definition: BaseBoundary.h:49

References boundaryHandler, and particleHandler.

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

◆ 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.

3264 {
3265 
3266  //Cycling over all boundaries within the system...
3267  for (BaseBoundary* b : boundaryHandler)
3268  {
3269  //check all boundaries...
3270  b->checkBoundaryAfterParticlesMove(particleHandler);
3271 
3272 
3273 #ifdef MERCURYDPM_USE_MPI
3274  //When ghost particles are deleted by deletion boundaries they need to be removed
3275  //from their communication lists to avoid segfaults
3276  if (NUMBER_OF_PROCESSORS > 1)
3277  {
3278  //Flush deleted particles from mpi communication zones
3279  getCurrentDomain()->flushParticles(b->getParticlesToBeDeleted());
3281  periodicBoundaryHandler.flushParticles(b->getParticlesToBeDeleted());
3283  }
3284 
3285  //Delete particles that were in communication zone
3286  for (auto p_it = b->getParticlesToBeDeleted().begin(); p_it != b->getParticlesToBeDeleted().end(); p_it++)
3287  {
3288  particleHandler.removeGhostObject((*p_it)->getIndex());
3289  }
3290 #endif
3291  }
3292 }
#define NUMBER_OF_PROCESSORS
For the MPI communication routines this quantity is often required. defining this macro makes the cod...
Definition: GeneralDefine.h:62
Domain * getCurrentDomain()
Function that returns a pointer to the domain corresponding to the processor.
Definition: DPMBase.cc:5289
void cleanCommunicationLists()
Removes nullptrs from boundaryParticleList_ and boundaryParticleListNeighbour_.
Definition: Domain.cc:1742
void flushParticles(std::set< BaseParticle * > &toBeDeletedList)
Particles that are going to be deleted from the simulation are flushed out of the communication bound...
Definition: Domain.cc:1698
void removeGhostObject(unsigned int index)
Removes a BaseParticle from the ParticleHandler without a global check, this is only to be done for m...
Definition: ParticleHandler.cc:422
void cleanCommunicationLists()
Definition: PeriodicBoundaryHandler.cc:1772
void flushParticles(std::set< BaseParticle * > &particlesToBeFlushed)
Removes particles from the periodiocParticleList_ and periociGhostList_.
Definition: PeriodicBoundaryHandler.cc:1705

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.

4806 {
4807 #ifdef MERCURYDPM_USE_MPI
4808  if (NUMBER_OF_PROCESSORS == 1)
4809  {
4811  }
4812 
4813  int localInteraction = checkParticleForInteractionLocal(p);
4814  //The root gathers all values and computes the global value
4815  int *interactionList = nullptr;
4816  if (PROCESSOR_ID == 0)
4817  {
4818  interactionList = new int [NUMBER_OF_PROCESSORS];
4819  }
4820 
4821  //Gather all local values
4822  MPIContainer::Instance().gather(localInteraction,interactionList);
4823 
4824  //Compute the global value
4825  int globalInteraction = 1;
4826  if (PROCESSOR_ID == 0)
4827  {
4828  for (int i = 0; i < NUMBER_OF_PROCESSORS; i++)
4829  {
4830  if (interactionList[i] == 0)
4831  {
4832  globalInteraction = 0;
4833  break;
4834  }
4835  }
4836  }
4837  //The root now tells the other processors what the global value for the interaction is
4838  MPIContainer::Instance().broadcast(globalInteraction);
4839 
4840  //Convert the result back to bool
4841  bool interaction = globalInteraction;
4842 #else
4843  bool interaction = checkParticleForInteractionLocalPeriodic(p);
4844 #endif
4845  return interaction;
4846 }
#define PROCESSOR_ID
Definition: GeneralDefine.h:63
virtual bool checkParticleForInteractionLocal(const BaseParticle &P)
Checks if a particle P has any interaction with walls or other particles in the local domain.
Definition: DPMBase.cc:4904
bool checkParticleForInteractionLocalPeriodic(const BaseParticle &P)
Definition: DPMBase.cc:4854
std::enable_if< std::is_scalar< T >::value, void >::type broadcast(T &t, int fromProcessor=0)
Broadcasts a scalar from the root to all other processors.
Definition: MpiContainer.h:441
void gather(T &send_t, T *receive_t)
Gathers a scaler from all processors to a vector of scalars on the root.
Definition: MpiContainer.h:428
static MPIContainer & Instance()
fetch the instance to be used for communication
Definition: MpiContainer.h:134
const std::complex< Mdouble > i
Definition: ExtendedMath.h:51

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.

4905 {
4906  Mdouble distance;
4907  Vec3D normal;
4908 
4909  //Check if it has no collision with walls
4910  for (BaseWall* w : wallHandler)
4911  {
4912  //returns false if the function getDistanceAndNormal returns true,
4913  //i.e. if there exists an interaction between wall and particle
4914  //\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.)
4915  if (w->getDistanceAndNormal(p, distance, normal))
4916  {
4917  //std::cout<<"failure: Collision with wall: "<<**it<<std::endl;
4918  return false;
4919  }
4920  else
4921  {
4922  //std::cout<<"No collision with wall: "<<**it<<std::endl;
4923  }
4924  }
4925 
4926  //Check if it has no collision with other particles
4927  for (BaseParticle* q : particleHandler)
4928  {
4929  //returns false if the particle separation is less than the relevant sum of interaction radii
4930  //(i.e. another particle is in contact with P)
4931  if (Vec3D::getDistanceSquared(q->getPosition(), p.getPosition())
4933  {
4934  //std::cout<<"failure: Collision with particle "<<**it<<std::endl;
4935  return false;
4936  }
4937  else
4938  {
4939  //std::cout<<"No collision with particle "<<**it<<std::endl;
4940  }
4941  }
4942  return true;
4944 }
double Mdouble
Definition: GeneralDefine.h:34
const Vec3D & getPosition() const
Returns the position of this BaseInteractable.
Definition: BaseInteractable.h:218
Definition: BaseParticle.h:54
Mdouble getSumOfInteractionRadii(const BaseParticle *particle) const
returns the sum of the radii plus the interactionDistance
Definition: BaseParticle.h:379
Basic class for walls.
Definition: BaseWall.h:49
Definition: Vector.h:51
static Mdouble getDistanceSquared(const Vec3D &a, const Vec3D &b)
Calculates the squared distance between two Vec3D: .
Definition: Vector.h:311
T square(const T val)
squares a number
Definition: ExtendedMath.h:106

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
4855 {
4856  //A vector of ghost particles of the particle that is to be inserted (empty if no periodic boundaries are present)
4857  std::vector<Vec3D> pPeriodic;
4858  for (BaseBoundary* b : boundaryHandler)
4859  {
4860  PeriodicBoundary* pb = dynamic_cast<PeriodicBoundary*>(b);
4861  if (pb && particleHandler.getNumberOfObjects() > 0 )
4862  {
4864  for (int i = pPeriodic.size() - 1; i >= 0; --i)
4865  {
4866  if (pb->getDistance(pPeriodic[i]) < maxDistance)
4867  {
4868  pPeriodic.push_back(pPeriodic[i]);
4869  pb->shiftPosition(pPeriodic.back());
4870  }
4871  }
4872  if (pb->getDistance(p) < maxDistance)
4873  {
4874  pPeriodic.push_back(p.getPosition());
4875  pb->shiftPosition(pPeriodic.back());
4876  }
4877  }
4878  }
4879  //check the particle AND the ghost particles for intersection problems
4880  bool insertable = checkParticleForInteractionLocal(p);
4881  if (!pPeriodic.empty()) {
4882  BaseParticle* q = p.copy();
4883  for (const Vec3D& pos : pPeriodic) {
4884  q->setPosition(pos);
4885  insertable &= checkParticleForInteractionLocal(*q);
4886  }
4887  delete q;
4888  }
4889  return insertable;
4890 }
virtual void setPosition(const Vec3D &position)
Sets the position of this BaseInteractable.
Definition: BaseInteractable.h:239
Mdouble getMaxInteractionRadius() const
Returns the particle's interaction radius, which might be different from radius_ (e....
Definition: BaseParticle.h:362
virtual BaseParticle * copy() const =0
Particle copy method. It calls to copy constructor of this Particle, useful for polymorphism.
unsigned int getNumberOfObjects() const override
Returns the number of objects in the container. In parallel code this practice is forbidden to avoid ...
Definition: ParticleHandler.cc:1325
BaseParticle * getLargestParticle() const
Returns the pointer of the largest particle in the particle handler. When mercury is running in paral...
Definition: ParticleHandler.cc:534
Defines a pair of periodic walls. Inherits from BaseBoundary.
Definition: PeriodicBoundary.h:41
Mdouble getDistance(const BaseParticle &p) const override
Returns the distance of the edge to the particle.
Definition: PeriodicBoundary.cc:197
virtual void shiftPosition(BaseParticle *p) const override
shifts the particle
Definition: PeriodicBoundary.cc:219

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(), and MercuryBase::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.
4000 {
4001  //check if name is set
4002  logger.assert_always(getName() != "",
4003  "File name not set: use setName()");
4004  //check if time step is set
4005  logger.assert_always(getTimeStep() != 0,
4006  "Time step undefined: use setTimeStep()");
4007  //check if domain is set
4008  logger.assert_always(getXMax() > getXMin(),
4009  "Domain size not set: use setXMin() and setXMax()");
4010  logger.assert_always(getYMax() > getYMin(),
4011  "Domain size not set: use setYMin() and setYMax()");
4012  logger.assert_always(systemDimensions_ == 3 ? (getZMax() > getZMin()) : (getZMax() >= getZMin()),
4013  "Domain size not set: use setZMin() and setZMax()", systemDimensions_);
4014 
4015  //check for species parameters
4016  logger.assert_always(speciesHandler.getNumberOfObjects() > 0,
4017  "No species defined: use speciesHandler.copyAndAddObject()");
4018  for (BaseParticle* p : particleHandler)
4019  {
4020  logger.assert_always(p->getSpecies() != nullptr, "particle % has no species", p->getId());
4021  }
4022  for (BaseWall* w : wallHandler)
4023  {
4024  logger.assert_always(w->getSpecies() != nullptr, "% with index % has no species", w->getName(), w->getId());
4025  }
4026 }
Logger< MERCURYDPM_LOGLEVEL > logger("MercuryKernel")
Definition of different loggers with certain modules. A user can define its own custom logger here.
virtual unsigned int getNumberOfObjects() const
Gets the number of real Object in this BaseHandler. (i.e. no mpi or periodic particles)
Definition: BaseHandler.h:648
Mdouble getXMin() const
If the length of the problem domain in x-direction is XMax - XMin, then getXMin() returns XMin.
Definition: DPMBase.h:619
Mdouble getXMax() const
If the length of the problem domain in x-direction is XMax - XMin, then getXMax() returns XMax.
Definition: DPMBase.h:626
Mdouble getYMin() const
If the length of the problem domain in y-direction is YMax - YMin, then getYMin() returns YMin.
Definition: DPMBase.h:632
Mdouble getTimeStep() const
Returns the simulation time step.
Definition: DPMBase.cc:1250
Mdouble getYMax() const
If the length of the problem domain in y-direction is YMax - YMin, then getYMax() returns XMax.
Definition: DPMBase.h:638
Mdouble getZMax() const
If the length of the problem domain in z-direction is ZMax - ZMin, then getZMax() returns ZMax.
Definition: DPMBase.h:650
Mdouble getZMin() const
If the length of the problem domain in z-direction is ZMax - ZMin, then getZMin() returns ZMin.
Definition: DPMBase.h:644

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

Referenced by initialiseSolve().

◆ closeFiles()

void DPMBase::closeFiles ( )

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

504 {
505 dataFile.close();
506 fStatFile.close();
508 statFile.close();
509 eneFile.close();
511 }
File eneFile
An instance of class File to handle in- and output into a .ene file.
Definition: DPMBase.h:1488
File fStatFile
An instance of class File to handle in- and output into a .fstat file.
Definition: DPMBase.h:1483
File dataFile
An instance of class File to handle in- and output into a .data file.
Definition: DPMBase.h:1478
File interactionFile
File class to handle in- and output into .interactions file. This file hold information about interac...
Definition: DPMBase.h:1504
File restartFile
An instance of class File to handle in- and output into a .restart file.
Definition: DPMBase.h:1493
File statFile
An instance of class File to handle in- and output into a .stat file.
Definition: DPMBase.h:1498
void close()
Closes the file by calling fstream_.close()
Definition: File.cc:407

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

Referenced by finaliseSolve(), 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 MembraneSelfTest, and MembraneDemo.

1107 {}

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, and Mercury3Dclump.

3389 {
3390  //Resetting all forces on both particles and walls to zero
3391  #pragma omp parallel num_threads(getNumberOfOMPThreads())
3392  {
3393  #pragma omp for
3394  for (int k = 0; k < particleHandler.getSize(); ++k) {
3396  }
3397  #pragma omp for
3398  for (int k = 0; k < wallHandler.getSize(); k++) {
3400  }
3401  }
3402  logger(DEBUG,"All forces set to zero");
3403 
3404  // for omp simulations, reset the newObjects_ variable (used for reduction)
3406 
3407  // compute all internal and external forces; for omp simulations, this can be done in parallel
3408  #pragma omp parallel num_threads(getNumberOfOMPThreads())
3409  {
3410  //logger(INFO, "Number of omp threads = %", getNumberOfOMPThreads());
3412  #pragma omp for schedule(dynamic)
3413  for (int k = 0; k < particleHandler.getSize(); ++k) {
3415  //computing both internal forces (e.g. due to collisions)
3416  //and external forces (e.g. gravity)
3417  //(compute internal forces compares the current particle p
3418  //with all others in the handler!)
3420  // body forces
3422  }
3423 
3424  // wall-forces
3425  #pragma omp for schedule(dynamic)
3426  for (int k = 0; k < wallHandler.getSize(); k++) {
3427  BaseWall *w = wallHandler.getObject(k);
3428  computeWallForces(w);
3429  w->computeWear();
3430  }
3431 
3432  }
3433 
3434  #ifdef MERCURYDPM_TRIANGLE_WALL_CORRECTION
3435  // This statement deals with interactions of a particle with a group of walls:
3436  // If there are multiple contact forces between the particle and the group of walls, we assume that these contacts share a concave edge or a vertex. Thus, we multiply each force by a weight $w_{\alpha\gamma}=|\vec{f}_{\alpha\gamma}^{\text{w}}|/\sum_\gamma|\vec{f}_{\alpha\gamma}^{\text{w}}|$. Note that these weights add up to 1, thus, the total contact force between the particle and the group of walls will be a weighted average of the individual contact forces.
3437  // A second modification is done in #BaseWall::getInteractionWith
3439  for (BaseParticle *p : particleHandler) {
3440  // find all current interactions between this particle and a TriangleWall
3441  std::vector<BaseInteraction *> wallInters;
3442  double overlapSum = 0.0;
3443  for (const auto i : p->getInteractions()) {
3444  if (i->getI()->getName() == "TriangleWall" && i->getTimeStamp() > getNumberOfTimeSteps()) {
3445  wallInters.push_back(i);
3446  overlapSum += i->getOverlap();
3447  }
3448  }
3449  // if more than one interactions are detected, we have a concave wall interaction problem.
3450  if (wallInters.size() > 1) {
3452  // get the multiple contact points to define the new contact plane, normal, and overlap
3453  for (BaseInteraction *i : wallInters) {
3454  auto q = i->getI();
3455  // undo the force/torque computation from multiple TriangleWalls
3456  p->addForce(-i->getForce());
3457  q->addForce(i->getForce());
3458  if (getRotation()) {
3459  p->addTorque(-i->getTorque() + Vec3D::cross(p->getPosition() - i->getContactPoint(), i->getForce()));
3460  q->addTorque( i->getTorque() - Vec3D::cross(q->getPosition() - i->getContactPoint(), i->getForce()));
3461  }
3462  // reset the forces
3463  double w = i->getOverlap() / overlapSum;
3464  i->setContactPoint(p->getPosition() - (p->getRadius() - 0.5 * i->getOverlap()) * w * i->getNormal());
3465  i->setForce(i->getForce() * w);
3466  i->setTorque(i->getTorque() * w);
3467  // applies the reset forces to the particle and the wall
3468  p->addForce(i->getForce());
3469  q->addForce(-i->getForce());
3470  if (getRotation()) {
3471  p->addTorque( i->getTorque() - Vec3D::cross(p->getPosition() - i->getContactPoint(), i->getForce()));
3472  q->addTorque(-i->getTorque() + Vec3D::cross(q->getPosition() - i->getContactPoint(), i->getForce()));
3473  }
3474  }
3475  }
3476  }
3477  #endif
3478 
3479 #ifdef CONTACT_LIST_HGRID
3480  PossibleContact* Curr=possibleContactList.getFirstPossibleContact();
3481  while(Curr)
3482  {
3483  computeInternalForces(Curr->getP1(),Curr->getP2());
3484  Curr=Curr->getNext();
3485  }
3486 #endif
3487 
3488  // Check wall forces
3489  #pragma omp for schedule(dynamic)
3490  for (int k = 0; k < wallHandler.getNumberOfObjects(); k++) {
3491  BaseWall *w = wallHandler.getObject(k);
3493  }
3494 
3496 
3497  // for omp simulations, sum up all forces and add all newObjects_ (needed since both are using reduction)
3498  #ifdef MERCURYDPM_USE_OMP
3499  if (getNumberOfOMPThreads()>1) {
3501  }
3502  //Resetting all forces on both particles and walls to zero
3503  #pragma omp parallel num_threads(getNumberOfOMPThreads())
3504  {
3505  #pragma omp for
3506  for (int k = 0; k < particleHandler.getSize(); k++) {
3508  }
3509  #pragma omp for
3510  for (int k = 0; k < wallHandler.getSize(); k++) {
3512  } //end reset forces loop
3513  }
3514  #endif
3515 
3516  //end outer loop over contacts.
3517 }
@ DEBUG
unsigned int getSize() const
Gets the size of the particleHandler (including mpi and periodic particles)
Definition: BaseHandler.h:655
T * getObject(const unsigned int id)
Gets a pointer to the Object at the specified index in the BaseHandler.
Definition: BaseHandler.h:613
void sumForceTorqueOMP()
Definition: BaseInteractable.cc:162
void addTorque(const Vec3D &addTorque)
Adds an amount to the torque on this BaseInteractable.
Definition: BaseInteractable.cc:132
virtual void resetForceTorque(int numberOfOMPthreads)
Definition: BaseInteractable.cc:141
const std::vector< BaseInteraction * > & getInteractions() const
Returns a list of interactions which belong to this interactable.
Definition: BaseInteractable.h:277
void addForce(const Vec3D &addForce)
Adds an amount to the force on this BaseInteractable.
Definition: BaseInteractable.cc:116
Stores information about interactions between two interactable objects; often particles but could be ...
Definition: BaseInteraction.h:60
Mdouble getRadius() const
Returns the particle's radius.
Definition: BaseParticle.h:348
virtual void checkInteractions(InteractionHandler *interactionHandler, unsigned int timeStamp)
Check if all interactions are valid.
Definition: BaseWall.h:220
virtual void computeWear()
Definition: BaseWall.h:248
int getNumberOfOMPThreads() const
Definition: DPMBase.cc:1286
virtual void computeWallForces(BaseWall *w)
Definition: DPMBase.cc:5427
unsigned int getNumberOfTimeSteps() const
Returns the current counter of time-steps, i.e. the number of time-steps that the simulation has unde...
Definition: DPMBase.cc:824
virtual void computeInternalForces(BaseParticle *)
Computes the internal forces on particle i (internal in the sense that the sum over all these forces ...
Definition: DPMBase.cc:3525
virtual void computeAdditionalForces()
A virtual function which allows to define operations to be executed prior to the OMP force collect.
Definition: DPMBase.h:1107
virtual void computeExternalForces(BaseParticle *)
Computes the external forces, such as gravity, acting on particles.
Definition: DPMBase.cc:3159
bool getRotation() const
Indicates whether particle rotation is enabled or disabled.
Definition: DPMBase.h:570
void resetNewObjectsOMP()
Definition: InteractionHandler.cc:122
void addNewObjectsOMP()
Definition: InteractionHandler.cc:129
Class that describes a possible contact between two BaseParticle.
Definition: PossibleContact.h:42
BaseParticle * getP2()
Gets a pointer to the second BaseParticle in this PossibleContact.
Definition: PossibleContact.h:139
PossibleContact * getNext()
Gets the next PossibleContact in the general linked list of PossibleContact.
Definition: PossibleContact.h:167
BaseParticle * getP1()
Gets a pointer to the first BaseParticle in this PossibleContact.
Definition: PossibleContact.h:130
static Vec3D cross(const Vec3D &a, const Vec3D &b)
Calculates the cross product of two Vec3D: .
Definition: Vector.cc:163

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

Referenced by DPM::computeAllForces(), computeOneTimeStep(), initialiseSolve(), and ExtremeOverlapVolumeUnitTest::setupInitialConditions().

◆ computeExternalForces()

void DPMBase::computeExternalForces ( BaseParticle CI)
protectedvirtual

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

By default we have gravity and background drag as the external forces

Parameters
[in]CIThe BaseParticle object to which the relevant external forces are applied.

Reimplemented in ScaleCoupling< Mercury3D, SolidProblem< ScaleCoupledElement< ELEMENT > > >, AngledPeriodicBoundarySecondUnitTest, SphericalIndenter, my_problem, my_problem, PeriodicWalls, and Contact.

3160 {
3161  //Checks that the current particle is not "fixed"
3162  //and hence infinitely massive!
3163  if ((!CI->isFixed()) && (!CI->isPebble()))
3164  {
3165  // Applying the force due to gravity (F = m.g) Do not apply gravity to slave particles
3166  CI->addForce(getGravity() * CI->getMass()-getBackgroundDrag()*CI->getVelocity());
3167  // Still calls this in compute External Forces.
3168  // computeForcesDueToWalls(CI);
3169  }
3170 }
virtual const Vec3D & getVelocity() const
Returns the velocity of this interactable.
Definition: BaseInteractable.cc:329
bool isFixed() const override
Is fixed Particle function. It returns whether a Particle is fixed or not, by checking its inverse Ma...
Definition: BaseParticle.h:93
bool isPebble() const
Checks if particle is a pebble (belongs to a clump)
Definition: BaseParticle.h:673
Mdouble getMass() const
Returns the particle's mass.
Definition: BaseParticle.h:322
const Mdouble getBackgroundDrag() const
Return the background drag.
Definition: DPMBase.h:812
Vec3D getGravity() const
Returns the gravitational acceleration.
Definition: DPMBase.cc:1391

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

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

◆ computeForcesDueToWalls()

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

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

Reimplemented in Mercury3Dclump.

3180 {
3181 
3182  //No need to compute interactions between periodic particle images and walls
3183  if (pI->getPeriodicFromParticle() != nullptr)
3184  return;
3185 
3186  //Checks if the particle is interacting with the current wall
3189  if (i!=nullptr) {
3190  //...calculates the forces between the two objects...
3191  i->computeForce();
3192 
3193  //...and applies them to each of the two objects (wall and particle).
3194  pI->addForce(i->getForce());
3195  w->addForce(-i->getForce());
3196 
3197  //If the rotation flag is on, also applies the relevant torques
3198  //(getRotation() returns a boolean).
3199  if (getRotation()) // getRotation() returns a boolean.
3200  {
3201  pI->addTorque(i->getTorque() - Vec3D::cross(pI->getPosition() - i->getContactPoint(), i->getForce()));
3203  w->addTorque(-i->getTorque() + Vec3D::cross(w->getPosition() - i->getContactPoint(), i->getForce()));
3204  }
3205  }
3206 }
BaseParticle * getPeriodicFromParticle() const
Returns the 'original' particle this one's a periodic copy of.
Definition: BaseParticle.h:341
BaseInteraction * getInteractionWith(BaseParticle *p, unsigned timeStamp, InteractionHandler *interactionHandler) override
Returns the interaction between this wall and a given particle, nullptr if there is no interaction.
Definition: BaseWall.cc:367

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

Reimplemented in Mercury3Dclump.

3105 {
3106  //Does not compute forces if particles are fixed
3107  //this is necessary because the rough bottom allows overlapping fixed particles
3108  if (P1->isFixed() && P2->isFixed())
3109  {
3110  return;
3111  }
3112 //Ensures that interactions between the "ghost" particles used to implement periodic behaviour
3113  //are not included in calculations
3114  //i.e. ends the function if both particles are "ghosts".
3115  if ((P1->getPeriodicFromParticle() != nullptr) && (P2->getPeriodicFromParticle() != nullptr))
3116  {
3117  return;
3118  }
3119 //if statement below ensures that the PI has the lower id than PJ
3120  BaseParticle* PI, * PJ;
3121  if (P1->getId() > P2->getId())
3122  {
3123  PI = P2;
3124  PJ = P1;
3125  }
3126  else
3127  {
3128  PI = P1;
3129  PJ = P2;
3130  }
3131  //checks if the two particles are interacting
3132  //("getInteractionWith" returns the relevant pointer if PI and PJ are interacting,
3133  //zero if not)
3134  //if statement above ensures that the PI has the lower id than PJ
3137  if (i!= nullptr) {
3138  //calculates the force corresponding to the interaction
3139  i->computeForce();
3140 
3141  //Applies the relevant calculated forces to PI and PJ
3142  PI->addForce(i->getForce());
3143  PJ->addForce(-i->getForce());
3144 
3145  //checks if particle rotation is turned on...
3146  if (getRotation()) {
3147  //...and, if so, performs equivalent calculations for the torque as were
3148  //performed for the force.
3149  PI->addTorque(i->getTorque() - Vec3D::cross(PI->getPosition() - i->getContactPoint(), i->getForce()));
3150  PJ->addTorque(-i->getTorque() + Vec3D::cross(PJ->getPosition() - i->getContactPoint(), i->getForce()));
3151  }
3152  }
3153 }
unsigned int getId() const
Returns the unique identifier of any particular object.
Definition: BaseObject.h:125
BaseInteraction * getInteractionWith(BaseParticle *P, unsigned timeStamp, InteractionHandler *interactionHandler) override
Checks if particle is in interaction with given particle P, and if so, returns vector of pointer to t...
Definition: BaseParticle.cc:690

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.

3526 {
3527  for (auto it = particleHandler.begin(); (*it) != i; ++it)
3528  {
3529  computeInternalForce(i, *it);
3530  }
3531 }
const std::vector< T * >::const_iterator begin() const
Gets the begin of the const_iterator over all Object in this BaseHandler.
Definition: BaseHandler.h:690
virtual void computeInternalForce(BaseParticle *, BaseParticle *)
Computes the forces between two particles (internal in the sense that the sum over all these forces i...
Definition: DPMBase.cc:3104

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}
4306 {
4307  logger(DEBUG, "starting computeOneTimeStep()");
4308 
4309  logger(DEBUG, "about to call writeOutputFiles()");
4310  writeOutputFiles(); //everything is written at the beginning of the time step!
4311 
4312  logger(DEBUG, "about to call hGridActionsBeforeIntegration()");
4314 
4315  //Computes the half-time step velocity and full time step position and updates the particles accordingly
4316  logger(DEBUG, "about to call integrateBeforeForceComputation()");
4317 
4319  //New positions require the MPI and parallel periodic boundaries to do things
4320  logger(DEBUG, "about to call performGhostParticleUpdate()");
4322  // Some walls need to be aware of the new positions
4324 
4328 
4329  logger(DEBUG, "about to call checkInteractionWithBoundaries()");
4330  checkInteractionWithBoundaries(); // INSERTION boundaries handled
4331 
4332  logger(DEBUG, "about to call hGridActionsAfterIntegration()");
4334 
4335  // Compute forces
4337  // INSERTION/DELETION boundary flag change
4338  for (BaseBoundary* b : boundaryHandler)
4339  {
4340  b->checkBoundaryBeforeTimeStep(this);
4341  }
4342 
4343  logger(DEBUG, "about to call actionsBeforeTimeStep()");
4345 
4346  logger(DEBUG, "about to call checkAndDuplicatePeriodicParticles()");
4348 
4349  logger(DEBUG, "about to call hGridActionsBeforeTimeStep()");
4351 
4352  //Creates and updates interactions and computes forces based on these
4353  logger(DEBUG, "about to call computeAllForces()");
4354  computeAllForces();
4355 
4356  logger(DEBUG, "about to call removeDuplicatePeriodicParticles()");
4358 
4359  logger(DEBUG, "about to call actionsAfterTimeStep()");
4361 
4362  //Computes new velocities and updates the particles accordingly
4363  logger(DEBUG, "about to call integrateAfterForceComputation()");
4365 
4366  //erase interactions that have not been used during the last time step
4367  //logger(DEBUG, "about to call interactionHandler.eraseOldInteractions(getNumberOfTimeSteps())");
4369  logger(DEBUG, "about to call interactionHandler.actionsAfterTimeStep()");
4372 
4373  time_ += timeStep_;
4375 
4376  logger(DEBUG, "finished computeOneTimeStep()");
4377 }
virtual void writeOutputFiles()
Writes simulation data to all the main Mercury files: .data, .ene, .fstat, .xballs and ....
Definition: DPMBase.cc:4049
virtual void integrateAfterForceComputation()
Update particles' and walls' positions and velocities after force computation.
Definition: DPMBase.cc:3305
void removeDuplicatePeriodicParticles()
Removes periodic duplicate Particles.
Definition: DPMBase.cc:4986
virtual void hGridActionsBeforeIntegration()
This function has to be called before integrateBeforeForceComputation.
Definition: DPMBase.cc:1940
virtual void actionsBeforeTimeStep()
A virtual function which allows to define operations to be executed before the new time step.
Definition: DPMBase.cc:1864
virtual void checkInteractionWithBoundaries()
There are a range of boundaries one could implement depending on ones' problem. This methods checks f...
Definition: DPMBase.cc:3263
virtual void computeAllForces()
Computes all the forces acting on the particles using the BaseInteractable::setForce() and BaseIntera...
Definition: DPMBase.cc:3388
virtual void hGridActionsAfterIntegration()
This function has to be called after integrateBeforeForceComputation.
Definition: DPMBase.cc:1947
void checkAndDuplicatePeriodicParticles()
For simulations using periodic boundaries, checks and adds particles when necessary into the particle...
Definition: DPMBase.cc:5029
virtual void integrateBeforeForceComputation()
Update particles' and walls' positions and velocities before force computation.
Definition: DPMBase.cc:3219
void performGhostParticleUpdate()
When the Verlet scheme updates the positions and velocities of particles, ghost particles will need a...
Definition: DPMBase.cc:5063
virtual void hGridActionsBeforeTimeStep()
A virtual function that allows one to set or execute hGrid parameters or operations before every simu...
Definition: DPMBase.cc:1690
virtual void actionsAfterTimeStep()
A virtual function which allows to define operations to be executed after time step.
Definition: DPMBase.cc:1878
void actionsAfterTimeStep()
Definition: InteractionHandler.cc:395
void eraseOldInteractions(unsigned)
erases interactions which have an old timestamp.
Definition: InteractionHandler.cc:377
void actionsAfterTimeStep()
Definition: ParticleHandler.cc:1372
void actionsAfterParticleGhostUpdate()
Calls the method actionsAfterParticleGhostUpdate of every wall in the handler.
Definition: WallHandler.cc:458

References WallHandler::actionsAfterParticleGhostUpdate(), actionsAfterTimeStep(), InteractionHandler::actionsAfterTimeStep(), ParticleHandler::actionsAfterTimeStep(), actionsBeforeTimeStep(), boundaryHandler, checkAndDuplicatePeriodicParticles(), checkInteractionWithBoundaries(), computeAllForces(), DEBUG, InteractionHandler::eraseOldInteractions(), 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.

5428 {
5429  //compute forces for all particles that are neither fixed or ghosts
5430  for (auto p : particleHandler)
5431  {
5432  if (!p->isFixed() && p->getPeriodicFromParticle() == nullptr)
5433  {
5434  //w->computeForces(p);
5436  }
5437  }
5438 }
virtual void computeForcesDueToWalls(BaseParticle *, BaseWall *)
Computes the forces on the particles due to the walls (normals are outward normals)
Definition: DPMBase.cc:3179

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.

209 {
210  // sofStop function
211  setSoftStop();
212  //constructor();
213  dataFile.getFstream().precision(10);
214  fStatFile.getFstream().precision(10);
215  eneFile.getFstream().precision(10);
216  restartFile.getFstream().precision(
217  std::numeric_limits<double>::digits10); //highly accurate, so the overlap is accurate
218  statFile.getFstream().precision(10);
219  statFile.getFstream().setf(std::ios::left);
220  interactionFile.getFstream().precision(10);
221  name_ = ""; // needs to be user-specified, otherwise checkSettings throws error
222  //by default, the fileType of all files is ONE_FILE. However, by default we don't want an interaction file since it
223  // is very large.
225 
226  runNumber_ = 0;
227 
228  //Decomposition direction for MPI
229  numberOfDomains_ = {1, 1, 1};
230 
231  //Check if MPI is already initialised
232  initialiseMPI();
233 
234  //This sets the maximum number of particles
239  cgHandler.setDPMBase(this);
241  wallHandler.setDPMBase(this);
247 
248  //set defaults for DPMBase parameters
251  setRestarted(false);
252  setGravity(Vec3D(0, 0, 0));
253  setBackgroundDrag(0.0);
254 
255  //This is the parameter of the numerical part
256  setTime(0);
257  numberOfTimeSteps_ = 0;
258  setTimeMax(0);
259  timeStep_ = 0; // needs to be user-specified, otherwise checkSettings throws error
260  setSaveCount(20);
261 
262  //This sets the default xballs domain
263  min_ = Vec3D(0, 0, 0);
264  max_ = Vec3D(0, 0, 0); // needs to be user-specified, otherwise checkSettings throws error
265 
266  //sets the default write particles data in VTK format flag to false
267  writeParticlesVTK_ = false;
269  vtkWriter_ = nullptr;
270 
271  setName(""); // needs to be user-specified, otherwise checkSettings throws error
272 
273  //Default mode is energy with no scale of the vectors
274  xBallsColourMode_ = 0;
275  xBallsVectorScale_ = -1;
276  xBallsScale_ = -1;
278  setAppend(false);
279 
280  //The default random seed is 0
282 
283  logger(DEBUG, "DPMBase problem constructor finished");
284 
285  readSpeciesFromDataFile_ = false;
286 
288 
289  //Set number of elements to write to the screen if a user wants to output write information to the terminal
290  nToWrite_ = 4;
291 }
@ NO_FILE
file will not be created/read
void initialiseMPI()
Inialises the MPI library.
Definition: MpiContainer.cc:137
void setSaveCount(unsigned int saveCount)
Sets File::saveCount_ for all files (ene, data, fstat, restart, stat)
Definition: DPMBase.cc:408
void setBackgroundDrag(Mdouble backgroundDrag)
Simple access function to turn on a background drag. The force of particleVelocity*drag is applied (n...
Definition: DPMBase.h:806
void setParticleDimensions(unsigned int particleDimensions)
Sets the particle dimensionality.
Definition: DPMBase.cc:1448
void setRestarted(bool newRestartedFlag)
Allows to set the flag stating if the simulation is to be restarted or not.
Definition: DPMBase.cc:1501
void setSoftStop()
function for setting sigaction constructor.
Definition: DPMBase.cc:5167
std::string name_
the name of the problem, used, e.g., for the output files
Definition: DPMBase.h:1406
void setTimeMax(Mdouble newTMax)
Sets a new value for the maximum simulation duration.
Definition: DPMBase.cc:873
void setSystemDimensions(unsigned int newDim)
Sets the system dimensionality.
Definition: DPMBase.cc:1417
void setTime(Mdouble time)
Sets a new value for the current simulation time.
Definition: DPMBase.cc:836
void setGravity(Vec3D newGravity)
Sets a new value for the gravitational acceleration.
Definition: DPMBase.cc:1383
void setAppend(bool newAppendFlag)
Sets whether the "append" option is on or off.
Definition: DPMBase.cc:1522
int nToWrite_
number of elements to write to a screen
Definition: DPMBase.h:1421
std::fstream & getFstream()
Allows to access the member variable File::fstream_.
Definition: File.cc:153
void setFileType(FileType fileType)
Sets the type of file needed to write into or read from. File::fileType_.
Definition: File.cc:215
void setRandomSeed(unsigned long int new_seed)
This is the seed for the random number generator (note the call to seed_LFG is only required really i...
Definition: RNG.cc:53

References boundaryHandler, cgHandler, dataFile, DEBUG, domainHandler, eneFile, fStatFile, File::getFstream(), DomainHandler::initialise(), PeriodicBoundaryHandler::initialise(), initialiseMPI(), interactionFile, interactionHandler, logger, max_, min_, name_, NO_FILE, nToWrite_, numberOfDomains_, numberOfOMPThreads_, numberOfTimeSteps_, particleHandler, periodicBoundaryHandler, random, readSpeciesFromDataFile_, restartFile, runNumber_, setAppend(), setBackgroundDrag(), BaseHandler< T >::setDPMBase(), File::setFileType(), setGravity(), setName(), setParticleDimensions(), RNG::setRandomSeed(), setRestarted(), setSaveCount(), setSoftStop(), setSystemDimensions(), setTime(), setTimeMax(), speciesHandler, statFile, timeStep_, vtkWriter_, wallHandler, writeParticlesVTK_, writeSuperquadricParticlesVTK_, 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, CSCWalls, CSCInit, ClosedCSCWalls, and T_protectiveWall.

1991 {
1992  return continueFlag_ != 0;
1993 }
static volatile sig_atomic_t continueFlag_
Definition: DPMBase.h:1276

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

4089 {
4090 #ifdef MERCURYDPM_USE_MPI
4091 
4092  //If running in parallel build, but just running with one core - no domain decomposition required
4093  int numberOfRequiredProcessors = numberOfDomains_[Direction::XAXIS]*
4096  if (NUMBER_OF_PROCESSORS != numberOfRequiredProcessors)
4097  {
4098  logger(ERROR,"The domain decompositions expects % processors, but only % are requested.\n"
4099  "Either run your process using \"mpirun -np % [executable]\", "
4100  "or change the domain decomposition to e.g. setNumberOfDomains({%,1,1}).", numberOfRequiredProcessors, NUMBER_OF_PROCESSORS, numberOfRequiredProcessors, NUMBER_OF_PROCESSORS);
4101  }
4102 
4103  if (NUMBER_OF_PROCESSORS == 1) {return;}
4104 
4105  //Check if the simulation domain has been set
4106  logger.assert_always(getXMax() - getXMin() > 0,"Please set your simulation domain (setXMax(),setXmin()) before calling solve()");
4107  logger.assert_always(getYMax() - getYMin() > 0,"Please set your simulation domain (setYMax(),setYmin()) before calling solve()");
4108  logger.assert_always(getZMax() - getZMin() > 0,"Please set your simulation domain (setZMax(),setZmin()) before calling solve()");
4109 
4110  //Grab simulation domains
4111  std::vector<Mdouble> simulationMin{getXMin(), getYMin(), getZMin()};
4112  std::vector<Mdouble> simulationMax{getXMax(), getYMax(), getZMax()};
4113 
4114  //Check if the user input decomposition is correct
4115  logger.assert_always(numberOfDomains_[Direction::XAXIS] > 0,"Number of domain in x-direction incorrect: %",numberOfDomains_[Direction::XAXIS]);
4116  logger.assert_always(numberOfDomains_[Direction::YAXIS] > 0,"Number of domain in y-direction incorrect: %",numberOfDomains_[Direction::YAXIS]);
4117  logger.assert_always(numberOfDomains_[Direction::ZAXIS] > 0,"Number of domain in z-direction incorrect: %",numberOfDomains_[Direction::ZAXIS]);
4118 
4119  //Open domain decomposition, closed is not implemented
4120  bool open = true;
4121 
4122  //Check if the number of domains is equal to the number of processors
4124  "Number of Processors is not equal to number of domains. Processors %, domains, %",
4127 
4128  //Create all processor domains
4129 
4130  domainHandler.setDPMBase(this);
4131  domainHandler.createMesh(simulationMin, simulationMax, numberOfDomains_, open);
4132  logger(VERBOSE,"Number of domains: % | Number of processors: %",domainHandler.getNumberOfObjects(), NUMBER_OF_PROCESSORS);
4133  //logger.assert_always(domainHandler.getNumberOfObjects() == numberOfProcessors, "Invalid decomposition: Number of domains and processors are different");
4134 
4135  //Tell the current processor to which domain it belongs
4136  for (Domain* domain : domainHandler)
4137  {
4138  if (domain->getRank() == PROCESSOR_ID)
4139  {
4140  logger(VERBOSE,"processor: %, domain index: %",PROCESSOR_ID, domain->getIndex());
4141  domainHandler.setCurrentDomainIndex(domain->getIndex());
4142  }
4143  }
4144 
4145  //Define the mpi transfer types, which requires a definition of the species already
4147  logger.assert_always(speciesHandler.getNumberOfObjects() > 0, "Please create a particle species before calling solve()");
4149 
4150  //Make sure all processors are done with decomposition before proceeding
4151  logger(VERBOSE,"processor %: #real particles: %, #total particles: %", PROCESSOR_ID, particleHandler.getNumberOfRealObjects(), particleHandler.getSize());
4153 #endif
4154 }
@ YAXIS
Definition: GeneralDefine.h:78
@ XAXIS
Definition: GeneralDefine.h:78
@ ZAXIS
Definition: GeneralDefine.h:78
@ ERROR
@ VERBOSE
void setCurrentDomainIndex(unsigned int index)
This sets a domain to the processor.
Definition: DomainHandler.cc:240
void createMesh(std::vector< Mdouble > &simulationMin, std::vector< Mdouble > &simulationMax, std::vector< unsigned > &numberOfDomains, bool open)
Creates a Cartesian square mesh in 3D.
Definition: DomainHandler.cc:93
The simulation can be subdivided into Domain's used in parallel code.
Definition: Domain.h:64
void initialiseMercuryMPITypes(const SpeciesHandler &speciesHandler)
Creates the MPI types required for communication of Mercury data through the MPI interface.
Definition: MpiContainer.cc:74
void sync()
Process all pending asynchronous communication requests before continuing.
Definition: MpiContainer.h:152
unsigned int getNumberOfRealObjects() const
Returns the number of real objects (on all processors)
Definition: ParticleHandler.cc:1304

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 initialiseSolve(), and read().

◆ deleteGhostParticles()

void DPMBase::deleteGhostParticles ( std::set< BaseParticle * > &  particlesToBeDeleted)
protected
Todo:
: doc
5087 {
5088  //Flush mixed particles from lists (MP particles are located in both structures)
5089  if (periodicBoundaryHandler.getSize() > 0)
5090  {
5091  //Flush particles from boundaries
5092  domainHandler.getCurrentDomain()->flushParticles(particlesToBeDeleted);
5093  periodicBoundaryHandler.flushParticles(particlesToBeDeleted);
5094  }
5095 
5096  //Clean communication lists
5099 
5100  //Delete the particles
5101  for (auto particle_it : particlesToBeDeleted)
5102  {
5103  particleHandler.removeGhostObject(particle_it->getIndex());
5104  }
5105 }
Domain * getCurrentDomain()
Gets the domain assigned to the processor.
Definition: DomainHandler.cc:250

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
2987  {
2988  logger.assert_always(speciesHandler.getSize()>0,"There needs to be at least one species");
2990  SphericalParticle p(s);
2992  b.set(p, 100, getMin(), getMax(), {0, 0, 0}, {0, 0, 0});
2993  b.insertParticles(this);
2994  logger(INFO,"Inserted % particles",particleHandler.getSize());
2995 }
@ INFO
T * getLastObject()
Gets a pointer to the last Object in this BaseHandler.
Definition: BaseHandler.h:634
It's an insertion boundary which has cuboidal shape (yes, 'CuboidalInsertionBoundary' would have been...
Definition: CubeInsertionBoundary.h:42
void set(BaseParticle *particleToCopy, unsigned int maxFailed, Vec3D posMin, Vec3D posMax, Vec3D velMin={0, 0, 0}, Vec3D velMax={0, 0, 0})
Sets the properties of the InsertionBoundary for mutliple different particle types.
Definition: CubeInsertionBoundary.cc:107
Vec3D getMax() const
Definition: DPMBase.h:670
Vec3D getMin() const
Definition: DPMBase.h:664
void insertParticles(DPMBase *md)
Fill a certain domain with particles.
Definition: InsertionBoundary.cc:328
Definition: ParticleSpecies.h:37
A spherical particle is the most simple particle used in MercuryDPM.
Definition: SphericalParticle.h:37

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

◆ finaliseSolve()

void DPMBase::finaliseSolve ( )

End of the solve routine, after time stepping.

4287  {
4288 
4289  //force writing of the last time step
4291 
4292  //end loop over interaction count
4294 
4295  //To make sure getTime gets the correct time for outputting statistics
4296  finishStatistics();
4297 
4298  closeFiles();
4299 }
void closeFiles()
Closes all files (ene, data, fstat, restart, stat) that were opened to read or write.
Definition: DPMBase.cc:503
void forceWriteOutputFiles()
Writes output files immediately, even if the current time step was not meant to be written....
Definition: DPMBase.cc:4028
virtual void finishStatistics()
Definition: DPMBase.cc:1925
virtual void actionsAfterSolve()
A virtual function which allows to define operations to be executed after the solve().
Definition: DPMBase.cc:1871

References actionsAfterSolve(), closeFiles(), finishStatistics(), and forceWriteOutputFiles().

Referenced by solve().

◆ 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.
2655 {
2657  {
2658  while (true)// This true corresponds to the if s
2659  {
2660  dataFile.open();
2661  //check if file exists and contains data
2662  int N;
2663  dataFile.getFstream() >> N;
2664  if (dataFile.getFstream().eof() || dataFile.getFstream().peek() == -1)
2665  {
2666  logger(WARN, "file % not found", dataFile.getName());
2667  return false;
2668  }
2669  //check if tmin condition is satisfied
2670  Mdouble t;
2671  dataFile.getFstream() >> t;
2672  if (t > tMin)
2673  {
2674  //set_file_counter(get_file_counter()-1);
2675  return true;
2676  }
2677  if (verbose)
2678  logger(VERBOSE, "Jumping file counter: %", dataFile.getCounter());
2679  }
2680  }
2681  return true;
2682 }
@ MULTIPLE_FILES
each time-step will be written into/read from separate files numbered consecutively: name_....
@ MULTIPLE_FILES_PADDED
each time-step will be written into/read from separate files numbered consecutively,...
@ WARN
const std::string & getName() const
Allows to access the file name, e.g., "problem.data".
Definition: File.cc:165
bool open()
Checks if the file stream fstream_ has any issues while opening. Alongside, it also increments the ne...
Definition: File.cc:347
unsigned int getCounter() const
In case of multiple files, File::getCounter() returns the the number (FILE::Counter_) of the next fil...
Definition: File.cc:223
FileType getFileType() const
Gets the file type e.g. NOFILE, ONEFILE and MULTIPLE FILES. File::fileType_.
Definition: File.cc:207
bool verbose
Definition: statXZ.cpp:28

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

◆ finishStatistics()

void DPMBase::finishStatistics ( )
protectedvirtual

This function is overridden by StatisticsVector

Reimplemented in statistics_while_running< T >, StatisticsVector< T >, StatisticsVector< O >, StatisticsVector< XZ >, and statistics_while_running< T >.

1926 {
1927  cgHandler.finish();
1928 }
void finish()
Contains the code executed after the last time step.
Definition: CGHandler.cc:113

References cgHandler, and CGHandler::finish().

Referenced by finaliseSolve(), 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.

4029 {
4031  writeOutputFiles();
4032 }
const unsigned NEVER
Definition: File.h:35
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 b...
Definition: DPMBase.cc:519

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

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

◆ gatherContactStatistics() [1/2]

void DPMBase::gatherContactStatistics ( )
protected
1899 {
1901  {
1902  c->gatherContactStatistics();
1903  }
1904 }

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.

Reimplemented in StatisticsVector< T >, StatisticsVector< O >, and StatisticsVector< XZ >.

1912 {
1913 }

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.
671 {
672 // Declare a vector of integers capable of storing 2 values
673 std::vector<int> temp(2);
674 
675 // Declare and initialise for the current simulation run number
676 int counter = getRunNumber();
677 
678 // Give studyNum value 0 if study is incomplete, otherwise value > 0
679 int studyNum = (counter-1)/sizeX;
680 counter = counter - sizeX*studyNum;
681 
682 int i = ((counter - 1) % sizeX) + 1;
683 logger(INFO,"StudyNum: % \t Counter: % \t i: %", studyNum, counter, i);
684 temp[0] = studyNum;
685 temp[1] = i;
686 
687 return temp;
688 }
int getRunNumber() const
This returns the current value of the counter (runNumber_)
Definition: DPMBase.cc:617

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

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

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.
1511 {
1512  return append_;
1513 }

References append_.

Referenced by initialiseSolve(), and writeEneHeader().

◆ getBackgroundDrag()

const Mdouble DPMBase::getBackgroundDrag ( ) const
inline

Return the background drag.

Returns
double which is the background drag. Positive number removes energy, negative gains.
812 {return backgroundDrag_;}

References backgroundDrag_.

Referenced by computeExternalForces(), and write().

◆ 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.

1615 {
1617 }
Vec3D getCentreOfMass() const
Definition: ParticleHandler.cc:654

References ParticleHandler::getCentreOfMass(), and particleHandler.

Referenced by GranuHeap::actionsAfterTimeStep(), GranuDrum::printTime(), GranuHeap::printTime(), VerticalMixer::printTime(), and GranuDrum::writeResults().

◆ getCPUTime()

double DPMBase::getCPUTime ( )
inline
910 { return clock_.getCPUTime(); }
Time clock_
record when the simulation started
Definition: DPMBase.h:1509
Mdouble getCPUTime() const
Definition: MercuryTime.h:80

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
5290 {
5292 }

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)
306 {
307 return dataFile;
308 }

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)
355 {
356 return dataFile;
357 }

References dataFile.

◆ getElasticEnergy()

Mdouble DPMBase::getElasticEnergy ( ) const

Returns the global elastic energy within the system.

Returns
elasticEnergy The total elastic energy of all current particle interactions.
1531 {
1532  Mdouble elasticEnergy = 0.0;
1533  // JMFT: Note that we do count the elastic energy of fixed particles here.
1534  for (const BaseInteraction* c : interactionHandler)
1535  {
1536  elasticEnergy += c->getElasticEnergy();
1537  }
1538  return elasticEnergy;
1539 }

References interactionHandler.

Referenced by SilbertHstop::actionAfterTimeStep(), BaseCluster::actionsAfterSolve(), GranuHeap::actionsAfterTimeStep(), ShearStage::actionsAfterTimeStep(), BaseCluster::actionsAfterTimeStep(), T_protectiveWall::continueSolve(), ClosedCSCWalls::continueSolve(), CSCInit::continueSolve(), CSCWalls::continueSolve(), InitialConditions< SpeciesType >::continueSolve(), DPM::continueSolve(), protectiveWall::continueSolve(), getTotalEnergy(), main(), GranuHeap::printTime(), ShearStage::printTime(), ClosedCSCRestart::printTime(), ClosedCSCRun::printTime(), ClosedCSCStats::printTime(), ClosedCSCWalls::printTime(), CSCInit::printTime(), CSCRestart::printTime(), CSCRun::printTime(), CSCStats::printTime(), CSCWalls::printTime(), HorizontalMixer::printTime(), VerticalMixer::printTime(), ParticleInclusion::printTime(), vibratedBed::printTime(), InitialConditions< SpeciesType >::printTime(), SphericalIndenter::printTime(), DPM::printTime(), regimeForceUnitTest::printTime(), TangentialSpringEnergyConservationUnitTest::printTime(), BaseCluster::printTime(), writeEneTimeStep(), LawinenBox::writeEneTimeStep(), and BaseCluster::writeToCdatFile().

◆ 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)
314 {
315 return eneFile;
316 }

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)
363 {
364 return eneFile;
365 }

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)
322 {
323 return fStatFile;
324 }

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)
371 {
372 return fStatFile;
373 }

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).
1562 {
1563  Mdouble gravitationalEnergy = 0;
1564  for (const BaseParticle* const p : particleHandler)
1565  {
1566  // Don't consider fixed particles. 'Fixed' particles aren't necessarily
1567  // stationary; it just means their position is prescribed.
1568  if (!(p->isFixed()))
1569  {
1570  gravitationalEnergy += p->getMass() * Vec3D::dot((-getGravity()), p->getPosition());
1571  }
1572  }
1573  return gravitationalEnergy;
1574 }
static Mdouble dot(const Vec3D &a, const Vec3D &b)
Calculates the dot product of two Vec3D: .
Definition: Vector.cc:76

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

Referenced by getTotalEnergy().

◆ getGravity()

◆ getHGridUpdateEachTimeStep()

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

Reimplemented in MercuryBase.

1719 {
1720  return true;
1721 }

Referenced by BaseParticle::integrateBeforeForceComputation(), and ClumpParticle::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.

1643 {
1644 // return p.getSpecies()->getId(); // was getIndex()
1645  return p.getInfo();
1646 }
virtual Mdouble getInfo() const
Returns some user-defined information about this object (by default, species ID).
Definition: BaseParticle.cc:358

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_
346 {
347 return interactionFile;
348 }

References interactionFile.

Referenced by initialiseSolve(), main(), setName(), 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.
395 {
396 return interactionFile;
397 }

References interactionFile.

◆ getKineticEnergy()

Mdouble DPMBase::getKineticEnergy ( ) const

Returns the global kinetic energy stored in the system.

Returns
kineticEnergy The total kinetic energy of all particles.
1545 {
1546  Mdouble kineticEnergy = 0;
1547  for (const BaseParticle* const p : particleHandler)
1548  {
1549  if (!(p->isFixed()))
1550  {
1551  kineticEnergy += .5 * p->getMass() * p->getVelocity().getLengthSquared();
1552  }
1553  }
1554  return kineticEnergy;
1555 }

References particleHandler.

Referenced by SilbertHstop::actionAfterTimeStep(), BaseCluster::actionsAfterSolve(), GranuHeap::actionsAfterTimeStep(), ShearStage::actionsAfterTimeStep(), BaseCluster::actionsAfterTimeStep(), DrumRot::actionsBeforeTimeStep(), RotatingDrum::actionsBeforeTimeStep(), T_protectiveWall::continueSolve(), ClosedCSCWalls::continueSolve(), CSCInit::continueSolve(), CSCWalls::continueSolve(), InitialConditions< SpeciesType >::continueSolve(), DPM::continueSolve(), protectiveWall::continueSolve(), getTotalEnergy(), main(), GranuHeap::printTime(), ShearStage::printTime(), ClosedCSCRestart::printTime(), ClosedCSCRun::printTime(), ClosedCSCStats::printTime(), ClosedCSCWalls::printTime(), CSCInit::printTime(), CSCRestart::printTime(), CSCRun::printTime(), CSCStats::printTime(), CSCWalls::printTime(), HorizontalMixer::printTime(), VerticalMixer::printTime(), ParticleInclusion::printTime(), vibratedBed::printTime(), InitialConditions< SpeciesType >::printTime(), SphericalIndenter::printTime(), DPM::printTime(), regimeForceUnitTest::printTime(), BaseCluster::printTime(), setMeanVelocityAndKineticEnergy(), and BaseCluster::writeToCdatFile().

◆ 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).
5380 {
5381  Matrix3D F; //set the kinetic energy tensor, this is in terms of Sum(m*v^2)
5382  Vec3D J; //set the momentum tensor
5383 
5384  //calculate stress for kinetic part
5385  for (const auto& p : particleHandler)
5386  {
5387  F += Matrix3D::dyadic(p->getVelocity(), p->getVelocity()) * p->getMass();
5388  J += p->getVelocity() * p->getMass();
5389  }
5390 
5391  Matrix3D stressKinetic = F - Matrix3D::dyadic(J, J) / getTotalMass();
5392  stressKinetic /= getTotalVolume();
5393  return stressKinetic;
5394 }
Mdouble getTotalVolume() const
Get the total volume of the cuboid system.
Definition: DPMBase.cc:5370
Mdouble getTotalMass() const
JMFT: Return the total mass of the system, excluding fixed particles.
Definition: DPMBase.cc:1598
Implementation of a 3D matrix.
Definition: Matrix.h:38
static Matrix3D dyadic(const Vec3D &a, const Vec3D &b)
Calculates the dyadic product of a two Vec3D: .
Definition: Matrix.cc:323

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

Referenced by getTotalStress().

◆ getMax()

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

References max_.

Referenced by BaseWall::addParticlesAtWall(), RandomClusterInsertionBoundary::checkBoundaryBeforeTimeStep(), ClosedCSCWalls::ClosedCSCWalls(), commandLineCG(), InfiniteWall::createVTK(), CSCWalls::CSCWalls(), SubcriticalMaserBoundaryTEST::extendBottom(), fillDomainWithParticles(), MembraneDemo::fixMembraneEdges(), MembraneSelfTest::fixMembraneEdges(), GranuDrum::GranuDrum(), GranuHeap::GranuHeap(), main(), FileReader::read(), Slide::set_Walls(), Domain::setBounds(), Domain::setRange(), ClosedCSCWalls::setupInitialConditions(), Drum::setupInitialConditions(), RotatingDrumWet::setupInitialConditions(), VerticalMixer::setupInitialConditions(), Binary::setupInitialConditions(), my_problem::setupInitialConditions(), FreeCooling2DinWalls::setupInitialConditions(), StressStrainControl::setupInitialConditions(), Cstatic2d::setupInitialConditions(), Penetration::setupInitialConditions(), DistributionSelfTest::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::writeWallDetailsVTKBoundingBox().

◆ getMin()

Vec3D DPMBase::getMin ( ) const
inline
665  { return min_; }

References min_.

Referenced by BaseWall::addParticlesAtWall(), RandomClusterInsertionBoundary::checkBoundaryBeforeTimeStep(), ClosedCSCWalls::ClosedCSCWalls(), commandLineCG(), InfiniteWall::createVTK(), CSCWalls::CSCWalls(), SubcriticalMaserBoundaryTEST::extendBottom(), fillDomainWithParticles(), MembraneDemo::fixMembraneEdges(), MembraneSelfTest::fixMembraneEdges(), GranuDrum::GranuDrum(), GranuHeap::GranuHeap(), main(), FileReader::read(), Domain::setBounds(), Domain::setRange(), Drum::setupInitialConditions(), RotatingDrumWet::setupInitialConditions(), VerticalMixer::setupInitialConditions(), Binary::setupInitialConditions(), my_problem::setupInitialConditions(), InsertionBoundaryMPI2Test::setupInitialConditions(), FreeCooling2DinWalls::setupInitialConditions(), StressStrainControl::setupInitialConditions(), Cstatic2d::setupInitialConditions(), Penetration::setupInitialConditions(), DistributionSelfTest::setupInitialConditions(), DistributionToPSDSelfTest::setupInitialConditions(), InsertionBoundarySelfTest::setupInitialConditions(), MultiplePSDSelfTest::setupInitialConditions(), PolydisperseInsertionBoundarySelfTest::setupInitialConditions(), PSDManualInsertionSelfTest::setupInitialConditions(), PSDSelfTest::setupInitialConditions(), FreeFallInteractionSelfTest::setupInitialConditions(), TwoParticleElasticCollisionInteraction::setupInitialConditions(), TriangulatedWallSelfTest::setupInitialConditions(), Packing::setupInitialConditions(), Packing::test(), AxisymmetricIntersectionOfWalls::writeVTK(), HorizontalBaseScrew::writeVTK(), IntersectionOfWalls::writeVTK(), ScrewsymmetricIntersectionOfWalls::writeVTK(), and WallHandler::writeWallDetailsVTKBoundingBox().

◆ getName()

◆ getNextTime()

Mdouble DPMBase::getNextTime ( ) const

Returns the current simulation time.

Returns
time_
817 {
818 return time_ + timeStep_;
819 }

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
865 {
866 return nToWrite_;
867 }

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
5281 {
5282  return numberOfDomains_;
5283 }

References numberOfDomains_.

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

◆ getNumberOfOMPThreads()

int DPMBase::getNumberOfOMPThreads ( ) const
1287 {
1288  //logger.assert_debug(numberOfOMPThreads_,"You need to set the number of OMP threads");
1289  return numberOfOMPThreads_;
1290 }

References numberOfOMPThreads_.

Referenced by SphericalIndenter::actionsBeforeTimeStep(), computeAllForces(), Mercury3Dclump::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).
1468 {
1469  return particleDimensions_;
1470 }

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
986 {
987 return writeParticlesVTK_;
988 }

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_
1494 {
1495  return restarted_;
1496 }

References restarted_.

Referenced by autoNumber(), initialiseSolve(), 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)
330 {
331 return restartFile;
332 }

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)
379 {
380 return restartFile;
381 }

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_
1476 {
1477  return restartVersion_;
1478 }

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.
571  { return rotation_; }

References rotation_.

Referenced by computeAllForces(), computeForcesDueToWalls(), Mercury3Dclump::computeForcesDueToWalls(), computeInternalForce(), Mercury3Dclump::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
1578 {
1579  Mdouble ene_rot = 0;
1580  for (std::vector<BaseParticle*>::const_iterator it = particleHandler.begin(); it != particleHandler.end(); ++it)
1581  {
1582  // See above.
1583  if (!(*it)->isFixed())
1584  {
1585  // ene_rot += .5 * (*it)->getInertia() * (*it)->getAngularVelocity().getLengthSquared();
1586  }
1587  }
1588  return ene_rot;
1589 }
const std::vector< T * >::const_iterator end() const
Gets the end of the const_iterator over all BaseBoundary in this BaseHandler.
Definition: BaseHandler.h:704

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.
618 {
619 return runNumber_;
620 }

References runNumber_.

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

◆ 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)
338 {
339 return statFile;
340 }

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)
387 {
388 return statFile;
389 }

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).
5402 {
5403  //stress components calculation variables
5404  Matrix3D stressStatic;
5405 
5406  //calculate the static stress tensor based on all the interactions
5407  for (const auto i : interactionHandler)
5408  {
5409  stressStatic += Matrix3D::dyadic(i->getForce(), i->getNormal()) * i->getDistance();
5410  }
5411 
5412  stressStatic /= getTotalVolume();
5413  return stressStatic;
5414 }

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

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

◆ getSuperquadricParticlesWriteVTK()

bool DPMBase::getSuperquadricParticlesWriteVTK ( ) const
Returns
bool
994 {
996 }

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.)
1431 {
1432  return systemDimensions_;
1433 }

References systemDimensions_.

Referenced by HGridOptimiser::initialise(), outputXBallsData(), readNextDataFile(), StatisticsVector< T >::setNZ(), write(), inflowFromPeriodic::writeXBallsScript(), and ChuteWithPeriodicInflow::writeXBallsScript().

◆ getTime()

Mdouble DPMBase::getTime ( ) const

Returns the current simulation time.

Returns
time_
809 {
810 return time_;
811 }

References time_.

Referenced by SilbertHstop::actionAfterTimeStep(), GranuHeap::actionsAfterTimeStep(), ShearStage::actionsAfterTimeStep(), multiParticleT1::actionsAfterTimeStep(), MaserRepeatedOutInMPI2Test::actionsAfterTimeStep(), FreeCooling2DinWallsDemo::actionsAfterTimeStep(), FreeCooling3DDemoProblem::actionsAfterTimeStep(), FreeCooling3DinWallsDemo::actionsAfterTimeStep(), FreeCoolingDemoProblem::actionsAfterTimeStep(), HourGlass::actionsAfterTimeStep(), MinimalExampleDrum::actionsAfterTimeStep(), Chutebelt::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(), LawinenBox::actionsBeforeTimeStep(), DPM::actionsBeforeTimeStep(), SmoothChute::actionsBeforeTimeStep(), Binary::actionsBeforeTimeStep(), AngleOfRepose::actionsBeforeTimeStep(), Slide::actionsBeforeTimeStep(), Chutebelt::actionsBeforeTimeStep(), ConstantRestitutionSelfTest::actionsBeforeTimeStep(), CoilSelfTest::actionsBeforeTimeStep(), DrumRot::actionsBeforeTimeStep(), RotatingDrum::actionsBeforeTimeStep(), QuaternionWallUnitTest::actionsBeforeTimeStep(), PeriodicWallsWithSlidingFrictionUnitTest::actionsBeforeTimeStep(), SaveCountUnitTest::actionsBeforeTimeStep(), AirySavageHutter::actionsOnRestart(), StatisticsVector< T >::check_current_time_for_statistics(), TimeDependentPeriodicBoundary::checkBoundaryAfterParticlesMove(), ClosedCSCStats::ClosedCSCStats(), commandLineCG(), ChuteWithPeriodicInflow::computeInternalForces(), SilbertHstop::continueSolve(), TimeDependentPeriodicBoundary::createGhostParticle(), CSCStats::CSCStats(), BaseCluster::decreaseForce(), CGHandler::evaluateDataFiles(), CGHandler::evaluateRestartFiles(), LeesEdwardsBoundary::getCurrentShift(), LeesEdwardsBoundary::getCurrentVelocity(), HorizontalBaseScrew::getDistanceAndNormal(), vibratedBed::getPrescribedVelocity(), BaseCluster::increaseForce(), integrateAfterForceComputation(), integrateBeforeForceComputation(), isTimeEqualTo(), loadingTest(), main(), normalAndTangentialLoadingTest(), objectivenessTest(), outputXBallsData(), LiquidMigrationMPI2Test::outputXBallsData(), LiquidMigrationSelfTest::outputXBallsData(), SphericalIndenter::outputXBallsData(), inflowFromPeriodic::printTime(), printTime(), T_protectiveWall::printTime(), LawinenBox::printTime(), GranuDrum::printTime(), ShearStage::printTime(), ClosedCSCRestart::printTime(), ClosedCSCRun::printTime(), ClosedCSCStats::printTime(), ClosedCSCWalls::printTime(), CSCInit::printTime(), CSCRestart::printTime(), CSCRun::printTime(), CSCStats::printTime(), CSCWalls::printTime(), ChuteWithPeriodicInflow::printTime(), HorizontalMixer::printTime(), NozzleDemo::printTime(), Drum::printTime(), RotatingDrumWet::printTime(), VerticalMixer::printTime(), ForceLawsMPI2Test::printTime(), ParticleInclusion::printTime(), ParticleBeam::printTime(), SilbertPeriodic::printTime(), CLiveStatistics< T >::printTime(), statistics_while_running< T >::printTime(), vibratedBed::printTime(), ConstantMassFlowMaserBoundaryMixedSpeciesSelfTest::printTime(), ConstantMassFlowMaserSelfTest::printTime(), CubeDeletionBoundarySelfTest::printTime(), DeletionBoundarySelfTest::printTime(), DistributionSelfTest::printTime(), DistributionToPSDSelfTest::printTime(), InsertionBoundarySelfTest::printTime(), MultiplePSDSelfTest::printTime(), NozzleSelfTest::printTime(), PolydisperseInsertionBoundarySelfTest::printTime(), PSDManualInsertionSelfTest::printTime(), PSDSelfTest::printTime(), LiquidMigrationSelfTest::printTime(), TwoParticleElasticCollisionInteraction::printTime(), InitialConditions< SpeciesType >::printTime(), SinterPair::printTime(), SphericalIndenter::printTime(), DPM::printTime(), protectiveWall::printTime(), EvaporationAndHeatTest::printTime(), RandomClusterInsertionBoundarySelfTest::printTime(), viscoElasticUnitTest::printTime(), MultiParticlesInsertion::printTime(), regimeForceUnitTest::printTime(), BaseCluster::printTime(), Chute::printTime(), FileReader::read(), BaseWall::renderWall(), CGHandler::restart(), statistics_while_running< T >::run(), NozzleDemo::setupInitialConditions(), Binary::setupInitialConditions(), my_problem::setupInitialConditions(), NozzleSelfTest::setupInitialConditions(), DrumRot::setupInitialConditions(), RotatingDrum::setupInitialConditions(), BaseCluster::setupInitialConditions(), ShearBoxBoundary::shiftHorizontalPosition(), LeesEdwardsBoundary::shiftVerticalPosition(), solve(), statistics_while_running< T >::statistics_while_running(), 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_
889 {
890 return timeMax_;
891 }

References timeMax_.

Referenced by AngleOfRepose::actionsBeforeTimeStep(), Slide::actionsBeforeTimeStep(), AirySavageHutter::actionsOnRestart(), ChutePeriodicDemo::ChutePeriodicDemo(), ForceLawsMPI2Test::ForceLawsMPI2Test(), StatisticsVector< T >::getTimeMaxStat(), GranuDrum::GranuDrum(), loadingTest(), main(), normalAndTangentialLoadingTest(), objectivenessTest(), ParticleBeam::ParticleBeam(), printTime(), T_protectiveWall::printTime(), LawinenBox::printTime(), GranuDrum::printTime(), HorizontalMixer::printTime(), NozzleDemo::printTime(), Drum::printTime(), RotatingDrumWet::printTime(), ParticleBeam::printTime(), SilbertPeriodic::printTime(), CLiveStatistics< T >::printTime(), statistics_while_running< T >::printTime(), vibratedBed::printTime(), ConstantMassFlowMaserBoundaryMixedSpeciesSelfTest::printTime(), ConstantMassFlowMaserSelfTest::printTime(), DistributionSelfTest::printTime(), DistributionToPSDSelfTest::printTime(), InsertionBoundarySelfTest::printTime(), MultiplePSDSelfTest::printTime(), NozzleSelfTest::printTime(), PolydisperseInsertionBoundarySelfTest::printTime(), PSDManualInsertionSelfTest::printTime(), PSDSelfTest::printTime(), SinterPair::printTime(), protectiveWall::printTime(), RandomClusterInsertionBoundarySelfTest::printTime(), MultiParticlesInsertion::printTime(), regimeForceUnitTest::printTime(), Chute::printTime(), readNextArgument(), Mercury3DRestart::readNextArgument(), regimeForceUnitTest::regimeForceUnitTest(), save(), ChutePeriodic::setup(), ClosedCSCStats::setupInitialConditions(), CSCRun::setupInitialConditions(), CSCStats::setupInitialConditions(), MarbleRun::setupInitialConditions(), Drum::setupInitialConditions(), Penetration::setupInitialConditions(), Silo::setupInitialConditions(), UnionOfWalls::setupInitialConditions(), SingleParticle< SpeciesType >::setupInitialConditions(), EvaporationAndHeatTest::setupInitialConditions(), MovingIntersectionOfWallsUnitTest_Basic::setupInitialConditions(), MovingWall::setupInitialConditions(), SeparateFilesSelfTest::setupInitialConditions(), MercuryProblem::setupMercuryProblem(), Siegen::Siegen(), Slide::Slide(), solve(), statistics_while_running< T >::statistics_while_running(), 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.
1251 {
1252 return timeStep_;
1253 }

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(), HeatFluidCoupledSpecies< NormalForceSpecies >::actionsAfterTimeStep(), LawinenBox::actionsBeforeTimeStep(), DPM::actionsBeforeTimeStep(), SmoothChute::actionsBeforeTimeStep(), Slide::actionsBeforeTimeStep(), Chutebelt::actionsBeforeTimeStep(), CoilSelfTest::actionsBeforeTimeStep(), BaseCluster::actionsOnRestart(), StressStrainControlBoundary::activateStrainRateControl(), NautaMixer::addSpeciesAndSetTimeStepAndSaveCount(), BaseCluster::calculateTimeStep(), StatisticsVector< T >::check_current_time_for_statistics(), 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(), WearableNurbsWall::computeWear(), WearableTriangleMeshWall::computeWear(), WearableTriangulatedWall::computeWear(), SilbertHstop::continueSolve(), CSCWalls::CSCWalls(), StressStrainControlBoundary::determineStressControlledShearBoundaries(), ForceLawsMPI2Test::ForceLawsMPI2Test(), ChuteWithHopper::getTimeStepRatio(), GranuDrum::GranuDrum(), integrateAfterForceComputation(), ChuteWithPeriodicInflow::integrateBeforeForceComputation(), integrateBeforeForceComputation(), inflowFromPeriodic::integrateBeforeForceComputation(), isTimeEqualTo(), LeesEdwardsDemo::LeesEdwardsDemo(), main(), ChuteBottom::makeRoughBottom(), ParticleBeam::ParticleBeam(), ParticleCreation::ParticleCreation(), readNextArgument(), readParAndIniFiles(), regimeForceUnitTest::regimeForceUnitTest(), BaseWall::renderWall(), Screw::rotate(), save(), Cstatic2d::set_particle_properties(), Cstatic3D::set_particle_properties(), SilbertPeriodic::set_study(), Calibration::setSpecies(), Material::setSpecies(), ChutePeriodic::setup(), ChuteWithContraction::setup_particles_initial_conditions(), CSCRun::setupInitialConditions(), RotatingDrumWet::setupInitialConditions(), MarbleRun::setupInitialConditions(), ShiftingConstantMassFlowMaserBoundarySelfTest::setupInitialConditions(), ShiftingMaserBoundarySelfTest::setupInitialConditions(), ChutePeriodic::setupInitialConditions(), GetDistanceAndNormalForIntersectionOfWalls::setupInitialConditions(), GetDistanceAndNormalForScrew::setupInitialConditions(), GetDistanceAndNormalForTriangleWall::setupInitialConditions(), Drum::setupInitialConditions(), Penetration::setupInitialConditions(), Silo::setupInitialConditions(), DistributionSelfTest::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(), EvaporationAndHeatTest::setupInitialConditions(), HertzianSinterForceUnitTest::setupInitialConditions(), MovingIntersectionOfWallsUnitTest_Basic::setupInitialConditions(), MovingWall::setupInitialConditions(), PlasticForceUnitTest::setupInitialConditions(), SeparateFilesSelfTest::setupInitialConditions(), BaseCluster::setupInitialConditions(), MercuryProblem::setupMercuryProblem(), Siegen::Siegen(), SilbertHstop::SilbertHstop(), Slide::Slide(), statistics_while_running< T >::statistics_while_running(), TangentialSpringEnergyConservationUnitTest::TangentialSpringEnergyConservationUnitTest(), TimeDependentPeriodicBoundary3DSelfTest::TimeDependentPeriodicBoundary3DSelfTest(), TimeDependentPeriodicBoundaryTest::TimeDependentPeriodicBoundaryTest(), TriangulatedScrewSelfTest::TriangulatedScrewSelfTest(), TriangulatedStepSelfTest::TriangulatedStepSelfTest(), TriangulatedStepWallSelfTest::TriangulatedStepWallSelfTest(), TriangulatedWallSelfTest::TriangulatedWallSelfTest(), StressStrainControlBoundary::updateDomainSize(), and write().

◆ getTotalEnergy()

Mdouble DPMBase::getTotalEnergy ( ) const
1591  {
1593 }
Mdouble getRotationalEnergy() const
JMFT Returns the global rotational energy stored in the system.
Definition: DPMBase.cc:1577
Mdouble getKineticEnergy() const
Returns the global kinetic energy stored in the system.
Definition: DPMBase.cc:1544
Mdouble getGravitationalEnergy() const
Returns the global gravitational potential energy stored in the system.
Definition: DPMBase.cc:1561
Mdouble getElasticEnergy() const
Returns the global elastic energy within the system.
Definition: DPMBase.cc:1530

References getElasticEnergy(), getGravitationalEnergy(), getKineticEnergy(), and getRotationalEnergy().

◆ getTotalMass()

Mdouble DPMBase::getTotalMass ( ) const

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

Returns
double
1599 {
1600  /*
1601  double mass_sum = 0;
1602  for (std::vector<BaseParticle*>::const_iterator it = particleHandler.begin(); it != particleHandler.end(); ++it)
1603  if (!(*it)->isFixed())
1604  mass_sum += (*it)->getMass();
1605  return mass_sum;
1606  */
1607  return particleHandler.getMass();
1608 }
Mdouble getMass() const
Definition: ParticleHandler.cc:611

References ParticleHandler::getMass(), and particleHandler.

Referenced by ShearStage::actionsAfterTimeStep(), getKineticStress(), ShearStage::printTime(), 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
1625 {
1626  return particleHandler.getMomentum();
1627  /*
1628  Vec3D total_momentum = Vec3D(0,0,0);
1629  for (std::vector<BaseParticle*>::const_iterator it = particleHandler.begin(); it != particleHandler.end(); ++it)
1630  if (!(*it)->isFixed())
1631  total_momentum += (*it)->getMass() * (*it)->getVelocity();
1632  return total_momentum;
1633  */
1634 }
Vec3D getMomentum() const
Definition: ParticleHandler.cc:666

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).
5422 {
5423  return getKineticStress() + getStaticStress();
5424 }
Matrix3D getKineticStress() const
Calculate the kinetic stress tensor in the system averaged over the whole volume.
Definition: DPMBase.cc:5379
Matrix3D getStaticStress() const
Calculate the static stress tensor in the system averaged over the whole volume.
Definition: DPMBase.cc:5401

References getKineticStress(), and getStaticStress().

Referenced by ShearStage::actionsAfterTimeStep(), StressStrainControlBoundary::computeStrainRate(), StressStrainControlBoundary::computeStressError(), and ShearStage::printTime().

◆ getTotalVolume()

Mdouble DPMBase::getTotalVolume ( ) const

Get the total volume of the cuboid system.

Returns
The total volume of the domain.
5371 {
5372  return (getXMax() - getXMin()) * (getYMax() - getYMin()) * (getZMax() - getZMin());
5373 }

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

Referenced by ShearStage::actionsAfterTimeStep(), getKineticStress(), getStaticStress(), GranuHeap::GranuHeap(), and ShearStage::printTime().

◆ getVtkWriter()

ParticleVtkWriter * DPMBase::getVtkWriter ( ) const
5295 {
5296  return vtkWriter_;
5297 }

References vtkWriter_.

◆ getWallsWriteVTK()

FileType DPMBase::getWallsWriteVTK ( ) const

Returns whether walls are written in a VTK file.

Deprecated:
Use wallHandler.getWriteVTK() instead (since 21-07-2021)

The VTK file is used for visualisation in Paraview.

Todo:
Move this (and the set) to WallHandler.
Returns
bool
974 {
975  logger(WARN, "DPMBase.getWallsWriteVTK() is deprecated! Use wallHandler.getWriteVTK() instead.");
976  return wallHandler.getWriteVTK();
977 }
FileType getWriteVTK() const
Returns whether walls are written in a VTK file.
Definition: WallHandler.cc:477

References WallHandler::getWriteVTK(), logger, wallHandler, and WARN.

◆ getWallTime()

double DPMBase::getWallTime ( )
inline
915 { return clock_.getWallTime(); }
Mdouble getWallTime()
Definition: MercuryTime.h:88

References clock_, and Time::getWallTime().

◆ getWallVTKWriter()

WallVTKWriter & DPMBase::getWallVTKWriter ( )

◆ getWritePythonFileForVTKVisualisation()

bool DPMBase::getWritePythonFileForVTKVisualisation ( ) const
5501 {
5503 }
bool forceWritePythonFileForVTKVisualisation_
Definition: DPMBase.h:1519

References forceWritePythonFileForVTKVisualisation_.

◆ getXBallsAdditionalArguments()

std::string DPMBase::getXBallsAdditionalArguments ( ) const

Returns the additional arguments for xballs.

Returns
xBallsAdditionalArguments_
1356 {
1358 }

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.
1311 {
1312  return xBallsColourMode_;
1313 }

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.
1373 {
1374  return xBallsScale_;
1375 }

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.
1331 {
1332  return xBallsVectorScale_;
1333 }

References xBallsVectorScale_.

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

◆ getXCenter()

Mdouble DPMBase::getXCenter ( ) const
inline
654  { return 0.5*(max_.X+min_.X); }
Mdouble X
the vector components
Definition: Vector.h:66

References max_, min_, and Vec3D::X.

Referenced by main().

◆ getXMax()

Mdouble DPMBase::getXMax ( ) const
inline

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

627  { return max_.x(); }
Mdouble & x()
RW reference to X.
Definition: Vector.h:360

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::determineStressControlledShearBoundaries(), Chute::getChuteLength(), ChuteWithHopper::getChuteLength(), ChuteWithHopper::getMaximumVelocityInducedByGravity(), DomainHandler::getParticleDomainGlobalIndex(), getTotalVolume(), StatisticsVector< T >::getXMaxStat(), 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(), T_protectiveWall::setupInitialConditions(), LawinenBox::setupInitialConditions(), ClosedCSCWalls::setupInitialConditions(), CSCInit::setupInitialConditions(), CSCWalls::setupInitialConditions(), ChutePeriodic::setupInitialConditions(), MercuryLogo::setupInitialConditions(), multiParticleT1::setupInitialConditions(), Binary::setupInitialConditions(), my_problem::setupInitialConditions(), LiquidMigrationMPI2Test::setupInitialConditions(), CubicCell::setupInitialConditions(), FreeCooling2DinWalls::setupInitialConditions(), FreeCooling2DinWallsDemo::setupInitialConditions(), FreeCooling3DDemoProblem::setupInitialConditions(), FreeCooling3DinWallsDemo::setupInitialConditions(), FreeCoolingDemoProblem::setupInitialConditions(), HeaterBoundaryTest::setupInitialConditions(), HourGlass2D::setupInitialConditions(), HourGlass::setupInitialConditions(), LeesEdwardsDemo::setupInitialConditions(), MarbleRun::setupInitialConditions(), TimeDependentPeriodicBoundary3DSelfTest::setupInitialConditions(), TimeDependentPeriodicBoundaryTest::setupInitialConditions(), Cstatic2d::setupInitialConditions(), AngleOfRepose::setupInitialConditions(), SilbertPeriodic::setupInitialConditions(), statistics_while_running< T >::setupInitialConditions(), GetDistanceAndNormalForIntersectionOfWalls::setupInitialConditions(), GetDistanceAndNormalForScrew::setupInitialConditions(), GetDistanceAndNormalForTriangleWall::setupInitialConditions(), RotatingDrum::setupInitialConditions(), Chutebelt::setupInitialConditions(), LeesEdwardsSelfTest::setupInitialConditions(), clumpTest::setupInitialConditions(), PolydisperseInsertionBoundarySelfTest::setupInitialConditions(), CGHandlerSelfTest::setupInitialConditions(), NewtonsCradleSelftest::setupInitialConditions(), SquarePacking::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(), Tutorial11::setupInitialConditions(), Tutorial12::setupInitialConditions(), Tutorial1::setupInitialConditions(), Tutorial2::setupInitialConditions(), Tutorial3::setupInitialConditions(), Tutorial4::setupInitialConditions(), Tutorial5::setupInitialConditions(), Tutorial6::setupInitialConditions(), Tutorial7::setupInitialConditions(), Tutorial8::setupInitialConditions(), Tutorial9::setupInitialConditions(), ExtremeOverlapWithWallsUnitTest::setupInitialConditions(), MD_demo::setupInitialConditions(), InclinedPlane::setupInitialConditions(), MultiParticlesInsertion::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.

620  { 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::determineStressControlledShearBoundaries(), DomainHandler::getParticleDomainGlobalIndex(), getTotalVolume(), StatisticsVector< T >::getXMinStat(), 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(), T_protectiveWall::setupInitialConditions(), LawinenBox::setupInitialConditions(), ClosedCSCWalls::setupInitialConditions(), CSCInit::setupInitialConditions(), CSCWalls::setupInitialConditions(), ChutePeriodic::setupInitialConditions(), MercuryLogo::setupInitialConditions(), multiParticleT1::setupInitialConditions(), my_problem::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(), LeesEdwardsDemo::setupInitialConditions(), MarbleRun::setupInitialConditions(), TimeDependentPeriodicBoundary3DSelfTest::setupInitialConditions(), TimeDependentPeriodicBoundaryTest::setupInitialConditions(), Cstatic2d::setupInitialConditions(), SilbertPeriodic::setupInitialConditions(), statistics_while_running< T >::setupInitialConditions(), GetDistanceAndNormalForIntersectionOfWalls::setupInitialConditions(), GetDistanceAndNormalForScrew::setupInitialConditions(), GetDistanceAndNormalForTriangleWall::setupInitialConditions(), RotatingDrum::setupInitialConditions(), Chutebelt::setupInitialConditions(), ConstantMassFlowMaserSelfTest::setupInitialConditions(), LeesEdwardsSelfTest::setupInitialConditions(), clumpTest::setupInitialConditions(), PolydisperseInsertionBoundarySelfTest::setupInitialConditions(), CGHandlerSelfTest::setupInitialConditions(), NewtonsCradleSelftest::setupInitialConditions(), SquarePacking::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().

◆ getYCenter()

Mdouble DPMBase::getYCenter ( ) const
inline
657  { return 0.5*(max_.Y+min_.Y); }
Mdouble Y
Definition: Vector.h:66

References max_, min_, and Vec3D::Y.

Referenced by main().

◆ getYMax()

Mdouble DPMBase::getYMax ( ) const
inline

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

639  { return max_.y(); }
Mdouble & y()
RW reference to Y.
Definition: Vector.h:372

References max_, and Vec3D::y().

Referenced by T_protectiveWall::actionsAfterTimeStep(), LeesEdwardsDemo::actionsAfterTimeStep(), TimeDependentPeriodicBoundary3DSelfTest::actionsAfterTimeStep(), TimeDependentPeriodicBoundaryTest::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::determineStressControlledShearBoundaries(), ChuteWithPeriodicInflow::ExtendInWidth(), Chute::getChuteWidth(), DomainHandler::getParticleDomainGlobalIndex(), getTotalVolume(), StatisticsVector< T >::getYMaxStat(), 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(), T_protectiveWall::setupInitialConditions(), LawinenBox::setupInitialConditions(), ClosedCSCWalls::setupInitialConditions(), CSCInit::setupInitialConditions(), CSCWalls::setupInitialConditions(), ChutePeriodic::setupInitialConditions(), MercuryLogo::setupInitialConditions(), SmoothChute::setupInitialConditions(), multiParticleT1::setupInitialConditions(), HorizontalMixer::setupInitialConditions(), RotatingDrumWet::setupInitialConditions(), Binary::setupInitialConditions(), my_problem::setupInitialConditions(), CubicCell::setupInitialConditions(), FreeCooling2DinWalls::setupInitialConditions(), FreeCooling2DinWallsDemo::setupInitialConditions(), FreeCooling3DDemoProblem::setupInitialConditions(), FreeCooling3DinWallsDemo::setupInitialConditions(), FreeCoolingDemoProblem::setupInitialConditions(), HeaterBoundaryTest::setupInitialConditions(), HourGlass::setupInitialConditions(), LeesEdwardsDemo::setupInitialConditions(), MarbleRun::setupInitialConditions(), MinimalExampleDrum::setupInitialConditions(), TimeDependentPeriodicBoundary3DSelfTest::setupInitialConditions(), TimeDependentPeriodicBoundaryTest::setupInitialConditions(), AngleOfRepose::setupInitialConditions(), SilbertPeriodic::setupInitialConditions(), statistics_while_running< T >::setupInitialConditions(), Chutebelt::setupInitialConditions(), ConstantMassFlowMaserSelfTest::setupInitialConditions(), LeesEdwardsSelfTest::setupInitialConditions(), clumpTest::setupInitialConditions(), PolydisperseInsertionBoundarySelfTest::setupInitialConditions(), CGHandlerSelfTest::setupInitialConditions(), NewtonsCradleSelftest::setupInitialConditions(), SquarePacking::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(), Tutorial11::setupInitialConditions(), Tutorial12::setupInitialConditions(), Tutorial1::setupInitialConditions(), Tutorial2::setupInitialConditions(), Tutorial3::setupInitialConditions(), Tutorial4::setupInitialConditions(), Tutorial5::setupInitialConditions(), Tutorial6::setupInitialConditions(), Tutorial7::setupInitialConditions(), Tutorial8::setupInitialConditions(), Tutorial9::setupInitialConditions(), MD_demo::setupInitialConditions(), MultiParticlesInsertion::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.

633  { 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::determineStressControlledShearBoundaries(), ChuteWithPeriodicInflow::ExtendInWidth(), DomainHandler::getParticleDomainGlobalIndex(), getTotalVolume(), StatisticsVector< T >::getYMinStat(), 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(), T_protectiveWall::setupInitialConditions(), LawinenBox::setupInitialConditions(), ClosedCSCWalls::setupInitialConditions(), CSCInit::setupInitialConditions(), CSCWalls::setupInitialConditions(), ChutePeriodic::setupInitialConditions(), MercuryLogo::setupInitialConditions(), SmoothChute::setupInitialConditions(), multiParticleT1::setupInitialConditions(), my_problem::setupInitialConditions(), RotatingDrumWet::setupInitialConditions(), Binary::setupInitialConditions(), CubicCell::setupInitialConditions(), FreeCooling2DinWalls::setupInitialConditions(), FreeCooling2DinWallsDemo::setupInitialConditions(), FreeCooling3DDemoProblem::setupInitialConditions(), FreeCooling3DinWallsDemo::setupInitialConditions(), FreeCoolingDemoProblem::setupInitialConditions(), HeaterBoundaryTest::setupInitialConditions(), HourGlass::setupInitialConditions(), LeesEdwardsDemo::setupInitialConditions(), MarbleRun::setupInitialConditions(), MinimalExampleDrum::setupInitialConditions(), TimeDependentPeriodicBoundary3DSelfTest::setupInitialConditions(), TimeDependentPeriodicBoundaryTest::setupInitialConditions(), SilbertPeriodic::setupInitialConditions(), statistics_while_running< T >::setupInitialConditions(), Chutebelt::setupInitialConditions(), ConstantMassFlowMaserSelfTest::setupInitialConditions(), LeesEdwardsSelfTest::setupInitialConditions(), clumpTest::setupInitialConditions(), PolydisperseInsertionBoundarySelfTest::setupInitialConditions(), CGHandlerSelfTest::setupInitialConditions(), NewtonsCradleSelftest::setupInitialConditions(), SquarePacking::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().

◆ getZCenter()

Mdouble DPMBase::getZCenter ( ) const
inline
660  { return 0.5*(max_.Z+min_.Z); }
Mdouble Z
Definition: Vector.h:66

References max_, min_, and Vec3D::Z.

◆ getZMax()

Mdouble DPMBase::getZMax ( ) const
inline

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

651  { return max_.z(); }
Mdouble & z()
RW reference to Z.
Definition: Vector.h:384

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::determineStressControlledShearBoundaries(), DomainHandler::getParticleDomainGlobalIndex(), getTotalVolume(), StatisticsVector< T >::getZMaxStat(), 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(), T_protectiveWall::setupInitialConditions(), LawinenBox::setupInitialConditions(), ClosedCSCWalls::setupInitialConditions(), CSCInit::setupInitialConditions(), CSCWalls::setupInitialConditions(), MercuryLogo::setupInitialConditions(), SmoothChute::setupInitialConditions(), multiParticleT1::setupInitialConditions(), NozzleDemo::setupInitialConditions(), Binary::setupInitialConditions(), MpiPeriodicBoundaryUnitTest::setupInitialConditions(), CubicCell::setupInitialConditions(), FreeCooling3DDemoProblem::setupInitialConditions(), FreeCooling3DinWallsDemo::setupInitialConditions(), HeaterBoundaryTest::setupInitialConditions(), HourGlass2D::setupInitialConditions(), HourGlass::setupInitialConditions(), MarbleRun::setupInitialConditions(), TimeDependentPeriodicBoundary3DSelfTest::setupInitialConditions(), AngleOfRepose::setupInitialConditions(), SilbertPeriodic::setupInitialConditions(), GetDistanceAndNormalForIntersectionOfWalls::setupInitialConditions(), GetDistanceAndNormalForScrew::setupInitialConditions(), GetDistanceAndNormalForTriangleWall::setupInitialConditions(), RotatingDrum::setupInitialConditions(), Chutebelt::setupInitialConditions(), ConstantMassFlowMaserSelfTest::setupInitialConditions(), NozzleSelfTest::setupInitialConditions(), clumpTest::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(), Tutorial11::setupInitialConditions(), Tutorial1::setupInitialConditions(), Tutorial2::setupInitialConditions(), Tutorial3::setupInitialConditions(), Tutorial4::setupInitialConditions(), Tutorial5::setupInitialConditions(), Tutorial6::setupInitialConditions(), FreeFall::setupInitialConditions(), MD_demo::setupInitialConditions(), MultiParticlesInsertion::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.

645  { 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::determineStressControlledShearBoundaries(), SphericalIndenter::getBedHeight(), DomainHandler::getParticleDomainGlobalIndex(), getTotalVolume(), StatisticsVector< T >::getZMinStat(), 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(), T_protectiveWall::setupInitialConditions(), LawinenBox::setupInitialConditions(), ClosedCSCWalls::setupInitialConditions(), CSCInit::setupInitialConditions(), CSCWalls::setupInitialConditions(), MercuryLogo::setupInitialConditions(), SmoothChute::setupInitialConditions(), multiParticleT1::setupInitialConditions(), NozzleDemo::setupInitialConditions(), Binary::setupInitialConditions(), my_problem::setupInitialConditions(), Chain::setupInitialConditions(), MpiPeriodicBoundaryUnitTest::setupInitialConditions(), CubicCell::setupInitialConditions(), FreeCooling3DDemoProblem::setupInitialConditions(), FreeCooling3DinWallsDemo::setupInitialConditions(), HeaterBoundaryTest::setupInitialConditions(), HourGlass2D::setupInitialConditions(), HourGlass::setupInitialConditions(), MarbleRun::setupInitialConditions(), TimeDependentPeriodicBoundary3DSelfTest::setupInitialConditions(), AngleOfRepose::setupInitialConditions(), GetDistanceAndNormalForIntersectionOfWalls::setupInitialConditions(), GetDistanceAndNormalForScrew::setupInitialConditions(), GetDistanceAndNormalForTriangleWall::setupInitialConditions(), RotatingDrum::setupInitialConditions(), Chutebelt::setupInitialConditions(), ConstantMassFlowMaserSelfTest::setupInitialConditions(), NozzleSelfTest::setupInitialConditions(), clumpTest::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(), MultiParticlesInsertion::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.
5478 {
5479  for (auto w: wallHandler)
5480  {
5481  w->handleParticleAddition(id, p);
5482  }
5483 }

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.
5463 {
5464  for (auto w: wallHandler)
5465  {
5466  w->handleParticleRemoval(id);
5467  }
5468 }

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.

1948 {
1949 }

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.

1941 {
1942 }

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.

1677 {
1678 }

Referenced by initialiseSolve().

◆ 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.

1691 {
1692 }

Referenced by computeOneTimeStep(), and initialiseSolve().

◆ 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.

1001  {};

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.

1698 {
1699 }

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.

1712 {
1713 }

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

◆ hGridUpdateMove()

void DPMBase::hGridUpdateMove ( BaseParticle ,
Mdouble   
)
virtual

◆ 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.
4955 {
4956  size_t nParticlesPreviouslyIn = particleHandler.getSize();
4957  for (auto k = particleH.begin(); k != particleH.end(); ++k) {
4958  auto p = particleHandler.copyAndAddObject( *k );
4959  p->setSpecies(species);
4960  }
4961 
4962  for (std::vector<BaseInteraction*>::const_iterator i = interactionH.begin(); i != interactionH.end(); ++i) {
4963  if ( (*i)->getP()->getInvMass() != 0.0 && (*i)->getI()->getInvMass() != 0.0 ) {
4965  j->importP(particleHandler.getObject(nParticlesPreviouslyIn + j->getP()->getIndex()));
4966  j->importI(particleHandler.getObject(nParticlesPreviouslyIn + j->getI()->getIndex()));
4967  j->setTimeStamp(getNumberOfTimeSteps());
4968  }
4969  }
4970 }
std::enable_if<!std::is_pointer< U >::value, U * >::type copyAndAddObject(const U &object)
Creates a copy of a Object and adds it to the BaseHandler.
Definition: BaseHandler.h:379

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.

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

Referenced by autoNumber().

◆ initialiseSolve()

void DPMBase::initialiseSolve ( )

Beginning of the solve routine, before time stepping.

  • Initialises the time, sets up the initial conditions for the simulation by calling the setupInitialConditions() and resets the counter using setNExtSavedTimeStep().
    • HGrid operations which is the contact detection algorithm.
    • Checks if the basic essentials are set for carrying out the simulations using checkSettings()
    • And many more vital operations.

Further details are included in the body of the code, below.

Todo:
Is it necessary to reset initial conditions here and in setTimeStepByParticle (i.e. should it be in constructor) Thomas: I agree, setTimeStepByParticle should be rewritten to work without calling setupInitialConditions

Initialise the time and sets up the initial conditions for the simulation

Todo:
Is it necessary to reset initial conditions here and in setTimeStepByParticle (i.e. should it be in constructor)? Thomas: I agree, setTimeStepByParticle should be rewritten to work without calling setupInitialConditions
Todo:
MX: Why does the mass get computed here? if a particle is assigned a radius, it automatically also computes its mass. IFCD: commenting out this line does not make any test fail on my system.
4171  {
4172  logger(DEBUG, "Entered solve");
4173 #ifdef CONTACT_LIST_HGRID
4174  logger(INFO,"Using CONTACT_LIST_HGRID");
4175 #endif
4176 
4181  if (!getRestarted()) {
4182  // If the simulation is "new" (i.e. not restarted):
4183  // - set time, nTimeSteps to zero
4184  // - reset the file counter etc.
4185  // - decompose the domain based on XMin, XMax, ....
4186  // - run user-defined setupInitialConditions
4187  numberOfTimeSteps_ = 0;
4188  setTime(0.0);
4189  resetFileCounter();
4190  decompose();
4191  //\todo tw there was a function combining the next two lines, why is it back to the old version?
4192  //setLastSavedTimeStep(NEVER); //reset the counter
4193  //this is to ensure that the interaction time stamps agree with the resetting of the time value
4194  for (auto &i: interactionHandler)
4195  i->setTimeStamp(0);
4197  logger(DEBUG, "Have created the particles initial conditions");
4198  } else {
4199  // If the simulation is "restarted" (i.e. not restarted):
4200 
4201  // - run wall-defined actionsOnRestart
4202  for (auto w: wallHandler) {
4203  w->actionsOnRestart();
4204  }
4205 
4206  // - run user-defined actionsOnRestart
4207  actionsOnRestart();
4208  }
4209 
4210  // Check that the code has been correctly set up,
4211  // i.e. system dimensions, particles and time steps are sensibly implemented
4212  checkSettings();
4213 
4214  // If the simulation is "new" and the runNumber is used, append the run number to the problem name
4215  if (getRunNumber() > 0 && !getRestarted()) {
4216  std::stringstream name;
4217  name << getName() << "." << getRunNumber();
4218  setName(name.str());
4219  }
4220 
4221  //If append is true, files are appended, not overwritten
4222  if (getAppend()) {
4223  setOpenMode(std::fstream::out | std::fstream::app);
4224  //Restart files should always be overwritten.
4225  restartFile.setOpenMode(std::fstream::out);
4226  } else {
4227  setOpenMode(std::fstream::out);
4228  }
4229 
4230  //sets the hgrid, writes headers to the .stat output file
4232 
4233  if (getInteractionFile().getFileType() == FileType::ONE_FILE) {
4234  logger(WARN, "Warning: interaction file will take up a lot of disk space!");
4236  }
4237 
4238  // Sets the mass of all particle.
4242 
4243  // Other initialisations
4244  //max_radius = getLargestParticle()->getRadius();
4245 
4249 
4250  // Performs a first force computation
4252 
4253 #ifdef MERCURYDPM_USE_MPI
4254  if (NUMBER_OF_PROCESSORS > 1)
4255  {
4256  //Find new mpi particles
4258  //Periodic particles in parallel
4260  }
4261 #endif
4262 
4264  computeAllForces();
4267  logger(DEBUG, "Have computed the initial values for the forces ");
4268 }
@ ONE_FILE
all data will be written into/ read from a single file called name_
void boundaryActionsBeforeTimeLoop()
Definition: BoundaryHandler.cc:261
bool getAppend() const
Returns whether the "append" option is on or off.
Definition: DPMBase.cc:1510
void checkSettings()
Checks if the essentials are set properly to go ahead with solving the problem.
Definition: DPMBase.cc:3999
virtual void initialiseStatistics()
Definition: DPMBase.cc:1885
virtual void setupInitialConditions()
This function allows to set the initial conditions for our problem to be solved, by default particle ...
Definition: DPMBase.cc:1998
void setOpenMode(std::fstream::openmode openMode)
Sets File::openMode_ for all files (ene, data, fstat, restart, stat)
Definition: DPMBase.cc:490
virtual void hGridActionsBeforeTimeLoop()
A virtual function that allows one to carry out hGrid operations before the start of the time loop.
Definition: DPMBase.cc:1676
File & getInteractionFile()
Return a reference to the file InteractionsFile.
Definition: DPMBase.cc:345
virtual void actionsOnRestart()
A virtual function where the users can add extra code which is executed only when the code is restart...
Definition: DPMBase.cc:1683
void resetFileCounter()
Resets the file counter for each file i.e. for ene, data, fstat, restart, stat)
Definition: DPMBase.cc:471
virtual void actionsBeforeTimeLoop()
A virtual function. Allows one to carry out any operations before the start of the time loop.
Definition: DPMBase.cc:1669
virtual void decompose()
Sends particles from processorId to the root processor.
Definition: DPMBase.cc:4088
void addNewParticles()
Definition: DomainHandler.cc:429
void setOpenMode(std::fstream::openmode openMode)
Allows the user to Sets File::openMode_.
Definition: File.cc:247
void computeAllMasses(unsigned int indSpecies)
Computes the mass for all BaseParticle of the given species in this ParticleHandler.
Definition: ParticleHandler.cc:1215
void addNewParticles()
Adds new particles to the periodic particle lists.
Definition: PeriodicBoundaryHandler.cc:300
std::string name
Definition: MercuryProb.h:48

References InteractionHandler::actionsAfterTimeStep(), actionsBeforeTimeLoop(), actionsOnRestart(), DomainHandler::addNewParticles(), PeriodicBoundaryHandler::addNewParticles(), BoundaryHandler::boundaryActionsBeforeTimeLoop(), boundaryHandler, checkAndDuplicatePeriodicParticles(), checkSettings(), computeAllForces(), ParticleHandler::computeAllMasses(), DEBUG, decompose(), domainHandler, getAppend(), getInteractionFile(), getName(), getRestarted(), getRunNumber(), hGridActionsBeforeTimeLoop(), hGridActionsBeforeTimeStep(), constants::i, INFO, initialiseStatistics(), interactionHandler, logger, units::name, NUMBER_OF_PROCESSORS, numberOfTimeSteps_, ONE_FILE, File::open(), particleHandler, periodicBoundaryHandler, removeDuplicatePeriodicParticles(), resetFileCounter(), restartFile, setName(), setOpenMode(), File::setOpenMode(), setTime(), setupInitialConditions(), wallHandler, and WARN.

Referenced by solve().

◆ initialiseStatistics()

void DPMBase::initialiseStatistics ( )
protectedvirtual

This function is overridden by StatisticsVector

Reimplemented in statistics_while_running< T >, StatisticsVector< T >, StatisticsVector< O >, StatisticsVector< XZ >, and statistics_while_running< T >.

1886 {
1888 }
void initialise()
Contains the code executed before the first time step.
Definition: CGHandler.cc:90

References cgHandler, and CGHandler::initialise().

Referenced by initialiseSolve().

◆ 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
1812 {
1813 #ifdef MERCURYDPM_USE_MPI
1814  //mpi particles only exist when there is more than one domain
1815  if (domainHandler.getSize() > 0)
1816  {
1817  //Add the particle to the mpi domain
1819  }
1820 
1821  //If periodic boundaries are present..
1822  if (periodicBoundaryHandler.getSize() > 0)
1823  {
1825  }
1826 #endif
1827 }
void addParticle(BaseParticle *particle)
Initialises a single particle which is added during the simulation.
Definition: Domain.cc:1610
void addNewParticle(BaseParticle *particle)
Adds a new particle to the periodic list.
Definition: PeriodicBoundaryHandler.cc:333

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.

3306 {
3307  //cycling through all particles, p, in the particleHandler
3308  //for_each(particleHandler.begin(), particleHandler.end(), [this](BaseParticle* p){
3309  #pragma omp parallel for num_threads(getNumberOfOMPThreads()) //schedule(dynamic)
3310  for (int k = 0; k < particleHandler.getSize(); ++k) {
3312 #ifdef MERCURYDPM_USE_MPI
3313  //MPI particles do not require integration - they are updated by the communication step
3314  if (!(p->isMPIParticle() || p->isPeriodicGhostParticle()))
3315  {
3317  }
3318 #else
3319  //using the particle p's internal "integrateAfterForceComputation" function
3320  //to update the relevant parameters concerning the particle's position and motion
3322 #endif
3323  }
3324  //});
3325  //cycling through all walls, w, in the wallHandler
3326  //for_each(wallHandler.begin(), wallHandler.end(), [this](BaseWall* w){
3327  #pragma omp parallel for num_threads(getNumberOfOMPThreads()) //schedule(dynamic)
3328  for (int k = 0; k < wallHandler.getSize(); k++) {
3329  BaseWall *w = wallHandler.getObject(k);
3330  //using the wall's internal "integrateAfterForceComputation" function
3331  //to update the relevant parameters concerning its position and motion
3333  }
3334  //});
3335 }
void integrateAfterForceComputation(double time, double timeStep)
This is part of the integration routine for objects with infinite mass.
Definition: BaseInteractable.cc:611
bool isPeriodicGhostParticle() const
Indicates if this particle is a ghost in the periodic boundary.
Definition: BaseParticle.cc:297
bool isMPIParticle() const
Indicates if this particle is a ghost in the MPI domain.
Definition: BaseParticle.cc:181
virtual void integrateAfterForceComputation(double time, double timeStep)
Second step of Velocity Verlet integration.
Definition: BaseParticle.cc:762
Mdouble getTime() const
Returns the current simulation time.
Definition: DPMBase.cc:808

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.

3220 {
3221  //cycling through all particles, p, in the particleHandler
3222  //for_each(particleHandler.begin(), particleHandler.end(), [this](BaseParticle* p)
3223  //for (BaseParticle* p : particleHandler) {
3224 
3225  #pragma omp parallel for num_threads(getNumberOfOMPThreads()) //schedule(dynamic)
3226  for (int k = 0; k < particleHandler.getSize(); ++k) {
3228 #ifdef MERCURYDPM_USE_MPI
3229  //MPI particles are not integrated, they are purely ghost particles and get their new velocity and position from an MPI update
3230  if (!(p->isMPIParticle() || p->isPeriodicGhostParticle()))
3231  {
3233  }
3234 #else
3235  //using the particle p's internal "integrateBeforeForceComputation" function
3236  //to update the relevant parameters concerning the particle's position and motion
3238 #endif
3239  }
3240  //});
3241  //cycling through all walls, w, in the wallHandler
3242  //for_each(wallHandler.begin(), wallHandler.end(), [this](BaseWall* w)
3243  //for (BaseWall* w : wallHandler) {
3244  #pragma omp parallel for num_threads(getNumberOfOMPThreads()) //schedule(dynamic)
3245  for (int k = 0; k < wallHandler.getSize(); k++) {
3246  BaseWall *w = wallHandler.getObject(k);
3247  //using the wall's internal "integrateBeforeForceComputation" function
3248  //to update the relevant parameters concerning its position and motion
3250  }
3251  //});