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. It removes this interactions from the objects that were interacting, and writes the time to a file when needed. 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 getOverlapVolume () const
 Returns the overlap volume between 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 addForce (Vec3D force)
 add an force increment to the total force. More...
 
void addTorque (Vec3D torque)
 add a torque increment to the total torque. More...
 
void setForce (Vec3D force)
 set total force (this is used by the normal force, tangential forces are added use addForce) More...
 
void setTorque (Vec3D torque)
 set the total force (this is used by the normal force, tangential torques are added use addTorque) 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 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.

Constructor & Destructor Documentation

◆ BaseInteraction() [1/3]

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.
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();
53  if (P->getSpecies()->getHandler()->getDPMBase()->getInteractionFile().getFileType() == FileType::ONE_FILE)
54  {
55  writeInteraction(P->getSpecies()->getHandler()->getDPMBase()->getInteractionFile().getFstream(), true);
56  }
58 
59 #ifdef DEBUG_CONSTRUCTOR
60  std::cout<<"BaseInteraction::BaseInteraction() finished"<<std::endl;
61 #endif
62 }
@ ONE_FILE
all data will be written into/ read from a single file called name_
const BaseSpecies * species_
Definition: BaseInteraction.h:573
void writeInteraction(std::ostream &os, bool created) const
Writes information about a interaction to the interaction file.
Definition: BaseInteraction.cc:729
Vec3D torque_
Definition: BaseInteraction.h:552
Vec3D normal_
Definition: BaseInteraction.h:563
Vec3D force_
Definition: BaseInteraction.h:547
Mdouble lagrangeMultiplier_
Definition: BaseInteraction.h:578
BaseInteractable * P_
Definition: BaseInteraction.h:506
Mdouble overlap_
Definition: BaseInteraction.h:568
Vec3D contactPoint_
Definition: BaseInteraction.h:522
unsigned timeStamp_
Definition: BaseInteraction.h:558
BaseInteractable * I_
Definition: BaseInteraction.h:511
BaseObject()=default
Default constructor.
void setNaN()
Sets all elements to NaN.
Definition: Vector.cc:53
void setZero()
Sets all elements to zero.
Definition: Vector.cc:43
double P
Uniform pressure.
Definition: TwenteMeshGluing.cpp:73

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

◆ BaseInteraction() [2/3]

BaseInteraction::BaseInteraction ( )
Todo:
: empty baseInteraction, used in mpi code probably
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 }

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

◆ BaseInteraction() [3/3]

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?
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 }

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

◆ ~BaseInteraction()

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.

126 {
127 #if MERCURYDPM_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_debug(P_ != nullptr, "Trying to destroy an interaction with P_ = nullptr");
136  logger.assert_debug(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 MERCURYDPM_USE_MPI
146  }
147 #endif
148 }
Logger< MERCURYDPM_LOGLEVEL > logger("MercuryKernel")
Definition of different loggers with certain modules. A user can define its own custom logger here.
@ DEBUG
DPMBase * getDPMBase()
Gets the problem that is solved using this handler.
Definition: BaseHandler.h:725
bool removeInteraction(BaseInteraction *I)
Removes an interaction from this BaseInteractable.
Definition: BaseInteractable.cc:308
InteractionHandler * getHandler() const
Gets a point to the interaction handlers to which this interaction belongs.
Definition: BaseInteraction.cc:267
File & getInteractionFile()
Return a reference to the file InteractionsFile.
Definition: DPMBase.cc:345
Definition: File.h:81
std::fstream & getFstream()
Allows to access the member variable File::fstream_.
Definition: File.cc:153
FileType getFileType() const
Gets the file type e.g. NOFILE, ONEFILE and MULTIPLE FILES. File::fileType_.
Definition: File.cc:207

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

Member Function Documentation

◆ actionsAfterTimeStep()

◆ actionsOnErase()

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

85  {};

Referenced by InteractionHandler::eraseOldInteractions().

◆ addForce()

void BaseInteraction::addForce ( Vec3D  force)

◆ addTorque()

void BaseInteraction::addTorque ( Vec3D  torque)

add a torque increment to the total torque.

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.

617 {
618  torque_ += torque;
619 }

References torque_.

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

◆ computeForce()

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.

Reimplemented in Interaction< NormalForceInteraction, FrictionForceInteraction, AdhesiveForceInteraction >.

695 {}

◆ copy()

virtual BaseInteraction* BaseInteraction::copy ( ) const
pure virtual

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

Implemented in Interaction< NormalForceInteraction, FrictionForceInteraction, AdhesiveForceInteraction >.

Referenced by copySwitchPointer().

◆ 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.
342 {
343  //Copy the interaction of ghost
344  BaseInteraction* C = copy();
345  //Finds out which of P and I is that the particle from whom the ghost is begin created.
346  //The object being interacted with is set to P
347  if (C->getP() == original)
348  {
349  //Reverse some force history
350  C->reverseHistory();
351  //Set the P to the original particle
352  C->P_ = C->getI();
353  }
354  //The new ghost particle is set to I in the interaction.
355  C->I_ = ghost;
356 
357  //Add the the interaction to both original and the ghost
358  handler_->addObject(C);
359 }
Stores information about interactions between two interactable objects; often particles but could be ...
Definition: BaseInteraction.h:60
virtual BaseInteraction * copy() const =0
Makes a copy of the interaction and returns a pointer to the copy.
BaseInteractable * getI()
Returns a pointer to the second object involved in the interaction (often a wall or a particle).
Definition: BaseInteraction.h:285
BaseInteractable * getP()
Returns a pointer to first object involved in the interaction (normally a particle).
Definition: BaseInteraction.h:274
virtual void reverseHistory()
When periodic particles some interaction need certain history properties reversing....
Definition: BaseInteraction.cc:718
InteractionHandler * handler_
Definition: BaseInteraction.h:501
void addObject(BaseInteraction *I) override
Adds an Interaction to the InteractionHandler.
Definition: InteractionHandler.cc:87

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

Referenced by BaseInteractable::copyInteractionsForPeriodicParticles().

◆ createMPIInteractionDataArray()

void * BaseInteraction::createMPIInteractionDataArray ( unsigned int  numberOfInteractions) const
virtual

Reimplemented in Interaction< NormalForceInteraction, FrictionForceInteraction, AdhesiveForceInteraction >.

912 {
913  logger(ERROR, "BaseInteraction::createMPIInteractionDataArray should never be called");
914  return nullptr;
915 }
@ ERROR

References ERROR, and logger.

Referenced by InteractionHandler::createMPIInteractionDataArray().

◆ createMPIType()

void BaseInteraction::createMPIType ( )
virtual

◆ deleteMPIInteractionDataArray()

void BaseInteraction::deleteMPIInteractionDataArray ( void *  dataArray)
virtual

Reimplemented in Interaction< NormalForceInteraction, FrictionForceInteraction, AdhesiveForceInteraction >.

918 {
919  logger(WARN, "Why on earth is this function called?");
920 }
@ WARN

References logger, and WARN.

Referenced by InteractionHandler::deleteMPIInteractionDataArray().

◆ gatherContactStatistics()

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
826 {
827  auto* IParticle = dynamic_cast<BaseParticle*>(I_);
828  auto* PParticle = static_cast<BaseParticle*>(P_);
829 
830  Vec3D tangentialForce = getTangentialForce();
831  Mdouble tangentialOverlap = getTangentialOverlap();
832 
833  Mdouble scalarNormalForce = Vec3D::dot(force_, getNormal());
834  Mdouble scalarTangentialForce = tangentialForce.getLength();
835  Vec3D tangential;
836  if (scalarTangentialForce != 0.0)
837  tangential = tangentialForce / scalarTangentialForce;
838  else
839  tangential = Vec3D(0.0, 0.0, 0.0);
840 
843  Vec3D centre;
844  if (IParticle != nullptr)
845  centre = getP()->getPosition() - normal_ * (PParticle->getRadius() + IParticle->getRadius() - overlap_) / 2.0;
846  else
847  centre = getP()->getPosition() - normal_ * (PParticle->getRadius() - overlap_);
848 
849  if (!PParticle->isFixed())
850  {
852  P_->getIndex(),
853  static_cast<int>((IParticle == nullptr ? (-I_->getIndex() - 1) : I_->getIndex())),
854  centre,
855  getOverlap(),
856  tangentialOverlap,
857  scalarNormalForce,
858  scalarTangentialForce,
859  (IParticle == nullptr ? -normal_ : normal_),
860  (IParticle == nullptr ? -tangential : tangential));
861  }
862  if (IParticle != nullptr && !IParticle->isFixed() && IParticle->getPeriodicFromParticle() == nullptr)
863  {
865  I_->getIndex(),
866  static_cast<int>(P_->getIndex()),
867  centre,
868  getOverlap(),
869  tangentialOverlap,
870  scalarNormalForce,
871  scalarTangentialForce,
872  -normal_,
873  -tangential);
874 
875  }
876 }
double Mdouble
Definition: GeneralDefine.h:34
const Vec3D & getPosition() const
Returns the position of this BaseInteractable.
Definition: BaseInteractable.h:218
const Vec3D & getNormal() const
Gets the normal vector between the two interacting objects.
Definition: BaseInteraction.h:226
virtual Mdouble getTangentialOverlap() const
get the length of the current tangential overlap
Definition: BaseInteraction.cc:551
virtual const Vec3D getTangentialForce() const
Definition: BaseInteraction.cc:563
Mdouble getOverlap() const
Returns a Mdouble with the current overlap between the two interacting objects.
Definition: BaseInteraction.h:240
unsigned int getIndex() const
Returns the index of the object in the handler.
Definition: BaseObject.h:118
Definition: BaseParticle.h:54
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:1909
Definition: Vector.h:51
static Mdouble getLength(const Vec3D &a)
Calculates the length of a Vec3D: .
Definition: Vector.cc:331
static Mdouble dot(const Vec3D &a, const Vec3D &b)
Calculates the dot product of two Vec3D: .
Definition: Vector.cc:76

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

◆ getAbsoluteNormalForce()

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.
597 {
598  return absoluteNormalForce_;
599 }
Mdouble absoluteNormalForce_
Definition: BaseInteraction.h:537

References absoluteNormalForce_.

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

◆ getBaseSpecies()

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.
683 {
684  return species_;
685 }

References species_.

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

◆ getContactPoint()

const Vec3D& BaseInteraction::getContactPoint ( ) const
inline

Gets constant reference to contact point (vector).

Returns a reference to a Vec3D which contains the current value of the contact point for the particles in interaction. Normally, does not change about the interaction is created.

Returns
A reference to a Vec3D containing the contact point.
235  { return contactPoint_; }

References contactPoint_.

Referenced by ContactDetectionNormalSpheresTest::actionsAfterTimeStep(), ContactDetectionRotatedSpheresTest::actionsAfterTimeStep(), HertzianViscoelasticInteraction::computeNormalForce(), LinearPlasticViscoelasticInteraction::computeNormalForce(), LinearViscoelasticInteraction::computeNormalForce(), SinterInteraction::computeNormalForce(), SinterLinInteraction::computeNormalForce(), SPHInteraction::computeNormalForce(), HertzianSinterInteraction::computeSinterForce(), CGCoordinates::R::getCNormal(), CGCoordinates::RZ::getCNormal(), CGCoordinates::X::getCNormal(), CGCoordinates::XY::getCNormal(), CGCoordinates::XZ::getCNormal(), CGCoordinates::Y::getCNormal(), CGCoordinates::YZ::getCNormal(), CGCoordinates::Z::getCNormal(), getCP(), getEffectiveMass(), getEffectiveRadius(), getIC(), SuperQuadricParticle::getInitialGuessForContact(), CGCoordinates::R::getINormal(), BaseWall::getInteractionWith(), MeshTriangle::getInteractionWith(), CGCoordinates::R::getPNormal(), main(), LiquidMigrationMPI2Test::outputXBallsData(), LiquidMigrationSelfTest::outputXBallsData(), ParticleInclusion::printTime(), CGFields::StandardFields::setCylindricalFields(), ContactDetectionWithWallTester::testEllipsoidsContact(), ContactDetectionWithWallTester::testSpheresContact(), and writeToFStat().

◆ getContactRadius()

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.
367 {
368  return getOverlap()<0.0?0.0:sqrt(2.0 * getEffectiveRadius() * getOverlap());
369 }
Mdouble getEffectiveRadius() const
Returns a Mdouble to the effective radius of the interaction. (Not corrected for the overlap)
Definition: BaseInteraction.cc:793

References getEffectiveRadius(), and getOverlap().

Referenced by SinterLinInteraction::computeNormalForce().

◆ getCP()

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.

473 {
474  //works even in periodic systems becuase contact point is defined on the P-side
475  return getP()->getPosition() - getContactPoint();
476 }
const Vec3D & getContactPoint() const
Gets constant reference to contact point (vector).
Definition: BaseInteraction.h:234

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

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

◆ getDistance()

Mdouble BaseInteraction::getDistance ( ) const

Returns an Mdouble which is the norm (length) of distance vector.

540 {
541  return distance_;
542 }
Mdouble distance_
Definition: BaseInteraction.h:542

References distance_.

Referenced by FrictionInteraction::computeFrictionForce(), SlidingFrictionInteraction::computeSlidingSpring(), getIC(), getIP(), main(), and FileReader::read().

◆ getEffectiveMass()

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.
811 {
812  Mdouble invEffectiveMass = getP()->getInvMass() + getI()->getInvMass();
813  logger.assert_debug(invEffectiveMass>0,
814  "getEffectiveMass(): interaction % at % has infinite effective mass",getId(), getContactPoint());
815  return 1.0 / invEffectiveMass;
816 }
virtual Mdouble getInvMass() const
Definition: BaseInteractable.h:408
unsigned int getId() const
Returns the unique identifier of any particular object.
Definition: BaseObject.h:125

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

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

◆ getEffectiveRadius()

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.
794 {
795  Mdouble invEffectiveRadius = getP()->getCurvature(contactPoint_) + getI()->getCurvature(contactPoint_);
796  logger.assert_debug(invEffectiveRadius>0,
797  "getEffectiveRadius(): interaction % at % has infinite effective radius",getId(), getContactPoint());
798  return 1.0 / invEffectiveRadius;
799 }
virtual Mdouble getCurvature(const Vec3D &labFixedCoordinates) const
Definition: BaseInteractable.h:414

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

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

◆ getElasticEnergy()

Mdouble BaseInteraction::getElasticEnergy ( ) const
virtual

◆ getElasticEnergyAtEquilibrium()

virtual Mdouble BaseInteraction::getElasticEnergyAtEquilibrium ( Mdouble  adhesiveForce) const
inlineprotectedvirtual

◆ getFieldVTK()

std::vector< Mdouble > BaseInteraction::getFieldVTK ( unsigned  i) const
virtual

Reimplemented in SinterInteraction, LiquidMigrationWilletInteraction, and LiquidMigrationLSInteraction.

894 {
895  return std::vector<Mdouble>();
896 }

◆ getForce()

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.
211  { return force_; }

References force_.

Referenced by MercuryProblem::actionsAfterTimeStep(), BondedInteraction::bondInPlace(), MPIInteraction< NormalForceInteraction, FrictionForceInteraction, AdhesiveForceInteraction >::copyFromInteraction(), CGFields::StandardFields::setFields(), and SingleParticle< SpeciesType >::writeEneTimeStep().

◆ getHandler()

◆ getI() [1/2]

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.
286  {
287  logger.assert_debug(I_ != nullptr, "Second particle in interaction % is nullptr", getId());
288  return I_;
289  }

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

Referenced by InteractionHandler::addObject(), ChargedBondedInteraction::computeAdhesionForce(), FrictionInteraction::computeFrictionForce(), MindlinRollingTorsionInteraction::computeFrictionForce(), HertzianViscoelasticInteraction::computeNormalForce(), LinearPlasticViscoelasticInteraction::computeNormalForce(), LinearViscoelasticInteraction::computeNormalForce(), SinterInteraction::computeNormalForce(), SinterLinInteraction::computeNormalForce(), SPHInteraction::computeNormalForce(), HertzianSinterInteraction::computeSinterForce(), SlidingFrictionInteraction::computeSlidingSpring(), SlidingFrictionInteraction::computeSlidingSpringSuperQuadric(), MPIInteraction< NormalForceInteraction, FrictionForceInteraction, AdhesiveForceInteraction >::copyFromInteraction(), copySwitchPointer(), LiquidMigrationLSInteraction::form(), LiquidMigrationWilletInteraction::form(), getEffectiveMass(), getEffectiveRadius(), ChargedBondedInteraction::getElasticEnergy(), CGCoordinates::R::getINormal(), CGCoordinates::RZ::getINormal(), CGCoordinates::X::getINormal(), CGCoordinates::XY::getINormal(), CGCoordinates::XYZ::getINormal(), CGCoordinates::XZ::getINormal(), CGCoordinates::Y::getINormal(), CGCoordinates::YZ::getINormal(), CGCoordinates::Z::getINormal(), getOverlapVolume(), InteractionHandler::removeObjectKeepingPeriodics(), LiquidMigrationLSInteraction::rupture(), and LiquidMigrationWilletInteraction::rupture().

◆ getI() [2/2]

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.
309  {
310  logger.assert_debug(I_ != nullptr, "Second particle in interaction % is nullptr", getId());
311  return I_;
312  }

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

◆ getIC()

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.

Todo:
getDistance is not set in postprocessing
467 {
469  return getNormal() * getDistance() + getContactPoint() - getP()->getPosition();
470 }
Mdouble getDistance() const
Returns an Mdouble which is the norm (length) of distance vector.
Definition: BaseInteraction.cc:539

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

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

◆ getIdentificationI()

int BaseInteraction::getIdentificationI ( )
946 {
947  return identificationI_;
948 }
int identificationI_
Definition: BaseInteraction.h:516

References identificationI_.

◆ getIdentificationP()

unsigned int BaseInteraction::getIdentificationP ( )
941 {
942  return identificationP_;
943 }
unsigned int identificationP_
Definition: BaseInteraction.h:515

References identificationP_.

◆ getInteractionDetails()

void BaseInteraction::getInteractionDetails ( void *  interactionDataArray,
unsigned int  index,
unsigned int &  identificationP,
unsigned int &  identificationI,
bool isWallInteraction,
unsigned &  timeStamp 
)
virtual

Reimplemented in Interaction< NormalForceInteraction, FrictionForceInteraction, AdhesiveForceInteraction >.

925 {
926  logger(ERROR, "Something went wrong, this function should not be called");
927 }

References ERROR, and logger.

Referenced by InteractionHandler::getInteractionDetails().

◆ getIP()

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.

460 {
461  //needs to be done by normal and distance or it fails in periodic systems
462  //return getP()->getPosition() - getI()->getPosition();
463  return getNormal() * getDistance();
464 }

References getDistance(), and getNormal().

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

◆ getLagrangeMultiplier()

Mdouble BaseInteraction::getLagrangeMultiplier ( )
inline
191  {
192  return lagrangeMultiplier_;
193  }

References lagrangeMultiplier_.

Referenced by SuperQuadricParticle::getInitialGuessForContact().

◆ getMPIInteraction()

void BaseInteraction::getMPIInteraction ( void *  historyDataArray,
unsigned int  index 
) const
virtual

copies the history interactions into the data array

Reimplemented in Interaction< NormalForceInteraction, FrictionForceInteraction, AdhesiveForceInteraction >.

904 {
905 }

◆ getMultiContactIdentifier()

unsigned int BaseInteraction::getMultiContactIdentifier ( ) const
764 {
766 }
unsigned multiContactIdentifier_
Definition: BaseInteraction.h:583

References multiContactIdentifier_.

◆ getName()

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.

Reimplemented in Interaction< NormalForceInteraction, FrictionForceInteraction, AdhesiveForceInteraction >.

203 {
204  return "BaseInteraction";
205 }

Referenced by write().

◆ getNameVTK()

std::string BaseInteraction::getNameVTK ( unsigned  i) const
virtual

◆ getNormal()

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.
227  { return normal_; }

References normal_.

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

◆ getNormalRelativeVelocity()

Mdouble BaseInteraction::getNormalRelativeVelocity ( ) const

◆ getNumberOfFieldsVTK()

unsigned BaseInteraction::getNumberOfFieldsVTK ( ) const
virtual

Reimplemented in SinterInteraction, LiquidMigrationWilletInteraction, and LiquidMigrationLSInteraction.

879 {
880  return 0;
881 }

◆ getOverlap()

Mdouble BaseInteraction::getOverlap ( ) const
inline

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

241  { return overlap_; }

References overlap_.

Referenced by LiquidMigrationLSInteraction::actionsAfterTimeStep(), LiquidMigrationWilletInteraction::actionsAfterTimeStep(), ConstantRestitutionSelfTest::actionsBeforeTimeStep(), BondedInteraction::computeAdhesionForce(), ChargedBondedInteraction::computeAdhesionForce(), IrreversibleAdhesiveInteraction::computeAdhesionForce(), LiquidBridgeWilletInteraction::computeAdhesionForce(), LiquidMigrationLSInteraction::computeAdhesionForce(), LiquidMigrationWilletInteraction::computeAdhesionForce(), ParhamiMcMeekingSinterInteraction::computeAdhesionForce(), ReversibleAdhesiveInteraction::computeAdhesionForce(), HertzianViscoelasticInteraction::computeNormalForce(), LinearPlasticViscoelasticInteraction::computeNormalForce(), LinearViscoelasticInteraction::computeNormalForce(), SinterInteraction::computeNormalForce(), SinterLinInteraction::computeNormalForce(), SPHInteraction::computeNormalForce(), HertzianSinterInteraction::computeSinterForce(), gatherContactStatistics(), getContactRadius(), BondedInteraction::getElasticEnergy(), ChargedBondedInteraction::getElasticEnergy(), IrreversibleAdhesiveInteraction::getElasticEnergy(), HertzianSinterInteraction::getElasticEnergy(), HertzianViscoelasticInteraction::getElasticEnergy(), LinearPlasticViscoelasticInteraction::getElasticEnergy(), LinearViscoelasticInteraction::getElasticEnergy(), SinterInteraction::getElasticEnergy(), SinterLinInteraction::getElasticEnergy(), SPHInteraction::getElasticEnergy(), SuperQuadricParticle::getInitialGuessForContact(), BaseParticle::getInteractionWith(), ArcWall::getInteractionWith(), BaseWall::getInteractionWith(), Combtooth::getInteractionWith(), MeshTriangle::getInteractionWith(), VChute::getInteractionWith(), SuperQuadricParticle::getInteractionWithSuperQuad(), getOverlapVolume(), HertzianSinterInteraction::getUnloadingModulus(), LinearPlasticViscoelasticInteraction::getUnloadingStiffness(), SinterInteraction::getUnloadingStiffness(), SinterLinInteraction::getUnloadingStiffness(), main(), FileReader::read(), setFStatData(), ContactDetectionWithWallTester::testEllipsoidsContact(), ContactDetectionWithWallTester::testSpheresContact(), MindlinInteraction::updateTangentialStiffnessZero(), SingleParticle< SpeciesType >::writeEneTimeStep(), and writeToFStat().

◆ getOverlapVolume()

Mdouble BaseInteraction::getOverlapVolume ( ) const

Returns the overlap volume between two interacting objects.

Warning
Only works for spherical particles. Not implemented for walls. Returns nonsense when one particle is fully inside the other.

Converts the linear overlap in the correct volume overlap i.e. this is the spherical cap approximation Please see additional docs directory for the calculation of this and the mathematica file with the calculation in

Returns
The volume of the overlap between the two objects in the interaction
278 {
279  //logger(WARN,"This function is only tested for spheres and (may) give the wrong answer for other objects");
280  //First get overlap and radii of each object
281  Mdouble delta = getOverlap();
282  Mdouble curvatureParticle=getP()->getCurvature(getP()->getPosition());
283  Mdouble curvatureInteractable=getI()->getCurvature(getI()->getPosition());
284 
285  if (curvatureInteractable == 0)
286  {
287  logger(WARN,"This function is not implemented for walls yet and will return 0");
288  return 0;
289  }
290  else
291  {
292  Mdouble r1=1.0/curvatureInteractable;
293  Mdouble r2=1.0/curvatureParticle;
294 
295  if (delta > 2.0 * r1 || delta > 2.0 * r2)
296  logger(WARN, "Warning in BaseInteraction::getOverlapVolume: One of the particles is fully inside the other. The calculations are undefined for this case and will return nonsensical values.");
297 
298  //Eq (2.1) - see doc
299 // logger(WARN,"Radius of first object % and second object %",r1,r2);
300  Mdouble t1=(r2-delta/2.0)/(r1+r2-delta)*delta;
301  //Eq (2.2) - see doc
302  Mdouble t2=(r1-delta/2.0)/(r1+r2-delta)*delta;
303 
304  //Eq (2.3) - see doc
306  std::pow(t1,2.0)*r1
307  -std::pow(t1,3.0)/3.0
308  +std::pow(t2,2.0)*r2
309  -std::pow(t2,3.0)/3.0
310  );
311 
312  return V;
313  }
314 
315 return 0;
316 }
const Mdouble pi
Definition: ExtendedMath.h:45

References BaseInteractable::getCurvature(), getI(), getOverlap(), getP(), logger, constants::pi, and WARN.

Referenced by ExtremeOverlapVolumeUnitTest::setupInitialConditions().

◆ getP() [1/2]

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.
275  {
276  logger.assert_debug(P_ != nullptr, "First particle in interaction % is nullptr", getId());
277  return P_;
278  }

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

Referenced by InteractionHandler::addObject(), ChargedBondedInteraction::computeAdhesionForce(), FrictionInteraction::computeFrictionForce(), MindlinRollingTorsionInteraction::computeFrictionForce(), HertzianViscoelasticInteraction::computeNormalForce(), LinearPlasticViscoelasticInteraction::computeNormalForce(), LinearViscoelasticInteraction::computeNormalForce(), SinterInteraction::computeNormalForce(), SinterLinInteraction::computeNormalForce(), SPHInteraction::computeNormalForce(), HertzianSinterInteraction::computeSinterForce(), SlidingFrictionInteraction::computeSlidingSpring(), MPIInteraction< NormalForceInteraction, FrictionForceInteraction, AdhesiveForceInteraction >::copyFromInteraction(), copySwitchPointer(), LiquidMigrationLSInteraction::form(), LiquidMigrationWilletInteraction::form(), gatherContactStatistics(), getCP(), getEffectiveMass(), getEffectiveRadius(), ChargedBondedInteraction::getElasticEnergy(), getIC(), getOverlapVolume(), CGCoordinates::R::getPNormal(), CGCoordinates::RZ::getPNormal(), CGCoordinates::X::getPNormal(), CGCoordinates::XY::getPNormal(), CGCoordinates::XZ::getPNormal(), CGCoordinates::Y::getPNormal(), CGCoordinates::YZ::getPNormal(), CGCoordinates::Z::getPNormal(), CGCoordinates::RZ::getTangentialSquared(), CGCoordinates::XY::getTangentialSquared(), CGCoordinates::XYZ::getTangentialSquared(), CGCoordinates::XZ::getTangentialSquared(), CGCoordinates::YZ::getTangentialSquared(), InteractionHandler::removeObjectKeepingPeriodics(), LiquidMigrationLSInteraction::rupture(), and LiquidMigrationWilletInteraction::rupture().

◆ getP() [2/2]

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.
298  {
299  logger.assert_debug(P_ != nullptr, "First particle in interaction % is nullptr", getId());
300  return P_;
301  }

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

◆ getRelativeVelocity()

const Vec3D & BaseInteraction::getRelativeVelocity ( ) const

◆ getTangentialForce()

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 SlidingFrictionInteraction, MindlinInteraction, and EmptyFrictionInteraction.

564 {
565  return Vec3D(0.0, 0.0, 0.0);
566 }

Referenced by gatherContactStatistics(), and writeToFStat().

◆ getTangentialOverlap()

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 SlidingFrictionInteraction, MindlinInteraction, and EmptyFrictionInteraction.

552 {
553  return 0;
554 }

Referenced by gatherContactStatistics(), and writeToFStat().

◆ getTimeStamp()

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.
320  { return timeStamp_; }

References timeStamp_.

Referenced by MPIInteraction< NormalForceInteraction, FrictionForceInteraction, AdhesiveForceInteraction >::copyFromInteraction(), InteractionHandler::eraseOldInteractions(), and InteractionHandler::removeObjectKeepingPeriodics().

◆ getTorque()

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.
219  { return torque_; }

References torque_.

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

◆ getTypeVTK()

std::string BaseInteraction::getTypeVTK ( unsigned  i) const
virtual

◆ importI()

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.
452 {
453  I_->removeInteraction(this);
454  I_ = I;
455  I_->addInteraction(this);
457 }
void addInteraction(BaseInteraction *I)
Adds an interaction to this BaseInteractable.
Definition: BaseInteractable.cc:292

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

◆ importP()

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.
420 {
421  P_->removeInteraction(this);
422  P_ = P;
423  P_->addInteraction(this);
425 }

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

◆ integrate()

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 SlidingFrictionInteraction, MindlinRollingTorsionInteraction, MindlinInteraction, FrictionInteraction, EmptyFrictionInteraction, and Interaction< NormalForceInteraction, FrictionForceInteraction, AdhesiveForceInteraction >.

379 {
380 
381 }

◆ isBonded()

virtual bool BaseInteraction::isBonded ( ) const
inlinevirtual

Reimplemented in ChargedBondedInteraction.

493 {return false;}

Referenced by writeToFStat().

◆ isWallInteraction()

bool BaseInteraction::isWallInteraction ( )
956 {
957  return isWallInteraction_;
958 }
bool isWallInteraction_
Definition: BaseInteraction.h:517

References isWallInteraction_.

◆ read()

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 SPHInteraction, SinterLinInteraction, SinterInteraction, LinearViscoelasticInteraction, LinearPlasticViscoelasticInteraction, HertzianViscoelasticInteraction, HertzianSinterInteraction, HertzianBSHPViscoelasticInteraction, SlidingFrictionInteraction, MindlinRollingTorsionInteraction, MindlinInteraction, FrictionInteraction, EmptyFrictionInteraction, and Interaction< NormalForceInteraction, FrictionForceInteraction, AdhesiveForceInteraction >.

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

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

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

◆ removeFromHandler()

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.

323 {
325 }
virtual void removeObject(unsigned const int index)
Removes an Object from the BaseHandler.
Definition: BaseHandler.h:472

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

◆ reverseHistory()

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 SlidingFrictionInteraction, MindlinRollingTorsionInteraction, MindlinInteraction, FrictionInteraction, and Interaction< NormalForceInteraction, FrictionForceInteraction, AdhesiveForceInteraction >.

719 {
720 }

Referenced by copySwitchPointer().

◆ rotateHistory()

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 SlidingFrictionInteraction, MindlinRollingTorsionInteraction, MindlinInteraction, FrictionInteraction, and Interaction< NormalForceInteraction, FrictionForceInteraction, AdhesiveForceInteraction >.

775 {
776  contactPoint_ = rotationMatrix * contactPoint_;
777  relativeVelocity_ = rotationMatrix * relativeVelocity_;
778  force_ = rotationMatrix * force_;
779  torque_ = rotationMatrix * torque_;
780  normal_ = rotationMatrix * normal_;
782 }

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

◆ setAbsoluteNormalForce()

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.
671 {
672  absoluteNormalForce_ = absoluteNormalForce;
673 }

References absoluteNormalForce_.

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

◆ setBasicMPIInteractionValues()

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?
963 {
964  this->setIdentificationP(P);
965  this->setIdentificationI(I);
966  this->setTimeStamp(timeStamp);
967  this->setForce(force);
968  this->setTorque(torque);
969  this->setWallInteraction(isWallInteraction);
970  if (resetPointers)
971  {
972  this->I_ = nullptr;
973  this->P_ = nullptr;
974  }
975 }
void setIdentificationP(unsigned int identification)
Definition: BaseInteraction.cc:930
void setTimeStamp(unsigned timeStamp)
Updates the time step of the interacting. Note, time steps used to find completed interactions.
Definition: BaseInteraction.cc:251
void setWallInteraction(bool flag)
Definition: BaseInteraction.cc:950
void setIdentificationI(int identification)
Definition: BaseInteraction.cc:935
void setForce(Vec3D force)
set total force (this is used by the normal force, tangential forces are added use addForce)
Definition: BaseInteraction.cc:627
void setTorque(Vec3D torque)
set the total force (this is used by the normal force, tangential torques are added use addTorque)
Definition: BaseInteraction.cc:638

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

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

◆ setContactPoint()

◆ setDistance()

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.
222 {
223  distance_ = distance;
224 }

References distance_.

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

◆ setForce()

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.

628 {
629  force_ = force;
630 }

References force_.

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

◆ setFStatData() [1/2]

void BaseInteraction::setFStatData ( std::fstream &  fstat,
BaseParticle P,
BaseParticle I 
)
979 {
980  Mdouble overlap, tangentialOverlap, scalarNormalForce, scalarTangentialForce;
981  Vec3D centre, normal, tangential;
982  fstat >> centre >> overlap >> tangentialOverlap >> scalarNormalForce >> scalarTangentialForce >> normal
983  >> tangential;
984  const Vec3D force = scalarNormalForce * normal + scalarTangentialForce * tangential;
985  setForce(force);
986  setNormal(normal);
987  setOverlap(overlap);
988  const Mdouble radius = P->getRadius();
989  const Vec3D branch = (radius - 0.5 * getOverlap()) * getNormal();
990  setContactPoint(P->getPosition() - branch);
991  setDistance(radius + I->getRadius() - getOverlap());
992 }
void setDistance(Mdouble distance)
Sets the interaction distance between the two interacting objects.
Definition: BaseInteraction.cc:221
void setContactPoint(Vec3D contactPoint)
Set the location of the contact point between the two interacting objects.
Definition: BaseInteraction.cc:240
void setNormal(Vec3D normal)
Sets the normal vector between the two interacting objects.
Definition: BaseInteraction.cc:212
void setOverlap(Mdouble overlap)
Set the overlap between the two interacting object.
Definition: BaseInteraction.cc:231
Mdouble getRadius() const
Returns the particle's radius.
Definition: BaseParticle.h:348

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

◆ setFStatData() [2/2]

void BaseInteraction::setFStatData ( std::fstream &  fstat,
BaseParticle P,
BaseWall I 
)
995 {
996  Mdouble overlap, tangentialOverlap, scalarNormalForce, scalarTangentialForce;
997  Vec3D centre, normal, tangential;
998  fstat >> centre >> overlap >> tangentialOverlap >> scalarNormalForce >> scalarTangentialForce >> normal
999  >> tangential;
1000  const Vec3D force = scalarNormalForce * normal + scalarTangentialForce * tangential;
1001  //note walls are defined different than particles (with an extra minus)
1002  setForce(-force);
1003  setNormal(-normal);
1004  setOverlap(overlap);
1005  const Mdouble radius = P->getRadius();
1006  const Vec3D branch = (radius - 0.5 * getOverlap()) * getNormal();
1007  setContactPoint(P->getPosition() - branch);
1008  setDistance(radius - getOverlap());
1009 }

References getNormal(), getOverlap(), Global_Physical_Variables::P, setContactPoint(), setDistance(), setForce(), setNormal(), and setOverlap().

Referenced by DPMBase::readNextFStatFile().

◆ setHandler()

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.
262 {
263  handler_ = handler;
264 }

References handler_.

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

◆ setI()

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.
436 {
437  I_->removeInteraction(this);
438  I_ = I;
439  I_->addInteraction(this);
441 }

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

Referenced by InteractionHandler::removeObjectKeepingPeriodics().

◆ setIdentificationI()

void BaseInteraction::setIdentificationI ( int  identification)
936 {
937  identificationI_ = identification;
938 }

References identificationI_.

Referenced by setBasicMPIInteractionValues().

◆ setIdentificationP()

void BaseInteraction::setIdentificationP ( unsigned int  identification)
931 {
932  identificationP_ = identification;
933 }

References identificationP_.

Referenced by setBasicMPIInteractionValues().

◆ setLagrangeMultiplier()

void BaseInteraction::setLagrangeMultiplier ( Mdouble  multiplier)
inline
186  {
187  lagrangeMultiplier_ = multiplier;
188  }

References lagrangeMultiplier_.

Referenced by SuperQuadricParticle::getInteractionWithSuperQuad().

◆ setMPIInteraction()

void BaseInteraction::setMPIInteraction ( void *  interactionDataArray,
unsigned int  index,
bool  resetPointers 
)
virtual

◆ setMultiContactIdentifier()

void BaseInteraction::setMultiContactIdentifier ( unsigned int  multiContactIdentifier_)
769 {
770  multiContactIdentifier_ = multiContactIdentifier;
771 }

References multiContactIdentifier_.

Referenced by MeshTriangle::getInteractionWith().

◆ setNormal()

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.
213 {
214  normal_ = normal;
215 }

References normal_.

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

◆ setNormalRelativeVelocity()

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.
661 {
662  normalRelativeVelocity_ = normalRelativeVelocity;
663 }

References normalRelativeVelocity_.

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

◆ setOverlap()

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.
232 {
233  overlap_ = overlap;
234 }

References overlap_.

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

◆ setP()

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.
404 {
405  P_->removeInteraction(this);
406  P_ = P;
407  P_->addInteraction(this);
409 }

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

◆ setRelativeVelocity()

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.
650 {
651  relativeVelocity_ = relativeVelocity;
652 }

References relativeVelocity_.

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

◆ setSpecies()

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.
391 {
392  species_ = species;
393 }

References species_.

Referenced by InteractionHandler::getInteraction().

◆ setTimeStamp()

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.
252 {
253  timeStamp_ = timeStamp;
254 }

References timeStamp_.

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

◆ setTorque()

void BaseInteraction::setTorque ( Vec3D  torque)

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.

639 {
640  torque_ = torque;
641 }

References torque_.

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

◆ setWallInteraction()

void BaseInteraction::setWallInteraction ( bool  flag)

◆ write()

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 SPHInteraction, SinterLinInteraction, SinterInteraction, LinearViscoelasticInteraction, LinearPlasticViscoelasticInteraction, HertzianViscoelasticInteraction, HertzianSinterInteraction, HertzianBSHPViscoelasticInteraction, SlidingFrictionInteraction, MindlinRollingTorsionInteraction, MindlinInteraction, FrictionInteraction, EmptyFrictionInteraction, and Interaction< NormalForceInteraction, FrictionForceInteraction, AdhesiveForceInteraction >.

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  //\todo tw we need to store normal and distance as well
174  // os << " normal " << normal_*distance_;
175  os << " force " << force_;
176  os << " torque " << torque_;
177  //\todo add information that can recreate the contact information (necessary for CG)
178  // os <<" timeStamp "<<timeStamp_<< " contactPoint " << contactPoint_ << " overlap " << overlap_ << " force " << force_ << " torque " << torque_;
179 }
std::string getName() const override
Virtual function which allows interactions to be named.
Definition: BaseInteraction.cc:202

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

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

◆ writeInteraction()

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.
730 {
731  if (created)
732  {
733  os << "started ";
734  }
735  else
736  {
737  os << "ended ";
738  }
739 
740  if (dynamic_cast<BaseParticle*>(I_) != nullptr)
741  {
742  os << " particleIds " << P_->getId() << " " << I_->getId() << " timeStamp ";
743  }
744  else
745  {
746  os << " particleWallIds " << P_->getId() << " " << I_->getId() << " timeStamp ";
747  }
748 
749  if (created)
750  {
751  os << timeStamp_;
752  }
753  else
754  {
755  os << P_->getSpecies()->getHandler()->getDPMBase()->getTime();
756  }
757 
758  os << std::endl;
759 
760 }
const ParticleSpecies * getSpecies() const
Returns a pointer to the species of this BaseInteractable.
Definition: BaseInteractable.h:108
SpeciesHandler * getHandler() const
Returns the pointer to the handler to which this species belongs.
Definition: BaseSpecies.cc:99
Mdouble getTime() const
Returns the current simulation time.
Definition: DPMBase.cc:808

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

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

◆ writeToFStat()

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
488 {
490  auto* IParticle = dynamic_cast<BaseParticle*>(I_);
491  auto* PParticle = dynamic_cast<BaseParticle*>(P_);
492 
493  // do not write fstat output if the force is an internal bond
494  if (isBonded()) return;
495 
496  Vec3D tangentialForce = getTangentialForce();
497  Mdouble tangentialOverlap = getTangentialOverlap();
498 
499  Mdouble scalarNormalForce = Vec3D::dot(force_, getNormal());
500  Mdouble scalarTangentialForce = tangentialForce.getLength();
501  Vec3D tangential;
502  if (scalarTangentialForce != 0.0)
503  tangential = tangentialForce / scalarTangentialForce;
504  else
505  tangential = Vec3D(0.0, 0.0, 0.0);
506 
507  if (PParticle != nullptr && !PParticle->isFixed())
508  {
509  os << time << " " << P_->getIndex()
510  << " " << static_cast<int>((IParticle == nullptr ? (-I_->getIndex() - 1) : I_->getIndex()))
511  << " " << getContactPoint()
512  << " " << getOverlap()
513  << " " << tangentialOverlap
514  << " " << scalarNormalForce
515  << " " << scalarTangentialForce
516  << " " << (IParticle == nullptr ? -normal_ : normal_)
517  << " " << (IParticle == nullptr ? -tangential : tangential) << std::endl;
519  }
520  if (IParticle != nullptr && !IParticle->isFixed() && IParticle->getPeriodicFromParticle() == nullptr)
521  {
522  os << time << " " << I_->getIndex()
523  << " " << P_->getIndex()
524  << " " << getContactPoint()
525  << " " << getOverlap()
526  << " " << tangentialOverlap
527  << " " << scalarNormalForce
528  << " " << scalarTangentialForce
529  << " " << -normal_
530  << " " << -tangential << std::endl;
531  }
532 }
virtual bool isBonded() const
Definition: BaseInteraction.h:493

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

Member Data Documentation

◆ absoluteNormalForce_

Mdouble BaseInteraction::absoluteNormalForce_
private

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

Referenced by getAbsoluteNormalForce(), and setAbsoluteNormalForce().

◆ contactPoint_

Vec3D BaseInteraction::contactPoint_
private

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

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

◆ distance_

Mdouble BaseInteraction::distance_
private

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

Referenced by getDistance(), and setDistance().

◆ force_

Vec3D BaseInteraction::force_
private

First computed by NormalForceInteraction, but added to by FrictionForceInteraction and AdhesiveForceInteraction.

Referenced by addForce(), BaseInteraction(), gatherContactStatistics(), getForce(), read(), rotateHistory(), setForce(), write(), and writeToFStat().

◆ handler_

InteractionHandler* BaseInteraction::handler_
private

Pointer to the InteractionHander for this interaction.

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

◆ I_

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.

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

◆ identificationI_

int BaseInteraction::identificationI_
private

◆ identificationP_

unsigned int BaseInteraction::identificationP_
private

◆ isWallInteraction_

bool BaseInteraction::isWallInteraction_
private

◆ lagrangeMultiplier_

Mdouble BaseInteraction::lagrangeMultiplier_
private

Lagrange multiplier used by contact detection of superquadrics.

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

◆ multiContactIdentifier_

unsigned BaseInteraction::multiContactIdentifier_
private

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

Referenced by getMultiContactIdentifier(), and setMultiContactIdentifier().

◆ normal_

Vec3D BaseInteraction::normal_
private

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

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

◆ normalRelativeVelocity_

Mdouble BaseInteraction::normalRelativeVelocity_
private

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

Referenced by getNormalRelativeVelocity(), and setNormalRelativeVelocity().

◆ overlap_

Mdouble BaseInteraction::overlap_
private

Mdouble which stores the current overlap.

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

◆ P_

BaseInteractable* BaseInteraction::P_
private

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

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

◆ relativeVelocity_

Vec3D BaseInteraction::relativeVelocity_
private

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

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

◆ species_

const BaseSpecies* BaseInteraction::species_
private

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

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

◆ timeStamp_

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

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

◆ torque_

Vec3D BaseInteraction::torque_
private

First computed by NormalForceInteraction, but added to by FrictionForceInteraction and AdhesiveForceInteraction.

Referenced by addTorque(), BaseInteraction(), getTorque(), read(), rotateHistory(), setTorque(), and write().


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