MercuryDPM  Alpha
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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 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 FilesAndRunNumber &other)
 Copy constructor type-1. More...
 
 DPMBase (const DPMBase &other)
 Copy constructor type-2. More...
 
virtual ~DPMBase ()
 virtual destructor More...
 
void solve ()
 The work horse of the code. More...
 
void checkSettings ()
 Checks if the essentials are set properly to go ahead with solving the problem. More...
 
virtual void writeOutputFiles ()
 Writes the simulation data onto all the files i.e. .data, .ene, .fstat ... More...
 
void solve (int argc, char *argv[])
 The solve function is the work horse of the code with the user input. More...
 
virtual void 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 double getInfo (const BaseParticle &P) const
 A virtual method that allows the user to overrride and set what is written into the info column in the data file. By default it returns the Species ID number. More...
 
virtual void writeRestartFile ()
 Stores all the particle data for current save time step. Calls the write function. More...
 
bool readRestartFile (bool restarted=true)
 Reads all the particle data corresponding to the current saved time step. Which is what the restart file basically stores. The problem description with the latest particle data. Returns 0 if it is successful, 1 otherwise. More...
 
int readRestartFile (std::string fileName)
 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
 Loads all MD data and plots statistics for all timesteps in the .data file. More...
 
virtual void read (std::istream &is)
 Reads all data from a restart file, e.g. domain data and particle data. More...
 
virtual bool readUserDefinedWall (std::string type, std::istream &is)
 
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 (const std::string fileName, unsigned int format=0)
 This allows particle data to be reloaded from data files. More...
 
bool readParAndIniFiles (const std::string fileName)
 Allows the user to read par.ini files (useful to read MDCLR files) More...
 
bool readNextDataFile (unsigned int format=0)
 Reads the next data file with default format=0. However, one can modify the format based on whether the particle data corresponds to 3D or 2D data. See XBalls/xballs.txt. More...
 
bool findNextExistingDataFile (Mdouble tMin, bool verbose=true)
 Useful when fileType is chosen as Multiple Files or Multiple files with padded. More...
 
bool readArguments (int argc, char *argv[])
 Can interpret main function input arguments that are passed by the driver codes. More...
 
virtual bool readNextArgument (int &i, int argc, char *argv[])
 Interprets the i^th command-line argument. More...
 
virtual bool checkParticleForInteraction (const BaseParticle &P)
 Checks if the particle having 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)
 
Mdouble getTime () const
 Access function for the time. More...
 
unsigned int getNtimeSteps () const
 Returns the current counter of time steps. More...
 
void setTime (Mdouble time)
 Access function for the time. More...
 
void setTimeMax (Mdouble newTMax)
 Allows the upper time limit to be changed. More...
 
Mdouble getTimeMax () const
 Allows the user to access the total simulation time during the simulation. Cannot change it though. More...
 
void setDoCGAlways (bool newDoCGFlag)
 
void setRotation (bool newRotFlag)
 Allows to set the flag for enabling or disabling particle rotation in the simulations. More...
 
bool getRotation () const
 Returns a flag indicating if particle rotation is enabled or disabled. More...
 
void setWallsWriteVTK (FileType writeWallsVTK)
 Allows to set the flag for enabling or disabling particle rotation in the simulations. More...
 
void setParticlesWriteVTK (bool writeParticlesVTK)
 Allows to set the flag for enabling or disabling particle rotation in the simulations. More...
 
FileType getWallsWriteVTK () const
 Returns a flag indicating if particle rotation is enabled or disabled. More...
 
bool getParticlesWriteVTK () const
 Returns a flag indicating if particle rotation is enabled or disabled. More...
 
bool getDoCGAlways () const
 
Vec3D getMin () const
 Return the "bottom left" corner of the domain, a vector with xMin_, yMin_ and zMin_. More...
 
Vec3D getMax () const
 Return the "upper right" corner of the domain, a vector with xMin_, yMin_ and zMin_. More...
 
Mdouble getXMin () const
 If the length of the problem domain in x-direction is XMax - XMin, then getXMin() returns XMin,. More...
 
Mdouble getXMax () const
 If the length of the problem domain in x-direction is XMax - XMin, then getXMax() returns XMax,. More...
 
Mdouble getYMin () const
 If the length of the problem domain in y-direction is YMax - YMin, then getYMin() returns YMin,. More...
 
Mdouble getYMax () const
 If the length of the problem domain in y-direction is YMax - YMin, then getYMax() returns XMax,. More...
 
Mdouble getZMin () const
 If the length of the problem domain in z-direction is ZMax - ZMin, then getZMin() returns ZMin,. More...
 
Mdouble getZMax () const
 If the length of the problem domain in z-direction is ZMax - ZMin, then getZMax() returns ZMax,. More...
 
void setMin (Vec3D min)
 Sets the values xMin, yMin, zMin of the problem domain, which is [xMin,xMax]x[yMin,yMax]x[zMin,zMax]. More...
 
void setMax (Vec3D max)
 Sets the values xMax, yMax, zMax of the problem domain, which is [xMin,xMax]x[yMin,yMax]x[zMin,zMax]. More...
 
void setXMin (Mdouble newXMin)
 If the length of the problem domain in x-direction is XMax - XMin, this method sets XMin. More...
 
void setYMin (Mdouble newYMin)
 If the length of the problem domain in y-direction is YMax - YMin, this method sets YMin. More...
 
void setZMin (Mdouble newZMin)
 If the length of the problem domain in z-direction is ZMax - ZMin, this method sets ZMin. More...
 
void setXMax (Mdouble newXMax)
 If the length of the problem domain in x-direction is XMax - XMin, this method sets XMax. More...
 
void setYMax (Mdouble newYMax)
 If the length of the problem domain in y-direction is YMax - YMin, this method sets YMax. More...
 
void setZMax (Mdouble newZMax)
 If the length of the problem domain in z-direction is XMax - XMin, this method sets ZMax. More...
 
int getAddLarge () const
 returns the number of large particles that are to be added on restart. More...
 
int getAddSmall () const
 returns the number of small particles that are to be added on restart. More...
 
void setAddLarge (int new_addL)
 sets the number of large particles that are to be added on restart. More...
 
void setAddSmall (int new_addS)
 sets the number of small particles that are to be added on restart. More...
 
void setTimeStep (Mdouble newDt)
 Allows the time step dt to be changed. More...
 
Mdouble getTimeStep () const
 Allows the time step dt to be accessed. More...
 
void setXBallsColourMode (int newCMode)
 Set the xball output mode. More...
 
int getXBallsColourMode () const
 Get the xball colour mode (CMode) More...
 
void setXBallsVectorScale (double newVScale)
 Set the scale of vectors in xballs. More...
 
double getXBallsVectorScale () const
 Returns the scale of vectors used in xballs. More...
 
void setXBallsAdditionalArguments (std::string newXBArgs)
 Set the additional arguments for xballs. More...
 
std::string getXBallsAdditionalArguments () const
 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)
 Allows to modify the gravity vector. More...
 
Vec3D getGravity () const
 Returns the gravity vector. More...
 
void setDimension (unsigned int newDim)
 Sets the system and particle dimension. More...
 
void setSystemDimensions (unsigned int newDim)
 Allows for the dimension of the simulation to be changed. More...
 
unsigned int getSystemDimensions () const
 Returns the dimension of the simulation. Note there is also a particle dimension. More...
 
void setParticleDimensions (unsigned int particleDimensions)
 Allows the dimension of the particle (f.e. for mass) to be changed. e.g. discs or spheres. More...
 
unsigned int getParticleDimensions () const
 Returns the particle dimensions. More...
 
std::string getRestartVersion () const
 This is to take into account for different Mercury versions. Returns the version of the restart file. More...
 
void setRestartVersion (std::string newRV)
 Sets restart_version. More...
 
bool getRestarted () const
 Returns the flag denoting if the simulation was restarted or not. More...
 
void setRestarted (bool newRestartedFlag)
 Allows to set the flag stating if the simulation is to be restarted or not. More...
 
bool getAppend () const
 Returns the flag denoting if the append option is on or off. More...
 
void setAppend (bool newAppendFlag)
 Allows to set the append option. More...
 
Mdouble getElasticEnergy () const
 Returns the global elastic energy within the system. More...
 
Mdouble getKineticEnergy () const
 Returns the global kinetic energy stored in the system. More...
 
Mdouble getGravitationalEnergy () const
 Returns the global gravitational potential energy stored in the system. More...
 
bool areInContact (const BaseParticle *pI, const BaseParticle *pJ) const
 Checks if two particle are in contact or is there any positive overlap. More...
 
virtual void hGridInsertParticle (BaseParticle *obj UNUSED)
 no implementation but can be overidden in its derived classes. More...
 
virtual void hGridUpdateParticle (BaseParticle *obj UNUSED)
 no implementation but can be overidden in its derived classes. More...
 
virtual void hGridRemoveParticle (BaseParticle *obj UNUSED)
 no implementation but can be overidden in its derived classes. More...
 
virtual void hGridUpdateMove (BaseParticle *, Mdouble)
 no implementation but can be overidden in its derived classes. More...
 
virtual void gatherContactStatistics (unsigned int index1 UNUSED, int index2 UNUSED, Vec3D Contact UNUSED, Mdouble delta UNUSED, Mdouble ctheta UNUSED, Mdouble fdotn UNUSED, Mdouble fdott UNUSED, Vec3D P1_P2_normal_ UNUSED, Vec3D P1_P2_tangential UNUSED)
 //Not unsigned index because of possible wall collisions. More...
 
- Public Member Functions inherited from FilesAndRunNumber
 FilesAndRunNumber ()
 Constructor. More...
 
 FilesAndRunNumber (const FilesAndRunNumber &other)
 Copy constructor. More...
 
virtual ~FilesAndRunNumber ()
 Constructor. More...
 
void constructor ()
 a function called by the FilesAndRunNumber() (constructor) More...
 
void incrementRunNumberInFile ()
 Increment the run Number (counter value) stored in the file_counter (COUNTER_DONOTDEL) by 1 and store the new value in the counter file. More...
 
int readRunNumberFromFile ()
 Read the run number or the counter from the counter file (COUNTER_DONOTDEL) More...
 
void autoNumber ()
 The autoNumber() function is the trigger. It calls three functions. setRunNumber(), readRunNumberFromFile() and incrementRunNumberInFile(). More...
 
std::vector< int > get2DParametersFromRunNumber (int size_x, int size_y)
 This turns a counter into two indices which is an amazing feature for doing two dimensional parameter studies. The indices run from 1:size_x and 1:size_y, while the study number starts at 0 ( initially the counter=1 in COUNTER_DONOTDEL) More...
 
int launchNewRun (const char *name, bool quick=false)
 This launches a code from within this code. Please pass the name of the code to run. More...
 
void setRunNumber (int runNumber)
 This sets the counter/Run number, overriding the defaults. More...
 
int getRunNumber () const
 This returns the current value of the counter (runNumber_) More...
 
void read (std::istream &is)
 Accepts an input stream std::istream. More...
 
void write (std::ostream &os) const
 Accepts an output stream read function, which accepts an input stream std::ostream. More...
 
- Public Member Functions inherited from Files
 Files ()
 A constructor. More...
 
virtual ~Files ()
 A destructor, watch out its a virtual destructor. More...
 
 Files (const Files &other)
 Copy constructor. More...
 
MERCURY_DEPRECATED FilegetDataFile ()
 The non const version. Allows one to edit the File::dataFile. More...
 
MERCURY_DEPRECATED FilegetEneFile ()
 The non const version. Allows to edit the File::eneFile. More...
 
MERCURY_DEPRECATED FilegetFStatFile ()
 The non const version. Allows to edit the File::fStatFile. More...
 
MERCURY_DEPRECATED FilegetRestartFile ()
 The non const version. Allows to edit the File::restartFile. More...
 
MERCURY_DEPRECATED FilegetStatFile ()
 The non const version. Allows to edit the File::statFile. More...
 
MERCURY_DEPRECATED const FilegetDataFile () const
 The const version. Does not allow for any editing of the File::dataFile. More...
 
MERCURY_DEPRECATED const FilegetEneFile () const
 The const version. Does not allow for any editing of the File::eneFile. More...
 
MERCURY_DEPRECATED const FilegetFStatFile () const
 The const version. Does not allow for any editing of the File::fStatFile. More...
 
MERCURY_DEPRECATED const FilegetRestartFile () const
 The const version. Does not allow for any editing of the File::restartFile. More...
 
MERCURY_DEPRECATED const FilegetStatFile () const
 The const version. Does not allow for any editing of the File::statFile. More...
 
const std::string & getName () const
 Returns the name of the file. Does not allow to change it though. More...
 
void setName (const std::string &name)
 Allows to set the name of all the files (ene, data, fstat, restart, stat) More...
 
void setName (const char *name)
 Calls setName(std::string) More...
 
void setSaveCount (unsigned int saveCount)
 Sets File::saveCount_ for all files (ene, data, fstat, restart, stat) More...
 
void setFileType (FileType fileType)
 Sets File::fileType_ for all files (ene, data, fstat, restart, stat) More...
 
void setOpenMode (std::fstream::openmode openMode)
 Sets File::openMode_ for all files (ene, data, fstat, restart, stat) More...
 
void resetFileCounter ()
 Resets the file counter for each file i.e. for ene, data, fstat, restart, stat) More...
 
void read (std::istream &is)
 Extracts data from the input stream (which is basically a file you want to read from) into name_, restartFile .... More...
 
void write (std::ostream &os) const
 Writes data into a file from the member variables name_, restartFile, dataFile etc. More...
 
void openFiles ()
 Opens all the files (ene, data, fstat, restart, stat) for reading and writing purposes. More...
 
void closeFiles ()
 Closes all files (ene, data, fstat, restart, stat) that were opened to read or write. More...
 
void setNextSavedTimeStep (unsigned int nextSavedTimeStep)
 Sets the next time step for all the files (ene, data, fstat, restart, stat) at which the data is to be written or saved. More...
 

Public Attributes

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

Protected Member Functions

virtual void computeAllForces ()
 Computes all the forces acting on the particles by using the setTorque and setForce methods. See BaseInteractible.cc. More...
 
virtual void computeInternalForces (BaseParticle *i)
 Computes the forces between particles (internal in the sense that the sum over all these forces is zero i.e. fully modelled forces) More...
 
virtual void computeInternalForces (BaseParticle *P1, BaseParticle *P2)
 Computes the forces between particles (internal in the sense that the sum over all these forces is zero i.e. fully modelled forces) More...
 
virtual void computeExternalForces (BaseParticle *PI)
 Computes the external forces acting on particles (e.g. gravitational) More...
 
virtual void computeForcesDueToWalls (BaseParticle *PI)
 Computes the forces on the particles due to the walls (normals are outward normals) More...
 
virtual void actionsOnRestart ()
 A virtual function where the users can add extra code which is executed only when the code is restarted. More...
 
virtual void actionsBeforeTimeLoop ()
 A virtual function. Allows one to carry out any operations before the start of the time loop. More...
 
virtual void 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 bool getHGridUpdateEachTimeStep () const
 
virtual void actionsBeforeTimeStep ()
 A virtual function which allows to define operations to be executed before the new time step. More...
 
virtual void actionsAfterSolve ()
 A virtual function which allows to define operations to be executed after the solve(). More...
 
virtual void actionsAfterTimeStep ()
 A virtual function which allows to define operations to be executed after time step. More...
 
virtual void outputXBallsData (std::ostream &os) const
 This function writes the location of the walls and particles in a format the XBalls program can read. See XBalls/xballs.txt. However, MercuryDPM supports a much better viewer now called Paraview. See the tutorials section in the documentation. More...
 
virtual void outputXBallsDataParticle (const unsigned int i, const unsigned int format, std::ostream &os) const
 This function writes out the particle locations into an output stream in a format the XBalls program can read. More...
 
virtual void writeEneHeader (std::ostream &os) const
 Writes a header with a certain format for ENE file. More...
 
virtual void writeFstatHeader (std::ostream &os) const
 Writes a header with a certain format for FStat file. More...
 
virtual void writeEneTimestep (std::ostream &os) const
 This function enables one to write the global energy available in the system after each time step. The default is to compute the rotational and translational kinetic energy, potential energy and the centre of mass. More...
 
virtual void initialiseStatistics ()
 no implementation but can be overidden in its derived classes. More...
 
virtual void outputStatistics ()
 no implementation but can be overidden in its derived classes. More...
 
void gatherContactStatistics ()
 
virtual void processStatistics (bool usethese UNUSED)
 no implementation but can be overidden in its derived classes. More...
 
virtual void finishStatistics ()
 no implementation but can be overidden in its derived classes. More...
 
virtual void integrateBeforeForceComputation ()
 This is were the integration is done, at the moment it is velocity Verlet integration and is done before the forces are computed. See http://en.wikipedia.org/wiki/Verlet_integration#Velocity_Verlet. More...
 
virtual void integrateAfterForceComputation ()
 Integration is done after force computations. We apply the Velocity verlet scheme. See http://en.wikipedia.org/wiki/Verlet_integration#Velocity_Verlet. More...
 
virtual void checkInteractionWithBoundaries ()
 There are a range of boundaries one could implement depending on ones' problem. This methods checks for interactions between particles and such range of boundaries. See BaseBoundary.h and all the boundaries in the Boundaries folder. More...
 
virtual void hGridActionsBeforeIntegration ()
 no implementation but can be overidden in its derived classes. More...
 
virtual void hGridActionsAfterIntegration ()
 no implementation but can be overidden in its derived classes. More...
 
virtual void broadPhase (BaseParticle *i)
 By broad one means to screen and determine an approximate number of particles that a given particle can be in contact with. Hence the word "Broad phase" of contact detection. More...
 
void setFixedParticles (unsigned int n)
 
void initialiseTangentialSprings ()
 
virtual void printTime () const
 Displays the current simulation time onto your screen for example. More...
 
virtual bool continueSolve () const
 
void outputInteractionDetails () const
 Displays the interaction details corresponding to the pointer objects in the interaction handler. More...
 
bool isTimeEqualTo (Mdouble time) const
 Checks if the input variable "time" is the current time in the simulation. More...
 
void removeDuplicatePeriodicParticles ()
 Removes periodic duplicate Particles. More...
 
void checkAndDuplicatePeriodicParticles ()
 In case of periodic boundaries, the below methods checks and adds particles when necessary into the particle handler. See DPMBase.cc and PeriodicBoundary.cc for more details. More...
 
Mdouble domainSize () const
 
void writeVTK () const
 

Private Attributes

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 xMin_
 If the length of the problem domain in x-direction is XMax - XMin, the above variable stores XMin. More...
 
Mdouble xMax_
 If the length of the problem domain in x-direction is XMax - XMin, the above variable stores XMax. More...
 
Mdouble yMin_
 If the length of the problem domain in y-direction is YMax - YMin, the above variable stores YMin. More...
 
Mdouble yMax_
 If the length of the problem domain in y-direction is YMax - XMin, the above variable stores YMax. More...
 
Mdouble zMin_
 If the length of the problem domain in z-direction is ZMax - ZMin, the above variable stores ZMin. More...
 
Mdouble zMax_
 If the length of the problem domain in z-direction is ZMax - ZMin, the above variable stores ZMax. More...
 
int addL_
 Stores the number of large particles that are to be added on restart. More...
 
int addS_
 Stores the number of small particles that are to be added on restart. More...
 
Mdouble time_
 Stores the current simulation time. More...
 
unsigned int ntimeSteps_
 Stores the number of time steps. More...
 
Mdouble timeStep_
 Stores the simulation time step. More...
 
Mdouble timeMax_
 Stores the duration of the simulation. More...
 
Mdouble elasticEnergy_
 used in force calculations 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. More...
 
FileType writeWallsVTK_
 A flag to turn on/off the vtk writer for walls. More...
 
bool writeParticlesVTK_
 A flag to turn on/off the vtk writer for particles. More...
 
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...
 

Friends

std::ostream & operator<< (std::ostream &os, const DPMBase &md)
 Operator overloading of DPMBase class, writes the StatType to the given ostream. More...
 

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

Definition at line 65 of file DPMBase.h.

Constructor & Destructor Documentation

DPMBase::DPMBase ( )

Constructor that calls the "void constructor()".

Definition at line 143 of file DPMBase.cc.

References constructor().

144 {
145  constructor();
146 }
void constructor()
A function which initialises the member variables to default values, so that the problem can be solve...
Definition: DPMBase.cc:905
DPMBase::DPMBase ( const FilesAndRunNumber other)

Copy constructor type-1.

Parameters
[in]other

Definition at line 87 of file DPMBase.cc.

References constructor().

88  : FilesAndRunNumber(other)
89 {
90  constructor();
91 }
void constructor()
A function which initialises the member variables to default values, so that the problem can be solve...
Definition: DPMBase.cc:905
FilesAndRunNumber()
Constructor.
DPMBase::DPMBase ( const DPMBase other)

Copy constructor type-2.

Parameters
[in]other

Definition at line 96 of file DPMBase.cc.

References append_, boundaryHandler, elasticEnergy_, gravity_, interactionHandler, ntimeSteps_, particleDimensions_, particleHandler, random, restarted_, restartVersion_, rotation_, BaseHandler< T >::setDPMBase(), speciesHandler, systemDimensions_, time_, timeMax_, timeStep_, wallHandler, writeParticlesVTK_, writeWallsVTK_, xBallsAdditionalArguments_, xBallsColourMode_, xBallsScale_, xBallsVectorScale_, xMax_, xMin_, yMax_, yMin_, zMax_, and zMin_.

97 {
101  gravity_ = other.gravity_;
102  xMin_ = other.xMin_;
103  xMax_ = other.xMax_;
104  yMin_ = other.yMin_;
105  yMax_ = other.yMax_;
106  zMin_ = other.zMin_;
107  zMax_ = other.zMax_;
108  time_ = other.time_;
109  timeStep_ = other.timeStep_;
110  ntimeSteps_ = other.ntimeSteps_;
111  timeMax_ = other.timeMax_;
112  restartVersion_ = other.restartVersion_; //to read new and old restart data
113  restarted_ = other.restarted_; //to see if it was restarted or not
114  append_ = other.append_;
115  rotation_ = other.rotation_;
116  xBallsColourMode_ = other.xBallsColourMode_; // sets the xballs argument cmode (see xballs.txt)
117  xBallsVectorScale_ = other.xBallsVectorScale_; // sets the xballs argument vscale (see xballs.txt)
118  xBallsScale_ = other.xBallsScale_; // sets the xballs argument scale (see xballs.txt)
119  xBallsAdditionalArguments_ = other.xBallsAdditionalArguments_; // std::string where additional xballs argument can be specified (see xballs.txt)
122 #ifdef CONTACT_LIST_HGRID
123  possibleContactList=other.possibleContactList;
124 #endif
125  random = other.random;
126 
131  wallHandler.setDPMBase(this);
132 
135  wallHandler = other.wallHandler;
138 }
Mdouble timeMax_
Stores the duration of the simulation.
Definition: DPMBase.h:914
Mdouble yMax_
If the length of the problem domain in y-direction is YMax - XMin, the above variable stores YMax...
Definition: DPMBase.h:866
unsigned int particleDimensions_
determines if 2D or 3D particle volume is used for mass calculations
Definition: DPMBase.h:837
Mdouble yMin_
If the length of the problem domain in y-direction is YMax - YMin, the above variable stores YMin...
Definition: DPMBase.h:860
void setDPMBase(DPMBase *DPMBase)
Sets the problem that is solved using this handler.
Definition: BaseHandler.h:536
Mdouble elasticEnergy_
used in force calculations
Definition: DPMBase.h:921
bool rotation_
A flag to turn on/off particle rotation.
Definition: DPMBase.h:944
Mdouble zMax_
If the length of the problem domain in z-direction is ZMax - ZMin, the above variable stores ZMax...
Definition: DPMBase.h:878
bool restarted_
A bool to check if the simulation was restarted or not, ie. if setupInitialConditionsShould be run an...
Definition: DPMBase.h:933
unsigned int systemDimensions_
The dimensions of the simulation i.e. 2D or 3D.
Definition: DPMBase.h:832
Mdouble zMin_
If the length of the problem domain in z-direction is ZMax - ZMin, the above variable stores ZMin...
Definition: DPMBase.h:872
Mdouble xMax_
If the length of the problem domain in x-direction is XMax - XMin, the above variable stores XMax...
Definition: DPMBase.h:854
unsigned int ntimeSteps_
Stores the number of time steps.
Definition: DPMBase.h:904
int xBallsColourMode_
XBalls is a package to view the particle data. As an alternative MercuryDPM also supports Paraview...
Definition: DPMBase.h:962
BoundaryHandler boundaryHandler
An object of the class BoundaryHandler which concerns insertion and deletion of particles into or fro...
Definition: DPMBase.h:1011
Mdouble xBallsScale_
sets the xballs argument scale (see XBalls/xballs.txt)
Definition: DPMBase.h:972
ParticleHandler particleHandler
An object of the class ParticleHandler, contains the pointers to all the particles created...
Definition: DPMBase.h:1001
Mdouble time_
Stores the current simulation time.
Definition: DPMBase.h:899
SpeciesHandler speciesHandler
A handler to that stores the species type i.e. elastic, linear visco-elastic... et cetera...
Definition: DPMBase.h:991
InteractionHandler interactionHandler
An object of the class InteractionHandler.
Definition: DPMBase.h:1016
FileType writeWallsVTK_
A flag to turn on/off the vtk writer for walls.
Definition: DPMBase.h:949
Mdouble xBallsVectorScale_
sets the xballs argument vscale (see XBalls/xballs.txt)
Definition: DPMBase.h:967
Mdouble xMin_
If the length of the problem domain in x-direction is XMax - XMin, the above variable stores XMin...
Definition: DPMBase.h:848
Mdouble timeStep_
Stores the simulation time step.
Definition: DPMBase.h:909
WallHandler wallHandler
An object of the class WallHandler. Contains pointers to all the walls created.
Definition: DPMBase.h:1006
RNG random
This is a random generator, often used for setting up the initial conditions etc...
Definition: DPMBase.h:996
bool writeParticlesVTK_
A flag to turn on/off the vtk writer for particles.
Definition: DPMBase.h:954
std::string xBallsAdditionalArguments_
A string of additional arguments for xballs can be specified (see XBalls/xballs.txt). e.g. "-solidf -v0".
Definition: DPMBase.h:977
std::string restartVersion_
Previous versions of MercuryDPM had a different restart file format, the below member variable allows...
Definition: DPMBase.h:928
Vec3D gravity_
Gravity vector.
Definition: DPMBase.h:842
bool append_
A flag to determine if the file has to be appended or not. See DPMBase::Solve() for example...
Definition: DPMBase.h:939
DPMBase::~DPMBase ( )
virtual

virtual destructor

Definition at line 151 of file DPMBase.cc.

152 {
153 
154 }

Member Function Documentation

void DPMBase::actionsAfterSolve ( )
protectedvirtual

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

no implementation but can be overidden in its derived classes.

Definition at line 786 of file DPMBase.cc.

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

787 {
788 }
void DPMBase::actionsAfterTimeStep ( )
protectedvirtual

A virtual function which allows to define operations to be executed after time step.

no implementation but can be overidden in its derived classes.

Definition at line 793 of file DPMBase.cc.

Referenced by solve().

794 {
795 }
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.

Definition at line 722 of file DPMBase.cc.

Referenced by solve().

723 {
724 }
void DPMBase::actionsBeforeTimeStep ( )
protectedvirtual

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

no implementation but can be overidden in its derived classes.

Reimplemented in Chute, and ChuteBottom.

Definition at line 779 of file DPMBase.cc.

Referenced by helpers::loadingTest(), helpers::normalAndTangentialLoadingTest(), helpers::objectivenessTest(), and solve().

780 {
781 }
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.

Definition at line 736 of file DPMBase.cc.

Referenced by solve().

737 {
738 }
bool DPMBase::areInContact ( const BaseParticle pI,
const BaseParticle pJ 
) const

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

Parameters
[in]pI
[in]pJ
Returns
bool (True or False)

Definition at line 713 of file DPMBase.cc.

References Vec3D::getDistanceSquared(), BaseParticle::getInteractionRadius(), BaseInteractable::getPosition(), and mathsFunc::square().

Referenced by Mercury3D::hGridHasContactsInTargetCell().

714 {
715  return (pI != pJ && Vec3D::getDistanceSquared(pI->getPosition(), pJ->getPosition()) <
717 }
T square(T val)
squares a number
Definition: ExtendedMath.h:91
const Vec3D & getPosition() const
Returns the position of this BaseInteractable.
static Mdouble getDistanceSquared(const Vec3D &a, const Vec3D &b)
Calculates the squared distance between two Vec3D: .
Definition: Vector.cc:280
Mdouble getInteractionRadius() const
Returns the particle's interaction radius, which might be different from radius_ (e.g., when dealing with wet particles)
void DPMBase::broadPhase ( BaseParticle i)
protectedvirtual

By broad one means to screen and determine an approximate number of particles that a given particle can be in contact with. Hence the word "Broad phase" of contact detection.

Parameters
[in]i

Reimplemented in MercuryBase.

Definition at line 866 of file DPMBase.cc.

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

Referenced by computeInternalForces().

867 {
868  for (auto it = particleHandler.begin(); (*it) != i; ++it)
869  {
870  computeInternalForces(i, *it);
871  }
872 }
virtual void computeInternalForces(BaseParticle *i)
Computes the forces between particles (internal in the sense that the sum over all these forces is ze...
Definition: DPMBase.cc:1888
const std::vector< T * >::const_iterator begin() const
Gets the begin of the const_iterator over all Object in this BaseHandler.
Definition: BaseHandler.h:508
ParticleHandler particleHandler
An object of the class ParticleHandler, contains the pointers to all the particles created...
Definition: DPMBase.h:1001
void DPMBase::checkAndDuplicatePeriodicParticles ( )
protected

In case of periodic boundaries, the below methods checks and adds particles when necessary into the particle handler. See DPMBase.cc and PeriodicBoundary.cc for more details.

periodicBoundary.png

Definition at line 2782 of file DPMBase.cc.

References boundaryHandler, BaseHandler< T >::getNumberOfObjects(), BaseHandler< T >::getObject(), and particleHandler.

Referenced by solve().

2783 {
2784  for (BaseBoundary* b : boundaryHandler) // For all pointers of type BaseBoundary in Boundary handler
2785  {
2786  unsigned int N = particleHandler.getNumberOfObjects(); //Required because the number of particles increases
2787  for (unsigned int i = 0; i < N; i++)
2788  {
2789  b->createPeriodicParticles(particleHandler.getObject(i), particleHandler);
2790  }
2791  }
2792 }
BoundaryHandler boundaryHandler
An object of the class BoundaryHandler which concerns insertion and deletion of particles into or fro...
Definition: DPMBase.h:1011
ParticleHandler particleHandler
An object of the class ParticleHandler, contains the pointers to all the particles created...
Definition: DPMBase.h:1001
T * getObject(const unsigned int id)
Gets a pointer to the Object at the specified index in the BaseHandler.
Definition: BaseHandler.h:451
unsigned int getNumberOfObjects() const
Gets the number of Object in this BaseHandler.
Definition: BaseHandler.h:487
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.

\\ calls checkBoundaryAfterParticleMoved()

Definition at line 1763 of file DPMBase.cc.

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

Referenced by solve().

1764 {
1765  for (BaseBoundary* b : boundaryHandler)
1766  {
1767  for (auto p = particleHandler.begin(); p != particleHandler.end(); ++p)
1768  {
1769  if (b->checkBoundaryAfterParticleMoved(*p, particleHandler))
1770  //Returns true if the particle is deleted
1771  --p;
1772  }
1773  }
1774 }
const std::vector< T * >::const_iterator end() const
Gets the end of the const_iterator over all BaseBoundary in this BaseHandler.
Definition: BaseHandler.h:522
const std::vector< T * >::const_iterator begin() const
Gets the begin of the const_iterator over all Object in this BaseHandler.
Definition: BaseHandler.h:508
BoundaryHandler boundaryHandler
An object of the class BoundaryHandler which concerns insertion and deletion of particles into or fro...
Definition: DPMBase.h:1011
ParticleHandler particleHandler
An object of the class ParticleHandler, contains the pointers to all the particles created...
Definition: DPMBase.h:1001
bool DPMBase::checkParticleForInteraction ( const BaseParticle p)
virtual

Checks if the particle having 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.

Definition at line 2632 of file DPMBase.cc.

References checkParticleForInteractionLocal(), and checkParticleForInteractionLocalPeriodic().

Referenced by InsertionBoundary::checkBoundaryBeforeTimeStep().

2633 {
2634 #ifdef MERCURY_USE_MPI
2635  int localInteraction = checkParticleForInteractionLocal(p);
2636 
2637  MPIContainer& communicator = MPIContainer::Instance();
2638  int numberOfProcessors = communicator.getNumberOfProcessors();
2639 
2640  //The root gathers all values and computes the global value
2641  int *interactionList = nullptr;
2642  if (communicator.getProcessorID() == 0)
2643  {
2644  interactionList = new int [numberOfProcessors];
2645  }
2646 
2647  //Gather all local values
2648  communicator.gather(localInteraction,interactionList);
2649 
2650  //Compute the global value
2651  int globalInteraction = 1;
2652  if (communicator.getProcessorID() == 0)
2653  {
2654  for (int i = 0; i<numberOfProcessors; i++)
2655  {
2656  if (interactionList[i] == 0)
2657  {
2658  globalInteraction = 0;
2659  break;
2660  }
2661  }
2662  }
2663  //The root now tells the other processors what the global value for the interaction is
2664  communicator.broadcast(globalInteraction);
2665 
2666  //Convert the result back to bool
2667  bool interaction = globalInteraction;
2668 #else
2669  bool interaction = checkParticleForInteractionLocalPeriodic(p);
2670 #endif
2671  return interaction;
2672 }
bool checkParticleForInteractionLocalPeriodic(const BaseParticle &P)
Definition: DPMBase.cc:2680
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:2718
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.

Definition at line 2718 of file DPMBase.cc.

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

Referenced by checkParticleForInteraction(), and checkParticleForInteractionLocalPeriodic().

2719 {
2720  Mdouble distance;
2721  Vec3D normal;
2722 
2723  //Check if it has no collision with walls
2724  for (BaseWall* w : wallHandler)
2725  {
2726  //returns false if the function getDistanceAndNormal returns true,
2727  //i.e. if there exists an interaction between wall and particle
2728  //\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.)
2729  if (w->getDistanceAndNormal(p, distance, normal))
2730  {
2731  //std::cout<<"failure: Collision with wall: "<<**it<<std::endl;
2732  return false;
2733  }
2734  else
2735  {
2736  //std::cout<<"No collision with wall: "<<**it<<std::endl;
2737  }
2738  }
2739 
2740  //Check if it has no collision with other particles
2741  for (BaseParticle* q : particleHandler)
2742  {
2743  //returns false if the particle separation is less than the relevant sum of interaction radii
2744  //(i.e. another particle is in contact with P)
2745  if (Vec3D::getDistanceSquared(q->getPosition(), p.getPosition())
2746  < mathsFunc::square(q->getInteractionRadius() + p.getInteractionRadius()))
2747  {
2748  //std::cout<<"failure: Collision with particle "<<**it<<std::endl;
2749  return false;
2750  }
2751  else
2752  {
2753  //std::cout<<"No collision with particle "<<**it<<std::endl;
2754  }
2755  }
2756  return true;
2758 }
double Mdouble
T square(T val)
squares a number
Definition: ExtendedMath.h:91
const Vec3D & getPosition() const
Returns the position of this BaseInteractable.
ParticleHandler particleHandler
An object of the class ParticleHandler, contains the pointers to all the particles created...
Definition: DPMBase.h:1001
Basic class for walls.
Definition: BaseWall.h:44
WallHandler wallHandler
An object of the class WallHandler. Contains pointers to all the walls created.
Definition: DPMBase.h:1006
static Mdouble getDistanceSquared(const Vec3D &a, const Vec3D &b)
Calculates the squared distance between two Vec3D: .
Definition: Vector.cc:280
Implementation of a 3D vector (by Vitaliy).
Definition: Vector.h:45
Mdouble getInteractionRadius() const
Returns the particle's interaction radius, which might be different from radius_ (e.g., when dealing with wet particles)
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

Definition at line 2680 of file DPMBase.cc.

References boundaryHandler, checkParticleForInteractionLocal(), PeriodicBoundary::getDistance(), BaseParticle::getInteractionRadius(), ParticleHandler::getLargestParticle(), BaseHandler< T >::getNumberOfObjects(), particleHandler, and PeriodicBoundary::shiftPosition().

Referenced by checkParticleForInteraction(), and MercuryBase::checkParticleForInteraction().

2680  {
2681  //A vector of ghost particles of the particle that is to be inserted (empty if no periodic boundaries are present)
2682  std::vector<BaseParticle> pPeriodic;
2683  for (BaseBoundary* b : boundaryHandler) {
2684  PeriodicBoundary* pb = dynamic_cast<PeriodicBoundary*>(b);
2685  if (pb) {
2686  for (int i=pPeriodic.size()-1; i>=0; --i) {
2687  if (particleHandler.getNumberOfObjects()>0 && pb->getDistance(pPeriodic[i]) < pPeriodic[i].getInteractionRadius() + particleHandler.getLargestParticle()->getInteractionRadius()) {
2688  pPeriodic.push_back(pPeriodic[i]);
2689  pb->shiftPosition(&pPeriodic.back());
2690  }
2691  }
2693  pPeriodic.push_back(p);
2694  pb->shiftPosition(&pPeriodic.back());
2695  }
2696  }
2697  }
2698  //check the particle AND the ghost particles for intersection problems
2699  bool insertable = checkParticleForInteractionLocal(p);
2700  for (BaseParticle& pP : pPeriodic) {
2701  insertable &= checkParticleForInteractionLocal(pP);
2702  }
2703  return insertable;
2704 }
BaseParticle * getLargestParticle() const
Gets a pointer to the largest BaseParticle (by interactionRadius) in this ParticleHandler.
Defines a pair of periodic walls. Inherits from BaseBoundary.
Mdouble getDistance(const BaseParticle &p) const
Returns the distance of the wall to the particle.
BoundaryHandler boundaryHandler
An object of the class BoundaryHandler which concerns insertion and deletion of particles into or fro...
Definition: DPMBase.h:1011
ParticleHandler particleHandler
An object of the class ParticleHandler, contains the pointers to all the particles created...
Definition: DPMBase.h:1001
void shiftPosition(BaseParticle *p) const
shifts the particle
unsigned int getNumberOfObjects() const
Gets the number of Object in this BaseHandler.
Definition: BaseHandler.h:487
Mdouble getInteractionRadius() const
Returns the particle's interaction radius, which might be different from radius_ (e.g., when dealing with wet particles)
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:2718
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.
    1. Checks if particle dimensions are set.
    2. Checks if system dimensions are set.
    3. Checks if the time step is set or not.

Definition at line 2115 of file DPMBase.cc.

References BaseHandler< T >::getNumberOfObjects(), getParticleDimensions(), getSystemDimensions(), getTimeStep(), and speciesHandler.

Referenced by solve().

2116 {
2118  {
2119  std::cerr << "Error in solve(): at least one species has to be defined" << std::endl;
2120  exit(-1);
2121  }
2122  if (getParticleDimensions() == 0)
2123  {
2124  std::cerr << "Error in solve(): particleDimensions not specified" << std::endl;
2125  exit(-1);
2126  }
2127  if (getSystemDimensions() == 0)
2128  {
2129  std::cerr << "Error in solve(): systemDimensions not specified" << std::endl;
2130  exit(-1);
2131  }
2132  if (getTimeStep() == 0.0)
2133  {
2134  std::cerr << "Error in solve(): timeStep not specified" << std::endl;
2135  exit(-1);
2136  }
2137 }
unsigned int getSystemDimensions() const
Returns the dimension of the simulation. Note there is also a particle dimension. ...
Definition: DPMBase.cc:575
unsigned int getParticleDimensions() const
Returns the particle dimensions.
Definition: DPMBase.cc:599
unsigned int getNumberOfObjects() const
Gets the number of Object in this BaseHandler.
Definition: BaseHandler.h:487
SpeciesHandler speciesHandler
A handler to that stores the species type i.e. elastic, linear visco-elastic... et cetera...
Definition: DPMBase.h:991
Mdouble getTimeStep() const
Allows the time step dt to be accessed.
Definition: DPMBase.cc:465
void DPMBase::computeAllForces ( )
protectedvirtual

Computes all the forces acting on the particles by using the setTorque and setForce methods. See BaseInteractible.cc.

Reset all forces to zero

Now loop over all particles contacts computing force contributions

Now loop over all other particles looking for contacts

Definition at line 1841 of file DPMBase.cc.

References computeExternalForces(), computeInternalForces(), PossibleContact::getNext(), PossibleContact::getP1(), PossibleContact::getP2(), particleHandler, and wallHandler.

Referenced by solve().

1842 {
1844  for (BaseParticle* const p : particleHandler)
1845  {
1846  p->setForce(Vec3D(0.0, 0.0, 0.0));
1847  p->setTorque(Vec3D(0.0, 0.0, 0.0));
1848  }
1849  for (BaseWall* const w : wallHandler)
1850  {
1851  w->setForce(Vec3D(0.0, 0.0, 0.0));
1852  w->setTorque(Vec3D(0.0, 0.0, 0.0));
1853  } //end reset forces loop
1854 
1855 #ifdef DEBUG_OUTPUT
1856  std::cerr << "Have all forces set to zero " << std::endl;
1857 #endif
1858 
1860 
1861  for (BaseParticle* p : particleHandler)
1862  {
1863 
1866  //end inner loop over contacts.
1867 
1869 
1870  }
1871 
1872 #ifdef CONTACT_LIST_HGRID
1873  //possibleContactList.write(std::cout);
1874  PossibleContact* Curr=possibleContactList.getFirstPossibleContact();
1875  while(Curr)
1876  {
1877  computeInternalForces(Curr->getP1(),Curr->getP2());
1878  Curr=Curr->getNext();
1879  }
1880 #endif
1881  //end outer loop over contacts.
1882 
1883 }
BaseParticle * getP1()
Gets a pointer to the first BaseParticle in this PossibleContact.
virtual void computeInternalForces(BaseParticle *i)
Computes the forces between particles (internal in the sense that the sum over all these forces is ze...
Definition: DPMBase.cc:1888
BaseParticle * getP2()
Gets a pointer to the second BaseParticle in this PossibleContact.
PossibleContact * getNext()
Gets the next PossibleContact in the general linked list of PossibleContact.
ParticleHandler particleHandler
An object of the class ParticleHandler, contains the pointers to all the particles created...
Definition: DPMBase.h:1001
Basic class for walls.
Definition: BaseWall.h:44
WallHandler wallHandler
An object of the class WallHandler. Contains pointers to all the walls created.
Definition: DPMBase.h:1006
Class that describes a possible contact between two BaseParticle.
Implementation of a 3D vector (by Vitaliy).
Definition: Vector.h:45
virtual void computeExternalForces(BaseParticle *PI)
Computes the external forces acting on particles (e.g. gravitational)
Definition: DPMBase.cc:1703
void DPMBase::computeExternalForces ( BaseParticle CI)
protectedvirtual

Computes the external forces acting on particles (e.g. gravitational)

Todo:
take out computeWalls() from compute External Forces method.
Parameters
[in]CI

Definition at line 1703 of file DPMBase.cc.

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

Referenced by computeAllForces().

1704 {
1705  if (!CI->isFixed())
1706  {
1707  // Gravitational force
1708  CI->addForce(getGravity() * CI->getMass());
1709  // Still calls this in compute External Forces.
1711  }
1712 }
void addForce(const Vec3D &addForce)
Adds an amount to the force on this BaseInteractable.
Mdouble getMass() const
Returns the particle's mass_.
Vec3D getGravity() const
Returns the gravity vector.
Definition: DPMBase.cc:545
virtual void computeForcesDueToWalls(BaseParticle *PI)
Computes the forces on the particles due to the walls (normals are outward normals) ...
Definition: DPMBase.cc:1717
bool isFixed() const
Is fixed Particle function. It returns whether a Particle is fixed or not, by checking its inverse Ma...
void DPMBase::computeForcesDueToWalls ( BaseParticle pI)
protectedvirtual

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

Parameters
[in]pI
Todo:
TW: I think this torque has the wrong sign

Definition at line 1717 of file DPMBase.cc.

References BaseInteractable::addForce(), BaseInteractable::addTorque(), Vec3D::cross(), BaseParticle::getPeriodicFromParticle(), BaseInteractable::getPosition(), getRotation(), getTime(), getTimeStep(), interactionHandler, and wallHandler.

Referenced by computeExternalForces().

1718 {
1719  //No need to compute interactions between periodic particle images and walls
1720  if (pI->getPeriodicFromParticle() != nullptr)
1721  return;
1722 
1723  for (BaseWall* w : wallHandler)
1724  {
1725  std::vector<BaseInteraction*> interactions = w->getInteractionWith(pI, getTime() + getTimeStep(),
1727 
1728  for (auto i : interactions)
1729  {
1730  i->computeForce();
1731 
1732  pI->addForce(i->getForce());
1733  w->addForce(-i->getForce());
1734 
1735  if (getRotation()) // getRotation() returns a boolean.
1736  {
1737  pI->addTorque(i->getTorque() - Vec3D::cross(pI->getPosition() - i->getContactPoint(), i->getForce()));
1739  w->addTorque(-i->getTorque() + Vec3D::cross(w->getPosition() - i->getContactPoint(), i->getForce()));
1740  }
1741  }
1742  }
1743 }
void addForce(const Vec3D &addForce)
Adds an amount to the force on this BaseInteractable.
const Vec3D & getPosition() const
Returns the position of this BaseInteractable.
BaseParticle * getPeriodicFromParticle() const
Returns the 'original' particle this one's a periodic copy of.
static Vec3D cross(const Vec3D &a, const Vec3D &b)
Calculates the cross product of two Vec3D: .
Definition: Vector.cc:255
Basic class for walls.
Definition: BaseWall.h:44
InteractionHandler interactionHandler
An object of the class InteractionHandler.
Definition: DPMBase.h:1016
WallHandler wallHandler
An object of the class WallHandler. Contains pointers to all the walls created.
Definition: DPMBase.h:1006
void addTorque(const Vec3D &addTorque)
Adds an amount to the torque on this BaseInteractable.
Mdouble getTimeStep() const
Allows the time step dt to be accessed.
Definition: DPMBase.cc:465
bool getRotation() const
Returns a flag indicating if particle rotation is enabled or disabled.
Definition: DPMBase.cc:239
Mdouble getTime() const
Access function for the time.
Definition: DPMBase.cc:169
void DPMBase::computeInternalForces ( BaseParticle i)
protectedvirtual

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

Parameters
[in]i

Definition at line 1888 of file DPMBase.cc.

References broadPhase().

Referenced by broadPhase(), computeAllForces(), Mercury3D::hGridFindContactsWithinTargetCell(), Mercury2D::hGridFindContactsWithinTargetCell(), Mercury2D::hGridFindContactsWithTargetCell(), and Mercury3D::hGridFindContactsWithTargetCell().

1889 {
1890  broadPhase(i);
1891 }
virtual void broadPhase(BaseParticle *i)
By broad one means to screen and determine an approximate number of particles that a given particle c...
Definition: DPMBase.cc:866
void DPMBase::computeInternalForces ( BaseParticle P1,
BaseParticle P2 
)
protectedvirtual

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

Parameters
[in]P1
[in]P2

Definition at line 1657 of file DPMBase.cc.

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

1658 {
1659  //this is because the rough bottom allows overlapping fixed particles
1660  if (P1->isFixed() && P2->isFixed())
1661  {
1662  return;
1663  }
1664 
1666  {
1667  return;
1668  }
1669 
1670  BaseParticle* PI, * PJ;
1671  if (P1->getId() > P2->getId())
1672  {
1673  PI = P2;
1674  PJ = P1;
1675  } else
1676  {
1677  PI = P1;
1678  PJ = P2;
1679  }
1680 
1681  //if statement above ensures that the PI has the lower id than PJ
1682  std::vector<BaseInteraction*> interactions = PJ->getInteractionWith(PI, getTime() + getTimeStep(),
1684  for (auto i : interactions)
1685  {
1686  i->computeForce();
1687 
1688  PI->addForce(i->getForce());
1689  PJ->addForce(-i->getForce());
1690 
1691  if (getRotation())
1692  {
1693  PI->addTorque(i->getTorque() - Vec3D::cross(PI->getPosition() - i->getContactPoint(), i->getForce()));
1694  PJ->addTorque(-i->getTorque() + Vec3D::cross(PJ->getPosition() - i->getContactPoint(), i->getForce()));
1695  }
1696  }
1697 }
unsigned int getId() const
Returns the unique identifier of any particular object.
Definition: BaseObject.cc:116
void addForce(const Vec3D &addForce)
Adds an amount to the force on this BaseInteractable.
const Vec3D & getPosition() const
Returns the position of this BaseInteractable.
BaseParticle * getPeriodicFromParticle() const
Returns the 'original' particle this one's a periodic copy of.
static Vec3D cross(const Vec3D &a, const Vec3D &b)
Calculates the cross product of two Vec3D: .
Definition: Vector.cc:255
InteractionHandler interactionHandler
An object of the class InteractionHandler.
Definition: DPMBase.h:1016
void addTorque(const Vec3D &addTorque)
Adds an amount to the torque on this BaseInteractable.
Mdouble getTimeStep() const
Allows the time step dt to be accessed.
Definition: DPMBase.cc:465
bool isFixed() const
Is fixed Particle function. It returns whether a Particle is fixed or not, by checking its inverse Ma...
bool getRotation() const
Returns a flag indicating if particle rotation is enabled or disabled.
Definition: DPMBase.cc:239
Mdouble getTime() const
Access function for the time.
Definition: DPMBase.cc:169
std::vector< BaseInteraction * > getInteractionWith(BaseParticle *P, Mdouble timeStamp, InteractionHandler *interactionHandler)
Checks if particle is in interaction with given particle P, and if so, returns pointer to the associa...
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().

Definition at line 905 of file DPMBase.cc.

References boundaryHandler, gravity_, interactionHandler, loggerOutput, logWriteAndDie(), NO_FILE, ntimeSteps_, LoggerOutput::onFatal, particleHandler, random, setAppend(), BaseHandler< T >::setDPMBase(), Files::setName(), setParticleDimensions(), RNG::setRandomSeed(), setRestarted(), Files::setSaveCount(), BaseHandler< T >::setStorageCapacity(), setSystemDimensions(), speciesHandler, time_, timeMax_, timeStep_, wallHandler, writeParticlesVTK_, writeWallsVTK_, xBallsAdditionalArguments_, xBallsColourMode_, xBallsScale_, xBallsVectorScale_, xMax_, xMin_, yMax_, yMin_, zMax_, and zMin_.

Referenced by DPMBase().

906 {
907  //These are the particle parameters like dissipation etc..
908  setRestarted(false);
909 
910  //This sets the maximum number of particles
915  wallHandler.setDPMBase(this);
917 
921 
922  // Set gravitational acceleration
923  gravity_ = Vec3D(0.0, -9.8, 0.0);
924 
925  //This is the parameter of the numerical part
926  time_ = 0.0;
927  timeStep_ = 0.0; // if dt is not user-specified, this is set in actionsBeforeTimeLoop()
928  ntimeSteps_ = 0;
929  setSaveCount(20);
930  timeMax_ = 1.0;
931 
932  //This sets the default xballs domain
933  xMin_ = 0.0;
934  xMax_ = 0.01;
935  yMin_ = 0.0;
936  yMax_ = 0.01;
937  zMin_ = 0.0;
938  zMax_ = 0.0;
939 
940  //sets the default write particles data in VTK format flag to false
941  writeParticlesVTK_ = false;
943 
945 
946  setName("");
947 
948  //Default mode is energy with no scale of the vectors
949  xBallsColourMode_ = 0;
950  xBallsVectorScale_ = -1;
951  xBallsScale_ = -1;
953  setAppend(false);
954 //TODO
955  //The default random seed is 0
957 
958 #ifdef DEBUG_OUTPUT
959  std::cerr << "MD problem constructor finished " << std::endl;
960 #endif
961 }
Mdouble timeMax_
Stores the duration of the simulation.
Definition: DPMBase.h:914
Mdouble yMax_
If the length of the problem domain in y-direction is YMax - XMin, the above variable stores YMax...
Definition: DPMBase.h:866
Mdouble yMin_
If the length of the problem domain in y-direction is YMax - YMin, the above variable stores YMin...
Definition: DPMBase.h:860
void setDPMBase(DPMBase *DPMBase)
Sets the problem that is solved using this handler.
Definition: BaseHandler.h:536
void setStorageCapacity(const unsigned int N)
Sets the storage capacity of this BaseHandler.
Definition: BaseHandler.h:501
void setParticleDimensions(unsigned int particleDimensions)
Allows the dimension of the particle (f.e. for mass) to be changed. e.g. discs or spheres...
Definition: DPMBase.cc:583
void setAppend(bool newAppendFlag)
Allows to set the append option.
Definition: DPMBase.cc:651
void setSystemDimensions(unsigned int newDim)
Allows for the dimension of the simulation to be changed.
Definition: DPMBase.cc:562
std::function< void(std::string, std::string)> onFatal
Definition: Logger.h:185
void logWriteAndDie(std::string module, std::string message)
todo strcmp relies on this, should be changed to more modern version
Definition: DPMBase.cc:65
Mdouble zMax_
If the length of the problem domain in z-direction is ZMax - ZMin, the above variable stores ZMax...
Definition: DPMBase.h:878
Mdouble zMin_
If the length of the problem domain in z-direction is ZMax - ZMin, the above variable stores ZMin...
Definition: DPMBase.h:872
Mdouble xMax_
If the length of the problem domain in x-direction is XMax - XMin, the above variable stores XMax...
Definition: DPMBase.h:854
file will not be created/read
unsigned int ntimeSteps_
Stores the number of time steps.
Definition: DPMBase.h:904
void setName(const std::string &name)
Allows to set the name of all the files (ene, data, fstat, restart, stat)
Definition: Files.cc:150
int xBallsColourMode_
XBalls is a package to view the particle data. As an alternative MercuryDPM also supports Paraview...
Definition: DPMBase.h:962
BoundaryHandler boundaryHandler
An object of the class BoundaryHandler which concerns insertion and deletion of particles into or fro...
Definition: DPMBase.h:1011
Mdouble xBallsScale_
sets the xballs argument scale (see XBalls/xballs.txt)
Definition: DPMBase.h:972
ParticleHandler particleHandler
An object of the class ParticleHandler, contains the pointers to all the particles created...
Definition: DPMBase.h:1001
Mdouble time_
Stores the current simulation time.
Definition: DPMBase.h:899
void setSaveCount(unsigned int saveCount)
Sets File::saveCount_ for all files (ene, data, fstat, restart, stat)
Definition: Files.cc:139
SpeciesHandler speciesHandler
A handler to that stores the species type i.e. elastic, linear visco-elastic... et cetera...
Definition: DPMBase.h:991
InteractionHandler interactionHandler
An object of the class InteractionHandler.
Definition: DPMBase.h:1016
FileType writeWallsVTK_
A flag to turn on/off the vtk writer for walls.
Definition: DPMBase.h:949
Mdouble xBallsVectorScale_
sets the xballs argument vscale (see XBalls/xballs.txt)
Definition: DPMBase.h:967
Mdouble xMin_
If the length of the problem domain in x-direction is XMax - XMin, the above variable stores XMin...
Definition: DPMBase.h:848
LoggerOutput * loggerOutput
Declaration of the output functions. If the output needs to be redirected, please swap the loggerOutp...
Definition: Logger.cc:143
Mdouble timeStep_
Stores the simulation time step.
Definition: DPMBase.h:909
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 ...
Definition: RNG.cc:46
WallHandler wallHandler
An object of the class WallHandler. Contains pointers to all the walls created.
Definition: DPMBase.h:1006
RNG random
This is a random generator, often used for setting up the initial conditions etc...
Definition: DPMBase.h:996
bool writeParticlesVTK_
A flag to turn on/off the vtk writer for particles.
Definition: DPMBase.h:954
std::string xBallsAdditionalArguments_
A string of additional arguments for xballs can be specified (see XBalls/xballs.txt). e.g. "-solidf -v0".
Definition: DPMBase.h:977
void setRestarted(bool newRestartedFlag)
Allows to set the flag stating if the simulation is to be restarted or not.
Definition: DPMBase.cc:634
Implementation of a 3D vector (by Vitaliy).
Definition: Vector.h:45
Vec3D gravity_
Gravity vector.
Definition: DPMBase.h:842
bool DPMBase::continueSolve ( ) const
protectedvirtual
Returns
bool (True or False)

Definition at line 897 of file DPMBase.cc.

Referenced by solve().

898 {
899  return true;
900 }
Mdouble DPMBase::domainSize ( ) const
protected

Definition at line 2818 of file DPMBase.cc.

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

2819 {
2820  return (getXMax() - getXMin()) * (getYMax() - getYMin()) * (getZMax() - getZMin());
2821 }
Mdouble getZMax() const
If the length of the problem domain in z-direction is ZMax - ZMin, then getZMax() returns ZMax...
Definition: DPMBase.cc:319
Mdouble getXMin() const
If the length of the problem domain in x-direction is XMax - XMin, then getXMin() returns XMin...
Definition: DPMBase.cc:279
Mdouble getYMin() const
If the length of the problem domain in y-direction is YMax - YMin, then getYMin() returns YMin...
Definition: DPMBase.cc:295
Mdouble getXMax() const
If the length of the problem domain in x-direction is XMax - XMin, then getXMax() returns XMax...
Definition: DPMBase.cc:287
Mdouble getYMax() const
If the length of the problem domain in y-direction is YMax - YMin, then getYMax() returns XMax...
Definition: DPMBase.cc:303
Mdouble getZMin() const
If the length of the problem domain in z-direction is ZMax - ZMin, then getZMin() returns ZMin...
Definition: DPMBase.cc:311
bool DPMBase::findNextExistingDataFile ( Mdouble  tMin,
bool  verbose = true 
)

Useful when fileType is chosen as Multiple Files or Multiple files with padded.

Parameters
[in]tMin
[in]verbose
Returns
bool (True or False)

Definition at line 1401 of file DPMBase.cc.

References Files::dataFile, File::getCounter(), File::getFileType(), File::getFstream(), File::getName(), MULTIPLE_FILES, MULTIPLE_FILES_PADDED, and File::openNextFile().

1402 {
1404  {
1405  while (true)// This true corresponds to the if s
1406  {
1408  //check if file exists and contains data
1409  int N;
1410  dataFile.getFstream() >> N;
1411  if (dataFile.getFstream().eof() || dataFile.getFstream().peek() == -1)
1412  {
1413  std::cout << "file " << dataFile.getName() << " not found" << std::endl;
1414  return false;
1415  }
1416  //check if tmin condition is satisfied
1417  Mdouble t;
1418  dataFile.getFstream() >> t;
1419  if (t > tMin)
1420  {
1421  //set_file_counter(get_file_counter()-1);
1422  return true;
1423  }
1424  if (verbose)
1425  std::cout << "Jumping file counter: " << dataFile.getCounter() << std::endl;
1426  }
1427  }
1428  return true;
1429 }
each time-step will be written into/read from separate files numbered consecutively, with numbers padded by zeros to a minimum of four digits: name_.0000, name_.0001, ..
FileType getFileType() const
Gets the file type e.g. NOFILE, ONEFILE and MULTIPLE FILES. File::fileType_.
Definition: File.cc:203
double Mdouble
bool openNextFile()
This function should be called before a data corresponding to the new time step is written or read...
Definition: File.cc:231
unsigned int getCounter() const
In case of multiple files, File::getCounter() returns the the number (FILE::Counter_) of the next fil...
Definition: File.cc:217
std::fstream & getFstream()
Allows to access the member variable File::fstream_.
Definition: File.cc:151
File dataFile
An instance of class File to handle in- and output into a .data file.
Definition: Files.h:204
each time-step will be written into/read from separate files numbered consecutively: name_...
const std::string & getName() const
Allows to access the file name, e.g., "problem.data".
Definition: File.cc:163
void DPMBase::finishStatistics ( )
protectedvirtual

no implementation but can be overidden in its derived classes.

Reimplemented in StatisticsVector< T >.

Definition at line 838 of file DPMBase.cc.

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

839 {
840 }
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 >.

Definition at line 822 of file DPMBase.cc.

Referenced by BaseInteraction::gatherContactStatistics().

825 {
826 }
void DPMBase::gatherContactStatistics ( )
protected

Definition at line 811 of file DPMBase.cc.

References interactionHandler.

812 {
814  {
815  c->gatherContactStatistics();
816  }
817 }
Stores information about interactions between two interactable objects; often particles but could be ...
InteractionHandler interactionHandler
An object of the class InteractionHandler.
Definition: DPMBase.h:1016
int DPMBase::getAddLarge ( ) const

returns the number of large particles that are to be added on restart.

Returns
addS_

Definition at line 327 of file DPMBase.cc.

References addL_.

328 {
329  return addL_;
330 }
int addL_
Stores the number of large particles that are to be added on restart.
Definition: DPMBase.h:886
int DPMBase::getAddSmall ( ) const

returns the number of small particles that are to be added on restart.

Returns
addL_

Definition at line 335 of file DPMBase.cc.

References addS_.

336 {
337  return addS_;
338 }
int addS_
Stores the number of small particles that are to be added on restart.
Definition: DPMBase.h:892
bool DPMBase::getAppend ( ) const

Returns the flag denoting if the append option is on or off.

Returns
bool (True or False)

Definition at line 643 of file DPMBase.cc.

References append_.

Referenced by solve(), and writeEneHeader().

644 {
645  return append_;
646 }
bool append_
A flag to determine if the file has to be appended or not. See DPMBase::Solve() for example...
Definition: DPMBase.h:939
bool DPMBase::getDoCGAlways ( ) const
Todo:
This method is not implemented
Mdouble DPMBase::getElasticEnergy ( ) const

Returns the global elastic energy within the system.

Returns
Mdouble elasticEnergy

Definition at line 659 of file DPMBase.cc.

References interactionHandler.

Referenced by writeEneTimestep().

660 {
661  Mdouble elasticEnergy = 0.0;
662  for (const BaseInteraction* c : interactionHandler)
663  {
664  elasticEnergy += c->getElasticEnergy();
665  }
666  return elasticEnergy;
667 }
double Mdouble
Stores information about interactions between two interactable objects; often particles but could be ...
InteractionHandler interactionHandler
An object of the class InteractionHandler.
Definition: DPMBase.h:1016
Mdouble DPMBase::getGravitationalEnergy ( ) const

Returns the global gravitational potential energy stored in the system.

Definition at line 686 of file DPMBase.cc.

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

687 {
688  Mdouble gravitationalEnergy = 0;
689  for (const BaseParticle* const p : particleHandler)
690  {
691  if (!(p->isFixed()))
692  {
693  gravitationalEnergy += p->getMass() * Vec3D::dot((-getGravity()), p->getPosition());
694  }
695  }
696  return gravitationalEnergy;
697 
698 }
double Mdouble
static Mdouble dot(const Vec3D &a, const Vec3D &b)
Calculates the dot product of two Vec3D: .
Definition: Vector.cc:167
ParticleHandler particleHandler
An object of the class ParticleHandler, contains the pointers to all the particles created...
Definition: DPMBase.h:1001
Vec3D getGravity() const
Returns the gravity vector.
Definition: DPMBase.cc:545
Vec3D DPMBase::getGravity ( ) const

Returns the gravity vector.

Returns
Vec3D gravity_

Definition at line 545 of file DPMBase.cc.

References gravity_.

Referenced by computeExternalForces(), getGravitationalEnergy(), ChuteWithHopper::getMaximumVelocityInducedByGravity(), Chute::setChuteAngle(), write(), and writeEneTimestep().

546 {
547  return gravity_;
548 }
Vec3D gravity_
Gravity vector.
Definition: DPMBase.h:842
bool DPMBase::getHGridUpdateEachTimeStep ( ) const
protectedvirtual
Returns
bool (True or False)

Reimplemented in MercuryBase.

Definition at line 771 of file DPMBase.cc.

772 {
773  return true;
774 }
double DPMBase::getInfo ( const BaseParticle p) const
virtual

A virtual method that allows the user to overrride and set what is written into the info column in the data file. By default it returns the Species ID number.

Returns
double

Definition at line 703 of file DPMBase.cc.

References BaseObject::getId(), and BaseInteractable::getSpecies().

Referenced by ParticleHandler::writeVTK().

704 {
705  return p.getSpecies()->getId(); // was getIndex()
706 }
unsigned int getId() const
Returns the unique identifier of any particular object.
Definition: BaseObject.cc:116
const ParticleSpecies * getSpecies() const
Returns a pointer to the species of this BaseInteractable.
Mdouble DPMBase::getKineticEnergy ( ) const

Returns the global kinetic energy stored in the system.

Returns
Mdouble kineticEnergy

Definition at line 672 of file DPMBase.cc.

References particleHandler.

673 {
674  Mdouble kineticEnergy = 0;
675  for (const BaseParticle* const p : particleHandler)
676  {
677  if (!(p->isFixed()))
678  {
679  kineticEnergy += .5 * p->getMass() * p->getVelocity().getLengthSquared();
680  }
681  }
682  return kineticEnergy;
683 }
double Mdouble
ParticleHandler particleHandler
An object of the class ParticleHandler, contains the pointers to all the particles created...
Definition: DPMBase.h:1001
Vec3D DPMBase::getMax ( ) const
inline

Return the "upper right" corner of the domain, a vector with xMin_, yMin_ and zMin_.

Definition at line 335 of file DPMBase.h.

References xMax_, yMax_, and zMax_.

Referenced by InfiniteWall::createVTK(), FileReader::read(), AxisymmetricIntersectionOfWalls::writeVTK(), and WallHandler::writeVTKBoundingBox().

335 {return Vec3D(xMax_,yMax_,zMax_);}
Mdouble yMax_
If the length of the problem domain in y-direction is YMax - XMin, the above variable stores YMax...
Definition: DPMBase.h:866
Mdouble zMax_
If the length of the problem domain in z-direction is ZMax - ZMin, the above variable stores ZMax...
Definition: DPMBase.h:878
Mdouble xMax_
If the length of the problem domain in x-direction is XMax - XMin, the above variable stores XMax...
Definition: DPMBase.h:854
Implementation of a 3D vector (by Vitaliy).
Definition: Vector.h:45
Vec3D DPMBase::getMin ( ) const
inline

Return the "bottom left" corner of the domain, a vector with xMin_, yMin_ and zMin_.

Definition at line 330 of file DPMBase.h.

References xMin_, yMin_, and zMin_.

Referenced by InfiniteWall::createVTK(), FileReader::read(), AxisymmetricIntersectionOfWalls::writeVTK(), and WallHandler::writeVTKBoundingBox().

330 {return Vec3D(xMin_,yMin_,zMin_);}
Mdouble yMin_
If the length of the problem domain in y-direction is YMax - YMin, the above variable stores YMin...
Definition: DPMBase.h:860
Mdouble zMin_
If the length of the problem domain in z-direction is ZMax - ZMin, the above variable stores ZMin...
Definition: DPMBase.h:872
Mdouble xMin_
If the length of the problem domain in x-direction is XMax - XMin, the above variable stores XMin...
Definition: DPMBase.h:848
Implementation of a 3D vector (by Vitaliy).
Definition: Vector.h:45
unsigned int DPMBase::getNtimeSteps ( ) const

Returns the current counter of time steps.

Returns
ntimeSteps_

Definition at line 177 of file DPMBase.cc.

References ntimeSteps_.

Referenced by FileReader::read(), and readNextArgument().

178 {
179  return ntimeSteps_;
180 }
unsigned int ntimeSteps_
Stores the number of time steps.
Definition: DPMBase.h:904
unsigned int DPMBase::getParticleDimensions ( ) const

Returns the particle dimensions.

Returns
particleDimensions_

Definition at line 599 of file DPMBase.cc.

References particleDimensions_.

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

600 {
601  return particleDimensions_;
602 }
unsigned int particleDimensions_
determines if 2D or 3D particle volume is used for mass calculations
Definition: DPMBase.h:837
bool DPMBase::getParticlesWriteVTK ( ) const

Returns a flag indicating if particle rotation is enabled or disabled.

Returns
bool

Definition at line 271 of file DPMBase.cc.

References writeParticlesVTK_.

Referenced by writeVTK().

272 {
273  return writeParticlesVTK_;
274 }
bool writeParticlesVTK_
A flag to turn on/off the vtk writer for particles.
Definition: DPMBase.h:954
bool DPMBase::getRestarted ( ) const

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

Returns
restarted_

Definition at line 626 of file DPMBase.cc.

References restarted_.

Referenced by solve(), and writeOutputFiles().

627 {
628  return restarted_;
629 }
bool restarted_
A bool to check if the simulation was restarted or not, ie. if setupInitialConditionsShould be run an...
Definition: DPMBase.h:933
std::string DPMBase::getRestartVersion ( ) const

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

Returns
restartVersion_

Definition at line 608 of file DPMBase.cc.

References restartVersion_.

Referenced by Chute::read().

609 {
610  return restartVersion_;
611 }
std::string restartVersion_
Previous versions of MercuryDPM had a different restart file format, the below member variable allows...
Definition: DPMBase.h:928
bool DPMBase::getRotation ( ) const

Returns a flag indicating if particle rotation is enabled or disabled.

Returns
bool (True or False)

Definition at line 239 of file DPMBase.cc.

References rotation_.

Referenced by computeForcesDueToWalls(), and computeInternalForces().

240 {
241  return rotation_;
242 }
bool rotation_
A flag to turn on/off particle rotation.
Definition: DPMBase.h:944
unsigned int DPMBase::getSystemDimensions ( ) const

Returns the dimension of the simulation. Note there is also a particle dimension.

Returns
systemDimensions_

Definition at line 575 of file DPMBase.cc.

References systemDimensions_.

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

576 {
577  return systemDimensions_;
578 }
unsigned int systemDimensions_
The dimensions of the simulation i.e. 2D or 3D.
Definition: DPMBase.h:832
Mdouble DPMBase::getTimeMax ( ) const

Allows the user to access the total simulation time during the simulation. Cannot change it though.

Returns
timeMax_

Definition at line 214 of file DPMBase.cc.

References timeMax_.

Referenced by StatisticsVector< T >::getTimeMaxStat(), helpers::loadingTest(), helpers::normalAndTangentialLoadingTest(), helpers::objectivenessTest(), Chute::printTime(), printTime(), Mercury3DRestart::readNextArgument(), readNextArgument(), solve(), and write().

215 {
216  return timeMax_;
217 }
Mdouble timeMax_
Stores the duration of the simulation.
Definition: DPMBase.h:914
FileType DPMBase::getWallsWriteVTK ( ) const

Returns a flag indicating if particle rotation is enabled or disabled.

Returns
bool

Definition at line 263 of file DPMBase.cc.

References writeWallsVTK_.

Referenced by writeVTK().

264 {
265  return writeWallsVTK_;
266 }
FileType writeWallsVTK_
A flag to turn on/off the vtk writer for walls.
Definition: DPMBase.h:949
std::string DPMBase::getXBallsAdditionalArguments ( ) const

Returns the additional arguments for xballs.

Returns
xBallsAdditionalArguments_

Definition at line 513 of file DPMBase.cc.

References xBallsAdditionalArguments_.

Referenced by write().

514 {
516 }
std::string xBallsAdditionalArguments_
A string of additional arguments for xballs can be specified (see XBalls/xballs.txt). e.g. "-solidf -v0".
Definition: DPMBase.h:977
int DPMBase::getXBallsColourMode ( ) const

Get the xball colour mode (CMode)

Returns
int xBallsColourMode_

Definition at line 481 of file DPMBase.cc.

References xBallsColourMode_.

482 {
483  return xBallsColourMode_;
484 }
int xBallsColourMode_
XBalls is a package to view the particle data. As an alternative MercuryDPM also supports Paraview...
Definition: DPMBase.h:962
double DPMBase::getXBallsScale ( ) const

Returns the scale of the view in xballs.

Returns
double xBallsScale_

Definition at line 529 of file DPMBase.cc.

References xBallsScale_.

530 {
531  return xBallsScale_;
532 }
Mdouble xBallsScale_
sets the xballs argument scale (see XBalls/xballs.txt)
Definition: DPMBase.h:972
double DPMBase::getXBallsVectorScale ( ) const

Returns the scale of vectors used in xballs.

Returns
double xBallsVectorScale_

Definition at line 497 of file DPMBase.cc.

References xBallsVectorScale_.

498 {
499  return xBallsVectorScale_;
500 }
Mdouble xBallsVectorScale_
sets the xballs argument vscale (see XBalls/xballs.txt)
Definition: DPMBase.h:967
Mdouble DPMBase::getXMax ( ) const

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

Returns
xMax_

Definition at line 287 of file DPMBase.cc.

References xMax_.

Referenced by Chute::cleanChute(), Chute::createBottom(), domainSize(), ChuteWithHopper::getChuteLength(), Chute::getChuteLength(), ChuteWithHopper::getMaximumVelocityInducedByGravity(), StatisticsVector< T >::getXMaxStat(), HGridOptimiser::initialise(), outputXBallsData(), readParAndIniFiles(), ChuteWithHopper::setHopperShift(), ChuteBottom::setupInitialConditions(), Chute::setupInitialConditions(), setXMin(), write(), and writeFstatHeader().

288 {
289  return xMax_;
290 }
Mdouble xMax_
If the length of the problem domain in x-direction is XMax - XMin, the above variable stores XMax...
Definition: DPMBase.h:854
Mdouble DPMBase::getXMin ( ) const

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

Returns
xMin_

Definition at line 279 of file DPMBase.cc.

References xMin_.

Referenced by Chute::cleanChute(), Chute::createBottom(), domainSize(), StatisticsVector< T >::getXMinStat(), HGridOptimiser::initialise(), outputXBallsData(), readParAndIniFiles(), ChuteBottom::setupInitialConditions(), Chute::setupInitialConditions(), setXMax(), write(), and writeFstatHeader().

280 {
281  return xMin_;
282 }
Mdouble xMin_
If the length of the problem domain in x-direction is XMax - XMin, the above variable stores XMin...
Definition: DPMBase.h:848
Mdouble DPMBase::getYMax ( ) const

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

Returns
yMax_

Definition at line 303 of file DPMBase.cc.

References yMax_.

Referenced by ChuteWithHopper::addHopper(), Chute::createBottom(), domainSize(), Chute::getChuteWidth(), StatisticsVector< T >::getYMaxStat(), HGridOptimiser::initialise(), outputXBallsData(), readParAndIniFiles(), ChuteBottom::setupInitialConditions(), Chute::setupInitialConditions(), ChuteWithHopper::setupInitialConditions(), Chute::setupSideWalls(), setYMin(), write(), and writeFstatHeader().

304 {
305  return yMax_;
306 }
Mdouble yMax_
If the length of the problem domain in y-direction is YMax - XMin, the above variable stores YMax...
Definition: DPMBase.h:866
Mdouble DPMBase::getYMin ( ) const

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

Returns
yMin_

Definition at line 295 of file DPMBase.cc.

References yMin_.

Referenced by ChuteWithHopper::addHopper(), Chute::createBottom(), domainSize(), StatisticsVector< T >::getYMinStat(), HGridOptimiser::initialise(), outputXBallsData(), readParAndIniFiles(), ChuteBottom::setupInitialConditions(), Chute::setupInitialConditions(), ChuteWithHopper::setupInitialConditions(), Chute::setupSideWalls(), setYMax(), write(), and writeFstatHeader().

296 {
297  return yMin_;
298 }
Mdouble yMin_
If the length of the problem domain in y-direction is YMax - YMin, the above variable stores YMin...
Definition: DPMBase.h:860
Mdouble DPMBase::getZMax ( ) const

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

Returns
zMax_

Definition at line 319 of file DPMBase.cc.

References zMax_.

Referenced by domainSize(), StatisticsVector< T >::getZMaxStat(), HGridOptimiser::initialise(), outputXBallsData(), readParAndIniFiles(), ChuteBottom::setupInitialConditions(), Chute::setupInitialConditions(), setZMin(), write(), and writeFstatHeader().

320 {
321  return zMax_;
322 }
Mdouble zMax_
If the length of the problem domain in z-direction is ZMax - ZMin, the above variable stores ZMax...
Definition: DPMBase.h:878
Mdouble DPMBase::getZMin ( ) const

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

Returns
zMin_

Definition at line 311 of file DPMBase.cc.

References zMin_.

Referenced by Chute::createBottom(), domainSize(), StatisticsVector< T >::getZMinStat(), HGridOptimiser::initialise(), outputXBallsData(), readParAndIniFiles(), ChuteBottom::setupInitialConditions(), Chute::setupInitialConditions(), setZMax(), write(), and writeFstatHeader().

312 {
313  return zMin_;
314 }
Mdouble zMin_
If the length of the problem domain in z-direction is ZMax - ZMin, the above variable stores ZMin...
Definition: DPMBase.h:872
void DPMBase::hGridActionsAfterIntegration ( )
protectedvirtual

no implementation but can be overidden in its derived classes.

Reimplemented in MercuryBase.

Definition at line 859 of file DPMBase.cc.

Referenced by solve().

860 {
861 }
void DPMBase::hGridActionsBeforeIntegration ( )
protectedvirtual

no implementation but can be overidden in its derived classes.

Reimplemented in MercuryBase.

Definition at line 852 of file DPMBase.cc.

Referenced by solve().

853 {
854 }
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.

Definition at line 729 of file DPMBase.cc.

Referenced by solve().

730 {
731 }
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.

Definition at line 743 of file DPMBase.cc.

Referenced by solve().

744 {
745 }
void DPMBase::hGridInsertParticle ( BaseParticle *obj  UNUSED)
virtual

no implementation but can be overidden in its derived classes.

Bug:
Why are the hGRID actions public, this seems wrong. Someone please comment [Ant].

Definition at line 750 of file DPMBase.cc.

Referenced by ParticleHandler::addObject().

751 {
752 }
void DPMBase::hGridRemoveParticle ( BaseParticle *obj  UNUSED)
virtual

no implementation but can be overidden in its derived classes.

Definition at line 764 of file DPMBase.cc.

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

765 {
766 }
void DPMBase::hGridUpdateMove ( BaseParticle ,
Mdouble   
)
virtual

no implementation but can be overidden in its derived classes.

Reimplemented in MercuryBase.

Definition at line 845 of file DPMBase.cc.

Referenced by BaseParticle::integrateBeforeForceComputation().

846 {
847 }
void DPMBase::hGridUpdateParticle ( BaseParticle *obj  UNUSED)
virtual

no implementation but can be overidden in its derived classes.

Definition at line 757 of file DPMBase.cc.

Referenced by ParticleHandler::addObject(), MercuryBase::hGridActionsBeforeTimeStep(), and MercuryBase::hGridRebuild().

758 {
759 }
void DPMBase::initialiseStatistics ( )
protectedvirtual

no implementation but can be overidden in its derived classes.

Reimplemented in StatisticsVector< T >.

Definition at line 800 of file DPMBase.cc.

Referenced by solve().

801 {
802 }
void DPMBase::initialiseTangentialSprings ( )
protected
Todo:
This method is not implemented and never used.
void DPMBase::integrateAfterForceComputation ( )
protectedvirtual

Integration is done after force computations. We apply the Velocity verlet scheme. See http://en.wikipedia.org/wiki/Verlet_integration#Velocity_Verlet.

Definition at line 1779 of file DPMBase.cc.

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

Referenced by solve().

1780 {
1781  for_each(particleHandler.begin(), particleHandler.end(), [this](BaseParticle* p)
1782  {
1783  p->integrateAfterForceComputation(getTime(), getTimeStep());
1784  });
1785  for_each(wallHandler.begin(), wallHandler.end(), [this](BaseWall* w)
1786  {
1787  w->integrateAfterForceComputation(getTime(), getTimeStep());
1788  });
1789 }
const std::vector< T * >::const_iterator end() const
Gets the end of the const_iterator over all BaseBoundary in this BaseHandler.
Definition: BaseHandler.h:522
const std::vector< T * >::const_iterator begin() const
Gets the begin of the const_iterator over all Object in this BaseHandler.
Definition: BaseHandler.h:508
ParticleHandler particleHandler
An object of the class ParticleHandler, contains the pointers to all the particles created...
Definition: DPMBase.h:1001
Basic class for walls.
Definition: BaseWall.h:44
WallHandler wallHandler
An object of the class WallHandler. Contains pointers to all the walls created.
Definition: DPMBase.h:1006
Mdouble getTimeStep() const
Allows the time step dt to be accessed.
Definition: DPMBase.cc:465
Mdouble getTime() const
Access function for the time.
Definition: DPMBase.cc:169
void DPMBase::integrateBeforeForceComputation ( )
protectedvirtual

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

Definition at line 1748 of file DPMBase.cc.

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

Referenced by solve().

1749 {
1750  for_each(particleHandler.begin(), particleHandler.end(), [this](BaseParticle* p)
1751  {
1752  p->integrateBeforeForceComputation(getTime(), getTimeStep());
1753  });
1754  for_each(wallHandler.begin(), wallHandler.end(), [this](BaseWall* w)
1755  {
1756  w->integrateBeforeForceComputation(getTime(), getTimeStep());
1757  });
1758 }
const std::vector< T * >::const_iterator end() const
Gets the end of the const_iterator over all BaseBoundary in this BaseHandler.
Definition: BaseHandler.h:522
const std::vector< T * >::const_iterator begin() const
Gets the begin of the const_iterator over all Object in this BaseHandler.
Definition: BaseHandler.h:508
ParticleHandler particleHandler
An object of the class ParticleHandler, contains the pointers to all the particles created...
Definition: DPMBase.h:1001
Basic class for walls.
Definition: BaseWall.h:44
WallHandler wallHandler
An object of the class WallHandler. Contains pointers to all the walls created.
Definition: DPMBase.h:1006
Mdouble getTimeStep() const
Allows the time step dt to be accessed.
Definition: DPMBase.cc:465
Mdouble getTime() const
Access function for the time.
Definition: DPMBase.cc:169
bool DPMBase::isTimeEqualTo ( Mdouble  time) const
protected

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

Returns
bool (True or False)

Definition at line 2813 of file DPMBase.cc.

References getTime(), and getTimeStep().

2814 {
2815  return getTime() <= time && getTime() + getTimeStep() > time;
2816 }
Mdouble getTimeStep() const
Allows the time step dt to be accessed.
Definition: DPMBase.cc:465
Mdouble getTime() const
Access function for the time.
Definition: DPMBase.cc:169
void DPMBase::outputInteractionDetails ( ) const
protected

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

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

Definition at line 2798 of file DPMBase.cc.

References interactionHandler.

2799 {
2800  std::cout << "Interactions currently in the handler:" << std::endl;
2802  {
2803  p->write(std::cout);
2804  std::cout << std::endl;
2805  std::cout << "Interaction " << p->getName() << " " << p->getId() << " between " << p->getP()->getId() << " and "
2806  << p->getI()->getId() << std::endl;
2807  }
2808 }
Stores information about interactions between two interactable objects; often particles but could be ...
InteractionHandler interactionHandler
An object of the class InteractionHandler.
Definition: DPMBase.h:1016
void DPMBase::outputStatistics ( )
protectedvirtual

no implementation but can be overidden in its derived classes.

Reimplemented in StatisticsVector< T >.

Definition at line 807 of file DPMBase.cc.

808 {
809 }
void DPMBase::outputXBallsData ( std::ostream &  os) const
protectedvirtual

This function writes the location of the walls and particles in a format the XBalls program can read. See XBalls/xballs.txt. However, MercuryDPM supports a much better viewer now called Paraview. See the tutorials section in the documentation.

Parameters
[in]os

Definition at line 1147 of file DPMBase.cc.

References BaseHandler< T >::getNumberOfObjects(), getSystemDimensions(), getTime(), getXMax(), getXMin(), getYMax(), getYMin(), getZMax(), getZMin(), outputXBallsDataParticle(), and particleHandler.

Referenced by writeOutputFiles().

1148 {
1149  //Set the correct formation based of dimension if the formation is not specified by the user
1150  unsigned int format;
1151  switch (getSystemDimensions())
1152  {
1153  case 2:
1154  format = 8;
1155  break;
1156  case 3:
1157  format = 14;
1158  break;
1159  default:
1160  std::cerr << "Unknown systemdimension" << std::endl;
1161  exit(-1);
1162  }
1163 
1164  // This outputs the location of walls and how many particles there are to file this is required by the xballs plotting
1165  if (format != 14) // dim = 1 or 2
1166  {
1168  << " " << getTime()
1169  << " " << getXMin()
1170  << " " << getYMin()
1171  << " " << getXMax()
1172  << " " << getYMax()
1173  << " " << std::endl;
1174  } else
1175  {
1176  //dim==3
1178  << " " << getTime()
1179  << " " << getXMin()
1180  << " " << getYMin()
1181  << " " << getZMin()
1182  << " " << getXMax()
1183  << " " << getYMax()
1184  << " " << getZMax()
1185  << " " << std::endl;
1186  }
1187  // This outputs the particle data
1188  for (unsigned int i = 0; i < particleHandler.getNumberOfObjects(); i++)
1189  {
1190  outputXBallsDataParticle(i, format, os);
1191  }
1192 #ifdef DEBUG_OUTPUT
1193  std::cerr << "Have output the properties of the problem to disk " << std::endl;
1194 #endif
1195 }
unsigned int getSystemDimensions() const
Returns the dimension of the simulation. Note there is also a particle dimension. ...
Definition: DPMBase.cc:575
Mdouble getZMax() const
If the length of the problem domain in z-direction is ZMax - ZMin, then getZMax() returns ZMax...
Definition: DPMBase.cc:319
Mdouble getXMin() const
If the length of the problem domain in x-direction is XMax - XMin, then getXMin() returns XMin...
Definition: DPMBase.cc:279
Mdouble getYMin() const
If the length of the problem domain in y-direction is YMax - YMin, then getYMin() returns YMin...
Definition: DPMBase.cc:295
Mdouble getXMax() const
If the length of the problem domain in x-direction is XMax - XMin, then getXMax() returns XMax...
Definition: DPMBase.cc:287
ParticleHandler particleHandler
An object of the class ParticleHandler, contains the pointers to all the particles created...
Definition: DPMBase.h:1001
virtual void outputXBallsDataParticle(const unsigned int i, const unsigned int format, std::ostream &os) const
This function writes out the particle locations into an output stream in a format the XBalls program ...
unsigned int getNumberOfObjects() const
Gets the number of Object in this BaseHandler.
Definition: BaseHandler.h:487
Mdouble getYMax() const
If the length of the problem domain in y-direction is YMax - YMin, then getYMax() returns XMax...
Definition: DPMBase.cc:303
Mdouble getZMin() const
If the length of the problem domain in z-direction is ZMax - ZMin, then getZMin() returns ZMin...
Definition: DPMBase.cc:311
Mdouble getTime() const
Access function for the time.
Definition: DPMBase.cc:169
virtual void DPMBase::outputXBallsDataParticle ( const unsigned int  i,
const unsigned int  format,
std::ostream &  os 
) const
protectedvirtual

This function writes out the particle locations into an output stream in a format the XBalls program can read.

Referenced by outputXBallsData().

void DPMBase::printTime ( ) const
protectedvirtual

Displays the current simulation time onto your screen for example.

Reimplemented in Chute.

Definition at line 886 of file DPMBase.cc.

References getTime(), and getTimeMax().

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

887 {
888  std::cout << "t=" << std::setprecision(3) << std::left << std::setw(6) << getTime()
889  << ", tmax=" << std::setprecision(3) << std::left << std::setw(6) << getTimeMax()
890  << std::endl;
891  std::cout.flush();
892 }
Mdouble getTime() const
Access function for the time.
Definition: DPMBase.cc:169
Mdouble getTimeMax() const
Allows the user to access the total simulation time during the simulation. Cannot change it though...
Definition: DPMBase.cc:214
void DPMBase::processStatistics ( bool usethese  UNUSED)
protectedvirtual

no implementation but can be overidden in its derived classes.

Reimplemented in StatisticsVector< T >.

Definition at line 831 of file DPMBase.cc.

832 {
833 }
void DPMBase::read ( std::istream &  is)
virtual

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

Todo:
warning: hides non-virtual function from the class 'Files'.
Parameters
[in]is

todo{Do we want to calculate the mass?}

Reimplemented in ChuteWithHopper, MercuryBase, and Chute.

Definition at line 1955 of file DPMBase.cc.

References boundaryHandler, BaseHandler< T >::clear(), ParticleHandler::clear(), ERROR, FATAL, helpers::getLineFromStringStream(), gravity_, INFO, interactionHandler, logger, NO_FILE, ntimeSteps_, particleDimensions_, particleHandler, random, RNG::read(), FilesAndRunNumber::read(), BaseHandler< T >::read(), BoundaryHandler::readObject(), WallHandler::readObject(), ParticleHandler::readObject(), readOld(), restartVersion_, BaseHandler< T >::setStorageCapacity(), InteractionHandler::setWriteVTK(), setXBallsAdditionalArguments(), speciesHandler, systemDimensions_, time_, timeMax_, timeStep_, wallHandler, writeParticlesVTK_, writeWallsVTK_, xMax_, xMin_, yMax_, yMin_, zMax_, and zMin_.

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

1956 {
1957  std::string dummy;
1958  is >> dummy;
1959  if (strcmp(dummy.c_str(), "restart_version"))
1960  {
1961  //only very old files did not have a restart_version
1962  logger.log(Log::FATAL, "Error in DPMBase::read(is): this is not a valid restart file");
1963  } else
1964  {
1965  is >> restartVersion_;
1966  if (!restartVersion_.compare("1.0"))
1967  {
1969  is >> dummy >> xMin_
1970  >> dummy >> xMax_
1971  >> dummy >> yMin_
1972  >> dummy >> yMax_
1973  >> dummy >> zMin_
1974  >> dummy >> zMax_
1975  >> dummy >> timeStep_
1976  >> dummy >> time_
1977  >> dummy >> ntimeSteps_
1978  >> dummy >> timeMax_
1979  >> dummy >> systemDimensions_
1980  >> dummy >> particleDimensions_
1981  >> dummy >> gravity_;
1982 
1983  std::stringstream line(std::stringstream::in | std::stringstream::out);
1985  line >> dummy;
1986  if (!dummy.compare("writeVTK")) {
1987  FileType writeInteractionsVTK = FileType::NO_FILE;
1988  line >> writeParticlesVTK_ >> writeWallsVTK_ >> writeInteractionsVTK >> dummy;
1989  interactionHandler.setWriteVTK(writeInteractionsVTK);
1990  }
1991  if (!dummy.compare("random"))
1992  {
1994  random.read(line);
1995  line >> dummy;
1997  setXBallsAdditionalArguments(line.str());
1998  }
1999 
2000  speciesHandler.read(is);
2001 
2002  unsigned int N;
2003  //std::stringstream line(std::stringstream::in | std::stringstream::out);
2004  is >> dummy >> N;
2005  if (dummy.compare("Walls"))
2006  logger(ERROR, "DPMBase::read(is): Error during restart: 'Walls' argument could not be found.");
2007  wallHandler.clear();
2010 
2011  for (unsigned int i = 0; i < N; i++)
2012  {
2014  wallHandler.readObject(line);
2015  }
2016 
2017  is >> dummy >> N;
2020  if (dummy.compare("Boundaries"))
2021  logger(ERROR, "DPMBase::read(is): Error during restart: 'Boundaries' argument could not be found.");
2023  for (unsigned int i = 0; i < N; i++)
2024  {
2027  }
2028 
2029  is >> dummy >> N;
2030  if (dummy.compare("Particles"))
2031  logger(ERROR, "DPMBase::read(is): Error during restart: 'Boundaries' argument could not be found.");
2035  for (unsigned int i = 0; i < N; i++)
2036  {
2040  //particleHandler.getLastObject()->computeMass();
2041  }
2042 
2044 
2045  } else if (!restartVersion_.compare("3"))
2046  {
2047  logger.log(Log::INFO, "DPMBase::read(is): restarting from an old restart file (restart_version %).",
2048  restartVersion_);
2049  readOld(is);
2050  } else
2051  {
2052  //only very old files did not have a restart_version
2053  logger.log(Log::FATAL,
2054  "Error in DPMBase::read(is): restart_version % cannot be read; use an older version of Mercury to upgrade the file",
2055  restartVersion_);
2056  }
2057  }
2058 }
Mdouble timeMax_
Stores the duration of the simulation.
Definition: DPMBase.h:914
Mdouble yMax_
If the length of the problem domain in y-direction is YMax - XMin, the above variable stores YMax...
Definition: DPMBase.h:866
void read(std::istream &is)
Definition: RNG.cc:52
Logger< MERCURY_LOGLEVEL > logger("MercuryKernel")
unsigned int particleDimensions_
determines if 2D or 3D particle volume is used for mass calculations
Definition: DPMBase.h:837
Mdouble yMin_
If the length of the problem domain in y-direction is YMax - YMin, the above variable stores YMin...
Definition: DPMBase.h:860
void setStorageCapacity(const unsigned int N)
Sets the storage capacity of this BaseHandler.
Definition: BaseHandler.h:501
virtual void readOld(std::istream &is)
Reads all data from a restart file, e.g. domain data and particle data; old version.
Definition: DPMBase.cc:2063
void readObject(std::istream &is)
Reads BaseParticle into the ParticleHandler from restart data.
void read(std::istream &is)
Reads all objects from restart data.
Definition: BaseHandler.h:407
Mdouble zMax_
If the length of the problem domain in z-direction is ZMax - ZMin, the above variable stores ZMax...
Definition: DPMBase.h:878
FileType
With FileType options, one is able to choose if data is to be read/written from/into no or single or ...
Definition: File.h:35
void clear()
Empties the whole ParticleHandler by removing all BaseParticle.
void readObject(std::istream &is)
Reads BaseWall into the WallHandler from restart data.
Definition: WallHandler.cc:109
unsigned int systemDimensions_
The dimensions of the simulation i.e. 2D or 3D.
Definition: DPMBase.h:832
void readObject(std::istream &is)
Reads BaseBoundary into the BoundaryHandler from restart data.
Mdouble zMin_
If the length of the problem domain in z-direction is ZMax - ZMin, the above variable stores ZMin...
Definition: DPMBase.h:872
Mdouble xMax_
If the length of the problem domain in x-direction is XMax - XMin, the above variable stores XMax...
Definition: DPMBase.h:854
file will not be created/read
unsigned int ntimeSteps_
Stores the number of time steps.
Definition: DPMBase.h:904
void getLineFromStringStream(std::istream &in, std::stringstream &out)
Reads a line from one stringstream into another, and prepares the latter for reading in...
Definition: Helpers.cc:396
BoundaryHandler boundaryHandler
An object of the class BoundaryHandler which concerns insertion and deletion of particles into or fro...
Definition: DPMBase.h:1011
ParticleHandler particleHandler
An object of the class ParticleHandler, contains the pointers to all the particles created...
Definition: DPMBase.h:1001
Mdouble time_
Stores the current simulation time.
Definition: DPMBase.h:899
void read(std::istream &is)
Accepts an input stream std::istream.
SpeciesHandler speciesHandler
A handler to that stores the species type i.e. elastic, linear visco-elastic... et cetera...
Definition: DPMBase.h:991
InteractionHandler interactionHandler
An object of the class InteractionHandler.
Definition: DPMBase.h:1016
FileType writeWallsVTK_
A flag to turn on/off the vtk writer for walls.
Definition: DPMBase.h:949
void setXBallsAdditionalArguments(std::string newXBArgs)
Set the additional arguments for xballs.
Definition: DPMBase.cc:505
Mdouble xMin_
If the length of the problem domain in x-direction is XMax - XMin, the above variable stores XMin...
Definition: DPMBase.h:848
Mdouble timeStep_
Stores the simulation time step.
Definition: DPMBase.h:909
WallHandler wallHandler
An object of the class WallHandler. Contains pointers to all the walls created.
Definition: DPMBase.h:1006
void setWriteVTK(FileType f)
RNG random
This is a random generator, often used for setting up the initial conditions etc...
Definition: DPMBase.h:996
bool writeParticlesVTK_
A flag to turn on/off the vtk writer for particles.
Definition: DPMBase.h:954
std::string restartVersion_
Previous versions of MercuryDPM had a different restart file format, the below member variable allows...
Definition: DPMBase.h:928
Vec3D gravity_
Gravity vector.
Definition: DPMBase.h:842
void clear()
Empties the whole BaseHandler by removing all Objects and setting all other variables to 0...
Definition: BaseHandler.h:392
bool DPMBase::readArguments ( int  argc,
char *  argv[] 
)

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

Parameters
[in]argc
[in]*argv[]

Definition at line 2320 of file DPMBase.cc.

References readNextArgument().

Referenced by solve().

2321 {
2322  bool isRead = true;
2323  for (int i = 1; i < argc; i += 2)
2324  {
2325  std::cout << "interpreting input argument " << argv[i];
2326  for (int j = i + 1; j < argc; j++)
2327  {
2328  if (argv[j][0] == '-')
2329  break;
2330  std::cout << " " << argv[j];
2331  }
2332  std::cout << std::endl;
2333  isRead &= readNextArgument(i, argc, argv);
2334  if (!isRead)
2335  {
2336  std::cerr << "Warning: not all arguments read correctly!" << std::endl;
2337  exit(-1);
2338  }
2339  }
2340  return isRead;
2341 }
virtual bool readNextArgument(int &i, int argc, char *argv[])
Interprets the i^th command-line argument.
Definition: DPMBase.cc:2349
bool DPMBase::readDataFile ( const std::string  fileName,
unsigned int  format = 0 
)

This allows particle data to be reloaded from data files.

E.g. If one has a data file. This function loads data from the .data file i.e. you get position, velocity, angular velocty, radius .. info. See also MD::readRestartFile For XBalls: Can read in format_ 14 - 8 or format_ 7 data format. This code saves in format_ 8 for 2D and format_ 14 for 3D. So if no extra parameters are specified it will assume things many parameters, like density cannot be set using the data file.

Parameters
[in]fileName
[in]format(format for specifying if its for 2D or 3D data)
Returns
bool (True or False)

Definition at line 1202 of file DPMBase.cc.

References File::close(), Files::dataFile, File::getFileType(), File::getFstream(), File::getName(), ONE_FILE, File::open(), readNextDataFile(), File::setFileType(), and File::setName().

Referenced by readNextArgument().

1203 {
1204  std::string oldFileName = dataFile.getName();
1205  //This opens the file the data will be recalled from
1206  dataFile.setName(fileName);
1207  dataFile.open(std::fstream::in);
1208  if (!dataFile.getFstream().is_open() || dataFile.getFstream().bad())
1209  {
1210  std::cout << "Loading data file " << fileName << " failed" << std::endl;
1211  return false;
1212  }
1213 
1214  //dataFile.getFileType() is ignored
1215  FileType fileTypeData = dataFile.getFileType();
1217  readNextDataFile(format);
1218  dataFile.setFileType(fileTypeData);
1219 
1220  dataFile.close();
1221  dataFile.setName(oldFileName);
1222 
1223  //std::cout << "Loaded data file " << filename << " (t=" << getTime() << ")" << std::endl;
1224  return true;
1225 }
FileType getFileType() const
Gets the file type e.g. NOFILE, ONEFILE and MULTIPLE FILES. File::fileType_.
Definition: File.cc:203
FileType
With FileType options, one is able to choose if data is to be read/written from/into no or single or ...
Definition: File.h:35
void close()
Closes the file by calling fstream_.close()
Definition: File.cc:362
std::fstream & getFstream()
Allows to access the member variable File::fstream_.
Definition: File.cc:151
all data will be written into/ read from a single file called name_
File dataFile
An instance of class File to handle in- and output into a .data file.
Definition: Files.h:204
bool readNextDataFile(unsigned int format=0)
Reads the next data file with default format=0. However, one can modify the format based on whether t...
Definition: DPMBase.cc:1434
void setFileType(FileType fileType)
Sets the type of file needed to write into or read from. File::fileType_.
Definition: File.cc:210
bool open()
Checks if the file stream fstream_ has any issues while opening. Alongside, it also increments the ne...
Definition: File.cc:320
void setName(const std::string &name)
Sets the file name, e.g. "Name.data".
Definition: File.cc:196
const std::string & getName() const
Allows to access the file name, e.g., "problem.data".
Definition: File.cc:163
bool DPMBase::readNextArgument ( int &  i,
int  argc,
char *  argv[] 
)
virtual

Interprets the i^th command-line argument.

Parameters
[in]i
[in]argc
[in]*argv[]
Returns
bool (True or False)

argv[i+1] interpreted as argument of type char*, Mdouble, integer or boolean unless noted

-gravity_ requires three arguments

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

-clean of -c removes all files <name>.*.

Reimplemented in MercuryBase, ChuteWithHopper, Chute, and Mercury3DRestart.

Definition at line 2349 of file DPMBase.cc.

References FilesAndRunNumber::autoNumber(), Files::dataFile, Files::eneFile, Files::fStatFile, Files::getName(), getNtimeSteps(), File::getSaveCount(), getTimeMax(), getTimeStep(), random, RNG::randomise(), readDataFile(), readRestartFile(), Files::restartFile, setAddLarge(), setAddSmall(), setAppend(), File::setFileType(), Files::setFileType(), setFixedParticles(), setGravity(), Files::setName(), Files::setNextSavedTimeStep(), FilesAndRunNumber::setRunNumber(), File::setSaveCount(), Files::setSaveCount(), setSystemDimensions(), setTimeMax(), setTimeStep(), setXMax(), setXMin(), setYMax(), setYMin(), setZMax(), setZMin(), Files::statFile, and to_string_padded().

Referenced by readArguments(), and MercuryBase::readNextArgument().

2350 {
2352  if (!strcmp(argv[i], "-name"))
2353  {
2354  setName(argv[i + 1]);
2355  } else if (!strcmp(argv[i], "-xmin"))
2356  {
2357  setXMin(atof(argv[i + 1]));
2358  } else if (!strcmp(argv[i], "-ymin"))
2359  {
2360  setYMin(atof(argv[i + 1]));
2361  } else if (!strcmp(argv[i], "-zmin"))
2362  {
2363  setZMin(atof(argv[i + 1]));
2364  } else if (!strcmp(argv[i], "-xmax"))
2365  {
2366  setXMax(atof(argv[i + 1]));
2367  } else if (!strcmp(argv[i], "-ymax"))
2368  {
2369  setYMax(atof(argv[i + 1]));
2370  } else if (!strcmp(argv[i], "-zmax"))
2371  {
2372  setZMax(atof(argv[i + 1]));
2373  //} else if (!strcmp(argv[i],"-svn")) {
2374  // std::cout << "svn version " << SVN_VERSION << std::endl;
2375  // i--;
2376  } else if (!strcmp(argv[i], "-addS"))
2377  {
2378  setAddSmall(atof(argv[i + 1]));
2379  } else if (!strcmp(argv[i], "-addL"))
2380  {
2381  setAddLarge(atof(argv[i + 1]));
2382  } else if (!strcmp(argv[i], "-dt"))
2383  {
2384  Mdouble old = getTimeStep();
2385  setTimeStep(atof(argv[i + 1]));
2386  std::cout << " reset dt from " << old << " to " << getTimeStep() << std::endl;
2387  }
2388 // else if (!strcmp(argv[i], "-Hertz"))
2389 // {
2390 // speciesHandler.getObject(0)->setForceType(ForceType::HERTZ);
2391 // i--;
2392 // }
2393  else if (!strcmp(argv[i], "-tmax"))
2394  {
2395  Mdouble old = getTimeMax();
2396  setTimeMax(atof(argv[i + 1]));
2397  std::cout << " reset timeMax from " << old << " to " << getTimeMax() << std::endl;
2398  } else if (!strcmp(argv[i], "-saveCount"))
2399  {
2400  Mdouble old = dataFile.getSaveCount();
2401  setSaveCount(static_cast<unsigned int>(atoi(argv[i + 1])));
2403  std::cout << " reset saveCount from " << old << " to " << dataFile.getSaveCount() << std::endl;
2404  } else if (!strcmp(argv[i], "-saveCountData"))
2405  {
2406  dataFile.setSaveCount(static_cast<unsigned int>(atoi(argv[i + 1])));
2407  } else if (!strcmp(argv[i], "-saveCountFStat"))
2408  {
2409  fStatFile.setSaveCount(static_cast<unsigned int>(atoi(argv[i + 1])));
2410  } else if (!strcmp(argv[i], "-saveCountStat"))
2411  {
2412  statFile.setSaveCount(static_cast<unsigned int>(atoi(argv[i + 1])));
2413  } else if (!strcmp(argv[i], "-saveCountEne"))
2414  {
2415  eneFile.setSaveCount(static_cast<unsigned int>(atoi(argv[i + 1])));
2416  } else if (!strcmp(argv[i], "-saveCountRestart"))
2417  {
2418  restartFile.setSaveCount(static_cast<unsigned int>(atoi(argv[i + 1])));
2419  } else if (!strcmp(argv[i], "-dim"))
2420  {
2421  setSystemDimensions(static_cast<unsigned int>(atoi(argv[i + 1])));
2422  } else if (!strcmp(argv[i], "-gravity"))
2423  {
2425  setGravity(Vec3D(atof(argv[i + 1]), atof(argv[i + 2]), atof(argv[i + 3])));
2426  i += 2;
2427  } else if (!strcmp(argv[i], "-fileType"))
2428  { //uses int input
2429  setFileType(static_cast<FileType>(atoi(argv[i + 1])));
2430  } else if (!strcmp(argv[i], "-fileTypeFStat"))
2431  { //uses int input
2432  fStatFile.setFileType(static_cast<FileType>(atoi(argv[i + 1])));
2433  } else if (!strcmp(argv[i], "-fileTypeRestart"))
2434  {
2435  restartFile.setFileType(static_cast<FileType>(atoi(argv[i + 1])));
2436  } else if (!strcmp(argv[i], "-fileTypeData"))
2437  {
2438  dataFile.setFileType(static_cast<FileType>(atoi(argv[i + 1])));
2439  } else if (!strcmp(argv[i], "-fileTypeStat"))
2440  {
2441  statFile.setFileType(static_cast<FileType>(atoi(argv[i + 1])));
2442  } else if (!strcmp(argv[i], "-fileTypeEne"))
2443  {
2444  eneFile.setFileType(static_cast<FileType>(atoi(argv[i + 1])));
2445  } else if (!strcmp(argv[i], "-auto_number"))
2446  {
2447  autoNumber();
2448  i--;
2449  }
2450 // else if (!strcmp(argv[i], "-number_of_saves"))
2451 // {
2452 // set_number_of_saves_all(atof(argv[i + 1]));
2453 // }
2454  else if (!strcmp(argv[i], "-restart") || !strcmp(argv[i], "-r"))
2455  {
2459  std::string filename;
2460 
2461  //use default filename if no argument is given
2462  if (i + 1 >= argc || argv[i + 1][0] == '-')
2463  {
2464  i--;
2465  filename = getName();
2466  std::cout << getName() << std::endl;
2467  } else
2468  filename = argv[i + 1];
2469 
2470  //add ".restart" if necessary
2471  if (filename.find(".restart") == std::string::npos)
2472  {
2473  filename = filename + ".restart";
2474  }
2475 
2476  std::cout << "restart from " << filename << std::endl;
2477  readRestartFile(filename);
2478  } else if (!strcmp(argv[i], "-clean") || !strcmp(argv[i], "-c"))
2479  {
2480  std::cout << "Remove old " << getName() << ".* files" << std::endl;
2482 // std::string filename;
2483  std::ostringstream filename;
2484  std::vector<std::string> ext{".restart", ".stat", ".fstat", ".data", ".ene", ".xballs"};
2485  for (unsigned int j = 0; j < ext.size(); j++)
2486  {
2487  // remove files with given extension for FileType::ONE_FILE
2488  filename.clear();
2489  filename << getName() << ext[j];
2490  if (!remove(filename.str().c_str()))
2491  {
2492  std::cout << " File " << filename.str() << " successfully deleted" << std::endl;
2493  }
2494  // remove files with given extension for FileType::MULTIPLE_FILES
2495  unsigned int k = 0;
2496  filename.clear();
2497  filename << getName() << ext[j] << '.' << k;
2498  while (!remove(filename.str().c_str()))
2499  {
2500  std::cout << " File " << filename.str() << " successfully deleted" << std::endl;
2501  filename.clear();
2502  filename << getName() << ext[j] << '.' << ++k;
2503  }
2504  // remove files with given extension for FileType::MULTIPLE_FILES_PADDED
2505  k = 0;
2506  filename.clear();
2507  filename << getName() << ext[j] << '.' << to_string_padded(k);
2508  while (!remove(filename.str().c_str()))
2509  {
2510  std::cout << " File " << filename.str() << " successfully deleted" << std::endl;
2511  filename.clear();
2512  filename << getName() << ext[j] << '.' << to_string_padded(++k);
2513  }
2514  }
2515  i--;
2516  } else if (!strcmp(argv[i], "-data"))
2517  {
2518  std::string filename = argv[i + 1];
2519  readDataFile(filename.c_str());
2520  }
2521 // else if (!strcmp(argv[i], "-k"))
2522 // {
2523 // Mdouble old = getSpecies(0)->getStiffness();
2524 // getSpecies(0)->setStiffness(atof(argv[i + 1]));
2525 // std::cout << " reset k from " << old << " to " << getSpecies(0)->getStiffness() << std::endl;
2526 // }
2527 // else if (!strcmp(argv[i], "-dissipation") || !strcmp(argv[i], "-disp"))
2528 // {
2529 // Mdouble old = getSpecies(0)->getDissipation();
2530 // getSpecies(0)->setDissipation(atof(argv[i + 1]));
2531 // std::cout << " reset getDissipation() from " << old << " to " << getSpecies(0)->getDissipation() << std::endl;
2532 // }
2533 // else if (!strcmp(argv[i], "-kt"))
2534 // {
2535 // Mdouble old = getSpecies(0)->getSlidingStiffness();
2536 // getSpecies(0)->setSlidingStiffness(atof(argv[i + 1]));
2537 // std::cout << " reset kt from " << old << " to " << getSpecies(0)->getSlidingStiffness() << std::endl;
2538 // }
2539 // else if (!strcmp(argv[i], "-dispt"))
2540 // {
2541 // Mdouble old = getSpecies(0)->getSlidingDissipation();
2542 // getSpecies(0)->setSlidingDissipation(atof(argv[i + 1]));
2543 // std::cout << " reset dispt from " << old << " to " << getSpecies(0)->getSlidingDissipation() << std::endl;
2544 // }
2545 // else if (!strcmp(argv[i], "-krolling"))
2546 // {
2547 // Mdouble old = getSpecies(0)->getRollingStiffness();
2548 // getSpecies(0)->setRollingStiffness(atof(argv[i + 1]));
2549 // std::cout << " reset krolling from " << old << " to " << getSpecies(0)->getRollingStiffness() << std::endl;
2550 // }
2551 // else if (!strcmp(argv[i], "-disprolling"))
2552 // {
2553 // Mdouble old = getSpecies(0)->getRollingDissipation();
2554 // getSpecies(0)->setRollingDissipation(atof(argv[i + 1]));
2555 // std::cout << " reset disprolling from " << old << " to " << getSpecies(0)->getRollingDissipation() << std::endl;
2556 // }
2557 // else if (!strcmp(argv[i], "-mu"))
2558 // {
2559 // Mdouble old = getSpecies(0)->getSlidingFrictionCoefficient();
2560 // getSpecies(0)->setSlidingFrictionCoefficient(atof(argv[i + 1]));
2561 // std::cout << " reset mu from " << old << " to " << getSpecies(0)->getSlidingFrictionCoefficient() << std::endl;
2562 // }
2563 // else if (!strcmp(argv[i], "-murolling"))
2564 // {
2565 // Mdouble old = getSpecies(0)->getRollingFrictionCoefficient();
2566 // getSpecies(0)->setRollingFrictionCoefficient(atof(argv[i + 1]));
2567 // std::cout << " reset murolling from " << old << " to " << getSpecies(0)->getRollingFrictionCoefficient() << std::endl;
2568 // }
2569  else if (!strcmp(argv[i], "-randomise") || !strcmp(argv[i], "-randomize"))
2570  {
2571  random.randomise();
2572  i--;
2573  }
2574 // else if (!strcmp(argv[i], "-k0"))
2575 // {
2576 // Mdouble old = speciesHandler.getObject(0)->getAdhesionStiffness();
2577 // speciesHandler.getObject(0)->setAdhesionStiffness(atof(argv[i + 1]));
2578 // std::cout << " reset k0 from " << old << " to " << speciesHandler.getObject(0)->getAdhesionStiffness() << std::endl;
2579 // }
2580 // else if (!strcmp(argv[i], "-f0"))
2581 // {
2582 // Mdouble old = speciesHandler.getObject(0)->getBondForceMax();
2583 // speciesHandler.getObject(0)->setBondForceMax(atof(argv[i + 1]));
2584 // std::cout << " reset f0 from " << old << " to " << speciesHandler.getObject(0)->getBondForceMax() << std::endl;
2585 // }
2586 // else if (!strcmp(argv[i], "-AdhesionForceType"))
2587 // {
2588 // AdhesionForceType old = speciesHandler.getObject(0)->getAdhesionForceType();
2589 // speciesHandler.getObject(0)->setAdhesionForceType(argv[i + 1]);
2590 // std::cout << " reset AdhesionForceType from "
2591 // << static_cast<signed char>(old) << " to "
2592 // << static_cast<signed char>(speciesHandler.getObject(0)->getAdhesionForceType()) << std::endl;
2593 // }
2594  else if (!strcmp(argv[i], "-append"))
2595  {
2596  setAppend(true);
2597  i--;
2598  } else if (!strcmp(argv[i], "-fixedParticles"))
2599  {
2600  setFixedParticles(static_cast<unsigned int>(atoi(argv[i + 1])));
2601  }
2602 // else if (!strcmp(argv[i], "-rho"))
2603 // {
2604 // Mdouble old = speciesHandler.getObject(0)->getDensity();
2605 // speciesHandler.getObject(0)->setDensity(atof(argv[i + 1]));
2606 // std::cout << " reset rho from " << old << " to " << speciesHandler.getObject(0)->getDensity() << std::endl;
2607 // }
2608 // else if (!strcmp(argv[i], "-dim_particle"))
2609 // {
2610 // setParticleDimensions(atoi(argv[i + 1]));
2611 // }
2612  else if (!strcmp(argv[i], "-counter"))
2613  {
2614  setRunNumber(atoi(argv[i + 1]));
2615  } else
2616  return false;
2617  return true; //returns true if argv is found
2618 }
void setXMax(Mdouble newXMax)
If the length of the problem domain in x-direction is XMax - XMin, this method sets XMax...
Definition: DPMBase.cc:415
void setNextSavedTimeStep(unsigned int nextSavedTimeStep)
Sets the next time step for all the files (ene, data, fstat, restart, stat) at which the data is to b...
Definition: Files.cc:263
void setTimeMax(Mdouble newTMax)
Allows the upper time limit to be changed.
Definition: DPMBase.cc:199
void setAddLarge(int new_addL)
sets the number of large particles that are to be added on restart.
Definition: DPMBase.cc:351
bool readRestartFile(bool restarted=true)
Reads all the particle data corresponding to the current saved time step. Which is what the restart f...
Definition: DPMBase.cc:1629
void setYMin(Mdouble newYMin)
If the length of the problem domain in y-direction is YMax - YMin, this method sets YMin...
Definition: DPMBase.cc:371
void setAddSmall(int new_addS)
sets the number of small particles that are to be added on restart.
Definition: DPMBase.cc:343
bool readDataFile(const std::string fileName, unsigned int format=0)
This allows particle data to be reloaded from data files.
Definition: DPMBase.cc:1202
File restartFile
An instance of class File to handle in- and output into a .restart file.
Definition: Files.h:219
double Mdouble
void setZMax(Mdouble newZMax)
If the length of the problem domain in z-direction is XMax - XMin, this method sets ZMax...
Definition: DPMBase.cc:439
void setAppend(bool newAppendFlag)
Allows to set the append option.
Definition: DPMBase.cc:651
void setSystemDimensions(unsigned int newDim)
Allows for the dimension of the simulation to be changed.
Definition: DPMBase.cc:562
void setFileType(FileType fileType)
Sets File::fileType_ for all files (ene, data, fstat, restart, stat)
Definition: Files.cc:170
void setGravity(Vec3D newGravity)
Allows to modify the gravity vector.
Definition: DPMBase.cc:537
void randomise()
sets the random variables such that they differ for each run
Definition: RNG.cc:91
void setRunNumber(int runNumber)
This sets the counter/Run number, overriding the defaults.
unsigned int getSaveCount() const
Gets File::saveCount_.
Definition: File.cc:275
void setYMax(Mdouble newYMax)
If the length of the problem domain in y-direction is YMax - YMin, this method sets YMax...
Definition: DPMBase.cc:427
File eneFile
An instance of class File to handle in- and output into a .ene file.
Definition: Files.h:214
void setName(const std::string &name)
Allows to set the name of all the files (ene, data, fstat, restart, stat)
Definition: Files.cc:150
void setXMin(Mdouble newXMin)
If the length of the problem domain in x-direction is XMax - XMin, this method sets XMin...
Definition: DPMBase.cc:359
unsigned int getNtimeSteps() const
Returns the current counter of time steps.
Definition: DPMBase.cc:177
File fStatFile
An instance of class File to handle in- and output into a .fstat file.
Definition: Files.h:209
void setSaveCount(unsigned int saveCount)
Sets File::saveCount_ for all files (ene, data, fstat, restart, stat)
Definition: Files.cc:139
File dataFile
An instance of class File to handle in- and output into a .data file.
Definition: Files.h:204
void setZMin(Mdouble newZMin)
If the length of the problem domain in z-direction is ZMax - ZMin, this method sets ZMin...
Definition: DPMBase.cc:383
void setSaveCount(unsigned int saveCount)
Sets File::saveCount_.
Definition: File.cc:283
void setFixedParticles(unsigned int n)
Definition: DPMBase.cc:877
void setFileType(FileType fileType)
Sets the type of file needed to write into or read from. File::fileType_.
Definition: File.cc:210
RNG random
This is a random generator, often used for setting up the initial conditions etc...
Definition: DPMBase.h:996
std::string to_string_padded(unsigned int value)
Pads the number This function tries to pad the number to 4 digits, which is used when you create mult...
Definition: File.cc:61
void autoNumber()
The autoNumber() function is the trigger. It calls three functions. setRunNumber(), readRunNumberFromFile() and incrementRunNumberInFile().
void setTimeStep(Mdouble newDt)
Allows the time step dt to be changed.
Definition: DPMBase.cc:451
Implementation of a 3D vector (by Vitaliy).
Definition: Vector.h:45
Mdouble getTimeStep() const
Allows the time step dt to be accessed.
Definition: DPMBase.cc:465
File statFile
An instance of class File to handle in- and output into a .stat file.
Definition: Files.h:224
const std::string & getName() const
Returns the name of the file. Does not allow to change it though.
Definition: Files.cc:132
Mdouble getTimeMax() const
Allows the user to access the total simulation time during the simulation. Cannot change it though...
Definition: DPMBase.cc:214
bool DPMBase::readNextDataFile ( unsigned int  format = 0)

Reads the next data file with default format=0. However, one can modify the format based on whether the particle data corresponds to 3D or 2D data. See XBalls/xballs.txt.

Parameters
[in]format

Definition at line 1434 of file DPMBase.cc.

References ParticleHandler::computeAllMasses(), BaseHandler< T >::copyAndAddObject(), Files::dataFile, File::getFstream(), BaseHandler< T >::getLastObject(), helpers::getLineFromStringStream(), BaseHandler< T >::getNumberOfObjects(), BaseHandler< T >::getObject(), getSystemDimensions(), INFO, logger, File::openNextFile(), particleHandler, ParticleHandler::removeLastObject(), BaseParticle::setSpecies(), setTime(), setXMax(), setXMin(), setYMax(), setYMin(), setZMax(), setZMin(), speciesHandler, time_, BaseParticle::unfix(), Vec3D::X, xMax_, xMin_, Vec3D::Y, yMax_, yMin_, Vec3D::Z, zMax_, and zMin_.

Referenced by main(), and readDataFile().

1435 {
1436  dataFile.openNextFile(std::fstream::in);
1437  //fStatFile.openNextFile();
1438  //Set the correct formation based of dimension if the formation is not specified by the user
1439  if (format == 0)
1440  {
1441  switch (getSystemDimensions())
1442  {
1443  case 1:
1444  case 2:
1445  format = 8;
1446  break;
1447  case 3:
1448  format = 14;
1449  break;
1450  }
1451  //end case
1452 
1453  }
1454  //end if
1455 
1456  unsigned int N = 0;
1457  Mdouble dummy;
1458  dataFile.getFstream() >> N;
1459  //read first parameter and check if we reached the end of the file
1460  if (N == 0)
1461  {
1462  //std::cout << "Reached the end of the data file" << std::endl;
1463  return false;
1464  }
1465 
1466  //create particles if N is not fixed
1468  {
1470  {
1471  BaseParticle p;
1474  std::cout << "Warning in readNextDataFile: particleHandler is empty, "
1475  "so newly created particles will be of BaseParticle type." << std::endl;
1476  }
1478  {
1479  while (particleHandler.getNumberOfObjects() != N)
1480  {
1482  //std::cout << "S" << particleHandler.getNumberOfObjects() << std::endl;
1483  }
1484  } else
1485  {
1486  while (particleHandler.getNumberOfObjects() != N)
1487  {
1490  //std::cout << particleHandler.getNumberOfObjects() << N << std::endl;
1491  }
1492  }
1493  }
1494  //for (auto p: particleHandler)
1495  // std::cout << *p << std::endl;
1496 #ifdef DEBUG_OUTPUT
1497  std::cout << "Number of particles read from file "<<N << std::endl;
1498 #endif
1499 
1500  //read all other data available for the time step
1501  switch (format)
1502  {
1503  //This is the format_ that Stefan's and Vitaly's code saves in - note the axis rotation_
1504  case 7:
1505  {
1506  std::stringstream line;
1508  line >> dummy;
1510  line >> dummy;
1511  setTime(dummy);
1513  line >> dummy;
1514  setXMin(dummy);
1516  line >> dummy;
1517  setYMin(dummy);
1519  line >> dummy;
1520  setZMin(dummy);
1522  line >> dummy;
1523  setXMax(dummy);
1525  line >> dummy;
1526  setYMax(dummy);
1528  line >> dummy;
1529  setZMax(dummy);
1530  //std::cout << " time " << t << std::endl;
1531  Mdouble radius;
1532  Vec3D position, velocity;
1533  for (BaseParticle* p : particleHandler)
1534  {
1536  line >> position.X >> position.Z >> position.Y >> velocity.X >> velocity.Z >> velocity.Y >> radius
1537  >> dummy;
1538  p->setPosition(position);
1539  p->setVelocity(velocity);
1540  p->setOrientation(Vec3D(0.0, 0.0, 0.0));
1541  p->setAngularVelocity(Vec3D(0.0, 0.0, 0.0));
1542  p->setRadius(radius);
1543  }
1544  break;
1545  }
1546  //This is a 2D format_
1547  case 8:
1548  {
1549  std::stringstream line;
1551  line >> time_ >> xMin_ >> yMin_ >> xMax_ >> yMax_;
1552  zMin_ = 0.0;
1553  zMax_ = 0.0;
1554  Mdouble radius;
1555  Vec3D position, velocity, angle, angularVelocity;
1556  for (BaseParticle* p : particleHandler)
1557  {
1559  line >> position.X >> position.Y >> velocity.X >> velocity.Y >> radius >> angle.Z >> angularVelocity.Z
1560  >> dummy;
1561  p->setPosition(position);
1562  p->setVelocity(velocity);
1563  p->setOrientation(-angle);
1564  p->setAngularVelocity(-angularVelocity);
1565  p->setRadius(radius);
1566  } //end for all particles
1567  break;
1568  }
1569  //This is a 3D format_
1570  case 14:
1571  {
1572  std::stringstream line;
1574  line >> time_ >> xMin_ >> yMin_ >> zMin_ >> xMax_ >> yMax_ >> zMax_;
1575  Mdouble radius;
1576  Vec3D position, velocity, angle, angularVelocity;
1577  for (BaseParticle* p : particleHandler)
1578  {
1580  line >> position >> velocity >> radius >> angle >> angularVelocity;
1581  p->setPosition(position);
1582  p->setVelocity(velocity);
1583  p->setOrientation(angle);
1584  p->setAngularVelocity(angularVelocity);
1585  p->setRadius(radius);
1586  } //end read into existing particles
1587  logger(INFO, "read % particles", particleHandler.getNumberOfObjects());
1588  break;
1589  }
1590  //This is a 3D format_
1591  case 15:
1592  {
1593  std::stringstream line;
1595  line >> time_ >> xMin_ >> yMin_ >> zMin_ >> xMax_ >> yMax_ >> zMax_;
1596  Mdouble radius;
1597  Vec3D position, velocity, angle, angularVelocity;
1598  for (BaseParticle* p : particleHandler)
1599  {
1601  line >> position >> velocity >> radius >> angle >> angularVelocity >> dummy >> dummy;
1602  p->setPosition(position);
1603  p->setVelocity(velocity);
1604  p->setOrientation(angle);
1605  p->setAngularVelocity(angularVelocity);
1606  p->setRadius(radius);
1607  } //end for all particles
1608  break;
1609  }
1610  } //end switch statement
1611  particleHandler.computeAllMasses();
1612  return true;
1613 }
void setTime(Mdouble time)
Access function for the time.
Definition: DPMBase.cc:185
void setXMax(Mdouble newXMax)
If the length of the problem domain in x-direction is XMax - XMin, this method sets XMax...
Definition: DPMBase.cc:415
Mdouble yMax_
If the length of the problem domain in y-direction is YMax - XMin, the above variable stores YMax...
Definition: DPMBase.h:866
Mdouble X
the vector components
Definition: Vector.h:52
void setVelocity(const Vec3D &velocity)
set the velocity of the BaseInteractable.
unsigned int getSystemDimensions() const
Returns the dimension of the simulation. Note there is also a particle dimension. ...
Definition: DPMBase.cc:575
Logger< MERCURY_LOGLEVEL > logger("MercuryKernel")
Mdouble yMin_
If the length of the problem domain in y-direction is YMax - YMin, the above variable stores YMin...
Definition: DPMBase.h:860
void setOrientation(const Vec3D &orientation)
Sets the orientation of this BaseInteractable.
void setYMin(Mdouble newYMin)
If the length of the problem domain in y-direction is YMax - YMin, this method sets YMin...
Definition: DPMBase.cc:371
double Mdouble
void unfix()
Unfix Particle function, which required a reference to the Species vector. It unfixes a Particle by c...
void setZMax(Mdouble newZMax)
If the length of the problem domain in z-direction is XMax - XMin, this method sets ZMax...
Definition: DPMBase.cc:439
bool openNextFile()
This function should be called before a data corresponding to the new time step is written or read...
Definition: File.cc:231
void setSpecies(const ParticleSpecies *species)
void setRadius(const Mdouble radius)
Sets the particle's radius_ (and adjusts the mass_ accordingly, based on the particle's species) ...
Mdouble zMax_
If the length of the problem domain in z-direction is ZMax - ZMin, the above variable stores ZMax...
Definition: DPMBase.h:878
void setYMax(Mdouble newYMax)
If the length of the problem domain in y-direction is YMax - YMin, this method sets YMax...
Definition: DPMBase.cc:427
Mdouble zMin_
If the length of the problem domain in z-direction is ZMax - ZMin, the above variable stores ZMin...
Definition: DPMBase.h:872
Mdouble xMax_
If the length of the problem domain in x-direction is XMax - XMin, the above variable stores XMax...
Definition: DPMBase.h:854
std::fstream & getFstream()
Allows to access the member variable File::fstream_.
Definition: File.cc:151
void getLineFromStringStream(std::istream &in, std::stringstream &out)
Reads a line from one stringstream into another, and prepares the latter for reading in...
Definition: Helpers.cc:396
void setXMin(Mdouble newXMin)
If the length of the problem domain in x-direction is XMax - XMin, this method sets XMin...
Definition: DPMBase.cc:359
ParticleHandler particleHandler
An object of the class ParticleHandler, contains the pointers to all the particles created...
Definition: DPMBase.h:1001
void removeLastObject()
Removes the last BaseParticle from the ParticleHandler.
T * getObject(const unsigned int id)
Gets a pointer to the Object at the specified index in the BaseHandler.
Definition: BaseHandler.h:451
Mdouble time_
Stores the current simulation time.
Definition: DPMBase.h:899
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:295
File dataFile
An instance of class File to handle in- and output into a .data file.
Definition: Files.h:204
void setZMin(Mdouble newZMin)
If the length of the problem domain in z-direction is ZMax - ZMin, this method sets ZMin...
Definition: DPMBase.cc:383
unsigned int getNumberOfObjects() const
Gets the number of Object in this BaseHandler.
Definition: BaseHandler.h:487
SpeciesHandler speciesHandler
A handler to that stores the species type i.e. elastic, linear visco-elastic... et cetera...
Definition: DPMBase.h:991
Mdouble Y
Definition: Vector.h:52
Mdouble xMin_
If the length of the problem domain in x-direction is XMax - XMin, the above variable stores XMin...
Definition: DPMBase.h:848
void setPosition(const Vec3D &position)
Sets the position of this BaseInteractable.
T * getLastObject()
Gets a pointer to the last Object in this BaseHandler.
Definition: BaseHandler.h:473
Implementation of a 3D vector (by Vitaliy).
Definition: Vector.h:45
Mdouble Z
Definition: Vector.h:52
void setAngularVelocity(const Vec3D &angularVelocity)
set the angular velocity of the BaseInteractble.
void DPMBase::readOld ( std::istream &  is)
virtual

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

Parameters
[in]is

Definition at line 2063 of file DPMBase.cc.

References boundaryHandler, Files::dataFile, Files::eneFile, Files::fStatFile, gravity_, particleHandler, BaseHandler< T >::read(), Files::restartFile, File::setFileType(), Files::setName(), File::setSaveCount(), speciesHandler, Files::statFile, systemDimensions_, time_, timeMax_, timeStep_, wallHandler, xMax_, xMin_, yMax_, yMin_, zMax_, and zMin_.

Referenced by read().

2064 {
2065  std::string dummy;
2066  is >> dummy >> dummy;
2067  setName(dummy);
2068 
2069  unsigned int saveCountData, saveCountEne, saveCountStat, saveCountFStat;
2070  unsigned int fileTypeFstat, fileTypeData, fileTypeEne, fileTypeRestart;
2071  is >> dummy >> xMin_
2072  >> dummy >> xMax_
2073  >> dummy >> yMin_
2074  >> dummy >> yMax_
2075  >> dummy >> zMin_
2076  >> dummy >> zMax_
2077  >> dummy >> timeStep_
2078  >> dummy >> time_
2079  >> dummy >> timeMax_
2080  >> dummy >> saveCountData
2081  >> dummy >> saveCountEne
2082  >> dummy >> saveCountStat
2083  >> dummy >> saveCountFStat
2084  >> dummy >> systemDimensions_
2085  >> dummy >> gravity_
2086  >> dummy >> fileTypeFstat
2087  >> dummy >> fileTypeData
2088  >> dummy >> fileTypeEne;
2089  dataFile.setSaveCount(saveCountData);
2090  eneFile.setSaveCount(saveCountEne);
2091  statFile.setSaveCount(saveCountStat);
2092  fStatFile.setSaveCount(saveCountFStat);
2093 
2094  fStatFile.setFileType(static_cast<FileType>(fileTypeFstat));
2095  dataFile.setFileType(static_cast<FileType>(fileTypeData));
2096  eneFile.setFileType(static_cast<FileType>(fileTypeEne));
2097 
2098  //this is optional to allow restart files with and without restartFile.getFileType()
2099  is >> dummy;
2100  if (!strcmp(dummy.c_str(), "options_restart"))
2101  {
2102  is >> fileTypeRestart;
2103  restartFile.setFileType(static_cast<FileType>(fileTypeRestart));
2104  }
2105 
2106  speciesHandler.read(is);
2107  wallHandler.read(is);
2108  boundaryHandler.read(is);
2109  particleHandler.read(is);
2110 }
Mdouble timeMax_
Stores the duration of the simulation.
Definition: DPMBase.h:914
Mdouble yMax_
If the length of the problem domain in y-direction is YMax - XMin, the above variable stores YMax...
Definition: DPMBase.h:866
Mdouble yMin_
If the length of the problem domain in y-direction is YMax - YMin, the above variable stores YMin...
Definition: DPMBase.h:860
File restartFile
An instance of class File to handle in- and output into a .restart file.
Definition: Files.h:219
void read(std::istream &is)
Reads all objects from restart data.
Definition: BaseHandler.h:407
Mdouble zMax_
If the length of the problem domain in z-direction is ZMax - ZMin, the above variable stores ZMax...
Definition: DPMBase.h:878
unsigned int systemDimensions_
The dimensions of the simulation i.e. 2D or 3D.
Definition: DPMBase.h:832
File eneFile
An instance of class File to handle in- and output into a .ene file.
Definition: Files.h:214
Mdouble zMin_
If the length of the problem domain in z-direction is ZMax - ZMin, the above variable stores ZMin...
Definition: DPMBase.h:872
Mdouble xMax_
If the length of the problem domain in x-direction is XMax - XMin, the above variable stores XMax...
Definition: DPMBase.h:854
void setName(const std::string &name)
Allows to set the name of all the files (ene, data, fstat, restart, stat)
Definition: Files.cc:150
BoundaryHandler boundaryHandler
An object of the class BoundaryHandler which concerns insertion and deletion of particles into or fro...
Definition: DPMBase.h:1011
ParticleHandler particleHandler
An object of the class ParticleHandler, contains the pointers to all the particles created...
Definition: DPMBase.h:1001
Mdouble time_
Stores the current simulation time.
Definition: DPMBase.h:899
File fStatFile
An instance of class File to handle in- and output into a .fstat file.
Definition: Files.h:209
File dataFile
An instance of class File to handle in- and output into a .data file.
Definition: Files.h:204
void setSaveCount(unsigned int saveCount)
Sets File::saveCount_.
Definition: File.cc:283
SpeciesHandler speciesHandler
A handler to that stores the species type i.e. elastic, linear visco-elastic... et cetera...
Definition: DPMBase.h:991
Mdouble xMin_
If the length of the problem domain in x-direction is XMax - XMin, the above variable stores XMin...
Definition: DPMBase.h:848
Mdouble timeStep_
Stores the simulation time step.
Definition: DPMBase.h:909
void setFileType(FileType fileType)
Sets the type of file needed to write into or read from. File::fileType_.
Definition: File.cc:210
WallHandler wallHandler
An object of the class WallHandler. Contains pointers to all the walls created.
Definition: DPMBase.h:1006
File statFile
An instance of class File to handle in- and output into a .stat file.
Definition: Files.h:224
Vec3D gravity_
Gravity vector.
Definition: DPMBase.h:842
bool DPMBase::readParAndIniFiles ( const std::string  fileName)

Allows the user to read par.ini files (useful to read MDCLR files)

Parameters
[in]fileName
Returns
bool (True or False)

Definition at line 1231 of file DPMBase.cc.

References SpeciesHandler::addObject(), boundaryHandler, BaseHandler< T >::clear(), BaseHandler< T >::copyAndAddObject(), Files::dataFile, Files::fStatFile, BaseHandler< T >::getObject(), getTimeStep(), getXMax(), getXMin(), getYMax(), getYMin(), getZMax(), getZMin(), PeriodicBoundary::set(), InfiniteWall::set(), setGravity(), setParticleDimensions(), File::setSaveCount(), Files::setSaveCount(), BaseWall::setSpecies(), setTime(), setTimeMax(), setTimeStep(), speciesHandler, and wallHandler.

1232 {
1233  //Opens the par.ini file
1234  std::fstream file;
1235  file.open(fileName, std::fstream::in);
1236  if (!file.is_open() || file.bad())
1237  {
1238  //std::cout << "Loading par.ini file " << filename << " failed" << std::endl;
1239  return false;
1240  }
1241 
1242  Mdouble doubleValue;
1243  int integerValue;
1244 
1245  // inputfile par.ini
1246  // line 1 =============================================================
1247  // Example: 1 1 0
1248  // 1: integer (0|1) switches from non-periodic to periodic
1249  // integer (5|6) does 2D integration only (y-coordinates fixed)
1250  // and switches from non-periodic to periodic
1251  // integer (11) uses a quarter system with circular b.c.
1252  file >> integerValue;
1253  //~ std::cout << "11" << integerValue << std::endl;
1254  if (integerValue == 0)
1255  {
1256  InfiniteWall w0;
1258  w0.set(Vec3D(-1, 0, 0), Vec3D(getXMin(), 0, 0));
1260  w0.set(Vec3D(1, 0, 0), Vec3D(getXMax(), 0, 0));
1262  w0.set(Vec3D(0, -1, 0), Vec3D(0, getYMin(), 0));
1264  w0.set(Vec3D(0, 1, 0), Vec3D(0, getYMax(), 0));
1266  w0.set(Vec3D(0, 0, -1), Vec3D(0, 0, getZMin()));
1268  w0.set(Vec3D(0, 0, 1), Vec3D(0, 0, getZMax()));
1270  } else if (integerValue == 1)
1271  {
1272  PeriodicBoundary b0;
1273  b0.set(Vec3D(1, 0, 0), getXMin(), getXMax());
1275  b0.set(Vec3D(0, 1, 0), getYMin(), getYMax());
1277  b0.set(Vec3D(0, 0, 1), getZMin(), getZMax());
1279  } else if (integerValue == 5)
1280  {
1281  InfiniteWall w0;
1283  w0.set(Vec3D(-1, 0, 0), Vec3D(-getXMin(), 0, 0));
1285  w0.set(Vec3D(1, 0, 0), Vec3D(getXMax(), 0, 0));
1287  w0.set(Vec3D(0, -1, 0), Vec3D(0, -getYMin(), 0));
1289  w0.set(Vec3D(0, 1, 0), Vec3D(0, getYMax(), 0));
1291 
1292  } else if (integerValue == 6)
1293  {
1294  PeriodicBoundary b0;
1295  b0.set(Vec3D(1, 0, 0), getXMin(), getXMax());
1297  b0.set(Vec3D(0, 1, 0), getYMin(), getYMax());
1299  b0.set(Vec3D(0, 0, 1), getZMin(), getZMax());
1301  } else
1302  {
1303  std::cerr << "Error in par.ini: line 1, value 1 is " << integerValue << std::endl;
1304  exit(-1);
1305  }
1306 
1307  // 2: integer (0|1) dont use | use the search pattern for linked cells
1308  file >> integerValue; //ignore
1309 
1310  // 3: real - gravity in z direction: positive points upwards
1311  file >> doubleValue;
1312  setGravity(Vec3D(0.0, 0.0, doubleValue));
1313 
1314  // line 2 =============================================================
1315  // Example: -10000 .5e-2
1316  // 1: time end of simulation - (negative resets start time to zero
1317  // and uses -time as end-time)
1318  file >> doubleValue;
1319  if (doubleValue < 0)
1320  setTime(0);
1321  setTimeMax(fabs(doubleValue));
1322 
1323  // 2: time-step of simulation
1324  file >> doubleValue;
1325  setTimeStep(doubleValue);
1326 
1327  // line 3 =============================================================
1328  // Example: 1e-1 100
1329  file >> doubleValue;
1330  if (doubleValue >= 0)
1331  {
1332  // 1: time-step for output on time-series protocoll file -> "ene"
1333  unsigned int savecount = static_cast<unsigned int>(round(doubleValue / getTimeStep()));
1334  setSaveCount(savecount);
1335 
1336  // 2: time-step for output on film (coordinate) file -> "c3d"
1337  // (fstat-output is coupled to c3d-output time-step)
1338  file >> doubleValue;
1339  savecount = static_cast<unsigned int>(round(doubleValue / getTimeStep()));
1340  dataFile.setSaveCount(savecount);
1341  fStatFile.setSaveCount(savecount);
1342  } else
1343  {
1344  // or: ---------------------------------------------------------------
1345  // 1: negative number is multiplied to the previous log-output-time
1346  // 2: requires initial log-output time
1347  // 3: negative number is multiplied to the previous film-output-time
1348  // 4: requires initial film-output time
1349  std::cerr << "Error in par.ini: line 3, value 1 is " << doubleValue << std::endl;
1350  exit(-1);
1351  }
1352 
1353  // line 4 =============================================================
1354  // Example: 2000 1e5 1e3 1e2
1355  // 1: particle density (mass=4/3*constants::pi*density*rad^3)
1356  file >> doubleValue;
1357 
1358  //clear species handler
1362 
1364  S->setDensity(doubleValue);
1365 
1366  // 2: linear spring constant
1367  file >> doubleValue;
1368  S->setStiffness(doubleValue);
1369 
1370  // 3: linear dashpot constant
1371  file >> doubleValue;
1372  S->setDissipation(doubleValue);
1373 
1374  // 4: background damping dashpot constant
1375  file >> doubleValue;
1376  if (doubleValue != 0.0)
1377  std::cerr << "Warning in par.ini: ignored background damping " << doubleValue << std::endl;
1378 
1379  // line 5 =============================================================
1380  // Example: 0 0
1381  // 1: growth rate: d(radius) = xgrow * dt
1382  file >> doubleValue;
1383  if (doubleValue != 0.0)
1384  std::cerr << "Warning in par.ini: ignored growth rate " << doubleValue << std::endl;
1385 
1386  // 2: target volume_fraction
1387  file >> doubleValue;
1388  if (doubleValue != 0.0)
1389  std::cerr << "Warning in par.ini: ignored target volume_fraction " << doubleValue << std::endl;
1390 
1391  file.close();
1392  //std::cout << "Loaded par.ini file " << filename << std::endl;
1393  return true;
1394 }
void setTime(Mdouble time)
Access function for the time.
Definition: DPMBase.cc:185
void set(Vec3D normal, Mdouble distanceLeft, Mdouble distanceRight)
Defines a periodic wall.
void setTimeMax(Mdouble newTMax)
Allows the upper time limit to be changed.
Definition: DPMBase.cc:199
Mdouble getZMax() const
If the length of the problem domain in z-direction is ZMax - ZMin, then getZMax() returns ZMax...
Definition: DPMBase.cc:319
Mdouble getXMin() const
If the length of the problem domain in x-direction is XMax - XMin, then getXMin() returns XMin...
Definition: DPMBase.cc:279
Mdouble getYMin() const
If the length of the problem domain in y-direction is YMax - YMin, then getYMin() returns YMin...
Definition: DPMBase.cc:295
double Mdouble
void setParticleDimensions(unsigned int particleDimensions)
Allows the dimension of the particle (f.e. for mass) to be changed. e.g. discs or spheres...
Definition: DPMBase.cc:583
Species< LinearViscoelasticNormalSpecies, SlidingFrictionSpecies > LinearViscoelasticSlidingFrictionSpecies
void setGravity(Vec3D newGravity)
Allows to modify the gravity vector.
Definition: DPMBase.cc:537
Defines a pair of periodic walls. Inherits from BaseBoundary.
Mdouble getXMax() const
If the length of the problem domain in x-direction is XMax - XMin, then getXMax() returns XMax...
Definition: DPMBase.cc:287
virtual void addObject(ParticleSpecies *const S)
Adds a new ParticleSpecies to the SpeciesHandler.
BoundaryHandler boundaryHandler
An object of the class BoundaryHandler which concerns insertion and deletion of particles into or fro...
Definition: DPMBase.h:1011
T * getObject(const unsigned int id)
Gets a pointer to the Object at the specified index in the BaseHandler.
Definition: BaseHandler.h:451
File fStatFile
An instance of class File to handle in- and output into a .fstat file.
Definition: Files.h:209
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:295
void setSaveCount(unsigned int saveCount)
Sets File::saveCount_ for all files (ene, data, fstat, restart, stat)
Definition: Files.cc:139
File dataFile
An instance of class File to handle in- and output into a .data file.
Definition: Files.h:204
void setSaveCount(unsigned int saveCount)
Sets File::saveCount_.
Definition: File.cc:283
SpeciesHandler speciesHandler
A handler to that stores the species type i.e. elastic, linear visco-elastic... et cetera...
Definition: DPMBase.h:991
Mdouble getYMax() const
If the length of the problem domain in y-direction is YMax - YMin, then getYMax() returns XMax...
Definition: DPMBase.cc:303
WallHandler wallHandler
An object of the class WallHandler. Contains pointers to all the walls created.
Definition: DPMBase.h:1006
void set(Vec3D normal, Vec3D point)
Defines a standard wall, given an outward normal vector s.t. normal*x=normal*point for all x of the w...
Definition: InfiniteWall.cc:79
Mdouble getZMin() const
If the length of the problem domain in z-direction is ZMax - ZMin, then getZMin() returns ZMin...
Definition: DPMBase.cc:311
void setTimeStep(Mdouble newDt)
Allows the time step dt to be changed.
Definition: DPMBase.cc:451
This is a class defining walls.
Definition: InfiniteWall.h:47
Implementation of a 3D vector (by Vitaliy).
Definition: Vector.h:45
Mdouble getTimeStep() const
Allows the time step dt to be accessed.
Definition: DPMBase.cc:465
void clear()
Empties the whole BaseHandler by removing all Objects and setting all other variables to 0...
Definition: BaseHandler.h:392
void setSpecies(const ParticleSpecies *species)
Define the species of this wall.
Definition: BaseWall.cc:113
bool DPMBase::readRestartFile ( bool  restarted = true)

Reads all the particle data corresponding to the current saved time step. Which is what the restart file basically stores. The problem description with the latest particle data. Returns 0 if it is successful, 1 otherwise.

Calls the read() and sets the restarted_ flag to true (if the file is found)

Returns
int

Definition at line 1629 of file DPMBase.cc.

References File::close(), File::getFstream(), File::open(), read(), Files::restartFile, and setRestarted().

Referenced by main(), Mercury3DRestart::readNextArgument(), readNextArgument(), and readRestartFile().

1630 {
1631  if (restartFile.open(std::fstream::in))
1632  {
1634  restartFile.close();
1635  setRestarted(restarted);
1636  return true;
1637  } else {
1638  //std::cerr << restartFile.getName() << " could not be loaded" << std::endl;
1639  return false;
1640  }
1641 }
File restartFile
An instance of class File to handle in- and output into a .restart file.
Definition: Files.h:219
void close()
Closes the file by calling fstream_.close()
Definition: File.cc:362
std::fstream & getFstream()
Allows to access the member variable File::fstream_.
Definition: File.cc:151
bool open()
Checks if the file stream fstream_ has any issues while opening. Alongside, it also increments the ne...
Definition: File.cc:320
void setRestarted(bool newRestartedFlag)
Allows to set the flag stating if the simulation is to be restarted or not.
Definition: DPMBase.cc:634
virtual void read(std::istream &is)
Reads all data from a restart file, e.g. domain data and particle data.
Definition: DPMBase.cc:1955
int DPMBase::readRestartFile ( std::string  fileName)

The same as readRestartFile(bool), but also reads all the particle data corresponding to the current saved time step.

Parameters
[in]fileName
Returns
int

Definition at line 1647 of file DPMBase.cc.

References readRestartFile(), Files::restartFile, and File::setName().

1648 {
1649  restartFile.setName(fileName);
1650  return readRestartFile();
1651 }
bool readRestartFile(bool restarted=true)
Reads all the particle data corresponding to the current saved time step. Which is what the restart f...
Definition: DPMBase.cc:1629
File restartFile
An instance of class File to handle in- and output into a .restart file.
Definition: Files.h:219
void setName(const std::string &name)
Sets the file name, e.g. "Name.data".
Definition: File.cc:196
virtual bool DPMBase::readUserDefinedWall ( std::string  type,
std::istream &  is 
)
inlinevirtual

Definition at line 179 of file DPMBase.h.

179 { return false;}
void DPMBase::removeDuplicatePeriodicParticles ( )
protected

Removes periodic duplicate Particles.

Removes particles created by CheckAndDuplicatePeriodicParticle(int i, int nWallPeriodic)). Note that between these two functions it is not allowed to create additional functions

periodicBoundary.pdf

Definition at line 2765 of file DPMBase.cc.

References BaseInteractable::getInteractions(), BaseHandler< T >::getNumberOfObjects(), BaseHandler< T >::getObject(), BaseParticle::getPeriodicFromParticle(), interactionHandler, particleHandler, ParticleHandler::removeObject(), and InteractionHandler::removeObjectKeepingPeriodics().

Referenced by solve().

2766 {
2767  for (unsigned int i = particleHandler.getNumberOfObjects();
2768  i >= 1 && particleHandler.getObject(i - 1)->getPeriodicFromParticle() != nullptr; i--)
2769  {
2770  while (particleHandler.getObject(i - 1)->getInteractions().size() > 0)
2771  {
2773  particleHandler.getObject(i - 1)->getInteractions().front()->getIndex());
2774  }
2776  }
2777 }
virtual void removeObject(unsigned const int index)
Removes a BaseParticle from the ParticleHandler.
BaseParticle * getPeriodicFromParticle() const
Returns the 'original' particle this one's a periodic copy of.
void removeObjectKeepingPeriodics(unsigned const int id)
Removes interactions of periodic particles when the periodic particles get deleted (see DPMBase::remo...
ParticleHandler particleHandler
An object of the class ParticleHandler, contains the pointers to all the particles created...
Definition: DPMBase.h:1001
T * getObject(const unsigned int id)
Gets a pointer to the Object at the specified index in the BaseHandler.
Definition: BaseHandler.h:451
unsigned int getNumberOfObjects() const
Gets the number of Object in this BaseHandler.
Definition: BaseHandler.h:487
InteractionHandler interactionHandler
An object of the class InteractionHandler.
Definition: DPMBase.h:1016
const std::list< BaseInteraction * > & getInteractions() const
Returns a reference to the list of interactions in this BaseInteractable.
void DPMBase::setAddLarge ( int  addL)

sets the number of large particles that are to be added on restart.

Parameters
[in]addL

Definition at line 351 of file DPMBase.cc.

References addL_.

Referenced by readNextArgument().

352 {
353  addL_ = addL;
354 }
int addL_
Stores the number of large particles that are to be added on restart.
Definition: DPMBase.h:886
void DPMBase::setAddSmall ( int  addS)

sets the number of small particles that are to be added on restart.

Parameters
[in]addS

Definition at line 343 of file DPMBase.cc.

References addS_.

Referenced by readNextArgument().

344 {
345  addS_ = addS;
346 }
int addS_
Stores the number of small particles that are to be added on restart.
Definition: DPMBase.h:892
void DPMBase::setAppend ( bool  newAppendFlag)

Allows to set the append option.

Parameters
[in]newAppendFlag

Definition at line 651 of file DPMBase.cc.

References append_.

Referenced by constructor(), Mercury3DRestart::readNextArgument(), and readNextArgument().

652 {
653  append_ = newAppendFlag;
654 }
bool append_
A flag to determine if the file has to be appended or not. See DPMBase::Solve() for example...
Definition: DPMBase.h:939
void DPMBase::setDimension ( unsigned int  newDim)

Sets the system and particle dimension.

Parameters
[in]newDim

Definition at line 553 of file DPMBase.cc.

References setParticleDimensions(), and setSystemDimensions().

554 {
555  setSystemDimensions(newDim);
556  setParticleDimensions(newDim);
557 }
void setParticleDimensions(unsigned int particleDimensions)
Allows the dimension of the particle (f.e. for mass) to be changed. e.g. discs or spheres...
Definition: DPMBase.cc:583
void setSystemDimensions(unsigned int newDim)
Allows for the dimension of the simulation to be changed.
Definition: DPMBase.cc:562
void DPMBase::setDoCGAlways ( bool  newDoCGFlag)
Todo:
This method is not implemented
void DPMBase::setFixedParticles ( unsigned int  n)
protected
Parameters
[in]n

Definition at line 877 of file DPMBase.cc.

References BaseParticle::fixParticle(), BaseHandler< T >::getNumberOfObjects(), BaseHandler< T >::getObject(), and particleHandler.

Referenced by readNextArgument().

878 {
879  for (unsigned int i = 0; i < std::min(particleHandler.getNumberOfObjects(), n); i++)
881 }
ParticleHandler particleHandler
An object of the class ParticleHandler, contains the pointers to all the particles created...
Definition: DPMBase.h:1001
T * getObject(const unsigned int id)
Gets a pointer to the Object at the specified index in the BaseHandler.
Definition: BaseHandler.h:451
unsigned int getNumberOfObjects() const
Gets the number of Object in this BaseHandler.
Definition: BaseHandler.h:487
void fixParticle()
Fix Particle function. It fixes a Particle by setting its inverse mass and inertia and velocities to ...
void DPMBase::setGravity ( Vec3D  newGravity)

Allows to modify the gravity vector.

Parameters
[in]newGravity

Definition at line 537 of file DPMBase.cc.

References gravity_.

Referenced by readNextArgument(), readParAndIniFiles(), and Chute::setChuteAngleAndMagnitudeOfGravity().

538 {
539  gravity_ = newGravity;
540 }
Vec3D gravity_
Gravity vector.
Definition: DPMBase.h:842
void DPMBase::setMax ( Vec3D  max)

Sets the values xMax, yMax, zMax of the problem domain, which is [xMin,xMax]x[yMin,yMax]x[zMin,zMax].

Parameters
[in]newXMax

Definition at line 395 of file DPMBase.cc.

References setXMax(), setYMax(), setZMax(), Vec3D::X, Vec3D::Y, and Vec3D::Z.

Referenced by helpers::loadingTest(), helpers::normalAndTangentialLoadingTest(), helpers::objectivenessTest(), and FileReader::read().

396 {
397  setXMax(max.X);
398  setYMax(max.Y);
399  setZMax(max.Z);
400 }
void setXMax(Mdouble newXMax)
If the length of the problem domain in x-direction is XMax - XMin, this method sets XMax...
Definition: DPMBase.cc:415
Mdouble X
the vector components
Definition: Vector.h:52
void setZMax(Mdouble newZMax)
If the length of the problem domain in z-direction is XMax - XMin, this method sets ZMax...
Definition: DPMBase.cc:439
void setYMax(Mdouble newYMax)
If the length of the problem domain in y-direction is YMax - YMin, this method sets YMax...
Definition: DPMBase.cc:427
Mdouble Y
Definition: Vector.h:52
Mdouble Z
Definition: Vector.h:52
void DPMBase::setMin ( Vec3D  min)

Sets the values xMin, yMin, zMin of the problem domain, which is [xMin,xMax]x[yMin,yMax]x[zMin,zMax].

Parameters
[in]newXMax

Definition at line 405 of file DPMBase.cc.

References setXMin(), setYMin(), setZMin(), Vec3D::X, Vec3D::Y, and Vec3D::Z.

Referenced by helpers::loadingTest(), helpers::normalAndTangentialLoadingTest(), helpers::objectivenessTest(), and FileReader::read().

406 {
407  setXMin(min.X);
408  setYMin(min.Y);
409  setZMin(min.Z);
410 }
Mdouble X
the vector components
Definition: Vector.h:52
void setYMin(Mdouble newYMin)
If the length of the problem domain in y-direction is YMax - YMin, this method sets YMin...
Definition: DPMBase.cc:371
void setXMin(Mdouble newXMin)
If the length of the problem domain in x-direction is XMax - XMin, this method sets XMin...
Definition: DPMBase.cc:359
void setZMin(Mdouble newZMin)
If the length of the problem domain in z-direction is ZMax - ZMin, this method sets ZMin...
Definition: DPMBase.cc:383
Mdouble Y
Definition: Vector.h:52
Mdouble Z
Definition: Vector.h:52
void DPMBase::setParticleDimensions ( unsigned int  particleDimensions)

Allows the dimension of the particle (f.e. for mass) to be changed. e.g. discs or spheres.

Parameters
[in]particleDimensions

Definition at line 583 of file DPMBase.cc.

References ParticleHandler::computeAllMasses(), logger, particleDimensions_, particleHandler, and WARN.

Referenced by Mercury2D::constructor(), Mercury3D::constructor(), constructor(), helpers::loadingTest(), helpers::normalAndTangentialLoadingTest(), helpers::objectivenessTest(), SpeciesHandler::readOldObject(), readParAndIniFiles(), and setDimension().

584 {
585  if (particleDimensions >= 1 && particleDimensions <= 3)
586  {
587  particleDimensions_ = particleDimensions;
589  } else
590  {
591  logger(WARN, "Error in setParticleDimensions, input argument is %", particleDimensions);
592  }
593 }
Logger< MERCURY_LOGLEVEL > logger("MercuryKernel")
unsigned int particleDimensions_
determines if 2D or 3D particle volume is used for mass calculations
Definition: DPMBase.h:837
void computeAllMasses(unsigned int indSpecies)
Computes the mass for all BaseParticle of the given species in this ParticleHandler.
ParticleHandler particleHandler
An object of the class ParticleHandler, contains the pointers to all the particles created...
Definition: DPMBase.h:1001
void DPMBase::setParticlesWriteVTK ( bool  writeParticlesVTK)

Allows to set the flag for enabling or disabling particle rotation in the simulations.

Parameters
[in]writeParticlesVTK

Definition at line 255 of file DPMBase.cc.

References writeParticlesVTK_.

256 {
257  writeParticlesVTK_ = writeParticlesVTK;
258 }
bool writeParticlesVTK_
A flag to turn on/off the vtk writer for particles.
Definition: DPMBase.h:954
void DPMBase::setRestarted ( bool  newRestartedFlag)

Allows to set the flag stating if the simulation is to be restarted or not.

Parameters
[in]newRestartedFlag

Definition at line 634 of file DPMBase.cc.

References restarted_.

Referenced by constructor(), and readRestartFile().

635 {
636  restarted_ = newRestartedFlag;
637  //setAppend(new_);
638 }
bool restarted_
A bool to check if the simulation was restarted or not, ie. if setupInitialConditionsShould be run an...
Definition: DPMBase.h:933
void DPMBase::setRestartVersion ( std::string  newRV)

Sets restart_version.

Parameters
[in]newRV

Definition at line 617 of file DPMBase.cc.

References restartVersion_.

618 {
619  restartVersion_ = newRV;
620 }
std::string restartVersion_
Previous versions of MercuryDPM had a different restart file format, the below member variable allows...
Definition: DPMBase.h:928
void DPMBase::setRotation ( bool  newRotFlag)

Allows to set the flag for enabling or disabling particle rotation in the simulations.

Todo:
{these functions should also update the mixed species}
Parameters
[in]newRotFlag

Definition at line 231 of file DPMBase.cc.

References rotation_.

Referenced by SpeciesHandler::addObject(), and SpeciesHandler::removeObject().

232 {
233  rotation_ = newRotFlag;
234 }
bool rotation_
A flag to turn on/off particle rotation.
Definition: DPMBase.h:944
void DPMBase::setSystemDimensions ( unsigned int  newDim)

Allows for the dimension of the simulation to be changed.

Parameters
[in]newDim

Definition at line 562 of file DPMBase.cc.

References ERROR, logger, and systemDimensions_.

Referenced by Mercury2D::constructor(), Mercury3D::constructor(), constructor(), helpers::loadingTest(), helpers::normalAndTangentialLoadingTest(), helpers::objectivenessTest(), readNextArgument(), and setDimension().

563 {
564  if (newDim >= 1 && newDim <= 3)
565  systemDimensions_ = newDim;
566  else
567  {
568  logger(ERROR,"Error in setSystemDimensions, input argument is %", newDim);
569  }
570 }
Logger< MERCURY_LOGLEVEL > logger("MercuryKernel")
unsigned int systemDimensions_
The dimensions of the simulation i.e. 2D or 3D.
Definition: DPMBase.h:832
void DPMBase::setTime ( Mdouble  time)

Access function for the time.

Parameters
[in]time

Definition at line 185 of file DPMBase.cc.

References interactionHandler, and time_.

Referenced by FileReader::read(), readNextDataFile(), readParAndIniFiles(), and solve().

186 {
187  Mdouble diff = time_ - time;
188  time_ = time;
189  //this sets the interaction timestamp, so each interaction has the right time
190  for (auto i : interactionHandler)
191  {
192  i->setTimeStamp(i->getTimeStamp() - diff);
193  }
194 }
double Mdouble
Mdouble time_
Stores the current simulation time.
Definition: DPMBase.h:899
InteractionHandler interactionHandler
An object of the class InteractionHandler.
Definition: DPMBase.h:1016
void DPMBase::setTimeMax ( Mdouble  newTMax)

Allows the upper time limit to be changed.

Parameters
[in]newTMmax

Definition at line 199 of file DPMBase.cc.

References ERROR, logger, and timeMax_.

Referenced by helpers::loadingTest(), ChuteBottom::makeRoughBottom(), helpers::normalAndTangentialLoadingTest(), helpers::objectivenessTest(), readNextArgument(), and readParAndIniFiles().

200 {
201  if (newTMax >= 0)
202  {
203  timeMax_ = newTMax;
204  }
205  else
206  {
207  logger(ERROR, "Error in setTimeMax, newTMax=%", newTMax);
208  }
209 }
Mdouble timeMax_
Stores the duration of the simulation.
Definition: DPMBase.h:914
Logger< MERCURY_LOGLEVEL > logger("MercuryKernel")
void DPMBase::setTimeStep ( Mdouble  timeStep)

Allows the time step dt to be changed.

Parameters
[in]timeStep

Definition at line 451 of file DPMBase.cc.

References ERROR, logger, and timeStep_.

Referenced by helpers::loadingTest(), ChuteBottom::makeRoughBottom(), helpers::normalAndTangentialLoadingTest(), helpers::objectivenessTest(), readNextArgument(), and readParAndIniFiles().

452 {
453  if (timeStep >= 0.0)
454  {
455  timeStep_ = timeStep;
456  } else
457  {
458  logger(ERROR, "Error in setTimeStep, proposed time step %", timeStep);
459  }
460 }
Logger< MERCURY_LOGLEVEL > logger("MercuryKernel")
Mdouble timeStep_
Stores the simulation time step.
Definition: DPMBase.h:909
void DPMBase::setupInitialConditions ( )
virtual

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.

A virtual function with no implementation but can be overriden.

Todo:
I (Anthony) wants to change this to be an external function. This has a lot of advantages especially when using copy-constructors. This is a major change and will break other codes, so therefore has to be done carefully.

This sets up the particles initial conditions it is as you expect the user to override this. By default the particles are randomly disibuted

Reimplemented in ChuteWithHopper, Chute, ChuteBottom, and Mercury2PVD.

Definition at line 966 of file DPMBase.cc.

Referenced by helpers::loadingTest(), helpers::normalAndTangentialLoadingTest(), helpers::objectivenessTest(), and solve().

967 {
968 }
void DPMBase::setWallsWriteVTK ( FileType  writeWallsVTK)

Allows to set the flag for enabling or disabling particle rotation in the simulations.

Parameters
[in]writeWallsVTK

Definition at line 247 of file DPMBase.cc.

References writeWallsVTK_.

248 {
249  writeWallsVTK_ = writeWallsVTK;
250 }
FileType writeWallsVTK_
A flag to turn on/off the vtk writer for walls.
Definition: DPMBase.h:949
void DPMBase::setXBallsAdditionalArguments ( std::string  newXBArgs)

Set the additional arguments for xballs.

Parameters
[in]newXBArgs

Definition at line 505 of file DPMBase.cc.

References xBallsAdditionalArguments_.

Referenced by read().

506 {
507  xBallsAdditionalArguments_ = newXBArgs.c_str();
508 }
std::string xBallsAdditionalArguments_
A string of additional arguments for xballs can be specified (see XBalls/xballs.txt). e.g. "-solidf -v0".
Definition: DPMBase.h:977
void DPMBase::setXBallsColourMode ( int  newCMode)

Set the xball output mode.

Parameters
[in]newCMode

Definition at line 473 of file DPMBase.cc.

References xBallsColourMode_.

474 {
475  xBallsColourMode_ = newCMode;
476 }
int xBallsColourMode_
XBalls is a package to view the particle data. As an alternative MercuryDPM also supports Paraview...
Definition: DPMBase.h:962
void DPMBase::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.

Parameters
[in]newScale

Definition at line 521 of file DPMBase.cc.

References xBallsScale_.

522 {
523  xBallsScale_ = newScale;
524 }
Mdouble xBallsScale_
sets the xballs argument scale (see XBalls/xballs.txt)
Definition: DPMBase.h:972
void DPMBase::setXBallsVectorScale ( double  newVScale)

Set the scale of vectors in xballs.

Parameters
[in]newVScale

Definition at line 489 of file DPMBase.cc.

References xBallsVectorScale_.

490 {
491  xBallsVectorScale_ = newVScale;
492 }
Mdouble xBallsVectorScale_
sets the xballs argument vscale (see XBalls/xballs.txt)
Definition: DPMBase.h:967
void DPMBase::setXMax ( Mdouble  xMax)

If the length of the problem domain in x-direction is XMax - XMin, this method sets XMax.

Parameters
[in]newXMax

Definition at line 415 of file DPMBase.cc.

References getXMin(), logger, WARN, and xMax_.

Referenced by readNextArgument(), readNextDataFile(), ChuteWithHopper::setChuteLength(), Chute::setChuteLength(), ChuteWithHopper::setHopperShift(), and setMax().

416 {
417  if (xMax < getXMin())
418  {
419  logger(WARN, "Warning in setXMax(%): value cannot be smaller than xMin=%", xMax, getXMin());
420  }
421  xMax_ = xMax;
422 }
Logger< MERCURY_LOGLEVEL > logger("MercuryKernel")
Mdouble getXMin() const
If the length of the problem domain in x-direction is XMax - XMin, then getXMin() returns XMin...
Definition: DPMBase.cc:279
Mdouble xMax_
If the length of the problem domain in x-direction is XMax - XMin, the above variable stores XMax...
Definition: DPMBase.h:854
void DPMBase::setXMin ( Mdouble  xMin)

If the length of the problem domain in x-direction is XMax - XMin, this method sets XMin.

Parameters
[in]newXMin

Definition at line 359 of file DPMBase.cc.

References getXMax(), logger, WARN, and xMin_.

Referenced by readNextArgument(), readNextDataFile(), ChuteWithHopper::setChuteLength(), and setMin().

360 {
361  if (xMin > getXMax())
362  {
363  logger(WARN, "Warning in setXMin(%): value cannot be larger than xMax=%", xMin, getXMax());
364  }
365  xMin_ = xMin;
366 }
Logger< MERCURY_LOGLEVEL > logger("MercuryKernel")
Mdouble getXMax() const
If the length of the problem domain in x-direction is XMax - XMin, then getXMax() returns XMax...
Definition: DPMBase.cc:287
Mdouble xMin_
If the length of the problem domain in x-direction is XMax - XMin, the above variable stores XMin...
Definition: DPMBase.h:848
void DPMBase::setYMax ( Mdouble  yMax)

If the length of the problem domain in y-direction is YMax - YMin, this method sets YMax.

Parameters
[in]newYMax

Definition at line 427 of file DPMBase.cc.

References getYMin(), logger, WARN, and yMax_.

Referenced by readNextArgument(), readNextDataFile(), Chute::setChuteWidth(), and setMax().

428 {
429  if (yMax < getYMin())
430  {
431  logger(WARN, "Warning in setYMax(%): value cannot be smaller than yMin=%", yMax, getYMin());
432  }
433  yMax_ = yMax;
434 }
Mdouble yMax_
If the length of the problem domain in y-direction is YMax - XMin, the above variable stores YMax...
Definition: DPMBase.h:866
Logger< MERCURY_LOGLEVEL > logger("MercuryKernel")
Mdouble getYMin() const
If the length of the problem domain in y-direction is YMax - YMin, then getYMin() returns YMin...
Definition: DPMBase.cc:295
void DPMBase::setYMin ( Mdouble  yMin)

If the length of the problem domain in y-direction is YMax - YMin, this method sets YMin.

Parameters
[in]newYMin

Definition at line 371 of file DPMBase.cc.

References getYMax(), logger, WARN, and yMin_.

Referenced by readNextArgument(), readNextDataFile(), and setMin().

372 {
373  if (yMin > getYMax())
374  {
375  logger(WARN, "Warning in setYMin(%): value cannot be larger than yMax=%", yMin, getYMax());
376  }
377  yMin_ = yMin;
378 }
Logger< MERCURY_LOGLEVEL > logger("MercuryKernel")
Mdouble yMin_
If the length of the problem domain in y-direction is YMax - YMin, the above variable stores YMin...
Definition: DPMBase.h:860
Mdouble getYMax() const
If the length of the problem domain in y-direction is YMax - YMin, then getYMax() returns XMax...
Definition: DPMBase.cc:303
void DPMBase::setZMax ( Mdouble  zMax)

If the length of the problem domain in z-direction is XMax - XMin, this method sets ZMax.

Parameters
[in]newZMax

Definition at line 439 of file DPMBase.cc.

References getZMin(), logger, WARN, and zMax_.

Referenced by ChuteWithHopper::addHopper(), Chute::readNextArgument(), readNextArgument(), readNextDataFile(), Chute::setInflowHeight(), and setMax().

440 {
441  if (zMax < getZMin())
442  {
443  logger(WARN, "Warning in setZMax(%): value cannot be smaller than zMin=%", zMax, getZMin());
444  }
445  zMax_ = zMax;
446 }
Logger< MERCURY_LOGLEVEL > logger("MercuryKernel")
Mdouble zMax_
If the length of the problem domain in z-direction is ZMax - ZMin, the above variable stores ZMax...
Definition: DPMBase.h:878
Mdouble getZMin() const
If the length of the problem domain in z-direction is ZMax - ZMin, then getZMin() returns ZMin...
Definition: DPMBase.cc:311
void DPMBase::setZMin ( Mdouble  zMin)

If the length of the problem domain in z-direction is ZMax - ZMin, this method sets ZMin.

Parameters
[in]newZMin

Definition at line 383 of file DPMBase.cc.

References getZMax(), logger, WARN, and zMin_.

Referenced by readNextArgument(), readNextDataFile(), and setMin().

384 {
385  if (zMin > getZMax())
386  {
387  logger(WARN, "Warning in setZMin(%): value cannot be larger than zMax=%", zMin, getZMax());
388  }
389  zMin_ = zMin;
390 }
Logger< MERCURY_LOGLEVEL > logger("MercuryKernel")
Mdouble getZMax() const
If the length of the problem domain in z-direction is ZMax - ZMin, then getZMax() returns ZMax...
Definition: DPMBase.cc:319
Mdouble zMin_
If the length of the problem domain in z-direction is ZMax - ZMin, the above variable stores ZMin...
Definition: DPMBase.h:872
void DPMBase::solve ( )

The work horse of the code.

  • 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. See below ;)
      Todo:
      Is it neccesarry 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 neccesarry 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
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 collison and be written to the fstat data}

Definition at line 2188 of file DPMBase.cc.

References actionsAfterSolve(), InteractionHandler::actionsAfterTimeStep(), actionsAfterTimeStep(), actionsBeforeTimeLoop(), actionsBeforeTimeStep(), actionsOnRestart(), boundaryHandler, checkAndDuplicatePeriodicParticles(), checkInteractionWithBoundaries(), checkSettings(), Files::closeFiles(), computeAllForces(), ParticleHandler::computeAllMasses(), continueSolve(), DEBUG, InteractionHandler::eraseOldInteractions(), finishStatistics(), getAppend(), Files::getName(), getRestarted(), FilesAndRunNumber::getRunNumber(), getTime(), getTimeMax(), hGridActionsAfterIntegration(), hGridActionsBeforeIntegration(), hGridActionsBeforeTimeLoop(), hGridActionsBeforeTimeStep(), INFO, initialiseStatistics(), integrateAfterForceComputation(), integrateBeforeForceComputation(), interactionHandler, logger, ntimeSteps_, particleHandler, removeDuplicatePeriodicParticles(), Files::resetFileCounter(), Files::restartFile, Files::setName(), Files::setNextSavedTimeStep(), File::setOpenMode(), Files::setOpenMode(), setTime(), setupInitialConditions(), time_, timeStep_, and writeOutputFiles().

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

2189 {
2190  logger(DEBUG, "Entered solve");
2191 #ifdef CONTACT_LIST_HGRID
2192  logger(INFO,"Using CONTACT_LIST_HGRID");
2193 #endif
2194 
2199  if (!getRestarted())
2200  {
2201  ntimeSteps_ = 0;
2202  resetFileCounter();
2203  setTime(0.0);
2204  setNextSavedTimeStep(0); //reset the counter
2205  //this is to ensure that the interaction time stamps agree with the resetting of the time value
2206  for (auto& i : interactionHandler)
2207  i->setTimeStamp(0);
2209  logger(DEBUG, "Have created the particles initial conditions");
2210  }
2211  else
2212  {
2213  actionsOnRestart();
2214  }
2215 
2216  checkSettings();
2217 
2218  if (getRunNumber() > 0 && !getRestarted())
2219  {
2220  std::stringstream name;
2221  name << getName() << "." << getRunNumber();
2222  setName(name.str());
2223  }
2224 
2225  //append_ determines if files have to be appended or not
2226  if (getAppend())
2227  {
2228  setOpenMode(std::fstream::out | std::fstream::app);
2229  restartFile.setOpenMode(std::fstream::out); //Restart files should always be overwritten.
2230  }
2231  else
2232  {
2233  setOpenMode(std::fstream::out);
2234  }
2235 
2237 
2238  // Setup the mass of each particle.
2240 
2241  // Other initialisations
2242  //max_radius = getLargestParticle()->getRadius();
2245 
2246  // do a first force computation
2249  time_ -= timeStep_; //to enforce that old time stamps are created
2250  ntimeSteps_--;
2251  computeAllForces();
2252  ntimeSteps_++;
2253  time_ += timeStep_;
2255  interactionHandler.actionsAfterTimeStep();
2256  logger(DEBUG, "Have computed the initial values for the forces ");
2257 
2258  // This is the main loop over advancing time
2259  while (getTime() < getTimeMax() && continueSolve())
2260  {
2261  writeOutputFiles(); //everything is written at the beginning of the timestep!
2262  // Loop over all particles doing the time integration step
2265  checkInteractionWithBoundaries(); // INSERTION boundaries handled
2267 
2268  // Compute forces
2269 
2271  // INSERTION/DELETION boundary flag change
2272  for (BaseBoundary* b : boundaryHandler)
2273  {
2274  b->checkBoundaryBeforeTimeStep(this);
2275  }
2276 
2278 
2280 
2282 
2283  computeAllForces();
2284 
2286 
2288 
2289  // Loop over all particles doing the time integration step
2292 
2293  checkInteractionWithBoundaries(); // DELETION boundaries handled
2295 
2296  //erase interactions that have not been used during the last timestep
2297  interactionHandler.eraseOldInteractions(getTime());
2298  interactionHandler.actionsAfterTimeStep();
2299 
2300  time_ += timeStep_;
2301  ntimeSteps_++;
2302  }
2303  //force writing of the last time step
2305  writeOutputFiles();
2306 
2307  //end loop over interaction count
2309 
2310  //To make sure getTime gets the correct time for outputting statistics
2311  finishStatistics();
2312 
2313  closeFiles();
2314 }
void setTime(Mdouble time)
Access function for the time.
Definition: DPMBase.cc:185
virtual void actionsBeforeTimeLoop()
A virtual function. Allows one to carry out any operations before the start of the time loop...
Definition: DPMBase.cc:722
virtual void integrateAfterForceComputation()
Integration is done after force computations. We apply the Velocity verlet scheme. See http://en.wikipedia.org/wiki/Verlet_integration#Velocity_Verlet.
Definition: DPMBase.cc:1779
void checkAndDuplicatePeriodicParticles()
In case of periodic boundaries, the below methods checks and adds particles when necessary into the p...
Definition: DPMBase.cc:2782
void setNextSavedTimeStep(unsigned int nextSavedTimeStep)
Sets the next time step for all the files (ene, data, fstat, restart, stat) at which the data is to b...
Definition: Files.cc:263
Logger< MERCURY_LOGLEVEL > logger("MercuryKernel")
void computeAllMasses(unsigned int indSpecies)
Computes the mass for all BaseParticle of the given species in this ParticleHandler.
virtual void initialiseStatistics()
no implementation but can be overidden in its derived classes.
Definition: DPMBase.cc:800
File restartFile
An instance of class File to handle in- and output into a .restart file.
Definition: Files.h:219
void closeFiles()
Closes all files (ene, data, fstat, restart, stat) that were opened to read or write.
Definition: Files.cc:252
virtual void actionsAfterTimeStep()
A virtual function which allows to define operations to be executed after time step.
Definition: DPMBase.cc:793
virtual void writeOutputFiles()
Writes the simulation data onto all the files i.e. .data, .ene, .fstat ...
Definition: DPMBase.cc:2139
void setOpenMode(std::fstream::openmode openMode)
Sets File::openMode_ for all files (ene, data, fstat, restart, stat)
Definition: Files.cc:201
unsigned int ntimeSteps_
Stores the number of time steps.
Definition: DPMBase.h:904
virtual void hGridActionsBeforeIntegration()
no implementation but can be overidden in its derived classes.
Definition: DPMBase.cc:852
bool getAppend() const
Returns the flag denoting if the append option is on or off.
Definition: DPMBase.cc:643
void setName(const std::string &name)
Allows to set the name of all the files (ene, data, fstat, restart, stat)
Definition: Files.cc:150
void resetFileCounter()
Resets the file counter for each file i.e. for ene, data, fstat, restart, stat)
Definition: Files.cc:190
bool getRestarted() const
Returns the flag denoting if the simulation was restarted or not.
Definition: DPMBase.cc:626
BoundaryHandler boundaryHandler
An object of the class BoundaryHandler which concerns insertion and deletion of particles into or fro...
Definition: DPMBase.h:1011
ParticleHandler particleHandler
An object of the class ParticleHandler, contains the pointers to all the particles created...
Definition: DPMBase.h:1001
Mdouble time_
Stores the current simulation time.
Definition: DPMBase.h:899
void checkSettings()
Checks if the essentials are set properly to go ahead with solving the problem.
Definition: DPMBase.cc:2115
virtual void hGridActionsBeforeTimeLoop()
A virtual function that allows one to carry out hGrid operations before the start of the time loop...
Definition: DPMBase.cc:729
virtual void computeAllForces()
Computes all the forces acting on the particles by using the setTorque and setForce methods...
Definition: DPMBase.cc:1841
virtual void actionsAfterSolve()
A virtual function which allows to define operations to be executed after the solve().
Definition: DPMBase.cc:786
InteractionHandler interactionHandler
An object of the class InteractionHandler.
Definition: DPMBase.h:1016
virtual void actionsBeforeTimeStep()
A virtual function which allows to define operations to be executed before the new time step...
Definition: DPMBase.cc:779
Mdouble timeStep_
Stores the simulation time step.
Definition: DPMBase.h:909
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:736
void removeDuplicatePeriodicParticles()
Removes periodic duplicate Particles.
Definition: DPMBase.cc:2765
virtual void integrateBeforeForceComputation()
This is were the integration is done, at the moment it is velocity Verlet integration and is done bef...
Definition: DPMBase.cc:1748
virtual bool continueSolve() const
Definition: DPMBase.cc:897
virtual void hGridActionsAfterIntegration()
no implementation but can be overidden in its derived classes.
Definition: DPMBase.cc:859
virtual void hGridActionsBeforeTimeStep()
A virtual function that allows one to set or execute hGrid parameters or operations before every simu...
Definition: DPMBase.cc:743
virtual void finishStatistics()
no implementation but can be overidden in its derived classes.
Definition: DPMBase.cc:838
Mdouble getTime() const
Access function for the time.
Definition: DPMBase.cc:169
const std::string & getName() const
Returns the name of the file. Does not allow to change it though.
Definition: Files.cc:132
virtual void checkInteractionWithBoundaries()
There are a range of boundaries one could implement depending on ones' problem. This methods checks f...
Definition: DPMBase.cc:1763
Mdouble getTimeMax() const
Allows the user to access the total simulation time during the simulation. Cannot change it though...
Definition: DPMBase.cc:214
int getRunNumber() const
This returns the current value of the counter (runNumber_)
void setOpenMode(std::fstream::openmode openMode)
Allows the user to Sets File::openMode_.
Definition: File.cc:268
virtual void setupInitialConditions()
This function allows to set the initial conditions for our problem to be solved, by default particle ...
Definition: DPMBase.cc:966
void DPMBase::solve ( int  argc,
char *  argv[] 
)

The solve function is the work horse of the code with the user input.

Parameters
[in]argc
[in]argv

Definition at line 160 of file DPMBase.cc.

References readArguments(), and solve().

161 {
162  readArguments(argc, argv);
163  solve();
164 }
void solve()
The work horse of the code.
Definition: DPMBase.cc:2188
bool readArguments(int argc, char *argv[])
Can interpret main function input arguments that are passed by the driver codes.
Definition: DPMBase.cc:2320
void DPMBase::write ( std::ostream &  os,
bool  writeAllParticles = true 
) const
virtual

Loads all MD data and plots statistics for all timesteps in the .data file.

Todo:
what to do with statisticsFromRestartData?

Writes all data into a restart file

Parameters
[in]os
[in]writeAllParticles
Todo:
TW: random number seed is not stored
Todo:
TW: xBalls arguments are not stored

Reimplemented in ChuteWithHopper, MercuryBase, and Chute.

Definition at line 1897 of file DPMBase.cc.

References boundaryHandler, helpers::compare(), getGravity(), BaseHandler< T >::getNumberOfObjects(), BaseHandler< T >::getObject(), getParticleDimensions(), getSystemDimensions(), getTime(), getTimeMax(), getTimeStep(), InteractionHandler::getWriteVTK(), getXBallsAdditionalArguments(), getXMax(), getXMin(), getYMax(), getYMin(), getZMax(), getZMin(), interactionHandler, ntimeSteps_, particleHandler, random, speciesHandler, wallHandler, RNG::write(), SpeciesHandler::write(), InteractionHandler::write(), FilesAndRunNumber::write(), ParticleHandler::write(), writeParticlesVTK_, and writeWallsVTK_.

Referenced by operator<<(), MercuryBase::write(), and writeRestartFile().

1898 {
1899  os << "restart_version " << "1.0";
1901  os << "xMin " << getXMin()
1902  << " xMax " << getXMax()
1903  << " yMin " << getYMin()
1904  << " yMax " << getYMax()
1905  << " zMin " << getZMin()
1906  << " zMax " << getZMax() << std::endl
1907  << "timeStep " << getTimeStep()
1908  << " time " << getTime()
1909  << " ntimeSteps " << ntimeSteps_
1910  << " timeMax " << getTimeMax() << std::endl
1911  << "systemDimensions " << getSystemDimensions()
1912  << " particleDimensions " << getParticleDimensions()
1913  << " gravity " << getGravity();
1914  os << " writeVTK " << writeParticlesVTK_ << " " << writeWallsVTK_ << " " << interactionHandler.getWriteVTK();
1915  os << " random "; random.write(os);
1916  //only write xBallsArguments if they are nonzero
1918  os << " xBallsArguments " << getXBallsAdditionalArguments();
1919  os << std::endl;
1920 
1921  speciesHandler.write(os);
1922  os << "Walls " << wallHandler.getNumberOfObjects() << std::endl;
1923  for (BaseWall* w : wallHandler)
1924  os << (*w) << std::endl;
1925  os << "Boundaries " << boundaryHandler.getNumberOfObjects() << std::endl;
1926  for (BaseBoundary* b : boundaryHandler)
1927  os << (*b) << std::endl;
1928  if (writeAllParticles || particleHandler.getNumberOfObjects() < 4)
1929  {
1930  particleHandler.write(os);
1931  } else
1932  {
1933  os << "Particles " << particleHandler.getNumberOfObjects() << std::endl;
1934  for (unsigned int i = 0; i < 2; i++)
1935  os << *particleHandler.getObject(i) << std::endl;
1936  os << "..." << std::endl;
1937  }
1938  if (writeAllParticles || interactionHandler.getNumberOfObjects() < 4)
1939  {
1941  } else
1942  {
1943  os << "Interactions " << interactionHandler.getNumberOfObjects() << std::endl;
1944  for (unsigned int i = 0; i < 2; i++)
1945  os << *interactionHandler.getObject(i) << std::endl;
1946  os << "..." << std::endl;
1947  }
1950 }
void write(std::ostream &os) const
void write(std::ostream &os) const
Writes the InteractionHandler to an output stream, for example a restart file.
unsigned int getSystemDimensions() const
Returns the dimension of the simulation. Note there is also a particle dimension. ...
Definition: DPMBase.cc:575
FileType getWriteVTK() const
Mdouble getZMax() const
If the length of the problem domain in z-direction is ZMax - ZMin, then getZMax() returns ZMax...
Definition: DPMBase.cc:319
Mdouble getXMin() const
If the length of the problem domain in x-direction is XMax - XMin, then getXMin() returns XMin...
Definition: DPMBase.cc:279
unsigned int getParticleDimensions() const
Returns the particle dimensions.
Definition: DPMBase.cc:599
Mdouble getYMin() const
If the length of the problem domain in y-direction is YMax - YMin, then getYMin() returns YMin...
Definition: DPMBase.cc:295
void write(std::ostream &os) const
Accepts an output stream read function, which accepts an input stream std::ostream.
virtual void write(std::ostream &os) const
Write all the species and mixed species to an output stream.
Mdouble getXMax() const
If the length of the problem domain in x-direction is XMax - XMin, then getXMax() returns XMax...
Definition: DPMBase.cc:287
unsigned int ntimeSteps_
Stores the number of time steps.
Definition: DPMBase.h:904
void write(std::ostream &os) const
Definition: RNG.cc:71
BoundaryHandler boundaryHandler
An object of the class BoundaryHandler which concerns insertion and deletion of particles into or fro...
Definition: DPMBase.h:1011
ParticleHandler particleHandler
An object of the class ParticleHandler, contains the pointers to all the particles created...
Definition: DPMBase.h:1001
T * getObject(const unsigned int id)
Gets a pointer to the Object at the specified index in the BaseHandler.
Definition: BaseHandler.h:451
Vec3D getGravity() const
Returns the gravity vector.
Definition: DPMBase.cc:545
Basic class for walls.
Definition: BaseWall.h:44
unsigned int getNumberOfObjects() const
Gets the number of Object in this BaseHandler.
Definition: BaseHandler.h:487
SpeciesHandler speciesHandler
A handler to that stores the species type i.e. elastic, linear visco-elastic... et cetera...
Definition: DPMBase.h:991
InteractionHandler interactionHandler
An object of the class InteractionHandler.
Definition: DPMBase.h:1016
FileType writeWallsVTK_
A flag to turn on/off the vtk writer for walls.
Definition: DPMBase.h:949
Mdouble getYMax() const
If the length of the problem domain in y-direction is YMax - YMin, then getYMax() returns XMax...
Definition: DPMBase.cc:303
WallHandler wallHandler
An object of the class WallHandler. Contains pointers to all the walls created.
Definition: DPMBase.h:1006
RNG random
This is a random generator, often used for setting up the initial conditions etc...
Definition: DPMBase.h:996
bool writeParticlesVTK_
A flag to turn on/off the vtk writer for particles.
Definition: DPMBase.h:954
Mdouble getZMin() const
If the length of the problem domain in z-direction is ZMax - ZMin, then getZMin() returns ZMin...
Definition: DPMBase.cc:311
bool compare(std::istream &is, std::string s)
Definition: Helpers.cc:754
std::string getXBallsAdditionalArguments() const
Returns the additional arguments for xballs.
Definition: DPMBase.cc:513
Mdouble getTimeStep() const
Allows the time step dt to be accessed.
Definition: DPMBase.cc:465
Mdouble getTime() const
Access function for the time.
Definition: DPMBase.cc:169
Mdouble getTimeMax() const
Allows the user to access the total simulation time during the simulation. Cannot change it though...
Definition: DPMBase.cc:214
void DPMBase::writeEneHeader ( std::ostream &  os) const
protectedvirtual

Writes a header with a certain format for ENE file.

Parameters
[in]os

todo{Why is there a +6 here? TW: to get the numbers and title aligned}

Definition at line 973 of file DPMBase.cc.

References getAppend().

Referenced by writeOutputFiles().

974 {
975  //only write if we don't restart
976  if (getAppend())
977  return;
978 
980  long width = os.precision() + 6;
981  os << std::setw(width) << "t" << " " << std::setw(width)
982  << "ene_gra" << " " << std::setw(width)
983  << "ene_kin" << " " << std::setw(width)
984  << "ene_rot" << " " << std::setw(width)
985  << "ene_ela" << " " << std::setw(width)
986  << "X_COM" << " " << std::setw(width)
987  << "Y_COM" << " " << std::setw(width)
988  << "Z_COM" << std::endl;
989 }
bool getAppend() const
Returns the flag denoting if the append option is on or off.
Definition: DPMBase.cc:643
void DPMBase::writeEneTimestep ( std::ostream &  os) const
protectedvirtual

This function enables one to write the global energy available in the system after each time step. The default is to compute the rotational and translational kinetic energy, potential energy and the centre of mass.

Parameters
[in]os

todo{Why is there a +6 here? TW: to ensure the numbers fit into a constant width column}

Definition at line 1044 of file DPMBase.cc.

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

Referenced by writeOutputFiles().

1045 {
1046  Mdouble ene_kin = 0, ene_elastic = 0, ene_rot = 0, ene_gra = 0, mass_sum = 0, x_masslength = 0, y_masslength = 0, z_masslength = 0;
1047 
1048  for (BaseParticle* p : particleHandler)
1049  if (!p->isFixed())
1050  {
1051  ene_kin += .5 * p->getMass() * p->getVelocity().getLengthSquared();
1052  ene_rot += .5 * p->getInertia() * p->getAngularVelocity().getLengthSquared();
1053  ene_gra -= p->getMass() * Vec3D::dot(getGravity(), p->getPosition());
1054  mass_sum += p->getMass();
1055  x_masslength += p->getMass() * p->getPosition().X;
1056  y_masslength += p->getMass() * p->getPosition().Y;
1057  z_masslength += p->getMass() * p->getPosition().Z;
1058  } //end for loop over Particles
1059 
1060  ene_elastic = getElasticEnergy();
1061 
1063  long width = os.precision() + 6;
1064  os << std::setw(width) << getTime()
1065  << " " << std::setw(width) << ene_gra
1066  << " " << std::setw(width) << ene_kin
1067  << " " << std::setw(width) << ene_rot
1068  << " " << std::setw(width) << ene_elastic
1069  << " " << std::setw(width)
1070  << (mass_sum != 0.0 ? x_masslength / mass_sum : std::numeric_limits<double>::quiet_NaN())
1071  << " " << std::setw(width)
1072  << (mass_sum != 0.0 ? y_masslength / mass_sum : std::numeric_limits<double>::quiet_NaN())
1073  << " " << std::setw(width)
1074  << (mass_sum != 0.0 ? z_masslength / mass_sum : std::numeric_limits<double>::quiet_NaN()) << std::endl;
1075 
1076  //sliding = sticking = 0;
1077 }
double Mdouble
static Mdouble dot(const Vec3D &a, const Vec3D &b)
Calculates the dot product of two Vec3D: .
Definition: Vector.cc:167
Mdouble getElasticEnergy() const
Returns the global elastic energy within the system.
Definition: DPMBase.cc:659
ParticleHandler particleHandler
An object of the class ParticleHandler, contains the pointers to all the particles created...
Definition: DPMBase.h:1001
Vec3D getGravity() const
Returns the gravity vector.
Definition: DPMBase.cc:545
Mdouble getTime() const
Access function for the time.
Definition: DPMBase.cc:169
void DPMBase::writeFstatHeader ( std::ostream &  os) const
protectedvirtual

Writes a header with a certain format for FStat file.

Parameters
[in]os

Definition at line 994 of file DPMBase.cc.

References ParticleHandler::getLargestParticle(), BaseParticle::getRadius(), ParticleHandler::getSmallestParticle(), getTime(), getXMax(), getXMin(), getYMax(), getYMin(), getZMax(), getZMin(), interactionHandler, and particleHandler.

Referenced by writeOutputFiles().

995 {
996 
997  // line #1: time, volume fraction
998  // line #2: wall box: wx0, wy0, wz0, wx1, wy1, wz1
999  // line #3: radii-min-max & moments: rad_min, rad_max, r1, r2, r3, r4
1000  os << "#"
1001  << " " << getTime()
1002  << " " << 0
1003  << std::endl;
1004  os << "#"
1005  << " " << getXMin()
1006  << " " << getYMin()
1007  << " " << getZMin()
1008  << " " << getXMax()
1009  << " " << getYMax()
1010  << " " << getZMax()
1011  << std::endl;
1012  os << "#"
1013  << " ";
1015  {
1017  } else
1018  {
1019  os << std::numeric_limits<double>::quiet_NaN();
1020  }
1021  os << " ";
1023  {
1025  } else
1026  {
1027  os << std::numeric_limits<double>::quiet_NaN();
1028  }
1029  os << " " << 0
1030  << " " << 0
1031  << " " << 0
1032  << " " << 0
1033  << std::endl;
1034  //B: write data
1036  {
1037  c->writeToFStat(os);
1038  }
1039 }
BaseParticle * getLargestParticle() const
Gets a pointer to the largest BaseParticle (by interactionRadius) in this ParticleHandler.
Mdouble getZMax() const
If the length of the problem domain in z-direction is ZMax - ZMin, then getZMax() returns ZMax...
Definition: DPMBase.cc:319
Mdouble getXMin() const
If the length of the problem domain in x-direction is XMax - XMin, then getXMin() returns XMin...
Definition: DPMBase.cc:279
Mdouble getYMin() const
If the length of the problem domain in y-direction is YMax - YMin, then getYMin() returns YMin...
Definition: DPMBase.cc:295
Stores information about interactions between two interactable objects; often particles but could be ...
Mdouble getXMax() const
If the length of the problem domain in x-direction is XMax - XMin, then getXMax() returns XMax...
Definition: DPMBase.cc:287
BaseParticle * getSmallestParticle() const
Gets a pointer to the smallest BaseParticle (by interactionRadius) in this ParticleHandler.
ParticleHandler particleHandler
An object of the class ParticleHandler, contains the pointers to all the particles created...
Definition: DPMBase.h:1001
Mdouble getRadius() const
Returns the particle's radius_.
InteractionHandler interactionHandler
An object of the class InteractionHandler.
Definition: DPMBase.h:1016
Mdouble getYMax() const
If the length of the problem domain in y-direction is YMax - YMin, then getYMax() returns XMax...
Definition: DPMBase.cc:303
Mdouble getZMin() const
If the length of the problem domain in z-direction is ZMax - ZMin, then getZMin() returns ZMin...
Definition: DPMBase.cc:311
Mdouble getTime() const
Access function for the time.
Definition: DPMBase.cc:169
void DPMBase::writeOutputFiles ( )
virtual

Writes the simulation data onto all the files i.e. .data, .ene, .fstat ...

Reimplemented in Mercury3DRestart, and StatisticsVector< T >.

Definition at line 2139 of file DPMBase.cc.

References File::close(), Files::dataFile, Files::eneFile, Files::fStatFile, File::getCounter(), File::getFileType(), File::getFstream(), getRestarted(), MULTIPLE_FILES, MULTIPLE_FILES_PADDED, NO_FILE, ntimeSteps_, outputXBallsData(), printTime(), Files::restartFile, File::saveCurrentTimestep(), writeEneHeader(), writeEneTimestep(), writeFstatHeader(), writeRestartFile(), writeVTK(), and writeXBallsScript().

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

2140 {
2143 
2145  {
2150  }
2151 
2153  {
2154  printTime();
2158  writeVTK();
2159  }
2160 
2161 // if (statFile.saveCurrentTimestep(ntimeSteps_))
2162 // {
2163 // outputStatistics();
2164 // gatherContactStatistics();
2165 // processStatistics(true);
2166 // }
2167 
2168  //write restart file last, otherwise the output cunters are wrong
2170  {
2171  writeRestartFile();
2172  restartFile.close(); //overwrite old restart file if FileType::ONE_FILE
2173  }
2174 }
each time-step will be written into/read from separate files numbered consecutively, with numbers padded by zeros to a minimum of four digits: name_.0000, name_.0001, ..
FileType getFileType() const
Gets the file type e.g. NOFILE, ONEFILE and MULTIPLE FILES. File::fileType_.
Definition: File.cc:203
File restartFile
An instance of class File to handle in- and output into a .restart file.
Definition: Files.h:219
void writeVTK() const
Definition: DPMBase.cc:1080
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...
Definition: DPMBase.cc:1147
void close()
Closes the file by calling fstream_.close()
Definition: File.cc:362
File eneFile
An instance of class File to handle in- and output into a .ene file.
Definition: Files.h:214
unsigned int getCounter() const
In case of multiple files, File::getCounter() returns the the number (FILE::Counter_) of the next fil...
Definition: File.cc:217
file will not be created/read
unsigned int ntimeSteps_
Stores the number of time steps.
Definition: DPMBase.h:904
virtual void writeEneTimestep(std::ostream &os) const
This function enables one to write the global energy available in the system after each time step...
Definition: DPMBase.cc:1044
std::fstream & getFstream()
Allows to access the member variable File::fstream_.
Definition: File.cc:151
bool getRestarted() const
Returns the flag denoting if the simulation was restarted or not.
Definition: DPMBase.cc:626
File fStatFile
An instance of class File to handle in- and output into a .fstat file.
Definition: Files.h:209
File dataFile
An instance of class File to handle in- and output into a .data file.
Definition: Files.h:204
virtual void printTime() const
Displays the current simulation time onto your screen for example.
Definition: DPMBase.cc:886
virtual void writeXBallsScript() const
This writes a script which can be used to load the xballs problem to display the data just generated...
virtual void writeEneHeader(std::ostream &os) const
Writes a header with a certain format for ENE file.
Definition: DPMBase.cc:973
bool saveCurrentTimestep(unsigned int ntimeSteps)
Definition: File.cc:309
virtual void writeRestartFile()
Stores all the particle data for current save time step. Calls the write function.
Definition: DPMBase.cc:1618
each time-step will be written into/read from separate files numbered consecutively: name_...
virtual void writeFstatHeader(std::ostream &os) const
Writes a header with a certain format for FStat file.
Definition: DPMBase.cc:994
void DPMBase::writeRestartFile ( )
virtual

Stores all the particle data for current save time step. Calls the write function.

/// See also MD::readRestartFile

Todo:
DPMBase::writeRestartFile should check if restartFIle is open or not

Definition at line 1618 of file DPMBase.cc.

References File::getFstream(), Files::restartFile, and write().

Referenced by writeOutputFiles().

1619 {
1622 }
virtual void write(std::ostream &os, bool writeAllParticles=true) const
Loads all MD data and plots statistics for all timesteps in the .data file.
Definition: DPMBase.cc:1897
File restartFile
An instance of class File to handle in- and output into a .restart file.
Definition: Files.h:219
std::fstream & getFstream()
Allows to access the member variable File::fstream_.
Definition: File.cc:151
void DPMBase::writeVTK ( ) const
protected

Definition at line 1080 of file DPMBase.cc.

References Files::getName(), getParticlesWriteVTK(), getTime(), getWallsWriteVTK(), InteractionHandler::getWriteVTK(), INFO, interactionHandler, logger, MULTIPLE_FILES, MULTIPLE_FILES_PADDED, NO_FILE, ONE_FILE, particleHandler, wallHandler, helpers::writeToFile(), WallHandler::writeVTK(), InteractionHandler::writeVTK(), and ParticleHandler::writeVTK().

Referenced by writeOutputFiles().

1080  {
1081  if ((getWallsWriteVTK() == FileType::ONE_FILE && getTime() == 0.0)
1084  {
1086  }
1087  if (getParticlesWriteVTK() == true)
1088  {
1090  }
1092 
1094  {
1095  logger(INFO,"Writing python script for paraview visualisation");
1096  helpers::writeToFile(getName()+".paraview.py",
1097  "#script to visualise the output of data2pvd of MercuryDPM in paraview.\n"
1098  "#usage: change the path below to your own path, open paraview\n"
1099  "#Tools->Python Shell->Run Script->VisualisationScript.py\n"
1100  "#or run paraview --script=VisualisationScript.py \n"
1101  "\n"
1102  "try: paraview.simple\n"
1103  "except: from paraview.simple import *\n"
1104  "import glob\n"
1105  //"import os\n"
1106  //"os.chdir(\"/Users/weinhartt/Mercury/Alpha/cmake-build-debug/Drivers/USER/Thomas/Mainz\")\n"
1107  "\n"
1108  "particles = XMLUnstructuredGridReader(FileName=glob.glob('./"
1109  + getName() + "Particle_*.vtu'))\n"
1110  "\n"
1111  "walls = XMLUnstructuredGridReader(FileName=glob.glob('./"
1112  + getName() + "Wall_*.vtu'))\n"
1113  "\n"
1114  "interactions = XMLUnstructuredGridReader(FileName=glob.glob('./"
1115  + getName() + "Interaction_*.vtu'))\n"
1116  "\n"
1117  "#Make the glyph, see visualisation guide on the docs\n"
1118  "glyphP = Glyph(particles)\n"
1119  "glyphP.GlyphType = 'Sphere'\n"
1120  "glyphP.Scalars = 'Radius'\n"
1121  "glyphP.Vectors = 'None'\n"
1122  "glyphP.ScaleMode = 'scalar'\n"
1123  "glyphP.ScaleFactor = 2\n"
1124  "glyphP.GlyphMode = 'All Points'\n"
1125  "\n"
1126  "#Make the glyph, see visualisation guide on the docs\n"
1127  "glyphI = Glyph(interactions)\n"
1128  "glyphI.GlyphType = 'Sphere'\n"
1129  "glyphI.Scalars = 'ContactRadius'\n"
1130  "glyphI.Vectors = 'None'\n"
1131  "glyphI.ScaleMode = 'scalar'\n"
1132  "glyphI.ScaleFactor = 10\n" //5 times too large
1133  "glyphI.GlyphMode = 'All Points'\n"
1134  "\n"
1135  "#show on screen\n"
1136  "Show(glyphI)\n"
1137  "Show(glyphP)\n"
1138  "Show(walls)\n"
1139  "Render()\n"
1140  "ResetCamera()");
1141  }
1142 }
void writeVTK() const
Writes all particles into a vtk file format (unstructured grid), consisting of particle positions...
FileType getWallsWriteVTK() const
Returns a flag indicating if particle rotation is enabled or disabled.
Definition: DPMBase.cc:263
bool writeToFile(std::string filename, std::string filecontent)
Writes a string to a file.
Definition: Helpers.cc:418
each time-step will be written into/read from separate files numbered consecutively, with numbers padded by zeros to a minimum of four digits: name_.0000, name_.0001, ..
void writeVTK() const
Writes all particles into a vtk file format (unstructured grid), consisting of particle positions...
FileType getWriteVTK() const
Logger< MERCURY_LOGLEVEL > logger("MercuryKernel")
bool getParticlesWriteVTK() const
Returns a flag indicating if particle rotation is enabled or disabled.
Definition: DPMBase.cc:271
file will not be created/read
ParticleHandler particleHandler
An object of the class ParticleHandler, contains the pointers to all the particles created...
Definition: DPMBase.h:1001
all data will be written into/ read from a single file called name_
InteractionHandler interactionHandler
An object of the class InteractionHandler.
Definition: DPMBase.h:1016
WallHandler wallHandler
An object of the class WallHandler. Contains pointers to all the walls created.
Definition: DPMBase.h:1006
each time-step will be written into/read from separate files numbered consecutively: name_...
Mdouble getTime() const
Access function for the time.
Definition: DPMBase.cc:169
const std::string & getName() const
Returns the name of the file. Does not allow to change it though.
Definition: Files.cc:132
void writeVTK() const
Writes all walls into a vtk format, consisting of points (edges) and cells (faces).
Definition: WallHandler.cc:239
virtual void DPMBase::writeXBallsScript ( ) const
virtual

This writes a script which can be used to load the xballs problem to display the data just generated.

Todo:
Implement or make pure virtual

Referenced by writeOutputFiles().

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  os,
const DPMBase md 
)
friend

Operator overloading of DPMBase class, writes the StatType to the given ostream.

Member Data Documentation

int DPMBase::addL_
private

Stores the number of large particles that are to be added on restart.

Definition at line 886 of file DPMBase.h.

Referenced by getAddLarge(), and setAddLarge().

int DPMBase::addS_
private

Stores the number of small particles that are to be added on restart.

Definition at line 892 of file DPMBase.h.

Referenced by getAddSmall(), and setAddSmall().

bool DPMBase::append_
private

A flag to determine if the file has to be appended or not. See DPMBase::Solve() for example.

Definition at line 939 of file DPMBase.h.

Referenced by DPMBase(), getAppend(), and setAppend().

Mdouble DPMBase::elasticEnergy_
private

used in force calculations

Stores the potential energy in the elastic springs (global, because it has to be calculated in the force loop

Definition at line 921 of file DPMBase.h.

Referenced by DPMBase().

Vec3D DPMBase::gravity_
private

Gravity vector.

Definition at line 842 of file DPMBase.h.

Referenced by constructor(), DPMBase(), getGravity(), read(), readOld(), and setGravity().

unsigned int DPMBase::ntimeSteps_
private

Stores the number of time steps.

Definition at line 904 of file DPMBase.h.

Referenced by constructor(), DPMBase(), getNtimeSteps(), read(), solve(), write(), and writeOutputFiles().

unsigned int DPMBase::particleDimensions_
private

determines if 2D or 3D particle volume is used for mass calculations

Definition at line 837 of file DPMBase.h.

Referenced by DPMBase(), getParticleDimensions(), read(), and setParticleDimensions().

RNG DPMBase::random

This is a random generator, often used for setting up the initial conditions etc...

Definition at line 996 of file DPMBase.h.

Referenced by InsertionBoundary::checkBoundaryBeforeTimeStep(), constructor(), Chute::createBottom(), DPMBase(), read(), readNextArgument(), ChuteBottom::setupInitialConditions(), and write().

bool DPMBase::restarted_
private

A bool to check if the simulation was restarted or not, ie. if setupInitialConditionsShould be run and the fileCounters reset.

Definition at line 933 of file DPMBase.h.

Referenced by DPMBase(), getRestarted(), and setRestarted().

std::string DPMBase::restartVersion_
private

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.

Definition at line 928 of file DPMBase.h.

Referenced by DPMBase(), getRestartVersion(), read(), and setRestartVersion().

bool DPMBase::rotation_
private

A flag to turn on/off particle rotation.

Definition at line 944 of file DPMBase.h.

Referenced by DPMBase(), getRotation(), and setRotation().

unsigned int DPMBase::systemDimensions_
private

The dimensions of the simulation i.e. 2D or 3D.

Definition at line 832 of file DPMBase.h.

Referenced by DPMBase(), getSystemDimensions(), read(), readOld(), and setSystemDimensions().

Mdouble DPMBase::time_
private

Stores the current simulation time.

Definition at line 899 of file DPMBase.h.

Referenced by constructor(), DPMBase(), getTime(), read(), readNextDataFile(), readOld(), setTime(), and solve().

Mdouble DPMBase::timeMax_
private

Stores the duration of the simulation.

Definition at line 914 of file DPMBase.h.

Referenced by constructor(), DPMBase(), getTimeMax(), read(), readOld(), and setTimeMax().

Mdouble DPMBase::timeStep_
private

Stores the simulation time step.

Definition at line 909 of file DPMBase.h.

Referenced by constructor(), DPMBase(), getTimeStep(), read(), readOld(), setTimeStep(), and solve().

bool DPMBase::writeParticlesVTK_
private

A flag to turn on/off the vtk writer for particles.

Definition at line 954 of file DPMBase.h.

Referenced by constructor(), DPMBase(), getParticlesWriteVTK(), read(), setParticlesWriteVTK(), and write().

FileType DPMBase::writeWallsVTK_
private

A flag to turn on/off the vtk writer for walls.

Definition at line 949 of file DPMBase.h.

Referenced by constructor(), DPMBase(), getWallsWriteVTK(), read(), setWallsWriteVTK(), and write().

std::string DPMBase::xBallsAdditionalArguments_
private

A string of additional arguments for xballs can be specified (see XBalls/xballs.txt). e.g. "-solidf -v0".

Definition at line 977 of file DPMBase.h.

Referenced by constructor(), DPMBase(), getXBallsAdditionalArguments(), and setXBallsAdditionalArguments().

int DPMBase::xBallsColourMode_
private

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)

Definition at line 962 of file DPMBase.h.

Referenced by constructor(), DPMBase(), getXBallsColourMode(), and setXBallsColourMode().

Mdouble DPMBase::xBallsScale_
private

sets the xballs argument scale (see XBalls/xballs.txt)

Definition at line 972 of file DPMBase.h.

Referenced by constructor(), DPMBase(), getXBallsScale(), and setXBallsScale().

Mdouble DPMBase::xBallsVectorScale_
private

sets the xballs argument vscale (see XBalls/xballs.txt)

Definition at line 967 of file DPMBase.h.

Referenced by constructor(), DPMBase(), getXBallsVectorScale(), and setXBallsVectorScale().

Mdouble DPMBase::xMax_
private

If the length of the problem domain in x-direction is XMax - XMin, the above variable stores XMax.

Definition at line 854 of file DPMBase.h.

Referenced by constructor(), DPMBase(), getMax(), getXMax(), read(), readNextDataFile(), readOld(), and setXMax().

Mdouble DPMBase::xMin_
private

If the length of the problem domain in x-direction is XMax - XMin, the above variable stores XMin.

Definition at line 848 of file DPMBase.h.

Referenced by constructor(), DPMBase(), getMin(), getXMin(), read(), readNextDataFile(), readOld(), and setXMin().

Mdouble DPMBase::yMax_
private

If the length of the problem domain in y-direction is YMax - XMin, the above variable stores YMax.

Definition at line 866 of file DPMBase.h.

Referenced by constructor(), DPMBase(), getMax(), getYMax(), read(), readNextDataFile(), readOld(), and setYMax().

Mdouble DPMBase::yMin_
private

If the length of the problem domain in y-direction is YMax - YMin, the above variable stores YMin.

Definition at line 860 of file DPMBase.h.

Referenced by constructor(), DPMBase(), getMin(), getYMin(), read(), readNextDataFile(), readOld(), and setYMin().

Mdouble DPMBase::zMax_
private

If the length of the problem domain in z-direction is ZMax - ZMin, the above variable stores ZMax.

Definition at line 878 of file DPMBase.h.

Referenced by constructor(), DPMBase(), getMax(), getZMax(), read(), readNextDataFile(), readOld(), and setZMax().

Mdouble DPMBase::zMin_
private

If the length of the problem domain in z-direction is ZMax - ZMin, the above variable stores ZMin.

Definition at line 872 of file DPMBase.h.

Referenced by constructor(), DPMBase(), getMin(), getZMin(), read(), readNextDataFile(), readOld(), and setZMin().


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