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.
19  : BaseObject()
20 {
21  P_ = P;
22  I_ = I;
23  normal_.setZero();
25  overlap_ = 0;
26  timeStamp_ = timeStamp;
28  species_ = nullptr;
29  force_.setZero();
30  torque_.setZero();
31  if (P->getSpecies()->getHandler()->getDPMBase()->getInteractionFile().getFileType() == FileType::ONE_FILE)
32  {
33  writeInteraction(P->getSpecies()->getHandler()->getDPMBase()->getInteractionFile().getFstream(), true);
34  }
36 
37 #ifdef DEBUG_CONSTRUCTOR
38  std::cout<<"BaseInteraction::BaseInteraction() finished"<<std::endl;
39 #endif
40 }
@ ONE_FILE
all data will be written into/ read from a single file called name_
const BaseSpecies * species_
Definition: BaseInteraction.h:552
void writeInteraction(std::ostream &os, bool created) const
Writes information about a interaction to the interaction file.
Definition: BaseInteraction.cc:710
Vec3D torque_
Definition: BaseInteraction.h:531
Vec3D normal_
Definition: BaseInteraction.h:542
Vec3D force_
Definition: BaseInteraction.h:526
Mdouble lagrangeMultiplier_
Definition: BaseInteraction.h:557
BaseInteractable * P_
Definition: BaseInteraction.h:485
Mdouble overlap_
Definition: BaseInteraction.h:547
Vec3D contactPoint_
Definition: BaseInteraction.h:501
unsigned timeStamp_
Definition: BaseInteraction.h:537
BaseInteractable * I_
Definition: BaseInteraction.h:490
BaseObject()=default
Default constructor.
void setNaN()
Sets all elements to NaN.
Definition: Vector.cc:33
void setZero()
Sets all elements to zero.
Definition: Vector.cc:23
#define I
Definition: main.h:127
double P
Uniform pressure.
Definition: TwenteMeshGluing.cpp:77

References contactPoint_, force_, I, 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
44  : BaseObject()
45 {
46  P_ = nullptr;
47  I_ = nullptr;
48  normal_.setZero();
49  overlap_ = 0;
50  timeStamp_ = 0;
51  species_ = nullptr;
52  force_.setZero();
53  torque_.setZero();
56 }

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?
63  : BaseObject(p)
64 {
65  P_ = p.P_;
66  I_ = p.I_;
67  normal_ = p.normal_;
68  overlap_ = p.overlap_;
69  force_ = p.force_;
70  torque_ = p.torque_;
71  species_ = p.species_;
72  timeStamp_ = p.timeStamp_;
73  lagrangeMultiplier_ = p.lagrangeMultiplier_;
74  contactPoint_ = p.contactPoint_;
75 
77 // InteractionHandler* handler_;
78 // BaseInteractable* P_;
79 // BaseInteractable* I_;
80 // unsigned int identificationP_;
81 // int identificationI_;
82 // bool isWallInteraction_;
83 // Vec3D contactPoint_;
84 // Vec3D relativeVelocity_;
85 // Mdouble normalRelativeVelocity_;
86 // Mdouble absoluteNormalForce_;
87 // Mdouble distance_;
88 // Vec3D force_;
89 // Vec3D torque_;
90 // unsigned timeStamp_;
91 // Vec3D normal_;
92 // Mdouble overlap_;
93 // const BaseSpecies* species_;
94 // Mdouble lagrangeMultiplier_;
95 // unsigned multiContactIdentifier_;
96 
97 }
float * p
Definition: Tutorial_Map_using.cpp:9

References contactPoint_, force_, I_, lagrangeMultiplier_, normal_, overlap_, p, 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.

104 {
105 #if MERCURYDPM_USE_MPI
106  if (P_ == nullptr)
107  {
108  logger(DEBUG,"Destroying a fictitious interaction used in MPI transmissions");
109  }
110  else
111  {
112 #endif
113  logger.assert_debug(P_ != nullptr, "Trying to destroy an interaction with P_ = nullptr");
114  logger.assert_debug(I_ != nullptr, "Trying to destroy an interaction with I_ = nullptr");
115  File& interactionFile = getHandler()->getDPMBase()->getInteractionFile();
116  if (interactionFile.getFileType() == FileType::ONE_FILE)
117  {
118  writeInteraction(interactionFile.getFstream(), false);
119  }
120 
121  P_->removeInteraction(this);
122  I_->removeInteraction(this);
123 #if MERCURYDPM_USE_MPI
124  }
125 #endif
126 }
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:733
bool removeInteraction(BaseInteraction *I)
Removes an interaction from this BaseInteractable.
Definition: BaseInteractable.cc:286
InteractionHandler * getHandler() const
Gets a point to the interaction handlers to which this interaction belongs.
Definition: BaseInteraction.cc:247
File & getInteractionFile()
Return a reference to the file InteractionsFile.
Definition: DPMBase.cc:323
Definition: File.h:59
std::fstream & getFstream()
Allows to access the member variable File::fstream_.
Definition: File.cc:131
FileType getFileType() const
Gets the file type e.g. NOFILE, ONEFILE and MULTIPLE FILES. File::fileType_.
Definition: File.cc:185

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.

64  {};

Referenced by InteractionHandler::eraseOldInteractions().

◆ addForce()

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

598 {
599  torque_ += torque;
600 }

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

676 {}

◆ 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.
323 {
324  //Copy the interaction of ghost
325  BaseInteraction* C = copy();
326  //Finds out which of P and I is that the particle from whom the ghost is begin created.
327  //The object being interacted with is set to P
328  if (C->getP() == original)
329  {
330  //Reverse some force history
331  C->reverseHistory();
332  //Set the P to the original particle
333  C->P_ = C->getI();
334  }
335  //The new ghost particle is set to I in the interaction.
336  C->I_ = ghost;
337 
338  //Add the the interaction to both original and the ghost
339  handler_->addObject(C);
340 }
Stores information about interactions between two interactable objects; often particles but could be ...
Definition: BaseInteraction.h:39
virtual BaseInteraction * copy() const =0
Makes a copy of the interaction and returns a pointer to the copy.
InteractionHandler * handler_
Definition: BaseInteraction.h:480
void addObject(BaseInteraction *I) override
Adds an Interaction to the InteractionHandler.
Definition: InteractionHandler.cc:67
Definition: matrices.h:74

References InteractionHandler::addObject(), copy(), and handler_.

Referenced by BaseInteractable::copyInteractionsForPeriodicParticles().

◆ createMPIInteractionDataArray()

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

Reimplemented in Interaction< NormalForceInteraction, FrictionForceInteraction, AdhesiveForceInteraction >.

895 {
896  logger(ERROR, "BaseInteraction::createMPIInteractionDataArray should never be called");
897  return nullptr;
898 }
@ 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 >.

901 {
902  logger(WARN, "Why on earth is this function called?");
903 }
@ 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
809 {
810  auto* IParticle = dynamic_cast<BaseParticle*>(I_);
811  auto* PParticle = static_cast<BaseParticle*>(P_);
812 
813  Vec3D tangentialForce = getTangentialForce();
814  Mdouble tangentialOverlap = getTangentialOverlap();
815 
816  Mdouble scalarNormalForce = Vec3D::dot(force_, getNormal());
817  Mdouble scalarTangentialForce = tangentialForce.getLength();
818  Vec3D tangential;
819  if (scalarTangentialForce != 0.0)
820  tangential = tangentialForce / scalarTangentialForce;
821  else
822  tangential = Vec3D(0.0, 0.0, 0.0);
823 
826  Vec3D centre;
827  if (IParticle != nullptr)
828  centre = getP()->getPosition() - normal_ * (PParticle->getRadius() + IParticle->getRadius() - overlap_) / 2.0;
829  else
830  centre = getP()->getPosition() - normal_ * (PParticle->getRadius() - overlap_);
831 
832  if (!PParticle->isFixed())
833  {
835  P_->getIndex(),
836  static_cast<int>((IParticle == nullptr ? (-I_->getIndex() - 1) : I_->getIndex())),
837  centre,
838  getOverlap(),
839  tangentialOverlap,
840  scalarNormalForce,
841  scalarTangentialForce,
842  (IParticle == nullptr ? -normal_ : normal_),
843  (IParticle == nullptr ? -tangential : tangential));
844  }
845  if (IParticle != nullptr && !IParticle->isFixed() && IParticle->getPeriodicFromParticle() == nullptr)
846  {
848  I_->getIndex(),
849  static_cast<int>(P_->getIndex()),
850  centre,
851  getOverlap(),
852  tangentialOverlap,
853  scalarNormalForce,
854  scalarTangentialForce,
855  -normal_,
856  -tangential);
857 
858  }
859 }
const Vec3D & getPosition() const
Returns the position of this BaseInteractable.
Definition: BaseInteractable.h:197
const Vec3D & getNormal() const
Gets the normal vector between the two interacting objects.
Definition: BaseInteraction.h:205
virtual Mdouble getTangentialOverlap() const
get the length of the current tangential overlap
Definition: BaseInteraction.cc:532
virtual const Vec3D getTangentialForce() const
Definition: BaseInteraction.cc:544
BaseInteractable * getP()
Returns a pointer to first object involved in the interaction (normally a particle).
Definition: BaseInteraction.h:253
Mdouble getOverlap() const
Returns a Mdouble with the current overlap between the two interacting objects.
Definition: BaseInteraction.h:219
unsigned int getIndex() const
Returns the index of the object in the handler.
Definition: BaseObject.h:97
Definition: BaseParticle.h:33
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:1898
Definition: Kernel/Math/Vector.h:30
static Mdouble getLength(const Vec3D &a)
Calculates the length of a Vec3D: .
Definition: Vector.cc:350
static Mdouble dot(const Vec3D &a, const Vec3D &b)
Calculates the dot product of two Vec3D: .
Definition: Vector.cc:56

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.
578 {
579  return absoluteNormalForce_;
580 }
Mdouble absoluteNormalForce_
Definition: BaseInteraction.h:516

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.
664 {
665  return species_;
666 }

References species_.

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

◆ getContactPoint()

◆ 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.
348 {
349  return getOverlap() < 0.0 ? 0.0 : sqrt(2.0 * getEffectiveRadius() * getOverlap());
350 }
AnnoyingScalar sqrt(const AnnoyingScalar &x)
Definition: AnnoyingScalar.h:134
Mdouble getEffectiveRadius() const
Returns a Mdouble to the effective radius of the interaction. (Not corrected for the overlap)
Definition: BaseInteraction.cc:774

References getEffectiveRadius(), getOverlap(), and sqrt().

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.

454 {
455  //works even in periodic systems becuase contact point is defined on the P-side
456  return getP()->getPosition() - getContactPoint();
457 }
const Vec3D & getContactPoint() const
Gets constant reference to contact point (vector).
Definition: BaseInteraction.h:213

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

◆ getDistance()

Mdouble BaseInteraction::getDistance ( ) const

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

521 {
522  return distance_;
523 }
Mdouble distance_
Definition: BaseInteraction.h:521

References distance_.

Referenced by MeltableInteraction::computeNormalForce(), getIC(), getIP(), and main().

◆ 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.
793 {
794  Mdouble invEffectiveMass = getP()->getInvMass() + getI()->getInvMass();
795  logger.assert_debug(invEffectiveMass > 0,
796  "getEffectiveMass(): interaction % at % has infinite effective mass", getId(),
797  getContactPoint());
798  return 1.0 / invEffectiveMass;
799 }
virtual Mdouble getInvMass() const
Definition: BaseInteractable.h:387
BaseInteractable * getI()
Returns a pointer to the second object involved in the interaction (often a wall or a particle).
Definition: BaseInteraction.h:264
unsigned int getId() const
Returns the unique identifier of any particular object.
Definition: BaseObject.h:104

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

Referenced by FrictionInteraction::computeFrictionForce(), MindlinInteraction::computeFrictionForce(), SlidingFrictionInteraction::computeFrictionForce(), HertzianViscoelasticInteraction::computeNormalForce(), LinearPlasticViscoelasticInteraction::computeNormalForce(), LinearViscoelasticInteraction::computeNormalForce(), MeltableInteraction::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.
775 {
776  Mdouble invEffectiveRadius = getP()->getCurvature(contactPoint_) + getI()->getCurvature(contactPoint_);
777  logger.assert_debug(invEffectiveRadius > 0,
778  "getEffectiveRadius(): interaction % at % has infinite effective radius", getId(),
779  getContactPoint());
780  return 1.0 / invEffectiveRadius;
781 }
virtual Mdouble getCurvature(const Vec3D &labFixedCoordinates) const
Definition: BaseInteractable.h:393

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

Referenced by MeltableInteraction::actionsAfterTimeStep(), JKRAdhesiveInteraction::computeAdhesionForce(), LiquidBridgeBagheriInteraction::computeAdhesionForce(), LiquidBridgeClassicalWilletInteraction::computeAdhesionForce(), LiquidBridgeWilletInteraction::computeAdhesionForce(), LiquidMigrationLSInteraction::computeAdhesionForce(), LiquidMigrationWilletInteraction::computeAdhesionForce(), LiquidMigrationWilletViscousInteraction::computeAdhesionForce(), ParhamiMcMeekingSinterInteraction::computeAdhesionForce(), FrictionInteraction::computeFrictionForce(), MindlinInteraction::computeFrictionForce(), MindlinRollingTorsionInteraction::computeFrictionForce(), HertzianBSHPViscoelasticInteraction::computeNormalForce(), HertzianViscoelasticInteraction::computeNormalForce(), LinearPlasticViscoelasticInteraction::computeNormalForce(), MeltableInteraction::computeNormalForce(), SinterInteraction::computeNormalForce(), SinterLinInteraction::computeNormalForce(), HertzianSinterInteraction::computeSinterForce(), getContactRadius(), HertzianViscoelasticInteraction::getElasticEnergy(), HertzianViscoelasticInteraction::getElasticEnergyAtEquilibrium(), SinterInteraction::getFieldVTK(), LiquidMigrationWilletViscousInteraction::getLimitingDistance(), HertzianSinterInteraction::getUnloadingModulus(), LinearPlasticViscoelasticInteraction::getUnloadingStiffness(), SinterInteraction::getUnloadingStiffness(), and SinterLinInteraction::getUnloadingStiffness().

◆ getElasticEnergy()

◆ getElasticEnergyAtEquilibrium()

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

◆ getFieldVTK()

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

Reimplemented in SinterInteraction, SolidifyingLiquidMigrationWilletInteraction, LiquidMigrationWilletInteraction, and LiquidMigrationLSInteraction.

877 {
878  return std::vector<Mdouble>();
879 }

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

References force_.

Referenced by MercuryProblem::actionsAfterTimeStep(), BondedInteraction::bondInPlace(), SolidifyingLiquidMigrationWilletInteraction::bondInPlace(), MPIInteraction< NormalForceInteraction, FrictionForceInteraction, AdhesiveForceInteraction >::copyFromInteraction(), 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.
265  {
266  logger.assert_debug(I_ != nullptr, "Second particle in interaction % is nullptr", getId());
267  return I_;
268  }

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

Referenced by MeltableInteraction::actionsAfterTimeStep(), ChargedBondedInteraction::computeAdhesionForce(), FrictionInteraction::computeFrictionForce(), MindlinRollingTorsionInteraction::computeFrictionForce(), HertzianBSHPViscoelasticInteraction::computeNormalForce(), HertzianViscoelasticInteraction::computeNormalForce(), LinearPlasticViscoelasticInteraction::computeNormalForce(), LinearViscoelasticInteraction::computeNormalForce(), MeltableInteraction::computeNormalForce(), SinterInteraction::computeNormalForce(), SinterLinInteraction::computeNormalForce(), SPHInteraction::computeNormalForce(), HertzianSinterInteraction::computeSinterForce(), MPIInteraction< NormalForceInteraction, FrictionForceInteraction, AdhesiveForceInteraction >::copyFromInteraction(), LiquidMigrationLSInteraction::form(), LiquidMigrationWilletInteraction::form(), getEffectiveMass(), getEffectiveRadius(), ChargedBondedInteraction::getElasticEnergy(), MeltableInteraction::getOverlapGrowthRate(), 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.
288  {
289  logger.assert_debug(I_ != nullptr, "Second particle in interaction % is nullptr", getId());
290  return I_;
291  }

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
448 {
450  return getNormal() * getDistance() + getContactPoint() - getP()->getPosition();
451 }
Mdouble getDistance() const
Returns an Mdouble which is the norm (length) of distance vector.
Definition: BaseInteraction.cc:520

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

◆ getIdentificationI()

int BaseInteraction::getIdentificationI ( )
929 {
930  return identificationI_;
931 }
int identificationI_
Definition: BaseInteraction.h:495

References identificationI_.

◆ getIdentificationP()

unsigned int BaseInteraction::getIdentificationP ( )
924 {
925  return identificationP_;
926 }
unsigned int identificationP_
Definition: BaseInteraction.h:494

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

908 {
909  logger(ERROR, "Something went wrong, this function should not be called");
910 }

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.

441 {
442  //needs to be done by normal and distance or it fails in periodic systems
443  //return getP()->getPosition() - getI()->getPosition();
444  return getNormal() * getDistance();
445 }

References getDistance(), and getNormal().

◆ getLagrangeMultiplier()

Mdouble BaseInteraction::getLagrangeMultiplier ( )
inline
170  {
171  return lagrangeMultiplier_;
172  }

References lagrangeMultiplier_.

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

887 {
888 }

◆ getMultiContactIdentifier()

unsigned int BaseInteraction::getMultiContactIdentifier ( ) const
745 {
747 }
unsigned multiContactIdentifier_
Definition: BaseInteraction.h:562

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

183 {
184  return "BaseInteraction";
185 }

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

References normal_.

Referenced by BondedInteraction::computeAdhesionForce(), ChargedBondedInteraction::computeAdhesionForce(), IrreversibleAdhesiveInteraction::computeAdhesionForce(), JKRAdhesiveInteraction::computeAdhesionForce(), LiquidBridgeBagheriInteraction::computeAdhesionForce(), LiquidBridgeClassicalWilletInteraction::computeAdhesionForce(), LiquidBridgeWilletInteraction::computeAdhesionForce(), LiquidMigrationLSInteraction::computeAdhesionForce(), LiquidMigrationWilletInteraction::computeAdhesionForce(), LiquidMigrationWilletViscousInteraction::computeAdhesionForce(), ParhamiMcMeekingSinterInteraction::computeAdhesionForce(), ReversibleAdhesiveInteraction::computeAdhesionForce(), SolidifyingLiquidMigrationWilletInteraction::computeAdhesionForce(), FrictionInteraction::computeFrictionForce(), MindlinInteraction::computeFrictionForce(), MindlinRollingTorsionInteraction::computeFrictionForce(), SlidingFrictionInteraction::computeFrictionForce(), HertzianBSHPViscoelasticInteraction::computeNormalForce(), HertzianViscoelasticInteraction::computeNormalForce(), LinearPlasticViscoelasticInteraction::computeNormalForce(), LinearViscoelasticInteraction::computeNormalForce(), MeltableInteraction::computeNormalForce(), SinterInteraction::computeNormalForce(), SinterLinInteraction::computeNormalForce(), SPHInteraction::computeNormalForce(), HertzianSinterInteraction::computeSinterForce(), SlidingFrictionInteraction::computeSlidingSpring(), gatherContactStatistics(), getIC(), getIP(), MeltableInteraction::getOverlapGrowthRate(), FrictionInteraction::integrate(), MindlinRollingTorsionInteraction::integrate(), setFStatData(), and writeToFStat().

◆ getNormalRelativeVelocity()

◆ getNumberOfFieldsVTK()

unsigned BaseInteraction::getNumberOfFieldsVTK ( ) const
virtual

◆ getOverlap()

Mdouble BaseInteraction::getOverlap ( ) const
inline

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

220  { return overlap_; }

References overlap_.

Referenced by LiquidMigrationLSInteraction::actionsAfterTimeStep(), LiquidMigrationWilletInteraction::actionsAfterTimeStep(), MeltableInteraction::actionsAfterTimeStep(), ConstantRestitutionSelfTest::actionsBeforeTimeStep(), BondedInteraction::computeAdhesionForce(), ChargedBondedInteraction::computeAdhesionForce(), IrreversibleAdhesiveInteraction::computeAdhesionForce(), JKRAdhesiveInteraction::computeAdhesionForce(), LiquidBridgeBagheriInteraction::computeAdhesionForce(), LiquidBridgeClassicalWilletInteraction::computeAdhesionForce(), LiquidBridgeWilletInteraction::computeAdhesionForce(), LiquidMigrationLSInteraction::computeAdhesionForce(), LiquidMigrationWilletInteraction::computeAdhesionForce(), LiquidMigrationWilletViscousInteraction::computeAdhesionForce(), ParhamiMcMeekingSinterInteraction::computeAdhesionForce(), ReversibleAdhesiveInteraction::computeAdhesionForce(), HertzianBSHPViscoelasticInteraction::computeNormalForce(), HertzianViscoelasticInteraction::computeNormalForce(), LinearPlasticViscoelasticInteraction::computeNormalForce(), LinearViscoelasticInteraction::computeNormalForce(), MeltableInteraction::computeNormalForce(), SinterInteraction::computeNormalForce(), SinterLinInteraction::computeNormalForce(), SPHInteraction::computeNormalForce(), HertzianSinterInteraction::computeSinterForce(), gatherContactStatistics(), getContactRadius(), BondedInteraction::getElasticEnergy(), ChargedBondedInteraction::getElasticEnergy(), IrreversibleAdhesiveInteraction::getElasticEnergy(), SolidifyingLiquidMigrationWilletInteraction::getElasticEnergy(), HertzianSinterInteraction::getElasticEnergy(), HertzianViscoelasticInteraction::getElasticEnergy(), LinearPlasticViscoelasticInteraction::getElasticEnergy(), LinearViscoelasticInteraction::getElasticEnergy(), SinterInteraction::getElasticEnergy(), SinterLinInteraction::getElasticEnergy(), SPHInteraction::getElasticEnergy(), getOverlapVolume(), HertzianSinterInteraction::getUnloadingModulus(), LinearPlasticViscoelasticInteraction::getUnloadingStiffness(), SinterInteraction::getUnloadingStiffness(), SinterLinInteraction::getUnloadingStiffness(), main(), setFStatData(), 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
258 {
259  //logger(WARN,"This function is only tested for spheres and (may) give the wrong answer for other objects");
260  //First get overlap and radii of each object
262  Mdouble curvatureParticle = getP()->getCurvature(getP()->getPosition());
263  Mdouble curvatureInteractable = getI()->getCurvature(getI()->getPosition());
264 
265  if (curvatureInteractable == 0)
266  {
267  logger(WARN, "This function is not implemented for walls yet and will return 0");
268  return 0;
269  }
270  else
271  {
272  Mdouble r1 = 1.0 / curvatureInteractable;
273  Mdouble r2 = 1.0 / curvatureParticle;
274 
275  if (delta > 2.0 * r1 || delta > 2.0 * r2)
276  logger(WARN,
277  "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.");
278 
279  //Eq (2.1) - see doc
280 // logger(WARN,"Radius of first object % and second object %",r1,r2);
281  Mdouble t1 = (r2 - delta / 2.0) / (r1 + r2 - delta) * delta;
282  //Eq (2.2) - see doc
283  Mdouble t2 = (r1 - delta / 2.0) / (r1 + r2 - delta) * delta;
284 
285  //Eq (2.3) - see doc
286  Mdouble V = constants::pi * (
287  std::pow(t1, 2.0) * r1
288  - std::pow(t1, 3.0) / 3.0
289  + std::pow(t2, 2.0) * r2
290  - std::pow(t2, 3.0) / 3.0
291  );
292 
293  return V;
294  }
295 
296  return 0;
297 }
MatrixXcd V
Definition: EigenSolver_EigenSolver_MatrixType.cpp:15
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC bfloat16 pow(const bfloat16 &a, const bfloat16 &b)
Definition: BFloat16.h:625
int delta
Definition: MultiOpt.py:96
const Mdouble pi
Definition: ExtendedMath.h:23

References MultiOpt::delta, BaseInteractable::getCurvature(), getI(), getOverlap(), getP(), logger, constants::pi, Eigen::bfloat16_impl::pow(), V, 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.
254  {
255  logger.assert_debug(P_ != nullptr, "First particle in interaction % is nullptr", getId());
256  return P_;
257  }

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

Referenced by MeltableInteraction::actionsAfterTimeStep(), ChargedBondedInteraction::computeAdhesionForce(), FrictionInteraction::computeFrictionForce(), MindlinRollingTorsionInteraction::computeFrictionForce(), HertzianBSHPViscoelasticInteraction::computeNormalForce(), HertzianViscoelasticInteraction::computeNormalForce(), LinearPlasticViscoelasticInteraction::computeNormalForce(), LinearViscoelasticInteraction::computeNormalForce(), MeltableInteraction::computeNormalForce(), SinterInteraction::computeNormalForce(), SinterLinInteraction::computeNormalForce(), SPHInteraction::computeNormalForce(), HertzianSinterInteraction::computeSinterForce(), MPIInteraction< NormalForceInteraction, FrictionForceInteraction, AdhesiveForceInteraction >::copyFromInteraction(), LiquidMigrationLSInteraction::form(), LiquidMigrationWilletInteraction::form(), gatherContactStatistics(), getCP(), getEffectiveMass(), getEffectiveRadius(), ChargedBondedInteraction::getElasticEnergy(), getIC(), MeltableInteraction::getOverlapGrowthRate(), getOverlapVolume(), 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.
277  {
278  logger.assert_debug(P_ != nullptr, "First particle in interaction % is nullptr", getId());
279  return P_;
280  }

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

◆ getRelativeVelocity()

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

545 {
546  return Vec3D(0.0, 0.0, 0.0);
547 }

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.

533 {
534  return 0;
535 }

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.
299  { 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.
198  { 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.
433 {
434  I_->removeInteraction(this);
435  I_ = I;
436  I_->addInteraction(this);
438 }
void addInteraction(BaseInteraction *I)
Adds an interaction to this BaseInteractable.
Definition: BaseInteractable.cc:270

References BaseInteractable::addInteraction(), BaseObject::getId(), I, 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.
401 {
402  P_->removeInteraction(this);
403  P_ = P;
404  P_->addInteraction(this);
406 }

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

360 {
361 
362 }

◆ isBonded()

virtual bool BaseInteraction::isBonded ( ) const
inlinevirtual

Reimplemented in ChargedBondedInteraction, and BondedInteraction.

472 {return false;}

Referenced by writeToFStat().

◆ isWallInteraction()

bool BaseInteraction::isWallInteraction ( )
939 {
940  return isWallInteraction_;
941 }
bool isWallInteraction_
Definition: BaseInteraction.h:496

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

166 {
167  //the rest gets read by the interaction handler
168  std::string dummy;
169  helpers::readOptionalVariable(is, "contactPoint", contactPoint_);
170  helpers::readOptionalVariable(is, "normal", normal_);
171  helpers::readOptionalVariable(is, "distance", distance_);
172  helpers::readOptionalVariable(is, "overlap", overlap_);
173  is >> dummy >> force_;
174  is >> dummy >> torque_;
175 }
bool readOptionalVariable(std::istream &is, const std::string &name, T &variable)
Reads optional variables in the restart file.
Definition: FileIOHelpers.h:68
std::string string(const unsigned &i)
Definition: oomph_definitions.cc:286

References contactPoint_, distance_, force_, normal_, overlap_, helpers::readOptionalVariable(), oomph::Global_string_for_annotation::string(), and torque_.

Referenced by HertzianSinterInteraction::read(), HertzianViscoelasticInteraction::read(), LinearPlasticViscoelasticInteraction::read(), LinearViscoelasticInteraction::read(), MeltableInteraction::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.

304 {
306 }
virtual void removeObject(unsigned const int index)
Removes an Object from the BaseHandler.
Definition: BaseHandler.h:453

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

700 {
701 }

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

756 {
757  contactPoint_ = rotationMatrix * contactPoint_;
758  relativeVelocity_ = rotationMatrix * relativeVelocity_;
759  force_ = rotationMatrix * force_;
760  torque_ = rotationMatrix * torque_;
761  normal_ = rotationMatrix * normal_;
763 }

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

◆ setAbsoluteNormalForce()

void BaseInteraction::setAbsoluteNormalForce ( Mdouble  absoluteNormalForce)
protected

◆ 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?
946 {
947  this->setIdentificationP(P);
948  this->setIdentificationI(I);
949  this->setTimeStamp(timeStamp);
950  this->setForce(force);
951  this->setTorque(torque);
952  this->setWallInteraction(isWallInteraction);
953  if (resetPointers)
954  {
955  this->I_ = nullptr;
956  this->P_ = nullptr;
957  }
958 }
void setIdentificationP(unsigned int identification)
Definition: BaseInteraction.cc:913
void setTimeStamp(unsigned timeStamp)
Updates the time step of the interacting. Note, time steps used to find completed interactions.
Definition: BaseInteraction.cc:231
void setWallInteraction(bool flag)
Definition: BaseInteraction.cc:933
void setIdentificationI(int identification)
Definition: BaseInteraction.cc:918
void setForce(Vec3D force)
set total force (this is used by the normal force, tangential forces are added use addForce)
Definition: BaseInteraction.cc:608
void setTorque(Vec3D torque)
set the total force (this is used by the normal force, tangential torques are added use addTorque)
Definition: BaseInteraction.cc:619

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

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

◆ setContactPoint()

void BaseInteraction::setContactPoint ( Vec3D  contactPoint)

Set the location of the contact point between the two interacting objects.

221 {
222  contactPoint_ = contactPoint;
223 }

References contactPoint_.

Referenced by setFStatData().

◆ 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.
202 {
203  distance_ = distance;
204 }

References distance_.

Referenced by 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.

609 {
610  force_ = force;
611 }

References force_.

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

◆ setFStatData() [1/2]

void BaseInteraction::setFStatData ( std::fstream &  fstat,
BaseParticle P,
BaseParticle I 
)
962 {
963  Mdouble overlap, tangentialOverlap, scalarNormalForce, scalarTangentialForce;
964  Vec3D centre, normal, tangential;
965  fstat >> centre >> overlap >> tangentialOverlap >> scalarNormalForce >> scalarTangentialForce >> normal
966  >> tangential;
967  const Vec3D force = scalarNormalForce * normal + scalarTangentialForce * tangential;
968  setForce(force);
969  setNormal(normal);
970  setOverlap(overlap);
971  const Mdouble radius = P->getRadius();
972  const Vec3D branch = (radius - 0.5 * getOverlap()) * getNormal();
973  setContactPoint(P->getPosition() - branch);
974  setDistance(radius + I->getRadius() - getOverlap());
975 }
void setDistance(Mdouble distance)
Sets the interaction distance between the two interacting objects.
Definition: BaseInteraction.cc:201
void setContactPoint(Vec3D contactPoint)
Set the location of the contact point between the two interacting objects.
Definition: BaseInteraction.cc:220
void setNormal(Vec3D normal)
Sets the normal vector between the two interacting objects.
Definition: BaseInteraction.cc:192
void setOverlap(Mdouble overlap)
Set the overlap between the two interacting object.
Definition: BaseInteraction.cc:211
radius
Definition: UniformPSDSelfTest.py:15
void normal(const Vector< double > &x, Vector< double > &normal)
Definition: free_surface_rotation.cc:65

References getNormal(), getOverlap(), I, WallFunction::normal(), Global_Physical_Variables::P, UniformPSDSelfTest::radius, setContactPoint(), setDistance(), setForce(), setNormal(), and setOverlap().

◆ setFStatData() [2/2]

void BaseInteraction::setFStatData ( std::fstream &  fstat,
BaseParticle P,
BaseWall I 
)
978 {
979  Mdouble overlap, tangentialOverlap, scalarNormalForce, scalarTangentialForce;
980  Vec3D centre, normal, tangential;
981  fstat >> centre >> overlap >> tangentialOverlap >> scalarNormalForce >> scalarTangentialForce >> normal
982  >> tangential;
983  const Vec3D force = scalarNormalForce * normal + scalarTangentialForce * tangential;
984  //note walls are defined different than particles (with an extra minus)
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);
992 }

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

◆ 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.
242 {
243  handler_ = handler;
244 }

References handler_.

◆ 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.
417 {
418  I_->removeInteraction(this);
419  I_ = I;
420  I_->addInteraction(this);
422 }

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

Referenced by InteractionHandler::removeObjectKeepingPeriodics().

◆ setIdentificationI()

void BaseInteraction::setIdentificationI ( int  identification)
919 {
920  identificationI_ = identification;
921 }

References identificationI_.

Referenced by setBasicMPIInteractionValues().

◆ setIdentificationP()

void BaseInteraction::setIdentificationP ( unsigned int  identification)
914 {
915  identificationP_ = identification;
916 }

References identificationP_.

Referenced by setBasicMPIInteractionValues().

◆ setLagrangeMultiplier()

void BaseInteraction::setLagrangeMultiplier ( Mdouble  multiplier)
inline
165  {
167  }
double multiplier(const Vector< double > &xi)
Definition: disk_oscillation.cc:63

References lagrangeMultiplier_, and Global_Physical_Variables::multiplier().

◆ setMPIInteraction()

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

◆ setMultiContactIdentifier()

void BaseInteraction::setMultiContactIdentifier ( unsigned int  multiContactIdentifier_)
750 {
751  multiContactIdentifier_ = multiContactIdentifier;
752 }

References multiContactIdentifier_.

◆ 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.
193 {
194  normal_ = normal;
195 }

References WallFunction::normal(), and normal_.

Referenced by 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.
642 {
643  normalRelativeVelocity_ = normalRelativeVelocity;
644 }

References normalRelativeVelocity_.

Referenced by HertzianBSHPViscoelasticInteraction::computeNormalForce(), HertzianViscoelasticInteraction::computeNormalForce(), LinearPlasticViscoelasticInteraction::computeNormalForce(), LinearViscoelasticInteraction::computeNormalForce(), MeltableInteraction::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.
212 {
213  overlap_ = overlap;
214 }

References overlap_.

Referenced by 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.
385 {
386  P_->removeInteraction(this);
387  P_ = P;
388  P_->addInteraction(this);
390 }

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.
631 {
632  relativeVelocity_ = relativeVelocity;
633 }

References relativeVelocity_.

Referenced by HertzianBSHPViscoelasticInteraction::computeNormalForce(), HertzianViscoelasticInteraction::computeNormalForce(), LinearPlasticViscoelasticInteraction::computeNormalForce(), LinearViscoelasticInteraction::computeNormalForce(), MeltableInteraction::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.
372 {
373  species_ = species;
374 }

References species_.

◆ 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.
232 {
233  timeStamp_ = timeStamp;
234 }

References timeStamp_.

Referenced by 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.

620 {
621  torque_ = torque;
622 }

References torque_.

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

◆ setWallInteraction()

void BaseInteraction::setWallInteraction ( bool  flag)
934 {
935  isWallInteraction_ = flag;
936 }

References isWallInteraction_.

Referenced by setBasicMPIInteractionValues().

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

138 {
139  os << getName();
140  if (dynamic_cast<BaseParticle*>(I_) != nullptr)
141  {
142  os << " particleIds " << P_->getId() << " " << I_->getId();
144  }
145  else
146  {
147  os << " particleWallIds " << P_->getId() << " " << I_->getId();
148  }
149  os << " timeStamp " << timeStamp_;
150  os << " contactPoint " << contactPoint_;
151  os << " normal " << normal_;
152  os << " distance " << distance_;
153  os << " overlap " << overlap_;
154  os << " force " << force_;
155  os << " torque " << torque_;
156 }
std::string getName() const override
Virtual function which allows interactions to be named.
Definition: BaseInteraction.cc:182

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

Referenced by HertzianSinterInteraction::write(), HertzianViscoelasticInteraction::write(), LinearPlasticViscoelasticInteraction::write(), LinearViscoelasticInteraction::write(), MeltableInteraction::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.
711 {
712  if (created)
713  {
714  os << "started ";
715  }
716  else
717  {
718  os << "ended ";
719  }
720 
721  if (dynamic_cast<BaseParticle*>(I_) != nullptr)
722  {
723  os << " particleIds " << P_->getId() << " " << I_->getId() << " timeStamp ";
724  }
725  else
726  {
727  os << " particleWallIds " << P_->getId() << " " << I_->getId() << " timeStamp ";
728  }
729 
730  if (created)
731  {
732  os << timeStamp_;
733  }
734  else
735  {
736  os << P_->getSpecies()->getHandler()->getDPMBase()->getTime();
737  }
738 
739  os << std::endl;
740 
741 }
const ParticleSpecies * getSpecies() const
Returns a pointer to the species of this BaseInteractable.
Definition: BaseInteractable.h:87
SpeciesHandler * getHandler() const
Returns the pointer to the handler to which this species belongs.
Definition: BaseSpecies.cc:78
Mdouble getTime() const
Returns the current simulation time.
Definition: DPMBase.cc:799

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
469 {
471  auto* IParticle = dynamic_cast<BaseParticle*>(I_);
472  auto* PParticle = dynamic_cast<BaseParticle*>(P_);
473 
474  // do not write fstat output if the force is an internal bond
475  if (isBonded()) return;
476 
477  Vec3D tangentialForce = getTangentialForce();
478  Mdouble tangentialOverlap = getTangentialOverlap();
479 
480  Mdouble scalarNormalForce = Vec3D::dot(force_, getNormal());
481  Mdouble scalarTangentialForce = tangentialForce.getLength();
482  Vec3D tangential;
483  if (scalarTangentialForce != 0.0)
484  tangential = tangentialForce / scalarTangentialForce;
485  else
486  tangential = Vec3D(0.0, 0.0, 0.0);
487 
488  if (PParticle != nullptr && !PParticle->isFixed())
489  {
490  os << time << " " << P_->getIndex()
491  << " " << static_cast<int>((IParticle == nullptr ? (-I_->getIndex() - 1) : I_->getIndex()))
492  << " " << getContactPoint()
493  << " " << getOverlap()
494  << " " << tangentialOverlap
495  << " " << scalarNormalForce
496  << " " << scalarTangentialForce
497  << " " << (IParticle == nullptr ? -normal_ : normal_)
498  << " " << (IParticle == nullptr ? -tangential : tangential) << std::endl;
500  }
501  if (IParticle != nullptr && !IParticle->isFixed() && IParticle->getPeriodicFromParticle() == nullptr)
502  {
503  os << time << " " << I_->getIndex()
504  << " " << P_->getIndex()
505  << " " << getContactPoint()
506  << " " << getOverlap()
507  << " " << tangentialOverlap
508  << " " << scalarNormalForce
509  << " " << scalarTangentialForce
510  << " " << -normal_
511  << " " << -tangential << std::endl;
512  }
513 }
virtual bool isBonded() const
Definition: BaseInteraction.h:472

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

◆ 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(), 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(), read(), rotateHistory(), setNormal(), write(), 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(), read(), setOverlap(), and write().

◆ P_

BaseInteractable* BaseInteraction::P_
private

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

Referenced by BaseInteraction(), 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: