MercuryDPM  Trunk
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
BaseInteraction Class Referenceabstract

Stores information about interactions between two interactable objects; often particles but could be walls etc. By info about interactions one means the overlaps, contact point, forces, torques, relative velocities etc. More...

#include <BaseInteraction.h>

+ Inheritance diagram for BaseInteraction:

Public Member Functions

 BaseInteraction (BaseInteractable *P, BaseInteractable *I, unsigned timeStamp)
 A constructor takes the BaseInteractable objects which are interacting (come into contact) and time the interaction starts. More...
 
 BaseInteraction ()
 
 BaseInteraction (const BaseInteraction &p)
 Copy constructor. More...
 
 ~BaseInteraction () override
 The destructor. More...
 
virtual void actionsOnErase ()
 If an interaction needs to do something before it gets erased, add it here. E.g. Liquid bridges rupture at the end of their lifetime, and the liquid bridge volume has to be redistributed. The reason this action is not done in the destructor is that this action should not be taken when erasing ghost interactions. More...
 
virtual void computeForce ()
 Virtual function that contains the force law between the two objects interacting. More...
 
void read (std::istream &is) override
 Interaction read function, which accepts an std::istream as input. More...
 
void write (std::ostream &os) const override
 Interaction print function, which accepts an std::ostream as input. More...
 
void writeToFStat (std::ostream &os, Mdouble time) const
 Writes forces data to the FStat file. More...
 
std::string getName () const override
 Virtual function which allows interactions to be named. More...
 
virtual Mdouble getElasticEnergy () const
 Returns a Mdouble which is the current about of Elastic energy in the interaction. More...
 
void setDistance (Mdouble distance)
 Sets the interaction distance between the two interacting objects. More...
 
void setNormal (Vec3D normal)
 Sets the normal vector between the two interacting objects. More...
 
void setOverlap (Mdouble overlap)
 Set the overlap between the two interacting object. More...
 
void setContactPoint (Vec3D contactPoint)
 Set the location of the contact point between the two interacting objects. More...
 
void setTimeStamp (unsigned timeStamp)
 Updates the time step of the interacting. Note, time steps used to find completed interactions. More...
 
void setSpecies (const BaseSpecies *species)
 Set the Species of the interaction; note this can either be a Species or MixedSpecies. More...
 
void setP (BaseInteractable *P)
 Sets the first object involved in the interaction (normally a particle). More...
 
void setI (BaseInteractable *I)
 Sets the second object involved in the interaction (often particle or wall). More...
 
void importP (BaseInteractable *P)
 Sets the first object involved in the interaction (normally a particle). More...
 
void importI (BaseInteractable *I)
 Sets the second object involved in the interaction (often particle or wall). More...
 
Vec3D getIP () const
 
Vec3D getIC () const
 
Vec3D getCP () const
 
void setLagrangeMultiplier (Mdouble multiplier)
 
Mdouble getLagrangeMultiplier ()
 
void setHandler (InteractionHandler *handler)
 Sets the pointer to the interaction hander which is storing this interaction. More...
 
InteractionHandlergetHandler () const
 Gets a point to the interaction handlers to which this interaction belongs. More...
 
const Vec3DgetForce () const
 Gets the current force (vector) between the two interacting objects. More...
 
const Vec3DgetTorque () const
 Gets the current torque (vector) between the two interacting objects. More...
 
const Vec3DgetNormal () const
 Gets the normal vector between the two interacting objects. More...
 
const Vec3DgetContactPoint () const
 Gets constant reference to contact point (vector). More...
 
Mdouble getOverlap () const
 Returns a Mdouble with the current overlap between the two interacting objects. More...
 
Mdouble getContactRadius () const
 Returns a Mdouble with the current contact between the two interacting objects. More...
 
void removeFromHandler ()
 Removes this interaction from its interaction hander. More...
 
void copySwitchPointer (const BaseInteractable *original, BaseInteractable *ghost) const
 This copies the interactions of the original particle and replaces the original with the ghost copy. More...
 
void gatherContactStatistics ()
 
BaseInteractablegetP ()
 Returns a pointer to first object involved in the interaction (normally a particle). More...
 
BaseInteractablegetI ()
 Returns a pointer to the second object involved in the interaction (often a wall or a particle). More...
 
const BaseInteractablegetP () const
 Returns a constant pointer to the first object involved in the interaction. More...
 
const BaseInteractablegetI () const
 Returns a constant pointer to the second object involved in the interaction. More...
 
Mdouble getTimeStamp () const
 Returns an Mdouble which is the time stamp of the interaction. More...
 
virtual void integrate (Mdouble timeStep)
 integrates variables of the interaction which need to be integrate e.g. the tangential overlap. More...
 
virtual Mdouble getTangentialOverlap () const
 get the length of the current tangential overlap More...
 
Mdouble getDistance () const
 Returns an Mdouble which is the norm (length) of distance vector. More...
 
const Vec3DgetRelativeVelocity () const
 Returns a constant reference to a vector of relative velocity. More...
 
Mdouble getNormalRelativeVelocity () const
 Returns a double which is the norm (length) of the relative velocity vector. More...
 
Mdouble getAbsoluteNormalForce () const
 Returns the absolute value of the norm (length) of the Normal force vector. More...
 
virtual BaseInteractioncopy () const =0
 Makes a copy of the interaction and returns a pointer to the copy. More...
 
void setFStatData (std::fstream &fstat, BaseParticle *P, BaseWall *I)
 
void setFStatData (std::fstream &fstat, BaseParticle *P, BaseParticle *I)
 
unsigned int getMultiContactIdentifier () const
 
void setMultiContactIdentifier (unsigned int multiContactIdentifier_)
 
virtual void rotateHistory (Matrix3D &rotationMatrix)
 When periodic particles are used, some interactions need certain history properties rotated (e.g. tangential springs). This is the function for that. More...
 
virtual void actionsAfterTimeStep ()
 
virtual unsigned getNumberOfFieldsVTK () const
 
virtual std::string getTypeVTK (unsigned i) const
 
virtual std::string getNameVTK (unsigned i) const
 
virtual std::vector< MdoublegetFieldVTK (unsigned i) const
 
void setForce (Vec3D force)
 set total force (this is used by the normal force, tangential forces are added use addForce) More...
 
const BaseSpeciesgetBaseSpecies () const
 Return a constant point to BaseSpecies of the interaction. More...
 
virtual void createMPIType ()
 
virtual void * createMPIInteractionDataArray (unsigned int numberOfInteractions) const
 
virtual void deleteMPIInteractionDataArray (void *dataArray)
 
virtual void getMPIInteraction (void *historyDataArray, unsigned int index) const
 copies the history interactions into the data array More...
 
virtual void getInteractionDetails (void *interactionDataArray, unsigned int index, unsigned int &identificationP, unsigned int &identificationI, bool &isWallInteraction, unsigned &timeStamp)
 
virtual void setMPIInteraction (void *interactionDataArray, unsigned int index, bool resetPointers)
 
void setBasicMPIInteractionValues (int P, int I, unsigned timeStamp, Vec3D force, Vec3D torque, bool isWallInteraction, bool resetPointers)
 
void setIdentificationP (unsigned int identification)
 
void setIdentificationI (int identification)
 
void setWallInteraction (bool flag)
 
unsigned int getIdentificationP ()
 
int getIdentificationI ()
 
bool isWallInteraction ()
 
virtual bool isBonded () const
 
- Public Member Functions inherited from BaseObject
 BaseObject ()=default
 Default constructor. More...
 
 BaseObject (const BaseObject &p)=default
 Copy constructor, copies all the objects BaseObject contains. More...
 
virtual ~BaseObject ()=default
 virtual destructor More...
 
virtual void moveInHandler (unsigned int index)
 Except that it is virtual, it does the same thing as setIndex() does. More...
 
void setIndex (unsigned int index)
 Allows one to assign an index to an object in the handler/container. More...
 
void setId (unsigned long id)
 Assigns a unique identifier to each object in the handler (container) which remains constant even after the object is deleted from the container/handler. More...
 
unsigned int getIndex () const
 Returns the index of the object in the handler. More...
 
unsigned int getId () const
 Returns the unique identifier of any particular object. More...
 
void setGroupId (unsigned groupId)
 
unsigned getGroupId () const
 

Protected Member Functions

virtual const Vec3D getTangentialForce () const
 
Mdouble getEffectiveRadius () const
 Returns a Mdouble to the effective radius of the interaction. (Not corrected for the overlap) More...
 
Mdouble getEffectiveMass () const
 Returns a Mdouble to the effective radius of the interaction. (Not corrected for the overlap) More...
 
void addForce (Vec3D force)
 add an force increment to the total force. More...
 
void addTorque (Vec3D torque)
 
void setTorque (Vec3D torque)
 set the total force (this is used by the normal force, tangential torques are added use addTorque) More...
 
void setRelativeVelocity (Vec3D relativeVelocity)
 set the relative velocity of the current of the interactions. More...
 
void setNormalRelativeVelocity (Mdouble normalRelativeVelocit)
 set the normal component of the relative velocity. More...
 
void setAbsoluteNormalForce (Mdouble absoluteNormalForce)
 the absolute values of the norm (length) of the normal force More...
 
virtual Mdouble getElasticEnergyAtEquilibrium (Mdouble adhesiveForce) const
 
virtual void reverseHistory ()
 When periodic particles some interaction need certain history properties reversing. This is the function for that. More...
 
void writeInteraction (std::ostream &os, bool created) const
 Writes information about a interaction to the interaction file. More...
 

Private Attributes

InteractionHandlerhandler_
 
BaseInteractableP_
 
BaseInteractableI_
 
unsigned int identificationP_
 
int identificationI_
 
bool isWallInteraction_
 
Vec3D contactPoint_
 
Vec3D relativeVelocity_
 
Mdouble normalRelativeVelocity_
 
Mdouble absoluteNormalForce_
 
Mdouble distance_
 
Vec3D force_
 
Vec3D torque_
 
unsigned timeStamp_
 
Vec3D normal_
 
Mdouble overlap_
 
const BaseSpeciesspecies_
 
Mdouble lagrangeMultiplier_
 
unsigned multiContactIdentifier_
 

Detailed Description

Stores information about interactions between two interactable objects; often particles but could be walls etc. By info about interactions one means the overlaps, contact point, forces, torques, relative velocities etc.

This class is completely a MercuryDPM internal and should not be visible to users. It is also an abstract base class. All possible Mercury interactions are derived from this class. It is basically a policy class that defines what an interaction must have in Mercury. Advanced uses that need to add a new interaction must derive it from here and implement the black functions.

Definition at line 59 of file BaseInteraction.h.

Constructor & Destructor Documentation

BaseInteraction::BaseInteraction ( BaseInteractable P,
BaseInteractable I,
unsigned  timeStamp 
)

A constructor takes the BaseInteractable objects which are interacting (come into contact) and time the interaction starts.

This is the constructor which creates a new interactions between two BaseInteractable objects. The timeStamp is time the interactions is created and is used to check if the interations is current or has ended. It adds

Parameters
[in]PBaseInteractable pointer which is the first object involved in the interaction normally a particle.
[in]IBaseInteractable pointer which is the second object involved in the interaction often a wall or particle.
[in]timeStampMdouble which is the time the interaction starts.
Bug:
Why is the species set to zero here and not the correct mixed type.

Definition at line 40 of file BaseInteraction.cc.

References contactPoint_, force_, BaseHandler< T >::getDPMBase(), File::getFileType(), File::getFstream(), BaseSpecies::getHandler(), DPMBase::getInteractionFile(), BaseInteractable::getSpecies(), I_, lagrangeMultiplier_, normal_, ONE_FILE, overlap_, P_, Vec3D::setNaN(), Vec3D::setZero(), species_, timeStamp_, torque_, and writeInteraction().

41  : BaseObject()
42 {
43  P_ = P;
44  I_ = I;
45  normal_.setZero();
47  overlap_ = 0;
48  timeStamp_ = timeStamp;
50  species_ = nullptr;
51  force_.setZero();
52  torque_.setZero();
54  {
56  }
58 
59 #ifdef DEBUG_CONSTRUCTOR
60  std::cout<<"BaseInteraction::BaseInteraction() finished"<<std::endl;
61 #endif
62 }
BaseInteractable * I_
FileType getFileType() const
Gets the file type e.g. NOFILE, ONEFILE and MULTIPLE FILES. File::fileType_.
Definition: File.cc:208
File & getInteractionFile()
Return a reference to the file InteractionsFile.
Definition: DPMBase.cc:335
const ParticleSpecies * getSpecies() const
Returns a pointer to the species of this BaseInteractable.
const BaseSpecies * species_
BaseObject()=default
Default constructor.
void setZero()
Sets all elements to zero.
Definition: Vector.cc:43
SpeciesHandler * getHandler() const
Returns the pointer to the handler to which this species belongs.
Definition: BaseSpecies.cc:99
BaseInteractable * P_
std::fstream & getFstream()
Allows to access the member variable File::fstream_.
Definition: File.cc:154
all data will be written into/ read from a single file called name_
Mdouble lagrangeMultiplier_
void writeInteraction(std::ostream &os, bool created) const
Writes information about a interaction to the interaction file.
DPMBase * getDPMBase()
Gets the problem that is solved using this handler.
Definition: BaseHandler.h:725
void setNaN()
Sets all elements to NaN.
Definition: Vector.cc:53
BaseInteraction::BaseInteraction ( )
Todo:
: empty baseInteraction, used in mpi code probably

Definition at line 65 of file BaseInteraction.cc.

References contactPoint_, force_, I_, lagrangeMultiplier_, normal_, overlap_, P_, Vec3D::setNaN(), Vec3D::setZero(), species_, timeStamp_, and torque_.

66  : BaseObject()
67 {
68  P_ = nullptr;
69  I_ = nullptr;
70  normal_.setZero();
71  overlap_ = 0;
72  timeStamp_ = 0;
73  species_ = nullptr;
74  force_.setZero();
75  torque_.setZero();
78 }
BaseInteractable * I_
const BaseSpecies * species_
BaseObject()=default
Default constructor.
void setZero()
Sets all elements to zero.
Definition: Vector.cc:43
BaseInteractable * P_
Mdouble lagrangeMultiplier_
void setNaN()
Sets all elements to NaN.
Definition: Vector.cc:53
BaseInteraction::BaseInteraction ( const BaseInteraction p)

Copy constructor.

This an copy constructor for a BaseInteraction.

Parameters
[in]pBaseInteraction
Todo:
why are not all of the member variables copied?

Definition at line 84 of file BaseInteraction.cc.

References contactPoint_, force_, I_, lagrangeMultiplier_, normal_, overlap_, P_, species_, timeStamp_, and torque_.

85  : BaseObject(p)
86 {
87  P_ = p.P_;
88  I_ = p.I_;
89  normal_ = p.normal_;
90  overlap_ = p.overlap_;
91  force_ = p.force_;
92  torque_ = p.torque_;
93  species_ = p.species_;
97 
99 // InteractionHandler* handler_;
100 // BaseInteractable* P_;
101 // BaseInteractable* I_;
102 // unsigned int identificationP_;
103 // int identificationI_;
104 // bool isWallInteraction_;
105 // Vec3D contactPoint_;
106 // Vec3D relativeVelocity_;
107 // Mdouble normalRelativeVelocity_;
108 // Mdouble absoluteNormalForce_;
109 // Mdouble distance_;
110 // Vec3D force_;
111 // Vec3D torque_;
112 // unsigned timeStamp_;
113 // Vec3D normal_;
114 // Mdouble overlap_;
115 // const BaseSpecies* species_;
116 // Mdouble lagrangeMultiplier_;
117 // unsigned multiContactIdentifier_;
118 
119 }
BaseInteractable * I_
const BaseSpecies * species_
BaseObject()=default
Default constructor.
BaseInteractable * P_
Mdouble lagrangeMultiplier_
BaseInteraction::~BaseInteraction ( )
override

The destructor.

It removes this interactions from the objects that were interacting, and writes the time to a file when needed.

Destructor for BaseInteraction. Also removes the interaction from the list of interactions for both objects involved in the interaction.

Definition at line 125 of file BaseInteraction.cc.

References DEBUG, BaseHandler< T >::getDPMBase(), File::getFileType(), File::getFstream(), getHandler(), DPMBase::getInteractionFile(), I_, logger, ONE_FILE, P_, BaseInteractable::removeInteraction(), and writeInteraction().

126 {
127 #if MERCURY_USE_MPI
128  if (P_ == nullptr)
129  {
130  logger(DEBUG,"Destroying a fictitious interaction used in MPI transmissions");
131  }
132  else
133  {
134 #endif
135  logger.assert(P_ != nullptr, "Trying to destroy an interaction with P_ = nullptr");
136  logger.assert(I_ != nullptr, "Trying to destroy an interaction with I_ = nullptr");
137  File& interactionFile = getHandler()->getDPMBase()->getInteractionFile();
138  if (interactionFile.getFileType() == FileType::ONE_FILE)
139  {
140  writeInteraction(interactionFile.getFstream(), false);
141  }
142 
143  P_->removeInteraction(this);
144  I_->removeInteraction(this);
145 #if MERCURY_USE_MPI
146  }
147 #endif
148 }
BaseInteractable * I_
FileType getFileType() const
Gets the file type e.g. NOFILE, ONEFILE and MULTIPLE FILES. File::fileType_.
Definition: File.cc:208
File & getInteractionFile()
Return a reference to the file InteractionsFile.
Definition: DPMBase.cc:335
Logger< MERCURY_LOGLEVEL > logger("MercuryKernel")
InteractionHandler * getHandler() const
Gets a point to the interaction handlers to which this interaction belongs.
bool removeInteraction(BaseInteraction *I)
Removes an interaction from this BaseInteractable.
BaseInteractable * P_
std::fstream & getFstream()
Allows to access the member variable File::fstream_.
Definition: File.cc:154
all data will be written into/ read from a single file called name_
void writeInteraction(std::ostream &os, bool created) const
Writes information about a interaction to the interaction file.
DPMBase * getDPMBase()
Gets the problem that is solved using this handler.
Definition: BaseHandler.h:725
Definition: File.h:80

Member Function Documentation

void BaseInteraction::actionsAfterTimeStep ( )
virtual

Reimplemented in LiquidMigrationWilletInteraction.

Definition at line 770 of file BaseInteraction.cc.

771 {
772 }
virtual void BaseInteraction::actionsOnErase ( )
inlinevirtual

If an interaction needs to do something before it gets erased, add it here. E.g. Liquid bridges rupture at the end of their lifetime, and the liquid bridge volume has to be redistributed. The reason this action is not done in the destructor is that this action should not be taken when erasing ghost interactions.

Reimplemented in LiquidMigrationWilletInteraction.

Definition at line 84 of file BaseInteraction.h.

Referenced by InteractionHandler::eraseOldInteractions().

85  {};
void BaseInteraction::addForce ( Vec3D  force)
protected

add an force increment to the total force.

add an increment to total force in the interaction. This is used by tangential and non-contact forces (e.g. adhesive forces) as this are 'added' after the normal forces have been computed.

Definition at line 558 of file BaseInteraction.cc.

References force_.

Referenced by BondedInteraction::computeAdhesionForce(), IrreversibleAdhesiveInteraction::computeAdhesionForce(), ChargedBondedInteraction::computeAdhesionForce(), ReversibleAdhesiveInteraction::computeAdhesionForce(), LiquidBridgeWilletInteraction::computeAdhesionForce(), ParhamiMcMeekingSinterInteraction::computeAdhesionForce(), LiquidMigrationWilletInteraction::computeAdhesionForce(), SlidingFrictionInteraction::computeFrictionForce(), and MindlinInteraction::computeFrictionForce().

559 {
560  force_ += force;
561 }
void BaseInteraction::addTorque ( Vec3D  torque)
protected

add an increment to total torque in the interaction. This is used by tangential and non-contact forces (e.g. adhesive forces) as this are 'added' after the normal forces have been computed.

Definition at line 568 of file BaseInteraction.cc.

References torque_.

Referenced by FrictionInteraction::computeFrictionForce(), and MindlinRollingTorsionInteraction::computeFrictionForce().

569 {
570  torque_ += torque;
571 }
void BaseInteraction::computeForce ( )
virtual

Virtual function that contains the force law between the two objects interacting.

The children of this class will implement this function; however, it is blank. This function will do the actually force calculation for this interaction. Note, it is not virtual as it is not called from within this class.

Definition at line 646 of file BaseInteraction.cc.

Referenced by DPMBase::computeForcesDueToWalls(), and DPMBase::computeInternalForce().

647 {}
virtual BaseInteraction* BaseInteraction::copy ( ) const
pure virtual

Makes a copy of the interaction and returns a pointer to the copy.

Referenced by copySwitchPointer().

void BaseInteraction::copySwitchPointer ( const BaseInteractable original,
BaseInteractable ghost 
) const

This copies the interactions of the original particle and replaces the original with the ghost copy.

This functions copies the interactions of a real original particle. It first works out which of P and I is not the original particle. Then it create a new interactions between the new ghost copy and which every object is not the original particle from the P and I of the interaction. Note, at the end the ghost will be I in the new interaction and original item being interacted with will be P.

Todo:
Can this be simpler if we replace the particle with the ghost.
Parameters
[in]originalBaseInteractable* to the original particles who periodic image is being created from.
[in]ghostBaseInteractble* to the new ghost (periodic partcles) that has just been created.

Definition at line 297 of file BaseInteraction.cc.

References InteractionHandler::addObject(), copy(), getI(), getP(), handler_, I_, P_, and reverseHistory().

Referenced by BaseInteractable::copyInteractionsForPeriodicParticles().

298 {
299  //Copy the interaction of ghost
300  BaseInteraction* C = copy();
301  //Finds out which of P and I is that the particle from whom the ghost is begin created.
302  //The object being interacted with is set to P
303  if (C->getP() == original)
304  {
305  //Reverse some force history
306  C->reverseHistory();
307  //Set the P to the original particle
308  C->P_ = C->getI();
309  }
310  //The new ghost particle is set to I in the interaction.
311  C->I_ = ghost;
312 
313  //Add the the interaction to both original and the ghost
314  handler_->addObject(C);
315 }
BaseInteractable * I_
virtual BaseInteraction * copy() const =0
Makes a copy of the interaction and returns a pointer to the copy.
virtual void reverseHistory()
When periodic particles some interaction need certain history properties reversing. This is the function for that.
BaseInteractable * getI()
Returns a pointer to the second object involved in the interaction (often a wall or a particle)...
Stores information about interactions between two interactable objects; often particles but could be ...
BaseInteractable * getP()
Returns a pointer to first object involved in the interaction (normally a particle).
BaseInteractable * P_
void addObject(BaseInteraction *I) override
Adds an Interaction to the InteractionHandler.
InteractionHandler * handler_
void * BaseInteraction::createMPIInteractionDataArray ( unsigned int  numberOfInteractions) const
virtual

Definition at line 863 of file BaseInteraction.cc.

References ERROR, and logger.

Referenced by InteractionHandler::createMPIInteractionDataArray().

864 {
865  logger(ERROR, "BaseInteraction::createMPIInteractionDataArray should never be called");
866  void* historyArray;
867  return historyArray;
868 }
Logger< MERCURY_LOGLEVEL > logger("MercuryKernel")
void BaseInteraction::createMPIType ( )
virtual

Definition at line 851 of file BaseInteraction.cc.

Referenced by MPIContainer::initialiseMercuryMPITypes().

852 {
853 }
void BaseInteraction::deleteMPIInteractionDataArray ( void *  dataArray)
virtual

Definition at line 870 of file BaseInteraction.cc.

References logger, and WARN.

Referenced by InteractionHandler::deleteMPIInteractionDataArray().

871 {
872  logger(WARN, "Why on earth is this function called?");
873 }
Logger< MERCURY_LOGLEVEL > logger("MercuryKernel")
void BaseInteraction::gatherContactStatistics ( )
Todo:
Thomas please document this; as this is the area you are currently rewriting.
Todo:
Thomas please document.
Todo:
TW centre is used just for backward compatibility; replace centre by contact law; we also have to correct it in StatisticsVector::gatherContactStatistics. There also seems to be an issue with the normal being defined differently for walls

Definition at line 777 of file BaseInteraction.cc.

References Vec3D::dot(), force_, DPMBase::gatherContactStatistics(), BaseHandler< T >::getDPMBase(), getHandler(), BaseObject::getIndex(), Vec3D::getLength(), getNormal(), getOverlap(), getP(), BaseInteractable::getPosition(), getTangentialForce(), getTangentialOverlap(), I_, normal_, overlap_, and P_.

778 {
779  auto* IParticle = dynamic_cast<BaseParticle*>(I_);
780  auto* PParticle = static_cast<BaseParticle*>(P_);
781 
782  Vec3D tangentialForce = getTangentialForce();
783  Mdouble tangentialOverlap = getTangentialOverlap();
784 
785  Mdouble scalarNormalForce = Vec3D::dot(force_, getNormal());
786  Mdouble scalarTangentialForce = tangentialForce.getLength();
787  Vec3D tangential;
788  if (scalarTangentialForce != 0.0)
789  tangential = tangentialForce / scalarTangentialForce;
790  else
791  tangential = Vec3D(0.0, 0.0, 0.0);
792 
795  Vec3D centre;
796  if (IParticle != nullptr)
797  centre = getP()->getPosition() - normal_ * (PParticle->getRadius() + IParticle->getRadius() - overlap_) / 2.0;
798  else
799  centre = getP()->getPosition() - normal_ * (PParticle->getRadius() - overlap_);
800 
801  if (!PParticle->isFixed())
802  {
804  P_->getIndex(),
805  static_cast<int>((IParticle == nullptr ? (-I_->getIndex() - 1) : I_->getIndex())),
806  centre,
807  getOverlap(),
808  tangentialOverlap,
809  scalarNormalForce,
810  scalarTangentialForce,
811  (IParticle == nullptr ? -normal_ : normal_),
812  (IParticle == nullptr ? -tangential : tangential));
813  }
814  if (IParticle != nullptr && !IParticle->isFixed() && IParticle->getPeriodicFromParticle() == nullptr)
815  {
817  I_->getIndex(),
818  static_cast<int>(P_->getIndex()),
819  centre,
820  getOverlap(),
821  tangentialOverlap,
822  scalarNormalForce,
823  scalarTangentialForce,
824  -normal_,
825  -tangential);
826 
827  }
828 }
BaseInteractable * I_
unsigned int getIndex() const
Returns the index of the object in the handler.
Definition: BaseObject.h:118
const Vec3D & getPosition() const
Returns the position of this BaseInteractable.
InteractionHandler * getHandler() const
Gets a point to the interaction handlers to which this interaction belongs.
double Mdouble
Definition: GeneralDefine.h:34
static Mdouble dot(const Vec3D &a, const Vec3D &b)
Calculates the dot product of two Vec3D: .
Definition: Vector.cc:76
static Mdouble getLength(const Vec3D &a)
Calculates the length of a Vec3D: .
Definition: Vector.cc:331
const Vec3D & getNormal() const
Gets the normal vector between the two interacting objects.
virtual void gatherContactStatistics(unsigned int index1, int index2, Vec3D Contact, Mdouble delta, Mdouble ctheta, Mdouble fdotn, Mdouble fdott, Vec3D P1_P2_normal_, Vec3D P1_P2_tangential)
//Not unsigned index because of possible wall collisions.
Definition: DPMBase.cc:1869
BaseInteractable * getP()
Returns a pointer to first object involved in the interaction (normally a particle).
BaseInteractable * P_
virtual const Vec3D getTangentialForce() const
Mdouble getOverlap() const
Returns a Mdouble with the current overlap between the two interacting objects.
Definition: Vector.h:49
DPMBase * getDPMBase()
Gets the problem that is solved using this handler.
Definition: BaseHandler.h:725
virtual Mdouble getTangentialOverlap() const
get the length of the current tangential overlap
Mdouble BaseInteraction::getAbsoluteNormalForce ( ) const

Returns the absolute value of the norm (length) of the Normal force vector.

Returns the absolute normal force. This is the magnitude of the normal force.

Todo:
Ant: Check this comment.
Returns
Mdouble that contains the absolute norm (length) of the normal force.

Definition at line 548 of file BaseInteraction.cc.

References absoluteNormalForce_.

Referenced by SlidingFrictionInteraction::computeFrictionForce(), MindlinRollingTorsionInteraction::computeFrictionForce(), FrictionInteraction::computeFrictionForce(), MindlinInteraction::computeFrictionForce(), and MindlinInteraction::updateK_t().

549 {
550  return absoluteNormalForce_;
551 }
Mdouble absoluteNormalForce_
const BaseSpecies * BaseInteraction::getBaseSpecies ( ) const

Return a constant point to BaseSpecies of the interaction.

Returns a BaseSpecies pointer to the current species. Note, this will be either a Species or a MixedSpecies done of which are derived from BaseSpecies.

Returns
A BaseSpecies pointer to the species associated with this interaction.

Definition at line 634 of file BaseInteraction.cc.

References species_.

Referenced by SlidingFrictionInteraction::computeFrictionForce(), FrictionInteraction::computeFrictionForce(), ChargedBondedInteraction::getElasticEnergy(), LinearViscoelasticInteraction::getElasticEnergy(), SlidingFrictionInteraction::getElasticEnergy(), LinearPlasticViscoelasticInteraction::getElasticEnergy(), IrreversibleAdhesiveInteraction::getElasticEnergy(), FrictionInteraction::getElasticEnergy(), BondedInteraction::getSpecies(), IrreversibleAdhesiveInteraction::getSpecies(), LiquidBridgeWilletInteraction::getSpecies(), ParhamiMcMeekingSinterInteraction::getSpecies(), RegimeSinterInteraction::getSpecies(), ReversibleAdhesiveInteraction::getSpecies(), ChargedBondedInteraction::getSpecies(), SinterInteraction::getSpecies(), EmptyAdhesiveInteraction::getSpecies(), LinearViscoelasticInteraction::getSpecies(), EmptyFrictionInteraction::getSpecies(), HertzianSinterInteraction::getSpecies(), LinearPlasticViscoelasticInteraction::getSpecies(), LiquidMigrationWilletInteraction::getSpecies(), HertzianViscoelasticInteraction::getSpecies(), MindlinRollingTorsionInteraction::getSpecies(), FrictionInteraction::getSpecies(), SlidingFrictionInteraction::getSpecies(), and MindlinInteraction::getSpecies().

635 {
636  return species_;
637 }
const BaseSpecies * species_
Mdouble BaseInteraction::getContactRadius ( ) const

Returns a Mdouble with the current contact between the two interacting objects.

Returns a Mdouble to the current overlap for the objects involved in the interaction.

Returns
Mdouble which is the value of the overlap.

Definition at line 322 of file BaseInteraction.cc.

References getEffectiveRadius(), and getOverlap().

323 {
324  return getOverlap()<0.0?0.0:sqrt(2.0 * getEffectiveRadius() * getOverlap());
325 }
Mdouble getEffectiveRadius() const
Returns a Mdouble to the effective radius of the interaction. (Not corrected for the overlap) ...
Mdouble getOverlap() const
Returns a Mdouble with the current overlap between the two interacting objects.
Vec3D BaseInteraction::getCP ( ) const

returns the vector from C to P. Note, this cannot simply computed as P-I because I is possibly a ghost particle and might be shifted.

Definition at line 425 of file BaseInteraction.cc.

References getContactPoint(), getP(), and BaseInteractable::getPosition().

Referenced by CGFields::StandardFields::setFields().

426 {
427  return getP()->getPosition() - getContactPoint();
428 }
const Vec3D & getPosition() const
Returns the position of this BaseInteractable.
const Vec3D & getContactPoint() const
Gets constant reference to contact point (vector).
BaseInteractable * getP()
Returns a pointer to first object involved in the interaction (normally a particle).
Mdouble BaseInteraction::getDistance ( ) const
Mdouble BaseInteraction::getEffectiveMass ( ) const
protected

Returns a Mdouble to the effective radius of the interaction. (Not corrected for the overlap)

Computes the effective mass of the particles in the interaction. This is used by many of the later interaction models. This functions assumes P is the particle and I is either a particle or a wall. Effective Radius = \(R_I*R_P/(R_I+R_P)\) See also BaseInteraction::getEffectiveCorrectedRadius()

Returns
A Mdouble which is the effective radius of the particles.

Definition at line 762 of file BaseInteraction.cc.

References getContactPoint(), getI(), BaseObject::getId(), BaseInteractable::getInvMass(), getP(), and logger.

Referenced by SlidingFrictionInteraction::computeFrictionForce(), FrictionInteraction::computeFrictionForce(), MindlinInteraction::computeFrictionForce(), HertzianViscoelasticInteraction::computeNormalForce(), LinearViscoelasticInteraction::computeNormalForce(), LinearPlasticViscoelasticInteraction::computeNormalForce(), LinearViscoelasticInteraction::getElasticEnergy(), SlidingFrictionInteraction::getElasticEnergy(), LinearPlasticViscoelasticInteraction::getElasticEnergy(), and FrictionInteraction::getElasticEnergy().

763 {
764  Mdouble invEffectiveMass = getP()->getInvMass() + getI()->getInvMass();
765  logger.assert(invEffectiveMass>0,
766  "getEffectiveMass(): interaction % at % has infinite effective mass",getId(), getContactPoint());
767  return 1.0 / invEffectiveMass;
768 }
unsigned int getId() const
Returns the unique identifier of any particular object.
Definition: BaseObject.h:125
Logger< MERCURY_LOGLEVEL > logger("MercuryKernel")
double Mdouble
Definition: GeneralDefine.h:34
const Vec3D & getContactPoint() const
Gets constant reference to contact point (vector).
BaseInteractable * getI()
Returns a pointer to the second object involved in the interaction (often a wall or a particle)...
BaseInteractable * getP()
Returns a pointer to first object involved in the interaction (normally a particle).
virtual Mdouble getInvMass() const
Mdouble BaseInteraction::getEffectiveRadius ( ) const
protected

Returns a Mdouble to the effective radius of the interaction. (Not corrected for the overlap)

Computes the effective radius of the two particles in the interaction. This is used by many of the later interaction models. This functions assumes P is the particle and I is either a particle or a wall. Effective Radius = \(R_I*R_P/(R_I+R_P)\) See also BaseInteraction::getEffectiveCorrectedRadius()

Returns
A Mdouble which is the effective radius of the particles.

Definition at line 745 of file BaseInteraction.cc.

References contactPoint_, getContactPoint(), BaseInteractable::getCurvature(), getI(), BaseObject::getId(), getP(), and logger.

Referenced by LiquidBridgeWilletInteraction::computeAdhesionForce(), ParhamiMcMeekingSinterInteraction::computeAdhesionForce(), LiquidMigrationWilletInteraction::computeAdhesionForce(), FrictionInteraction::computeFrictionForce(), MindlinInteraction::computeFrictionForce(), MindlinRollingTorsionInteraction::computeFrictionForce(), HertzianViscoelasticInteraction::computeNormalForce(), SinterInteraction::computeNormalForce(), LinearPlasticViscoelasticInteraction::computeNormalForce(), HertzianSinterInteraction::computeSinterForce(), getContactRadius(), HertzianViscoelasticInteraction::getElasticEnergy(), HertzianViscoelasticInteraction::getElasticEnergyAtEquilibrium(), SinterInteraction::getFieldVTK(), HertzianSinterInteraction::getUnloadingModulus(), SinterInteraction::getUnloadingStiffness(), and LinearPlasticViscoelasticInteraction::getUnloadingStiffness().

746 {
747  Mdouble invEffectiveRadius = getP()->getCurvature(contactPoint_) + getI()->getCurvature(contactPoint_);
748  logger.assert(invEffectiveRadius>0,
749  "getEffectiveRadius(): interaction % at % has infinite effective radius",getId(), getContactPoint());
750  return 1.0 / invEffectiveRadius;
751 }
unsigned int getId() const
Returns the unique identifier of any particular object.
Definition: BaseObject.h:125
Logger< MERCURY_LOGLEVEL > logger("MercuryKernel")
double Mdouble
Definition: GeneralDefine.h:34
const Vec3D & getContactPoint() const
Gets constant reference to contact point (vector).
BaseInteractable * getI()
Returns a pointer to the second object involved in the interaction (often a wall or a particle)...
BaseInteractable * getP()
Returns a pointer to first object involved in the interaction (normally a particle).
virtual Mdouble getCurvature(const Vec3D &labFixedCoordinates) const
Mdouble BaseInteraction::getElasticEnergy ( ) const
virtual

Returns a Mdouble which is the current about of Elastic energy in the interaction.

The children of this class will implement this function; however, it is blank. This function will contain the calculation for th elastic energy. Note, it is not virtual as it is not called from within this class.

Reimplemented in BondedInteraction, IrreversibleAdhesiveInteraction, FrictionInteraction, MindlinRollingTorsionInteraction, HertzianViscoelasticInteraction, MindlinInteraction, LiquidMigrationWilletInteraction, SlidingFrictionInteraction, LinearPlasticViscoelasticInteraction, EmptyAdhesiveInteraction, EmptyFrictionInteraction, HertzianSinterInteraction, LinearViscoelasticInteraction, SinterInteraction, ChargedBondedInteraction, ParhamiMcMeekingSinterInteraction, RegimeSinterInteraction, ReversibleAdhesiveInteraction, and LiquidBridgeWilletInteraction.

Definition at line 655 of file BaseInteraction.cc.

656 {
657  return 0.0;
658 }
virtual Mdouble BaseInteraction::getElasticEnergyAtEquilibrium ( Mdouble  adhesiveForce) const
inlineprotectedvirtual

Reimplemented in HertzianViscoelasticInteraction, and LinearViscoelasticInteraction.

Definition at line 432 of file BaseInteraction.h.

Referenced by ChargedBondedInteraction::getElasticEnergy().

433  { return 0; }
std::vector< Mdouble > BaseInteraction::getFieldVTK ( unsigned  i) const
virtual

Reimplemented in LiquidMigrationWilletInteraction, and SinterInteraction.

Definition at line 845 of file BaseInteraction.cc.

846 {
847  return std::vector<Mdouble>();
848 }
const Vec3D& BaseInteraction::getForce ( ) const
inline

Gets the current force (vector) between the two interacting objects.

Return a reference to a Vec3D which contains the current value of the force associated with this interaction.

Returns
A reference to a Vec3D containing the total force.

Definition at line 210 of file BaseInteraction.h.

References force_.

Referenced by DPMBase::computeForcesDueToWalls(), DPMBase::computeInternalForce(), and CGFields::StandardFields::setFields().

211  { return force_; }
BaseInteractable* BaseInteraction::getI ( )
inline

Returns a pointer to the second object involved in the interaction (often a wall or a particle).

Returns a pointer to the second object in the interaction; often a particle or a wall i.e. a general interactale hence I.

Returns
Pointer to BaseInteraction often a particle or a wall.

Definition at line 280 of file BaseInteraction.h.

References BaseObject::getId(), I_, and logger.

Referenced by InteractionHandler::addObject(), ChargedBondedInteraction::computeAdhesionForce(), FrictionInteraction::computeFrictionForce(), MindlinInteraction::computeFrictionForce(), MindlinRollingTorsionInteraction::computeFrictionForce(), HertzianViscoelasticInteraction::computeNormalForce(), LinearViscoelasticInteraction::computeNormalForce(), SinterInteraction::computeNormalForce(), LinearPlasticViscoelasticInteraction::computeNormalForce(), HertzianSinterInteraction::computeSinterForce(), SlidingFrictionInteraction::computeSlidingSpring(), SlidingFrictionInteraction::computeSlidingSpringSuperQuadric(), copySwitchPointer(), LiquidMigrationWilletInteraction::form(), getEffectiveMass(), getEffectiveRadius(), ChargedBondedInteraction::getElasticEnergy(), CGCoordinates::YZ::getINormal(), CGCoordinates::RZ::getINormal(), CGCoordinates::Y::getINormal(), CGCoordinates::XY::getINormal(), CGCoordinates::XZ::getINormal(), CGCoordinates::X::getINormal(), CGCoordinates::Z::getINormal(), CGCoordinates::R::getINormal(), CGCoordinates::XYZ::getINormal(), InteractionHandler::removeObjectKeepingPeriodics(), and LiquidMigrationWilletInteraction::rupture().

281  {
282  logger.assert(I_ != nullptr, "Second particle in interaction % is nullptr", getId());
283  return I_;
284  }
BaseInteractable * I_
unsigned int getId() const
Returns the unique identifier of any particular object.
Definition: BaseObject.h:125
Logger< MERCURY_LOGLEVEL > logger("MercuryKernel")
const BaseInteractable* BaseInteraction::getI ( ) const
inline

Returns a constant pointer to the second object involved in the interaction.

Returns a constant pointer to the second object in the interaction; often a particle or a wall i.e. a general interactale hence I.

Returns
Constant pointer to BaseInteraction often a particle or a wall.

Definition at line 303 of file BaseInteraction.h.

References BaseObject::getId(), I_, and logger.

304  {
305  logger.assert(I_ != nullptr, "Second particle in interaction % is nullptr", getId());
306  return I_;
307  }
BaseInteractable * I_
unsigned int getId() const
Returns the unique identifier of any particular object.
Definition: BaseObject.h:125
Logger< MERCURY_LOGLEVEL > logger("MercuryKernel")
Vec3D BaseInteraction::getIC ( ) const

returns the vector from I to C. Note, this cannot simply computed as P-I because I is possibly a ghost particle and might be shifted.

Definition at line 420 of file BaseInteraction.cc.

References getContactPoint(), getDistance(), getNormal(), getP(), and BaseInteractable::getPosition().

Referenced by CGFields::StandardFields::setFields().

421 {
422  return getNormal() * getDistance() + getContactPoint() - getP()->getPosition();
423 }
const Vec3D & getPosition() const
Returns the position of this BaseInteractable.
const Vec3D & getContactPoint() const
Gets constant reference to contact point (vector).
const Vec3D & getNormal() const
Gets the normal vector between the two interacting objects.
BaseInteractable * getP()
Returns a pointer to first object involved in the interaction (normally a particle).
Mdouble getDistance() const
Returns an Mdouble which is the norm (length) of distance vector.
int BaseInteraction::getIdentificationI ( )

Definition at line 898 of file BaseInteraction.cc.

References identificationI_.

899 {
900  return identificationI_;
901 }
unsigned int BaseInteraction::getIdentificationP ( )

Definition at line 893 of file BaseInteraction.cc.

References identificationP_.

894 {
895  return identificationP_;
896 }
unsigned int identificationP_
void BaseInteraction::getInteractionDetails ( void *  interactionDataArray,
unsigned int  index,
unsigned int &  identificationP,
unsigned int &  identificationI,
bool &  isWallInteraction,
unsigned timeStamp 
)
virtual

Definition at line 876 of file BaseInteraction.cc.

References ERROR, and logger.

Referenced by InteractionHandler::getInteractionDetails().

878 {
879  logger(ERROR, "Something went wrong, this function should not be called");
880 }
Logger< MERCURY_LOGLEVEL > logger("MercuryKernel")
Vec3D BaseInteraction::getIP ( ) const

returns the vector from I to P. Note, this cannot simply computed as P-I because I is possibly a ghost particle and might be shifted.

Definition at line 415 of file BaseInteraction.cc.

References getDistance(), and getNormal().

Referenced by CGFields::StandardFields::setFields().

416 {
417  return getNormal() * getDistance();
418 }
const Vec3D & getNormal() const
Gets the normal vector between the two interacting objects.
Mdouble getDistance() const
Returns an Mdouble which is the norm (length) of distance vector.
Mdouble BaseInteraction::getLagrangeMultiplier ( )
inline

Definition at line 190 of file BaseInteraction.h.

References lagrangeMultiplier_.

Referenced by SuperQuadricParticle::getInitialGuessForContact().

191  {
192  return lagrangeMultiplier_;
193  }
Mdouble lagrangeMultiplier_
void BaseInteraction::getMPIInteraction ( void *  historyDataArray,
unsigned int  index 
) const
virtual

copies the history interactions into the data array

Definition at line 855 of file BaseInteraction.cc.

856 {
857 }
unsigned int BaseInteraction::getMultiContactIdentifier ( ) const

Definition at line 715 of file BaseInteraction.cc.

References multiContactIdentifier_.

716 {
718 }
unsigned multiContactIdentifier_
std::string BaseInteraction::getName ( ) const
overridevirtual

Virtual function which allows interactions to be named.

Functions which returns the name of the Interaction here is called BaseInteraction; but, it should be later overridden by the actual interaction classes.

Implements BaseObject.

Definition at line 200 of file BaseInteraction.cc.

Referenced by write().

201 {
202  return "BaseInteraction";
203 }
std::string BaseInteraction::getNameVTK ( unsigned  i) const
virtual

Reimplemented in LiquidMigrationWilletInteraction, and SinterInteraction.

Definition at line 840 of file BaseInteraction.cc.

841 {
842  return "";
843 }
const Vec3D& BaseInteraction::getNormal ( ) const
inline

Gets the normal vector between the two interacting objects.

Returns a reference to a Vec3D which contains the current value of the normal associated with the interactions.

Returns
A reference to a Vec3D containing the current normal.

Definition at line 226 of file BaseInteraction.h.

References normal_.

Referenced by BondedInteraction::computeAdhesionForce(), IrreversibleAdhesiveInteraction::computeAdhesionForce(), ReversibleAdhesiveInteraction::computeAdhesionForce(), LiquidBridgeWilletInteraction::computeAdhesionForce(), ChargedBondedInteraction::computeAdhesionForce(), ParhamiMcMeekingSinterInteraction::computeAdhesionForce(), LiquidMigrationWilletInteraction::computeAdhesionForce(), SlidingFrictionInteraction::computeFrictionForce(), MindlinInteraction::computeFrictionForce(), MindlinRollingTorsionInteraction::computeFrictionForce(), FrictionInteraction::computeFrictionForce(), HertzianViscoelasticInteraction::computeNormalForce(), LinearViscoelasticInteraction::computeNormalForce(), SinterInteraction::computeNormalForce(), LinearPlasticViscoelasticInteraction::computeNormalForce(), HertzianSinterInteraction::computeSinterForce(), SlidingFrictionInteraction::computeSlidingSpring(), SlidingFrictionInteraction::computeSlidingSpringSuperQuadric(), gatherContactStatistics(), getIC(), CGCoordinates::XYZ::getINormal(), VChute::getInteractionWith(), Combtooth::getInteractionWith(), ArcWall::getInteractionWith(), BaseWall::getInteractionWith(), BaseParticle::getInteractionWith(), getIP(), MindlinRollingTorsionInteraction::integrate(), FrictionInteraction::integrate(), setFStatData(), and writeToFStat().

227  { return normal_; }
Mdouble BaseInteraction::getNormalRelativeVelocity ( ) const

Returns a double which is the norm (length) of the relative velocity vector.

Returns the norm (length) of the relative normal velocity. Note, this can be negative or positive it is not a speed.

Todo:
Ant: Check this comment.
Returns
Mdouble that contains the norm (length) of the relative velocity.

Definition at line 536 of file BaseInteraction.cc.

References normalRelativeVelocity_.

Referenced by BondedInteraction::computeAdhesionForce(), ChargedBondedInteraction::computeAdhesionForce(), ParhamiMcMeekingSinterInteraction::computeAdhesionForce(), SlidingFrictionInteraction::computeFrictionForce(), MindlinInteraction::computeFrictionForce(), HertzianViscoelasticInteraction::computeNormalForce(), SinterInteraction::computeNormalForce(), LinearViscoelasticInteraction::computeNormalForce(), LinearPlasticViscoelasticInteraction::computeNormalForce(), and HertzianSinterInteraction::computeSinterForce().

537 {
539 }
Mdouble normalRelativeVelocity_
unsigned BaseInteraction::getNumberOfFieldsVTK ( ) const
virtual

Reimplemented in LiquidMigrationWilletInteraction, and SinterInteraction.

Definition at line 830 of file BaseInteraction.cc.

831 {
832  return 0;
833 }
Mdouble BaseInteraction::getOverlap ( ) const
inline

Returns a Mdouble with the current overlap between the two interacting objects.

Definition at line 240 of file BaseInteraction.h.

References overlap_.

Referenced by LiquidMigrationWilletInteraction::actionsAfterTimeStep(), BondedInteraction::computeAdhesionForce(), IrreversibleAdhesiveInteraction::computeAdhesionForce(), ParhamiMcMeekingSinterInteraction::computeAdhesionForce(), ReversibleAdhesiveInteraction::computeAdhesionForce(), ChargedBondedInteraction::computeAdhesionForce(), LiquidBridgeWilletInteraction::computeAdhesionForce(), LiquidMigrationWilletInteraction::computeAdhesionForce(), HertzianViscoelasticInteraction::computeNormalForce(), LinearViscoelasticInteraction::computeNormalForce(), SinterInteraction::computeNormalForce(), LinearPlasticViscoelasticInteraction::computeNormalForce(), HertzianSinterInteraction::computeSinterForce(), gatherContactStatistics(), getContactRadius(), ChargedBondedInteraction::getElasticEnergy(), HertzianSinterInteraction::getElasticEnergy(), LinearViscoelasticInteraction::getElasticEnergy(), SinterInteraction::getElasticEnergy(), LinearPlasticViscoelasticInteraction::getElasticEnergy(), BondedInteraction::getElasticEnergy(), HertzianViscoelasticInteraction::getElasticEnergy(), IrreversibleAdhesiveInteraction::getElasticEnergy(), SuperQuadricParticle::getInitialGuessForContact(), VChute::getInteractionWith(), Combtooth::getInteractionWith(), ArcWall::getInteractionWith(), BaseWall::getInteractionWith(), BaseParticle::getInteractionWith(), SuperQuadricParticle::getInteractionWithSuperQuad(), HertzianSinterInteraction::getUnloadingModulus(), SinterInteraction::getUnloadingStiffness(), LinearPlasticViscoelasticInteraction::getUnloadingStiffness(), FileReader::read(), setFStatData(), MindlinInteraction::updateTangentialStiffnessZero(), and writeToFStat().

241  { return overlap_; }
BaseInteractable* BaseInteraction::getP ( )
inline

Returns a pointer to first object involved in the interaction (normally a particle).

Returns a pointer to the first object in the interactions; normally the particle.

Returns
Pointer to BaseInteraction but normally will be a BaseParticle.

Definition at line 269 of file BaseInteraction.h.

References BaseObject::getId(), logger, and P_.

Referenced by InteractionHandler::addObject(), ChargedBondedInteraction::computeAdhesionForce(), FrictionInteraction::computeFrictionForce(), MindlinInteraction::computeFrictionForce(), MindlinRollingTorsionInteraction::computeFrictionForce(), HertzianViscoelasticInteraction::computeNormalForce(), LinearViscoelasticInteraction::computeNormalForce(), SinterInteraction::computeNormalForce(), LinearPlasticViscoelasticInteraction::computeNormalForce(), HertzianSinterInteraction::computeSinterForce(), SlidingFrictionInteraction::computeSlidingSpring(), copySwitchPointer(), LiquidMigrationWilletInteraction::form(), gatherContactStatistics(), getCP(), getEffectiveMass(), getEffectiveRadius(), ChargedBondedInteraction::getElasticEnergy(), getIC(), CGCoordinates::XZ::getPNormal(), CGCoordinates::Y::getPNormal(), CGCoordinates::XY::getPNormal(), CGCoordinates::YZ::getPNormal(), CGCoordinates::RZ::getPNormal(), CGCoordinates::X::getPNormal(), CGCoordinates::Z::getPNormal(), CGCoordinates::R::getPNormal(), CGCoordinates::YZ::getTangentialSquared(), CGCoordinates::XY::getTangentialSquared(), CGCoordinates::RZ::getTangentialSquared(), CGCoordinates::XZ::getTangentialSquared(), CGCoordinates::XYZ::getTangentialSquared(), InteractionHandler::removeObjectKeepingPeriodics(), and LiquidMigrationWilletInteraction::rupture().

270  {
271  logger.assert(P_ != nullptr, "First particle in interaction % is nullptr", getId());
272  return P_;
273  }
unsigned int getId() const
Returns the unique identifier of any particular object.
Definition: BaseObject.h:125
Logger< MERCURY_LOGLEVEL > logger("MercuryKernel")
BaseInteractable * P_
const BaseInteractable* BaseInteraction::getP ( ) const
inline

Returns a constant pointer to the first object involved in the interaction.

Returns a constant pointer to the first object in the interactions; normally the particle. Why implement const and non-const setters and getters? See https://www.gamedev.net/forums/topic/550112-c-non-const-getter-in-terms-of-const-getter/

Returns
Constant pointer to BaseInteraction but normally will be a BaseParticle.

Definition at line 292 of file BaseInteraction.h.

References BaseObject::getId(), logger, and P_.

293  {
294  logger.assert(P_ != nullptr, "First particle in interaction % is nullptr", getId());
295  return P_;
296  }
unsigned int getId() const
Returns the unique identifier of any particular object.
Definition: BaseObject.h:125
Logger< MERCURY_LOGLEVEL > logger("MercuryKernel")
BaseInteractable * P_
const Vec3D & BaseInteraction::getRelativeVelocity ( ) const

Returns a constant reference to a vector of relative velocity.

Returns the relative velocity between the two interactable objects involved in the interaction.

Returns
A reference to Vec3D that contains the relative velocity.

Definition at line 525 of file BaseInteraction.cc.

References relativeVelocity_.

Referenced by ParhamiMcMeekingSinterInteraction::computeAdhesionForce(), SlidingFrictionInteraction::computeFrictionForce(), MindlinInteraction::computeFrictionForce(), HertzianViscoelasticInteraction::computeNormalForce(), SinterInteraction::computeNormalForce(), LinearViscoelasticInteraction::computeNormalForce(), LinearPlasticViscoelasticInteraction::computeNormalForce(), and HertzianSinterInteraction::computeSinterForce().

526 {
527  return relativeVelocity_;
528 }
const Vec3D BaseInteraction::getTangentialForce ( ) const
protectedvirtual

Returns a constant vector to the Tangential Force

Returns the vector that is the tangential force Note, at this level there cannot be a tangential force therefore by default it return the zero vector. This function will be overridden by interactions that have tangential components.

Returns
Vec3D that contains the current tangential force of the interaction.

Reimplemented in EmptyFrictionInteraction, SlidingFrictionInteraction, and MindlinInteraction.

Definition at line 515 of file BaseInteraction.cc.

Referenced by gatherContactStatistics(), and writeToFStat().

516 {
517  return Vec3D(0.0, 0.0, 0.0);
518 }
Definition: Vector.h:49
Mdouble BaseInteraction::getTangentialOverlap ( ) const
virtual

get the length of the current tangential overlap

Returns tangential overlap. Note, at this level there cannot be a tangential overlap hence by default it returns 0. This function will be overridden by interactions that have tangential components.

Returns
Positive Mdouble that is the tangential overlap.

Reimplemented in EmptyFrictionInteraction, MindlinInteraction, and SlidingFrictionInteraction.

Definition at line 503 of file BaseInteraction.cc.

Referenced by gatherContactStatistics(), and writeToFStat().

504 {
505  return 0;
506 }
Mdouble BaseInteraction::getTimeStamp ( ) const
inline

Returns an Mdouble which is the time stamp of the interaction.

Returns the current time stamp of interaction. This should be the last time the interaction was active and used to find the end of the interaction.

Returns
Mdouble which is the last time the interaction was active.

Definition at line 314 of file BaseInteraction.h.

References timeStamp_.

Referenced by InteractionHandler::eraseOldInteractions(), and InteractionHandler::removeObjectKeepingPeriodics().

315  { return timeStamp_; }
const Vec3D& BaseInteraction::getTorque ( ) const
inline

Gets the current torque (vector) between the two interacting objects.

Return a reference to a Vec3D which contains the current value of the torque associated with the interaction.

Returns
A reference to a Vec3D containing the total torque.

Definition at line 218 of file BaseInteraction.h.

References torque_.

Referenced by DPMBase::computeForcesDueToWalls(), and DPMBase::computeInternalForce().

219  { return torque_; }
std::string BaseInteraction::getTypeVTK ( unsigned  i) const
virtual

Reimplemented in LiquidMigrationWilletInteraction, and SinterInteraction.

Definition at line 835 of file BaseInteraction.cc.

836 {
837  return "";
838 }
void BaseInteraction::importI ( BaseInteractable I)

Sets the second object involved in the interaction (often particle or wall).

Changes the second object involved in the interaction. This function differs from BaseInteraction::setI(BaseInteractable* I) because no interactable is removed: this is needed in DPMBase::importParticlesAs as in it there's no iteractable to remove and using BaseInteraction::setI(BaseInteractable* I) would led to an output printing overloaded with warnings.

Parameters
[in]IBaseInteractable* The particle involved in the interaction.

Definition at line 407 of file BaseInteraction.cc.

References BaseInteractable::addInteraction(), BaseObject::getId(), I_, identificationI_, and BaseInteractable::removeInteraction().

408 {
409  I_->removeInteraction(this);
410  I_ = I;
411  I_->addInteraction(this);
413 }
BaseInteractable * I_
unsigned int getId() const
Returns the unique identifier of any particular object.
Definition: BaseObject.h:125
bool removeInteraction(BaseInteraction *I)
Removes an interaction from this BaseInteractable.
void addInteraction(BaseInteraction *I)
Adds an interaction to this BaseInteractable.
void BaseInteraction::importP ( BaseInteractable P)

Sets the first object involved in the interaction (normally a particle).

Set the first object involved in the interaction. This function differs from BaseInteraction::setP(BaseInteractable* P) because no interactable is removed: this is needed in DPMBase::importParticlesAs as in it there's no iteractable to remove and using BaseInteraction::setP(BaseInteractable* P) would led to an output printing overloaded with warnings.

Parameters
[in]PBaseInteractable* The particle involved in the interaction.

Definition at line 375 of file BaseInteraction.cc.

References BaseInteractable::addInteraction(), BaseObject::getId(), identificationP_, P_, and BaseInteractable::removeInteraction().

376 {
377  P_->removeInteraction(this);
378  P_ = P;
379  P_->addInteraction(this);
381 }
unsigned int getId() const
Returns the unique identifier of any particular object.
Definition: BaseObject.h:125
bool removeInteraction(BaseInteraction *I)
Removes an interaction from this BaseInteractable.
void addInteraction(BaseInteraction *I)
Adds an interaction to this BaseInteractable.
unsigned int identificationP_
BaseInteractable * P_
void BaseInteraction::integrate ( Mdouble timeStep  UNUSED)
virtual

integrates variables of the interaction which need to be integrate e.g. the tangential overlap.

Various variables in the force law need to be integrated. This is the place where this code goes. Note, it is empty at this point; it can be overriden in subclasses. For usage, see e.g. MindlinInteraction.cc.

Parameters
[in]timeStepThe time-step dt.

Reimplemented in EmptyFrictionInteraction, FrictionInteraction, MindlinRollingTorsionInteraction, MindlinInteraction, and SlidingFrictionInteraction.

Definition at line 334 of file BaseInteraction.cc.

335 {
336 
337 }
virtual bool BaseInteraction::isBonded ( ) const
inlinevirtual

Reimplemented in ChargedBondedInteraction.

Definition at line 491 of file BaseInteraction.h.

Referenced by writeToFStat().

491 {return false;}
bool BaseInteraction::isWallInteraction ( )

Definition at line 908 of file BaseInteraction.cc.

References isWallInteraction_.

909 {
910  return isWallInteraction_;
911 }
void BaseInteraction::read ( std::istream &  is)
overridevirtual

Interaction read function, which accepts an std::istream as input.

BaseInteaction read functions. Reads in all the information about an interaction. Note, this can be from any istream but would normally be a file See also BaseInteaction::write

Parameters
[in]isstd::istream to which the information is read from.

Implements BaseObject.

Reimplemented in EmptyFrictionInteraction, HertzianViscoelasticInteraction, FrictionInteraction, MindlinInteraction, MindlinRollingTorsionInteraction, SlidingFrictionInteraction, LinearPlasticViscoelasticInteraction, HertzianSinterInteraction, LinearViscoelasticInteraction, and SinterInteraction.

Definition at line 186 of file BaseInteraction.cc.

References contactPoint_, force_, helpers::readOptionalVariable(), and torque_.

Referenced by HertzianSinterInteraction::read(), SinterInteraction::read(), LinearViscoelasticInteraction::read(), LinearPlasticViscoelasticInteraction::read(), and HertzianViscoelasticInteraction::read().

187 {
188  //the rest gets read by the interaction handler
189  std::string dummy;
190  helpers::readOptionalVariable(is,"contactPoint",contactPoint_);
191  is >> dummy >> force_;
192  is >> dummy >> torque_;
193 }
bool readOptionalVariable(std::istream &is, const std::string &name, T &variable)
Reads optional variables in the restart file.
Definition: Helpers.h:247
void BaseInteraction::removeFromHandler ( )

Removes this interaction from its interaction hander.

Removes the interaction from its InteractionHandler. Does no other cleaning up as it does not remove it from the particles.

Definition at line 278 of file BaseInteraction.cc.

References BaseObject::getIndex(), handler_, and BaseHandler< T >::removeObject().

279 {
281 }
unsigned int getIndex() const
Returns the index of the object in the handler.
Definition: BaseObject.h:118
virtual void removeObject(unsigned const int index)
Removes an Object from the BaseHandler.
Definition: BaseHandler.h:472
InteractionHandler * handler_
void BaseInteraction::reverseHistory ( )
protectedvirtual

When periodic particles some interaction need certain history properties reversing. This is the function for that.

The children of this class will implement this function; however, it is blank. This function will contain code that changes some history information if a copy changes the P <-> I order; as can happen in creating a periodic particle. See also PeriodicBoundary::createPeriodicParticles and BaseInteraction::copySwitchPointer Note, it is not virtual as it is not called from within this class.

Reimplemented in MindlinInteraction, SlidingFrictionInteraction, FrictionInteraction, and MindlinRollingTorsionInteraction.

Definition at line 670 of file BaseInteraction.cc.

Referenced by copySwitchPointer().

671 {
672 }
void BaseInteraction::rotateHistory ( Matrix3D rotationMatrix)
virtual

When periodic particles are used, some interactions need certain history properties rotated (e.g. tangential springs). This is the function for that.

Todo:
some of these might be unneccesary

Reimplemented in MindlinInteraction, SlidingFrictionInteraction, FrictionInteraction, and MindlinRollingTorsionInteraction.

Definition at line 726 of file BaseInteraction.cc.

References contactPoint_, force_, normal_, relativeVelocity_, and torque_.

727 {
728  contactPoint_ = rotationMatrix * contactPoint_;
729  relativeVelocity_ = rotationMatrix * relativeVelocity_;
730  force_ = rotationMatrix * force_;
731  torque_ = rotationMatrix * torque_;
732  normal_ = rotationMatrix * normal_;
734 }
void BaseInteraction::setAbsoluteNormalForce ( Mdouble  absoluteNormalForce)
protected

the absolute values of the norm (length) of the normal force

set absolute normal force.

Parameters
[in]absoluteNormalForceMdouble contain the value of the absolute normal force.

Definition at line 622 of file BaseInteraction.cc.

References absoluteNormalForce_.

Referenced by HertzianViscoelasticInteraction::computeNormalForce(), SinterInteraction::computeNormalForce(), LinearViscoelasticInteraction::computeNormalForce(), LinearPlasticViscoelasticInteraction::computeNormalForce(), and HertzianSinterInteraction::computeSinterForce().

623 {
624  absoluteNormalForce_ = absoluteNormalForce;
625 }
Mdouble absoluteNormalForce_
void BaseInteraction::setBasicMPIInteractionValues ( int  P,
int  I,
unsigned  timeStamp,
Vec3D  force,
Vec3D  torque,
bool  isWallInteraction,
bool  resetPointers 
)
Todo:
TW should P, I be of type unsigned?

Definition at line 914 of file BaseInteraction.cc.

References I_, P_, setForce(), setIdentificationI(), setIdentificationP(), setTimeStamp(), setTorque(), and setWallInteraction().

Referenced by MPIInteraction< NormalForceInteraction, FrictionForceInteraction, AdhesiveForceInteraction >::copyToInteraction().

916 {
917  this->setIdentificationP(P);
918  this->setIdentificationI(I);
919  this->setTimeStamp(timeStamp);
920  this->setForce(force);
921  this->setTorque(torque);
923  if (resetPointers)
924  {
925  this->I_ = nullptr;
926  this->P_ = nullptr;
927  }
928 }
BaseInteractable * I_
void setForce(Vec3D force)
set total force (this is used by the normal force, tangential forces are added use addForce) ...
void setTimeStamp(unsigned timeStamp)
Updates the time step of the interacting. Note, time steps used to find completed interactions...
BaseInteractable * P_
void setIdentificationP(unsigned int identification)
void setTorque(Vec3D torque)
set the total force (this is used by the normal force, tangential torques are added use addTorque) ...
void setWallInteraction(bool flag)
void setIdentificationI(int identification)
void BaseInteraction::setContactPoint ( Vec3D  contactPoint)
void BaseInteraction::setDistance ( Mdouble  distance)

Sets the interaction distance between the two interacting objects.

set the distance of the interaction.

Parameters
[in]distanceMdouble which is the distance to set.

Definition at line 219 of file BaseInteraction.cc.

References distance_.

Referenced by VChute::getInteractionWith(), Combtooth::getInteractionWith(), SineWall::getInteractionWith(), ArcWall::getInteractionWith(), TriangulatedWall::getInteractionWith(), BaseWall::getInteractionWith(), BaseParticle::getInteractionWith(), SuperQuadricParticle::getInteractionWithSuperQuad(), FileReader::read(), and setFStatData().

220 {
221  distance_ = distance;
222 }
void BaseInteraction::setForce ( Vec3D  force)

set total force (this is used by the normal force, tangential forces are added use addForce)

set the absolute values of the force. This is used by the normal forces as these are always called first and then the tangential and non-contact (e.g. adhesive forces) forces are added. See also BaseInteraction::addForce.

Definition at line 579 of file BaseInteraction.cc.

References force_.

Referenced by HertzianViscoelasticInteraction::computeNormalForce(), LinearViscoelasticInteraction::computeNormalForce(), SinterInteraction::computeNormalForce(), LinearPlasticViscoelasticInteraction::computeNormalForce(), HertzianSinterInteraction::computeSinterForce(), FileReader::read(), setBasicMPIInteractionValues(), and setFStatData().

580 {
581  force_ = force;
582 }
void BaseInteraction::setFStatData ( std::fstream &  fstat,
BaseParticle P,
BaseWall I 
)

Definition at line 947 of file BaseInteraction.cc.

References getNormal(), getOverlap(), BaseInteractable::getPosition(), BaseParticle::getRadius(), setContactPoint(), setDistance(), setForce(), setNormal(), and setOverlap().

Referenced by DPMBase::readNextFStatFile().

948 {
949  Mdouble overlap, tangentialOverlap, scalarNormalForce, scalarTangentialForce;
950  Vec3D centre, normal, tangential;
951  fstat >> centre >> overlap >> tangentialOverlap >> scalarNormalForce >> scalarTangentialForce >> normal
952  >> tangential;
953  const Vec3D force = scalarNormalForce * normal + scalarTangentialForce * tangential;
954  //note walls are defined different than particles (with an extra minus)
955  setForce(-force);
956  setNormal(-normal);
957  setOverlap(overlap);
958  const Mdouble radius = P->getRadius();
959  const Vec3D branch = (radius - 0.5 * getOverlap()) * getNormal();
960  setContactPoint(P->getPosition() - branch);
961  setDistance(radius - getOverlap());
962 }
const Vec3D & getPosition() const
Returns the position of this BaseInteractable.
void setNormal(Vec3D normal)
Sets the normal vector between the two interacting objects.
void setOverlap(Mdouble overlap)
Set the overlap between the two interacting object.
double Mdouble
Definition: GeneralDefine.h:34
void setContactPoint(Vec3D contactPoint)
Set the location of the contact point between the two interacting objects.
void setForce(Vec3D force)
set total force (this is used by the normal force, tangential forces are added use addForce) ...
void setDistance(Mdouble distance)
Sets the interaction distance between the two interacting objects.
const Vec3D & getNormal() const
Gets the normal vector between the two interacting objects.
Mdouble getRadius() const
Returns the particle's radius.
Definition: BaseParticle.h:345
Mdouble getOverlap() const
Returns a Mdouble with the current overlap between the two interacting objects.
Definition: Vector.h:49
void BaseInteraction::setFStatData ( std::fstream &  fstat,
BaseParticle P,
BaseParticle I 
)

Definition at line 931 of file BaseInteraction.cc.

References getNormal(), getOverlap(), BaseInteractable::getPosition(), BaseParticle::getRadius(), setContactPoint(), setDistance(), setForce(), setNormal(), and setOverlap().

932 {
933  Mdouble overlap, tangentialOverlap, scalarNormalForce, scalarTangentialForce;
934  Vec3D centre, normal, tangential;
935  fstat >> centre >> overlap >> tangentialOverlap >> scalarNormalForce >> scalarTangentialForce >> normal
936  >> tangential;
937  const Vec3D force = scalarNormalForce * normal + scalarTangentialForce * tangential;
938  setForce(force);
939  setNormal(normal);
940  setOverlap(overlap);
941  const Mdouble radius = P->getRadius();
942  const Vec3D branch = (radius - 0.5 * getOverlap()) * getNormal();
943  setContactPoint(P->getPosition() - branch);
944  setDistance(radius + I->getRadius() - getOverlap());
945 }
const Vec3D & getPosition() const
Returns the position of this BaseInteractable.
void setNormal(Vec3D normal)
Sets the normal vector between the two interacting objects.
void setOverlap(Mdouble overlap)
Set the overlap between the two interacting object.
double Mdouble
Definition: GeneralDefine.h:34
void setContactPoint(Vec3D contactPoint)
Set the location of the contact point between the two interacting objects.
void setForce(Vec3D force)
set total force (this is used by the normal force, tangential forces are added use addForce) ...
void setDistance(Mdouble distance)
Sets the interaction distance between the two interacting objects.
const Vec3D & getNormal() const
Gets the normal vector between the two interacting objects.
Mdouble getRadius() const
Returns the particle's radius.
Definition: BaseParticle.h:345
Mdouble getOverlap() const
Returns a Mdouble with the current overlap between the two interacting objects.
Definition: Vector.h:49
void BaseInteraction::setHandler ( InteractionHandler handler)

Sets the pointer to the interaction hander which is storing this interaction.

set the handler which this interactions belongs to.

Parameters
[in]handlerInteractionHandler* pointer to the interaction handler, this interaction will belong.

Definition at line 259 of file BaseInteraction.cc.

References handler_.

Referenced by InteractionHandler::addObject(), and InteractionHandler::getInteraction().

260 {
261  handler_ = handler;
262 }
InteractionHandler * handler_
void BaseInteraction::setI ( BaseInteractable I)

Sets the second object involved in the interaction (often particle or wall).

Changes the second object involved in the interaction; often a general interactable not always a particle. Note, set is slightly misleading as it removed the interaction from old interactable and adds it to the new interactable.

Parameters
[in]IBaseInteractable* An interactable object that is involved in the interaction.

Definition at line 391 of file BaseInteraction.cc.

References BaseInteractable::addInteraction(), BaseObject::getId(), I_, identificationI_, and BaseInteractable::removeInteraction().

Referenced by InteractionHandler::removeObjectKeepingPeriodics().

392 {
393  I_->removeInteraction(this);
394  I_ = I;
395  I_->addInteraction(this);
397 }
BaseInteractable * I_
unsigned int getId() const
Returns the unique identifier of any particular object.
Definition: BaseObject.h:125
bool removeInteraction(BaseInteraction *I)
Removes an interaction from this BaseInteractable.
void addInteraction(BaseInteraction *I)
Adds an interaction to this BaseInteractable.
void BaseInteraction::setIdentificationI ( int  identification)

Definition at line 888 of file BaseInteraction.cc.

References identificationI_.

Referenced by setBasicMPIInteractionValues().

889 {
890  identificationI_ = identification;
891 }
void BaseInteraction::setIdentificationP ( unsigned int  identification)

Definition at line 883 of file BaseInteraction.cc.

References identificationP_.

Referenced by setBasicMPIInteractionValues().

884 {
885  identificationP_ = identification;
886 }
unsigned int identificationP_
void BaseInteraction::setLagrangeMultiplier ( Mdouble  multiplier)
inline

Definition at line 185 of file BaseInteraction.h.

References lagrangeMultiplier_.

Referenced by SuperQuadricParticle::getInteractionWithSuperQuad().

186  {
187  lagrangeMultiplier_ = multiplier;
188  }
Mdouble lagrangeMultiplier_
void BaseInteraction::setMPIInteraction ( void *  interactionDataArray,
unsigned int  index,
bool  resetPointers 
)
virtual
void BaseInteraction::setMultiContactIdentifier ( unsigned int  multiContactIdentifier_)

Definition at line 720 of file BaseInteraction.cc.

References multiContactIdentifier_.

721 {
722  multiContactIdentifier_ = multiContactIdentifier;
723 }
void BaseInteraction::setNormal ( Vec3D  normal)

Sets the normal vector between the two interacting objects.

sets the normal of the interaction, in direction from I to P. Must be a unit normal vector. This is not checked by the class.

Parameters
[in]normalVec3D which is the normal of the interaction.

Definition at line 210 of file BaseInteraction.cc.

References normal_.

Referenced by VChute::getInteractionWith(), Combtooth::getInteractionWith(), SineWall::getInteractionWith(), ArcWall::getInteractionWith(), TriangulatedWall::getInteractionWith(), BaseWall::getInteractionWith(), BaseParticle::getInteractionWith(), SuperQuadricParticle::getInteractionWithSuperQuad(), FileReader::read(), and setFStatData().

211 {
212  normal_ = normal;
213 }
void BaseInteraction::setNormalRelativeVelocity ( Mdouble  normalRelativeVelocity)
protected

set the normal component of the relative velocity.

set the norm (length) of the normal relative velocity.

Parameters
[in]normalRelativeVelocityMdouble containing the normal (length) of the normal velocity between the interactable objects.

Definition at line 612 of file BaseInteraction.cc.

References normalRelativeVelocity_.

Referenced by HertzianViscoelasticInteraction::computeNormalForce(), SinterInteraction::computeNormalForce(), LinearViscoelasticInteraction::computeNormalForce(), LinearPlasticViscoelasticInteraction::computeNormalForce(), and HertzianSinterInteraction::computeSinterForce().

613 {
614  normalRelativeVelocity_ = normalRelativeVelocity;
615 }
Mdouble normalRelativeVelocity_
void BaseInteraction::setOverlap ( Mdouble  overlap)

Set the overlap between the two interacting object.

set the overlap between the two interactable object involved in the interactions.

Parameters
[in]overlapMdouble which is the overlap to set.

Definition at line 229 of file BaseInteraction.cc.

References overlap_.

Referenced by VChute::getInteractionWith(), Combtooth::getInteractionWith(), SineWall::getInteractionWith(), ArcWall::getInteractionWith(), TriangulatedWall::getInteractionWith(), BaseWall::getInteractionWith(), BaseParticle::getInteractionWith(), SuperQuadricParticle::getInteractionWithSuperQuad(), FileReader::read(), and setFStatData().

230 {
231  overlap_ = overlap;
232 }
void BaseInteraction::setP ( BaseInteractable P)

Sets the first object involved in the interaction (normally a particle).

Changes the first object involved in the interaction; normally a particle. Note, set is slightly misleading as it removed the interaction from old particle and adds it to the new particle.

Parameters
[in]PBaseInteractable* An interactable object that is involved in the interaction.

Definition at line 359 of file BaseInteraction.cc.

References BaseInteractable::addInteraction(), BaseObject::getId(), identificationP_, P_, and BaseInteractable::removeInteraction().

360 {
361  P_->removeInteraction(this);
362  P_ = P;
363  P_->addInteraction(this);
365 }
unsigned int getId() const
Returns the unique identifier of any particular object.
Definition: BaseObject.h:125
bool removeInteraction(BaseInteraction *I)
Removes an interaction from this BaseInteractable.
void addInteraction(BaseInteraction *I)
Adds an interaction to this BaseInteractable.
unsigned int identificationP_
BaseInteractable * P_
void BaseInteraction::setRelativeVelocity ( Vec3D  relativeVelocity)
protected

set the relative velocity of the current of the interactions.

set the relative velocity between the two particles involved in the interaction.

Parameters
[in]relativeVelocityThis is Vec3D that contains the relative velocity between the two interactable objects.

Definition at line 601 of file BaseInteraction.cc.

References relativeVelocity_.

Referenced by HertzianViscoelasticInteraction::computeNormalForce(), SinterInteraction::computeNormalForce(), LinearViscoelasticInteraction::computeNormalForce(), LinearPlasticViscoelasticInteraction::computeNormalForce(), and HertzianSinterInteraction::computeSinterForce().

602 {
603  relativeVelocity_ = relativeVelocity;
604 }
void BaseInteraction::setSpecies ( const BaseSpecies species)

Set the Species of the interaction; note this can either be a Species or MixedSpecies.

Sets the species for the interactions. Note, this can be either a normal Species or a MixedSpecies; depending on if this interaction is between interactables of the same or different types.

Parameters
[in]BaseSpecies*pointer to the actually species of the interaction.

Definition at line 346 of file BaseInteraction.cc.

References species_.

Referenced by InteractionHandler::getInteraction().

347 {
348  species_ = species;
349 }
const BaseSpecies * species_
void BaseInteraction::setTimeStamp ( unsigned  timeStamp)

Updates the time step of the interacting. Note, time steps used to find completed interactions.

Updated the time stamp of the interaction. The time stamp being old is how ended interactions are detected.

Parameters
[in]timeStampThe new timeStamp for the interactions should be the current time step.

Definition at line 249 of file BaseInteraction.cc.

References timeStamp_.

Referenced by InteractionHandler::getInteraction(), and setBasicMPIInteractionValues().

250 {
251  timeStamp_ = timeStamp;
252 }
void BaseInteraction::setTorque ( Vec3D  torque)
protected

set the total force (this is used by the normal force, tangential torques are added use addTorque)

set the absolute values of the torque. This is used by the normal forces as these are always called first and then the tangential and non-contact (e.g. adhesive forces) forces/torques are added. See also BaseInteraction::addTorque.

Definition at line 590 of file BaseInteraction.cc.

References torque_.

Referenced by HertzianViscoelasticInteraction::computeNormalForce(), LinearViscoelasticInteraction::computeNormalForce(), SinterInteraction::computeNormalForce(), LinearPlasticViscoelasticInteraction::computeNormalForce(), HertzianSinterInteraction::computeSinterForce(), and setBasicMPIInteractionValues().

591 {
592  torque_ = torque;
593 }
void BaseInteraction::setWallInteraction ( bool  flag)

Definition at line 903 of file BaseInteraction.cc.

References isWallInteraction_.

Referenced by setBasicMPIInteractionValues().

904 {
905  isWallInteraction_ = flag;
906 }
void BaseInteraction::write ( std::ostream &  os) const
overridevirtual

Interaction print function, which accepts an std::ostream as input.

BaseInteaction write function. Writes out all the information required to recreate this interaction. To write this interaction to the screen call write(std::cout). See also BaseInteraction::read

Parameters
[in]osstd::ostream to which the information is written. Note, is any ostram is can be file or screen.
Todo:
should we output id's here? os << " id " << getId() << " particleIds " << P_->getId() << " " << I_->getId();

Implements BaseObject.

Reimplemented in EmptyFrictionInteraction, HertzianViscoelasticInteraction, FrictionInteraction, MindlinInteraction, MindlinRollingTorsionInteraction, SlidingFrictionInteraction, LinearPlasticViscoelasticInteraction, HertzianSinterInteraction, LinearViscoelasticInteraction, and SinterInteraction.

Definition at line 159 of file BaseInteraction.cc.

References contactPoint_, force_, BaseObject::getId(), getName(), I_, P_, timeStamp_, and torque_.

Referenced by HertzianSinterInteraction::write(), SinterInteraction::write(), LinearViscoelasticInteraction::write(), LinearPlasticViscoelasticInteraction::write(), and HertzianViscoelasticInteraction::write().

160 {
161  os << getName();
162  if (dynamic_cast<BaseParticle*>(I_) != nullptr)
163  {
164  os << " particleIds " << P_->getId() << " " << I_->getId();
166  }
167  else
168  {
169  os << " particleWallIds " << P_->getId() << " " << I_->getId();
170  }
171  os << " timeStamp " << timeStamp_;
172  os << " contactPoint " << contactPoint_;
173  os << " force " << force_;
174  os << " torque " << torque_;
175  //\todo add information that can recreate the contact information (necessary for CG)
176  // os <<" timeStamp "<<timeStamp_<< " contactPoint " << contactPoint_ << " overlap " << overlap_ << " force " << force_ << " torque " << torque_;
177 }
BaseInteractable * I_
unsigned int getId() const
Returns the unique identifier of any particular object.
Definition: BaseObject.h:125
BaseInteractable * P_
std::string getName() const override
Virtual function which allows interactions to be named.
void BaseInteraction::writeInteraction ( std::ostream &  os,
bool  created 
) const
protected

Writes information about a interaction to the interaction file.

Method to write the interaction data to a stream, usually an interaction file. It saves the IDs of the particles (in case there are two particles) or particle and wall. Furthermore, the time when the interaction starts and ends is written to the stream.

Parameters
in/out]os The outputstream to which the interaction information should be written, usually a file
[in]createdWhether or not this is the beginning of the interaction.

Definition at line 681 of file BaseInteraction.cc.

References BaseHandler< T >::getDPMBase(), BaseSpecies::getHandler(), BaseObject::getId(), BaseInteractable::getSpecies(), DPMBase::getTime(), I_, P_, and timeStamp_.

Referenced by BaseInteraction(), and ~BaseInteraction().

682 {
683  if (created)
684  {
685  os << "started ";
686  }
687  else
688  {
689  os << "ended ";
690  }
691 
692  if (dynamic_cast<BaseParticle*>(I_) != nullptr)
693  {
694  os << " particleIds " << P_->getId() << " " << I_->getId() << " timeStamp ";
695  }
696  else
697  {
698  os << " particleWallIds " << P_->getId() << " " << I_->getId() << " timeStamp ";
699  }
700 
701  if (created)
702  {
703  os << timeStamp_;
704  }
705  else
706  {
707  os << P_->getSpecies()->getHandler()->getDPMBase()->getTime();
708  }
709 
710  os << std::endl;
711 
712 }
BaseInteractable * I_
unsigned int getId() const
Returns the unique identifier of any particular object.
Definition: BaseObject.h:125
const ParticleSpecies * getSpecies() const
Returns a pointer to the species of this BaseInteractable.
SpeciesHandler * getHandler() const
Returns the pointer to the handler to which this species belongs.
Definition: BaseSpecies.cc:99
BaseInteractable * P_
DPMBase * getDPMBase()
Gets the problem that is solved using this handler.
Definition: BaseHandler.h:725
Mdouble getTime() const
Returns the current simulation time.
Definition: DPMBase.cc:797
void BaseInteraction::writeToFStat ( std::ostream &  os,
Mdouble  time 
) const

Writes forces data to the FStat file.

Writes the FStat information that is required for the coarse- graining package MercuryCG if you want stress and force information. Note, it takes a general ostream but is normally a file i.e. ofstream

Parameters
[in]osThis is the ostream that the FStat information will be written to. Normally, a file but could be a gerneral ostream.
Todo:
MX The documentation mentions that the first variable is the time - this is incorrect, is is the timeStamp the interaction started
Todo:
the flip in normal/tangential direction for walls should not be done; this is an old bug

Definition at line 439 of file BaseInteraction.cc.

References Vec3D::dot(), force_, getContactPoint(), BaseObject::getIndex(), Vec3D::getLength(), getNormal(), getOverlap(), getTangentialForce(), getTangentialOverlap(), I_, isBonded(), normal_, and P_.

440 {
442  auto* IParticle = dynamic_cast<BaseParticle*>(I_);
443  auto* PParticle = dynamic_cast<BaseParticle*>(P_);
444 
445  // do not write fstat output if the force is an internal bond
446  if (isBonded()) return;
447 
448  Vec3D tangentialForce = getTangentialForce();
449  Mdouble tangentialOverlap = getTangentialOverlap();
450 
451  Mdouble scalarNormalForce = Vec3D::dot(force_, getNormal());
452  Mdouble scalarTangentialForce = tangentialForce.getLength();
453  Vec3D tangential;
454  if (scalarTangentialForce != 0.0)
455  tangential = tangentialForce / scalarTangentialForce;
456  else
457  tangential = Vec3D(0.0, 0.0, 0.0);
458 
459  if (PParticle != nullptr && !PParticle->isFixed())
460  {
461  os << time << " " << P_->getIndex()
462  << " " << static_cast<int>((IParticle == nullptr ? (-I_->getIndex() - 1) : I_->getIndex()))
463  << " " << getContactPoint()
464  << " " << getOverlap()
465  << " " << tangentialOverlap
466  << " " << scalarNormalForce
467  << " " << scalarTangentialForce
468  << " " << (IParticle == nullptr ? -normal_ : normal_)
469  << " " << (IParticle == nullptr ? -tangential : tangential) << std::endl;
471  }
472  if (IParticle != nullptr && !IParticle->isFixed() && IParticle->getPeriodicFromParticle() == nullptr)
473  {
474  os << time << " " << I_->getIndex()
475  << " " << P_->getIndex()
476  << " " << getContactPoint()
477  << " " << getOverlap()
478  << " " << tangentialOverlap
479  << " " << scalarNormalForce
480  << " " << scalarTangentialForce
481  << " " << -normal_
482  << " " << -tangential << std::endl;
483  }
484 }
BaseInteractable * I_
unsigned int getIndex() const
Returns the index of the object in the handler.
Definition: BaseObject.h:118
double Mdouble
Definition: GeneralDefine.h:34
const Vec3D & getContactPoint() const
Gets constant reference to contact point (vector).
static Mdouble dot(const Vec3D &a, const Vec3D &b)
Calculates the dot product of two Vec3D: .
Definition: Vector.cc:76
static Mdouble getLength(const Vec3D &a)
Calculates the length of a Vec3D: .
Definition: Vector.cc:331
const Vec3D & getNormal() const
Gets the normal vector between the two interacting objects.
BaseInteractable * P_
virtual const Vec3D getTangentialForce() const
Mdouble getOverlap() const
Returns a Mdouble with the current overlap between the two interacting objects.
virtual bool isBonded() const
Definition: Vector.h:49
virtual Mdouble getTangentialOverlap() const
get the length of the current tangential overlap

Member Data Documentation

Mdouble BaseInteraction::absoluteNormalForce_
private

Variables calculated by NormalForceInteraction, used by FrictionForceInteraction and AdhesiveForceInteraction (but not changed by them)

Definition at line 535 of file BaseInteraction.h.

Referenced by getAbsoluteNormalForce(), and setAbsoluteNormalForce().

Vec3D BaseInteraction::contactPoint_
private

This is Vec3D which stores the contact point of the interaction.

Definition at line 520 of file BaseInteraction.h.

Referenced by BaseInteraction(), getContactPoint(), getEffectiveRadius(), read(), rotateHistory(), setContactPoint(), and write().

Mdouble BaseInteraction::distance_
private

Variables calculated by NormalForceInteraction, used by FrictionForceInteraction and AdhesiveForceInteraction (but not changed by them)

Definition at line 540 of file BaseInteraction.h.

Referenced by getDistance(), and setDistance().

Vec3D BaseInteraction::force_
private
InteractionHandler* BaseInteraction::handler_
private

Pointer to the InteractionHander for this interaction.

Definition at line 499 of file BaseInteraction.h.

Referenced by copySwitchPointer(), getHandler(), removeFromHandler(), and setHandler().

BaseInteractable* BaseInteraction::I_
private

This is the second of the two interactable object involved in the interaction; often a particle or a wall, hence I because it is general interactable.

Definition at line 509 of file BaseInteraction.h.

Referenced by BaseInteraction(), copySwitchPointer(), gatherContactStatistics(), getI(), importI(), setBasicMPIInteractionValues(), setI(), write(), writeInteraction(), writeToFStat(), and ~BaseInteraction().

int BaseInteraction::identificationI_
private

Definition at line 514 of file BaseInteraction.h.

Referenced by getIdentificationI(), importI(), setI(), and setIdentificationI().

unsigned int BaseInteraction::identificationP_
private

Definition at line 513 of file BaseInteraction.h.

Referenced by getIdentificationP(), importP(), setIdentificationP(), and setP().

bool BaseInteraction::isWallInteraction_
private

Definition at line 515 of file BaseInteraction.h.

Referenced by isWallInteraction(), and setWallInteraction().

Mdouble BaseInteraction::lagrangeMultiplier_
private

Lagrange multiplier used by contact detection of superquadrics.

Definition at line 576 of file BaseInteraction.h.

Referenced by BaseInteraction(), getLagrangeMultiplier(), and setLagrangeMultiplier().

unsigned BaseInteraction::multiContactIdentifier_
private

Identifies individual contact such that it can be distinguished. E.g. the face number of a triangulated wall.

Definition at line 581 of file BaseInteraction.h.

Referenced by getMultiContactIdentifier(), and setMultiContactIdentifier().

Vec3D BaseInteraction::normal_
private

Vec3D which stores the normal vector (unit vector from I to P) of the interaction.

Definition at line 561 of file BaseInteraction.h.

Referenced by BaseInteraction(), gatherContactStatistics(), getNormal(), rotateHistory(), setNormal(), and writeToFStat().

Mdouble BaseInteraction::normalRelativeVelocity_
private

Variables calculated by NormalForceInteraction, used in other force routines (but not changed by them)

Definition at line 530 of file BaseInteraction.h.

Referenced by getNormalRelativeVelocity(), and setNormalRelativeVelocity().

Mdouble BaseInteraction::overlap_
private

Mdouble which stores the current overlap.

Definition at line 566 of file BaseInteraction.h.

Referenced by BaseInteraction(), gatherContactStatistics(), getOverlap(), and setOverlap().

BaseInteractable* BaseInteraction::P_
private

This first of two interactable objects involved in the interaction; normally a particle hence P.

Definition at line 504 of file BaseInteraction.h.

Referenced by BaseInteraction(), copySwitchPointer(), gatherContactStatistics(), getP(), importP(), setBasicMPIInteractionValues(), setP(), write(), writeInteraction(), writeToFStat(), and ~BaseInteraction().

Vec3D BaseInteraction::relativeVelocity_
private

Variables calculated by the normal force routines used in other force routines (but not changed by them).

Definition at line 525 of file BaseInteraction.h.

Referenced by getRelativeVelocity(), rotateHistory(), and setRelativeVelocity().

const BaseSpecies* BaseInteraction::species_
private

Pointer to the species of the interaction could be a mixed species or a species.

Definition at line 571 of file BaseInteraction.h.

Referenced by BaseInteraction(), getBaseSpecies(), and setSpecies().

unsigned BaseInteraction::timeStamp_
private

Mdouble which store the last timeStamp the interaction was active.

Todo:
TW it would be safer to use the integer time step here, instead of the double

Definition at line 556 of file BaseInteraction.h.

Referenced by BaseInteraction(), getTimeStamp(), setTimeStamp(), write(), and writeInteraction().

Vec3D BaseInteraction::torque_
private

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