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

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

#include <BaseInteraction.h>

+ Inheritance diagram for BaseInteraction:

Public Member Functions

 BaseInteraction (BaseInteractable *P, BaseInteractable *I, Mdouble timeStamp)
 A constructor takes the BaseInteractable objects which are interacting (come into contact) and time the interaction starts. More...
 
 BaseInteraction (const BaseInteraction &p)
 Copy constructor. More...
 
 BaseInteraction ()
 Empty constructor. More...
 
virtual ~BaseInteraction ()
 The default destructor. More...
 
virtual void actionsOnErase ()
 If an interaction needs to do something before it gets erased, add it here. E.g. Liquid bridges rupture at the end of their lifetime, and the liquid bridge volume has to be redistributed. The reason this action is not done in the destructor is that this action should not be taken when erasing ghost interactions. More...
 
virtual void computeForce ()
 Virtual function that contains the force law between the two objects interacting. More...
 
virtual void read (std::istream &is)
 Interaction read function, which accepts an std::istream as input. More...
 
virtual void write (std::ostream &os) const
 Interaction print function, which accepts an std::ostream as input. More...
 
void writeToFStat (std::ostream &os) const
 Writes forces data to the FStat file. More...
 
virtual std::string getName () const
 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 (Mdouble timeStamp)
 Updates the time step of the interacting. Note, timesteps used to find completed interactions. More...
 
void setSpecies (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 setHandler (InteractionHandler *handler)
 Sets the pointer to the interaction hander which is storing this interaction. More...
 
InteractionHandlergetHandler () const
 Gets a point to the interaction handlers to which this interaction belongs. More...
 
const Vec3DgetForce () const
 Gets the current force (vector) between the two interacting objects. More...
 
const Vec3DgetTorque () const
 Gets the current torque (vector) between the two interacting objects. More...
 
const Vec3DgetNormal () const
 Gets the normal vector between the two interacting objects. More...
 
const Vec3DgetContactPoint () const
 Gets constant reference to contact point (vector). More...
 
Mdouble getOverlap () const
 Returns a Mdouble with the current overlap between the two interacting objects. More...
 
Mdouble getContactRadius () const
 Returns a Mdouble with the current contact between the two interacting objects. More...
 
void removeFromHandler ()
 Removes this interaction from its interaction hander. More...
 
void copySwitchPointer (const BaseInteractable *original, BaseInteractable *ghost) const
 This copies the interactions of the original particle and replaces the original with the ghost copy. More...
 
void gatherContactStatistics ()
 
BaseInteractablegetP ()
 Returns a pointer to first object involved in the interaction (normally a particle). More...
 
BaseInteractablegetI ()
 
const BaseInteractablegetP () const
 
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...
 
unsigned int getMultiContactIdentifier () const
 
void setMultiContactIdentifier (unsigned int multiContactIdentifier_)
 
virtual void rotateHistory (Matrix3D &rotationMatrix)
 When periodic particles are used, some interactions need certain history properties rotated (e.g. tangential springs). This is the function for that. More...
 
virtual void actionsAfterTimeStep ()
 
virtual unsigned getNumberOfFieldsVTK () const
 
virtual std::string getTypeVTK (unsigned i) const
 
virtual std::string getNameVTK (unsigned i) const
 
virtual std::vector< MdoublegetFieldVTK (unsigned i) const
 
void setForce (Vec3D force)
 set total force (this is used by the normal force, tangential forces are added use addForce) More...
 
- Public Member Functions inherited from BaseObject
 BaseObject ()
 Default constructor. More...
 
 BaseObject (const BaseObject &p)
 Copy constructor, copies all the objects BaseObject contains. More...
 
virtual ~BaseObject ()
 virtual destructor More...
 
virtual void moveInHandler (const unsigned int index)
 Except that it is virtual, it does the same thing as setIndex() does. More...
 
void setIndex (const unsigned int index)
 Allows one to assign an index to an object in the handler/container. More...
 
void setId (const unsigned int 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...
 

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...
 
Mdouble getEffectiveCorrectedRadius ()
 Returns a Mdouble to the effective radius corrected for the overlaps of the particles. More...
 
void addForce (Vec3D force)
 add an force increment to the total force. More...
 
void addTorque (Vec3D torque)
 
void setTorque (Vec3D torque)
 set the total force (this is used by the normal force, tangential torques are added use addTorque) More...
 
void setRelativeVelocity (Vec3D relativeVelocity)
 set the relative velocity of the current of the interactions. More...
 
void setNormalRelativeVelocity (Mdouble normalRelativeVelocit)
 set the normal component of the relative velocity. More...
 
void setAbsoluteNormalForce (Mdouble absoluteNormalForce)
 the absolute values of the norm (length) of the normal force More...
 
const BaseSpeciesgetBaseSpecies () const
 Return a constant point to BaseSpecies of the interaction. 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...
 

Private Attributes

InteractionHandlerhandler_
 
BaseInteractableP_
 
BaseInteractableI_
 
Vec3D contactPoint_
 
Vec3D relativeVelocity_
 
Mdouble normalRelativeVelocity_
 
Mdouble absoluteNormalForce_
 
Mdouble distance_
 
Vec3D force_
 
Vec3D torque_
 
Mdouble timeStamp_
 
Vec3D normal_
 
Mdouble overlap_
 
BaseSpeciesspecies_
 
unsigned multiContactIdentifier_
 

Detailed Description

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

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

Definition at line 52 of file BaseInteraction.h.

Constructor & Destructor Documentation

BaseInteraction::BaseInteraction ( BaseInteractable P,
BaseInteractable I,
Mdouble  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.

Definition at line 44 of file BaseInteraction.cc.

References BaseInteractable::addInteraction(), force_, I_, normal_, overlap_, P_, Vec3D::setZero(), species_, timeStamp_, and torque_.

45  : BaseObject()
46 {
47  P_ = P;
48  P->addInteraction(this);
49  I_ = I;
50  I->addInteraction(this);
51  normal_.setZero();
52  overlap_ = 0;
53  timeStamp_ = timeStamp;
54  species_ = 0;
55  force_.setZero();
56  torque_.setZero();
57 #ifdef DEBUG_CONSTRUCTOR
58  std::cout<<"BaseInteraction::BaseInteraction() finished"<<std::endl;
59 #endif
60 }
BaseInteractable * I_
void addInteraction(BaseInteraction *I)
Adds an interaction to this BaseInteractable.
BaseSpecies * species_
void setZero()
Sets all elements to zero.
Definition: Vector.cc:52
BaseInteractable * P_
BaseObject()
Default constructor.
Definition: BaseObject.cc:55
BaseInteraction::BaseInteraction ( const BaseInteraction p)

Copy constructor.

This an copy constructor for a BaseInteraction.

Parameters
[in]pBaseInteraction

Definition at line 66 of file BaseInteraction.cc.

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

67  : BaseObject(p)
68 {
69  P_ = p.P_;
70  I_ = p.I_;
71  normal_ = p.normal_;
72  overlap_ = p.overlap_;
73  force_ = p.force_;
74  torque_ = p.torque_;
75  species_ = p.species_;
77 }
BaseInteractable * I_
BaseSpecies * species_
BaseInteractable * P_
BaseObject()
Default constructor.
Definition: BaseObject.cc:55
BaseInteraction::BaseInteraction ( )

Empty constructor.

Empty interaction. Will be used for parallel in t

Definition at line 82 of file BaseInteraction.cc.

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

83  : BaseObject()
84 {
85  P_ = nullptr;
86  I_ = nullptr;
87  normal_.setZero();
88  overlap_ = 0;
89  timeStamp_ = 0;
90  species_ = 0;
91  force_.setZero();
92  torque_.setZero();
93 }
BaseInteractable * I_
BaseSpecies * species_
void setZero()
Sets all elements to zero.
Definition: Vector.cc:52
BaseInteractable * P_
BaseObject()
Default constructor.
Definition: BaseObject.cc:55
BaseInteraction::~BaseInteraction ( )
virtual

The default destructor.

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

Definition at line 99 of file BaseInteraction.cc.

References I_, P_, and BaseInteractable::removeInteraction().

100 {
101  P_->removeInteraction(this);
102  I_->removeInteraction(this);
103 }
BaseInteractable * I_
bool removeInteraction(BaseInteraction *I)
Removes an interaction from this BaseInteractable.
BaseInteractable * P_

Member Function Documentation

void BaseInteraction::actionsAfterTimeStep ( )
virtual

Reimplemented in LiquidMigrationWilletInteraction.

Definition at line 799 of file BaseInteraction.cc.

800 {
801 }
virtual void BaseInteraction::actionsOnErase ( )
inlinevirtual

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

Reimplemented in LiquidMigrationWilletInteraction.

Definition at line 76 of file BaseInteraction.h.

Referenced by InteractionHandler::eraseOldInteractions().

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

add an force increment to the total force.

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

Definition at line 569 of file BaseInteraction.cc.

References force_.

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

570 {
571  force_+=force;
572 }
void BaseInteraction::addTorque ( Vec3D  torque)
protected

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

Definition at line 579 of file BaseInteraction.cc.

References torque_.

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

580 {
581  torque_+=torque;
582 }
void BaseInteraction::computeForce ( )
virtual

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

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

Definition at line 657 of file BaseInteraction.cc.

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

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

Referenced by copySwitchPointer().

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

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

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

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

Definition at line 240 of file BaseInteraction.cc.

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

Referenced by BaseInteractable::copyInteractionsForPeriodicParticles().

241 {
242  //Copy the interaction of ghost
243  BaseInteraction* C = copy();
244  //Finds out which of P and I is that the particle from whom the ghost is begin created.
245  //The object being interacted with is set to P
246  if (C->getP() == original)
247  {
248  //Reverse some force history
249  C->reverseHistory();
250  //Set the P to the original particle
251  C->P_ =C->getI();
252  }
253  //The new ghost particle is set to I in the interaction.
254  C->I_ = ghost;
255 
256  //Add the the interaction to both original and the ghost
257  C->getP()->addInteraction(C);
258  C->getI()->addInteraction(C);
259  handler_->addObject(C);
260 }
BaseInteractable * I_
virtual BaseInteraction * copy() const =0
Makes a copy of the interaction and returns a pointer to the copy.
void addInteraction(BaseInteraction *I)
Adds an interaction to this BaseInteractable.
virtual void reverseHistory()
When periodic particles some interaction need certain history properties reversing. This is the function for that.
Stores information about interactions between two interactable objects; often particles but could be ...
BaseInteractable * P_
BaseInteractable * getI()
BaseInteractable * getP()
Returns a pointer to first object involved in the interaction (normally a particle).
void addObject(BaseInteraction *I)
Adds an Interaction to the InteractionHandler.
InteractionHandler * handler_
void BaseInteraction::gatherContactStatistics ( )
Todo:
Thomas please document this; as this is the area you are currently rewriting.
Todo:
Thomas please document.
Todo:
TW centre is used just for backward compatibility; replace centre by contact law; we also have to correct it in StatisticsVector::gatherContactStatistics. There also seems to be an issue with the normal being defined differently for walls

Definition at line 806 of file BaseInteraction.cc.

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

807 {
808  BaseParticle* IParticle = dynamic_cast<BaseParticle*>(I_);
809  BaseParticle* PParticle = dynamic_cast<BaseParticle*>(P_);
810 
811  Vec3D tangentialForce = getTangentialForce();
812  Mdouble tangentialOverlap = getTangentialOverlap();
813 
814  Mdouble scalarNormalForce = Vec3D::dot(force_, getNormal());
815  Mdouble scalarTangentialForce = tangentialForce.getLength();
816  Vec3D tangential;
817  if (scalarTangentialForce!=0.0)
818  tangential = tangentialForce/scalarTangentialForce;
819  else
820  tangential = Vec3D(0.0,0.0,0.0);
821 
824  Vec3D centre;
825  if (IParticle!=nullptr)
826  centre = getP()->getPosition() - normal_ * (PParticle->getRadius() + IParticle->getRadius() - overlap_)/2.0;
827  else
828  centre = getP()->getPosition() - normal_ * (PParticle->getRadius() - overlap_);
829 
830  if (PParticle!=nullptr && !PParticle->isFixed())
831  {
833  P_->getIndex(),
834  static_cast<int>((IParticle==0?(-I_->getIndex()-1):I_->getIndex())),
835  centre,
836  getOverlap(),
837  tangentialOverlap,
838  scalarNormalForce,
839  scalarTangentialForce,
840  (IParticle==0?-normal_:normal_),
841  (IParticle==0?-tangential:tangential));
842  }
843  if (IParticle!= nullptr && !IParticle->isFixed() && IParticle->getPeriodicFromParticle()==0)
844  {
846  I_->getIndex(),
847  static_cast<int>(P_->getIndex()),
848  centre,
849  getOverlap(),
850  tangentialOverlap,
851  scalarNormalForce,
852  scalarTangentialForce,
853  -normal_,
854  -tangential);
855 
856  }
857 }
BaseInteractable * I_
unsigned int getIndex() const
Returns the index of the object in the handler.
Definition: BaseObject.cc:108
virtual void gatherContactStatistics(unsigned int index1 UNUSED, int index2 UNUSED, Vec3D Contact UNUSED, Mdouble delta UNUSED, Mdouble ctheta UNUSED, Mdouble fdotn UNUSED, Mdouble fdott UNUSED, Vec3D P1_P2_normal_ UNUSED, Vec3D P1_P2_tangential UNUSED)
//Not unsigned index because of possible wall collisions.
Definition: DPMBase.cc:822
InteractionHandler * getHandler() const
Gets a point to the interaction handlers to which this interaction belongs.
double Mdouble
static Mdouble dot(const Vec3D &a, const Vec3D &b)
Calculates the dot product of two Vec3D: .
Definition: Vector.cc:167
const Vec3D & getPosition() const
Returns the position of this BaseInteractable.
static Mdouble getLength(const Vec3D &a)
Calculates the length of a Vec3D: .
Definition: Vector.cc:414
BaseInteractable * P_
const Vec3D & getNormal() const
Gets the normal vector between the two interacting objects.
virtual const Vec3D getTangentialForce() const
Mdouble getRadius() const
Returns the particle's radius_.
Mdouble getOverlap() const
Returns a Mdouble with the current overlap between the two interacting objects.
BaseInteractable * getP()
Returns a pointer to first object involved in the interaction (normally a particle).
Implementation of a 3D vector (by Vitaliy).
Definition: Vector.h:45
DPMBase * getDPMBase()
Gets the problem that is solved using this handler.
Definition: BaseHandler.h:543
virtual Mdouble getTangentialOverlap() const
get the length of the current tangential overlap
bool isFixed() const
Is fixed Particle function. It returns whether a Particle is fixed or not, by checking its inverse Ma...
Mdouble BaseInteraction::getAbsoluteNormalForce ( ) const

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

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

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

Definition at line 559 of file BaseInteraction.cc.

References absoluteNormalForce_.

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

560 {
561  return absoluteNormalForce_;
562 }
Mdouble absoluteNormalForce_
const Vec3D & BaseInteraction::getContactPoint ( ) const

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.

Definition at line 298 of file BaseInteraction.cc.

References contactPoint_.

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

299 {
300  return contactPoint_;
301 }
Mdouble BaseInteraction::getContactRadius ( ) const

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

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

Returns
Mdouble which is the value of the overlap.

Definition at line 318 of file BaseInteraction.cc.

References getEffectiveRadius(), and getOverlap().

319 {
320  return sqrt(2.0*getEffectiveRadius()*getOverlap());
321 }
Mdouble getEffectiveRadius() const
Returns a Mdouble to the effective radius of the interaction. (Not corrected for the overlap) ...
Mdouble getOverlap() const
Returns a Mdouble with the current overlap between the two interacting objects.
Mdouble BaseInteraction::getDistance ( ) const

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

Definition at line 502 of file BaseInteraction.cc.

References distance_.

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

503 {
504  return distance_;
505 }
Mdouble BaseInteraction::getEffectiveCorrectedRadius ( )
protected

Returns a Mdouble to the effective radius corrected for the overlaps of the particles.

Computes the effective corrected radius of a particle. This is used by some of the later interaction models. This correction is for the overlap. This functions assumes P is the particle and I is either a particle or a wall. See also BaseInteraction::getEffectiveCorrectedRadius()

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

Definition at line 777 of file BaseInteraction.cc.

References getI(), getOverlap(), getP(), and BaseParticle::getRadius().

778 {
779  BaseParticle* PParticle = dynamic_cast<BaseParticle*>(getP());
780  BaseParticle* IParticle = dynamic_cast<BaseParticle*>(getI());
781  if (PParticle==nullptr)
782  {
783  std::cerr << "BaseInteraction::getEffectiveCorrectedRadius(): first interactable P is not a particle" << std::endl;
784  exit(-1);
785  }
786  //Compute the reduced diameter
787  if (IParticle==nullptr) //if particle-wall
788  {
789  return PParticle->getRadius() - 0.5*getOverlap();
790  }
791  else
792  {
793  Mdouble radiusP = PParticle->getRadius() - 0.5*getOverlap();
794  Mdouble radiusI = IParticle->getRadius() - 0.5*getOverlap();
795  return radiusP * radiusI / (radiusP + radiusI);
796  }
797 }
double Mdouble
Mdouble getRadius() const
Returns the particle's radius_.
Mdouble getOverlap() const
Returns a Mdouble with the current overlap between the two interacting objects.
BaseInteractable * getI()
BaseInteractable * getP()
Returns a pointer to first object involved in the interaction (normally a particle).
Mdouble BaseInteraction::getEffectiveMass ( ) const
protected

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

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

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

Definition at line 746 of file BaseInteraction.cc.

References getI(), BaseParticle::getMass(), and getP().

Referenced by MindlinInteraction::computeFrictionForce().

747 {
748  const BaseParticle* PParticle = dynamic_cast<const BaseParticle*>(getP());
749  const BaseParticle* IParticle = dynamic_cast<const BaseParticle*>(getI());
750  if (PParticle==nullptr)
751  {
752  std::cerr << "BaseInteraction::getEffectiveCorrectedRadius(): first interactable P is not a particle" << std::endl;
753  exit(-1);
754  }
755  //Compute the reduced diameter
756  if (IParticle==nullptr) //if particle-wall
757  {
758  return PParticle->getMass();
759  }
760  else
761  {
762  Mdouble massP = PParticle->getMass();
763  Mdouble massI = IParticle->getMass();
764  return massP * massI / (massP + massI);
765  }
766 }
double Mdouble
Mdouble getMass() const
Returns the particle's mass_.
BaseInteractable * getI()
BaseInteractable * getP()
Returns a pointer to first object involved in the interaction (normally a particle).
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 a particle. This is used by many of the later interaction models. This functions assumes P is the particle and I is either a particle or a wall. Effective Radius = $R_I*R_P/(R_I+R_P)$ See also BaseInteraction::getEffectiveCorrectedRadius()

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

Definition at line 715 of file BaseInteraction.cc.

References getI(), getP(), and BaseParticle::getRadius().

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

716 {
717  const BaseParticle* PParticle = dynamic_cast<const BaseParticle*>(getP());
718  const BaseParticle* IParticle = dynamic_cast<const BaseParticle*>(getI());
719  if (PParticle==nullptr)
720  {
721  std::cerr << "BaseInteraction::getEffectiveCorrectedRadius(): first interactable P is not a particle" << std::endl;
722  exit(-1);
723  }
724  //Compute the reduced diameter
725  if (IParticle==nullptr) //if particle-wall
726  {
727  return PParticle->getRadius();
728  }
729  else
730  {
731  Mdouble radiusP = PParticle->getRadius();
732  Mdouble radiusI = IParticle->getRadius();
733  return radiusP * radiusI / (radiusP + radiusI);
734  }
735 }
double Mdouble
Mdouble getRadius() const
Returns the particle's radius_.
BaseInteractable * getI()
BaseInteractable * getP()
Returns a pointer to first object involved in the interaction (normally a particle).
Mdouble BaseInteraction::getElasticEnergy ( ) const
virtual

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

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

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

Definition at line 666 of file BaseInteraction.cc.

667 {
668  return 0.0;
669 }
virtual Mdouble BaseInteraction::getElasticEnergyAtEquilibrium ( Mdouble  adhesiveForce) const
inlineprotectedvirtual

Reimplemented in HertzianViscoelasticInteraction, and LinearViscoelasticInteraction.

Definition at line 350 of file BaseInteraction.h.

Referenced by ChargedBondedInteraction::getElasticEnergy().

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

Reimplemented in LiquidMigrationWilletInteraction, and SinterInteraction.

Definition at line 871 of file BaseInteraction.cc.

871  {
872  return std::vector<Mdouble>();
873 }
const Vec3D & BaseInteraction::getForce ( ) const

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

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

Returns
A reference to a Vec3D containing the total force.

Definition at line 267 of file BaseInteraction.cc.

References force_.

268 {
269  return force_;
270 }
InteractionHandler * BaseInteraction::getHandler ( ) const

Gets a point to the interaction handlers to which this interaction belongs.

Returns a pointer to the InteractionHandler that this interaction belongs.

Returns
Constant pointer to the InteractionHandler.

Definition at line 212 of file BaseInteraction.cc.

References handler_.

Referenced by SlidingFrictionInteraction::computeFrictionForce(), FrictionInteraction::computeFrictionForce(), MindlinInteraction::computeFrictionForce(), MindlinRollingTorsionInteraction::computeFrictionForce(), SinterInteraction::computeNormalForce(), HertzianSinterInteraction::computeSinterForce(), gatherContactStatistics(), and LiquidMigrationWilletInteraction::rupture().

213 {
214  return handler_;
215 }
InteractionHandler * handler_
const BaseInteractable * BaseInteraction::getI ( ) const

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

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

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

Definition at line 358 of file BaseInteraction.cc.

References I_.

359 {
360  return I_;
361 }
BaseInteractable * I_
unsigned int BaseInteraction::getMultiContactIdentifier ( ) const

Definition at line 685 of file BaseInteraction.cc.

References multiContactIdentifier_.

686 {
688 }
unsigned multiContactIdentifier_
std::string BaseInteraction::getName ( ) const
virtual

Virtual function which allows interactions to be named.

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

Implements BaseObject.

Definition at line 143 of file BaseInteraction.cc.

Referenced by write().

144 {
145  return "BaseInteraction";
146 }
std::string BaseInteraction::getNameVTK ( unsigned  i) const
virtual

Reimplemented in LiquidMigrationWilletInteraction, and SinterInteraction.

Definition at line 867 of file BaseInteraction.cc.

Referenced by InteractionHandler::writeVTK().

867  {
868  return "";
869 }
const Vec3D & BaseInteraction::getNormal ( ) const
Mdouble BaseInteraction::getNormalRelativeVelocity ( ) const

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

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

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

Definition at line 547 of file BaseInteraction.cc.

References normalRelativeVelocity_.

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

548 {
550 }
Mdouble normalRelativeVelocity_
unsigned BaseInteraction::getNumberOfFieldsVTK ( ) const
virtual

Reimplemented in LiquidMigrationWilletInteraction, and SinterInteraction.

Definition at line 859 of file BaseInteraction.cc.

Referenced by InteractionHandler::writeVTK().

859  {
860  return 0;
861 }
Mdouble BaseInteraction::getOverlap ( ) const

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

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

Returns
Mdouble which is the value of the overlap.

Definition at line 308 of file BaseInteraction.cc.

References overlap_.

Referenced by LiquidMigrationWilletInteraction::actionsAfterTimeStep(), ChargedBondedInteraction::computeAdhesionForce(), ParhamiMcMeekingSinterInteraction::computeAdhesionForce(), ReversibleAdhesiveInteraction::computeAdhesionForce(), LiquidBridgeWilletInteraction::computeAdhesionForce(), IrreversibleAdhesiveInteraction::computeAdhesionForce(), BondedInteraction::computeAdhesionForce(), LiquidMigrationWilletInteraction::computeAdhesionForce(), LinearPlasticViscoelasticInteraction::computeLinearPlasticViscoelasticForce(), HertzianViscoelasticInteraction::computeNormalForce(), SinterInteraction::computeNormalForce(), LinearViscoelasticInteraction::computeNormalForce(), HertzianSinterInteraction::computeSinterForce(), gatherContactStatistics(), getContactRadius(), getEffectiveCorrectedRadius(), ChargedBondedInteraction::getElasticEnergy(), HertzianSinterInteraction::getElasticEnergy(), SinterInteraction::getElasticEnergy(), LinearViscoelasticInteraction::getElasticEnergy(), HertzianViscoelasticInteraction::getElasticEnergy(), LinearPlasticViscoelasticInteraction::getElasticEnergy(), IrreversibleAdhesiveInteraction::getElasticEnergy(), BondedInteraction::getElasticEnergy(), BaseWall::getInteractionWith(), BaseParticle::getInteractionWith(), HertzianSinterInteraction::getUnloadingModulus(), SinterInteraction::getUnloadingStiffness(), LinearPlasticViscoelasticInteraction::getUnloadingStiffness(), MindlinInteraction::updateTangentialStiffnessZero(), and writeToFStat().

309 {
310  return overlap_;
311 }
const BaseInteractable * BaseInteraction::getP ( ) const

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

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

Definition at line 348 of file BaseInteraction.cc.

References P_.

349 {
350  return P_;
351 }
BaseInteractable * P_
const Vec3D & BaseInteraction::getRelativeVelocity ( ) const

Returns a constant reference to a vector of relative velocity.

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

Returns
A reference to Vec3D that contains the relative velocity.

Definition at line 536 of file BaseInteraction.cc.

References relativeVelocity_.

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

537 {
538  return relativeVelocity_;
539 }
const Vec3D BaseInteraction::getTangentialForce ( ) const
protectedvirtual

Returns a constant vector to the Tangential Force

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

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

Reimplemented in EmptyFrictionInteraction, MindlinInteraction, and SlidingFrictionInteraction.

Definition at line 526 of file BaseInteraction.cc.

Referenced by gatherContactStatistics(), and writeToFStat().

527 {
528  return Vec3D(0.0,0.0,0.0);
529 }
Implementation of a 3D vector (by Vitaliy).
Definition: Vector.h:45
Mdouble BaseInteraction::getTangentialOverlap ( ) const
virtual

get the length of the current tangential overlap

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

Returns
Positive Mdouble that is the tangential overlap.

Reimplemented in EmptyFrictionInteraction, MindlinInteraction, and SlidingFrictionInteraction.

Definition at line 514 of file BaseInteraction.cc.

Referenced by gatherContactStatistics(), and writeToFStat().

515 {
516  return 0;
517 }
Mdouble BaseInteraction::getTimeStamp ( ) const

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

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

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

Definition at line 369 of file BaseInteraction.cc.

References timeStamp_.

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

370 {
371  return timeStamp_;
372 }
const Vec3D & BaseInteraction::getTorque ( ) const

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

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

Returns
A reference to a Vec3D containing the total torque.

Definition at line 277 of file BaseInteraction.cc.

References torque_.

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

Reimplemented in LiquidMigrationWilletInteraction, and SinterInteraction.

Definition at line 863 of file BaseInteraction.cc.

Referenced by InteractionHandler::writeVTK().

863  {
864  return "";
865 }
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 and abstract at this point; but, not virtual as it as not called from within this class. It is only called by higher classes.

Parameters
[in]timeStepThis is the current time step and is passed in case the variables that are integrated depend on the absolute time of the system
Todo:
Ant: When is this case; is there an examepl?

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

Definition at line 385 of file BaseInteraction.cc.

386 {
387 
388 }
void BaseInteraction::read ( std::istream &  is)
virtual

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 MindlinRollingTorsionInteraction, LiquidMigrationWilletInteraction, MindlinInteraction, HertzianViscoelasticInteraction, LinearPlasticViscoelasticInteraction, FrictionInteraction, BondedInteraction, IrreversibleAdhesiveInteraction, EmptyFrictionInteraction, LinearViscoelasticInteraction, EmptyAdhesiveInteraction, SlidingFrictionInteraction, HertzianSinterInteraction, SinterInteraction, ChargedBondedInteraction, LiquidBridgeWilletInteraction, ParhamiMcMeekingSinterInteraction, and ReversibleAdhesiveInteraction.

Definition at line 131 of file BaseInteraction.cc.

References force_, and torque_.

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

132 {
133  //the rest gets read by the interaction handler
134  std::string dummy;
135  is >> dummy >> force_ >> dummy >> torque_;
136 }
void BaseInteraction::removeFromHandler ( )

Removes this interaction from its interaction hander.

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

Definition at line 221 of file BaseInteraction.cc.

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

222 {
224 }
unsigned int getIndex() const
Returns the index of the object in the handler.
Definition: BaseObject.cc:108
virtual void removeObject(unsigned const int id)
Removes an Object from the BaseHandler.
Definition: BaseHandler.h:333
InteractionHandler * handler_
void BaseInteraction::reverseHistory ( )
protectedvirtual

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

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

Reimplemented in MindlinInteraction, SlidingFrictionInteraction, MindlinRollingTorsionInteraction, and FrictionInteraction.

Definition at line 681 of file BaseInteraction.cc.

Referenced by copySwitchPointer().

682 {
683 }
void BaseInteraction::rotateHistory ( Matrix3D rotationMatrix)
virtual

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

Todo:
some of these might be unneccesary

Reimplemented in MindlinInteraction, SlidingFrictionInteraction, MindlinRollingTorsionInteraction, and FrictionInteraction.

Definition at line 696 of file BaseInteraction.cc.

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

697 {
698  contactPoint_=rotationMatrix*contactPoint_;
699  relativeVelocity_=rotationMatrix*relativeVelocity_;
700  force_=rotationMatrix*force_;
701  torque_=rotationMatrix*torque_;
702  normal_=rotationMatrix*normal_;
704 }
void BaseInteraction::setAbsoluteNormalForce ( Mdouble  absoluteNormalForce)
protected

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

set absolute normal force.

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

Definition at line 633 of file BaseInteraction.cc.

References absoluteNormalForce_.

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

634 {
635  absoluteNormalForce_ = absoluteNormalForce;
636 }
Mdouble absoluteNormalForce_
void BaseInteraction::setContactPoint ( Vec3D  contactPoint)

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

Definition at line 181 of file BaseInteraction.cc.

References contactPoint_.

Referenced by TriangulatedWall::getInteractionWith(), BaseWall::getInteractionWith(), and BaseParticle::getInteractionWith().

182 {
183  contactPoint_ = contactPoint;
184 }
void BaseInteraction::setDistance ( Mdouble  distance)

Sets the interaction distance between the two interacting objects.

set the distance of the interaction.

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

Definition at line 162 of file BaseInteraction.cc.

References distance_.

Referenced by TriangulatedWall::getInteractionWith(), BaseWall::getInteractionWith(), and BaseParticle::getInteractionWith().

163 {
164  distance_ = distance;
165 }
void BaseInteraction::setForce ( Vec3D  force)

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

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

Definition at line 590 of file BaseInteraction.cc.

References force_.

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

591 {
592  force_=force;
593 }
void BaseInteraction::setHandler ( InteractionHandler handler)

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

set the handler which this interactions belongs to.

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

Definition at line 202 of file BaseInteraction.cc.

References handler_.

Referenced by InteractionHandler::addObject().

203 {
204  handler_ = handler;
205 }
InteractionHandler * handler_
void BaseInteraction::setI ( BaseInteractable I)

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

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

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

Definition at line 425 of file BaseInteraction.cc.

References BaseInteractable::addInteraction(), I_, and BaseInteractable::removeInteraction().

Referenced by InteractionHandler::removeObjectKeepingPeriodics().

426 {
427  I_->removeInteraction(this);
428  I_=I;
429  I_->addInteraction(this);
430 }
BaseInteractable * I_
bool removeInteraction(BaseInteraction *I)
Removes an interaction from this BaseInteractable.
void addInteraction(BaseInteraction *I)
Adds an interaction to this BaseInteractable.
void BaseInteraction::setMultiContactIdentifier ( unsigned int  multiContactIdentifier_)

Definition at line 690 of file BaseInteraction.cc.

References multiContactIdentifier_.

691 {
692  multiContactIdentifier_ = multiContactIdentifier;
693 }
void BaseInteraction::setNormal ( Vec3D  normal)

Sets the normal vector between the two interacting objects.

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

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

Definition at line 153 of file BaseInteraction.cc.

References normal_.

Referenced by TriangulatedWall::getInteractionWith(), BaseWall::getInteractionWith(), and BaseParticle::getInteractionWith().

154 {
155  normal_ = normal;
156 }
void BaseInteraction::setNormalRelativeVelocity ( Mdouble  normalRelativeVelocity)
protected

set the normal component of the relative velocity.

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

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

Definition at line 623 of file BaseInteraction.cc.

References normalRelativeVelocity_.

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

624 {
625  normalRelativeVelocity_=normalRelativeVelocity;
626 }
Mdouble normalRelativeVelocity_
void BaseInteraction::setOverlap ( Mdouble  overlap)

Set the overlap between the two interacting object.

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

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

Definition at line 172 of file BaseInteraction.cc.

References overlap_.

Referenced by TriangulatedWall::getInteractionWith(), BaseWall::getInteractionWith(), and BaseParticle::getInteractionWith().

173 {
174  overlap_ = overlap;
175 }
void BaseInteraction::setP ( BaseInteractable P)

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

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

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

Definition at line 410 of file BaseInteraction.cc.

References BaseInteractable::addInteraction(), P_, and BaseInteractable::removeInteraction().

411 {
412  P_->removeInteraction(this);
413  P_=P;
414  P_->addInteraction(this);
415 }
bool removeInteraction(BaseInteraction *I)
Removes an interaction from this BaseInteractable.
void addInteraction(BaseInteraction *I)
Adds an interaction to this BaseInteractable.
BaseInteractable * P_
void BaseInteraction::setRelativeVelocity ( Vec3D  relativeVelocity)
protected

set the relative velocity of the current of the interactions.

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

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

Definition at line 612 of file BaseInteraction.cc.

References relativeVelocity_.

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

613 {
614  relativeVelocity_=relativeVelocity;
615 }
void BaseInteraction::setSpecies ( BaseSpecies species)

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

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

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

Definition at line 397 of file BaseInteraction.cc.

References species_.

Referenced by InteractionHandler::getInteraction().

398 {
399  species_ = species;
400 }
BaseSpecies * species_
void BaseInteraction::setTimeStamp ( Mdouble  timeStamp)

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

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

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

Definition at line 192 of file BaseInteraction.cc.

References timeStamp_.

Referenced by InteractionHandler::getInteraction().

193 {
194  timeStamp_ = timeStamp;
195 }
void BaseInteraction::setTorque ( Vec3D  torque)
protected

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

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

Definition at line 601 of file BaseInteraction.cc.

References torque_.

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

602 {
603  torque_=torque;
604 }
void BaseInteraction::write ( std::ostream &  os) const
virtual

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 MindlinRollingTorsionInteraction, LiquidMigrationWilletInteraction, MindlinInteraction, HertzianViscoelasticInteraction, LinearPlasticViscoelasticInteraction, BondedInteraction, IrreversibleAdhesiveInteraction, FrictionInteraction, EmptyFrictionInteraction, LinearViscoelasticInteraction, EmptyAdhesiveInteraction, SlidingFrictionInteraction, HertzianSinterInteraction, SinterInteraction, ChargedBondedInteraction, LiquidBridgeWilletInteraction, ParhamiMcMeekingSinterInteraction, and ReversibleAdhesiveInteraction.

Definition at line 113 of file BaseInteraction.cc.

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

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

114 {
115  os << getName();
116  if (dynamic_cast<BaseParticle*>(I_) != nullptr)
117  os << " particleIds " << P_->getId() << " " << I_->getId();
119  else
120  os << " particleWallIds " << P_->getId() << " " << I_->getId();
121  os <<" timeStamp "<<timeStamp_<< " force " << force_ << " torque " << torque_;
122 }
BaseInteractable * I_
unsigned int getId() const
Returns the unique identifier of any particular object.
Definition: BaseObject.cc:116
BaseInteractable * P_
virtual std::string getName() const
Virtual function which allows interactions to be named.
void BaseInteraction::writeToFStat ( std::ostream &  os) 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:
TW centre is used just for backward compatibility; replace centre by getContactPoint(); we also have to correct it in StatisticsVector::gatherContactStatistics.
Todo:
note, here normal is used as branch vector!! There also seems to be an issue with the normal being defined differently for walls
Todo:
the flip in normal/tangential direction for walls should not be done; this is an old bug

Definition at line 441 of file BaseInteraction.cc.

References Vec3D::dot(), force_, BaseObject::getIndex(), Vec3D::getLength(), getNormal(), getOverlap(), getP(), BaseParticle::getPeriodicFromParticle(), BaseInteractable::getPosition(), BaseParticle::getRadius(), getTangentialForce(), getTangentialOverlap(), I_, BaseParticle::isFixed(), normal_, overlap_, P_, and timeStamp_.

442 {
443  BaseParticle* IParticle = dynamic_cast<BaseParticle*>(I_);
444  BaseParticle* PParticle = dynamic_cast<BaseParticle*>(P_);
445 
446  Vec3D tangentialForce = getTangentialForce();
447  Mdouble tangentialOverlap = getTangentialOverlap();
448 
449  Mdouble scalarNormalForce = Vec3D::dot(force_, getNormal());
450  Mdouble scalarTangentialForce = tangentialForce.getLength();
451  Vec3D tangential;
452  if (scalarTangentialForce!=0.0)
453  tangential = tangentialForce/scalarTangentialForce;
454  else
455  tangential = Vec3D(0.0,0.0,0.0);
456 
460  Vec3D centre;
461  if (IParticle!=0)
462  centre = getP()->getPosition() - normal_ * (PParticle->getRadius() + IParticle->getRadius() - overlap_)/2.0;
463  //centre = 0.5 * (getP()->getPosition() + getI()->getPosition());
464  else
465  centre = getP()->getPosition() - normal_ * (PParticle->getRadius() - overlap_);
466 
467  if (PParticle!=0 && !PParticle->isFixed())
468  {
469  os << timeStamp_
470  << " " << P_->getIndex()
471  << " " << static_cast<int>((IParticle==0?(-I_->getIndex()-1):I_->getIndex()))
472  << " " << centre
473  << " " << getOverlap()
474  << " " << tangentialOverlap
475  << " " << scalarNormalForce
476  << " " << scalarTangentialForce
477  << " " << (IParticle==0?-normal_:normal_)
478  << " " << (IParticle==0?-tangential:tangential) << std::endl;
480  }
481  if (IParticle!=0 && !IParticle->isFixed() && IParticle->getPeriodicFromParticle()==0)
482  {
483  os << timeStamp_
484  << " " << I_->getIndex()
485  << " " << P_->getIndex()
486  << " " << centre
487  << " " << getOverlap()
488  << " " << tangentialOverlap
489  << " " << scalarNormalForce
490  << " " << scalarTangentialForce
491  << " " << -normal_
492  << " " << -tangential << std::endl;
493  }
494 
495 }
BaseInteractable * I_
unsigned int getIndex() const
Returns the index of the object in the handler.
Definition: BaseObject.cc:108
double Mdouble
static Mdouble dot(const Vec3D &a, const Vec3D &b)
Calculates the dot product of two Vec3D: .
Definition: Vector.cc:167
const Vec3D & getPosition() const
Returns the position of this BaseInteractable.
static Mdouble getLength(const Vec3D &a)
Calculates the length of a Vec3D: .
Definition: Vector.cc:414
BaseParticle * getPeriodicFromParticle() const
Returns the 'original' particle this one's a periodic copy of.
BaseInteractable * P_
const Vec3D & getNormal() const
Gets the normal vector between the two interacting objects.
virtual const Vec3D getTangentialForce() const
Mdouble getRadius() const
Returns the particle's radius_.
Mdouble getOverlap() const
Returns a Mdouble with the current overlap between the two interacting objects.
BaseInteractable * getP()
Returns a pointer to first object involved in the interaction (normally a particle).
Implementation of a 3D vector (by Vitaliy).
Definition: Vector.h:45
virtual Mdouble getTangentialOverlap() const
get the length of the current tangential overlap
bool isFixed() const
Is fixed Particle function. It returns whether a Particle is fixed or not, by checking its inverse Ma...

Member Data Documentation

Mdouble BaseInteraction::absoluteNormalForce_
private

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

Definition at line 395 of file BaseInteraction.h.

Referenced by getAbsoluteNormalForce(), and setAbsoluteNormalForce().

Vec3D BaseInteraction::contactPoint_
private

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

Definition at line 378 of file BaseInteraction.h.

Referenced by getContactPoint(), rotateHistory(), and setContactPoint().

Mdouble BaseInteraction::distance_
private

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

Definition at line 400 of file BaseInteraction.h.

Referenced by getDistance(), and setDistance().

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

Pointer to the InteractionHander for this interaction.

Definition at line 363 of file BaseInteraction.h.

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

BaseInteractable* BaseInteraction::I_
private

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

Definition at line 373 of file BaseInteraction.h.

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

unsigned BaseInteraction::multiContactIdentifier_
private

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

Definition at line 437 of file BaseInteraction.h.

Referenced by getMultiContactIdentifier(), and setMultiContactIdentifier().

Vec3D BaseInteraction::normal_
private

Vec3D which stores the normal vector of the interaction.

Definition at line 421 of file BaseInteraction.h.

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

Mdouble BaseInteraction::normalRelativeVelocity_
private

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

Definition at line 390 of file BaseInteraction.h.

Referenced by getNormalRelativeVelocity(), and setNormalRelativeVelocity().

Mdouble BaseInteraction::overlap_
private

Mdouble which stores the current overlap.

Definition at line 426 of file BaseInteraction.h.

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

BaseInteractable* BaseInteraction::P_
private

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

Definition at line 368 of file BaseInteraction.h.

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

Vec3D BaseInteraction::relativeVelocity_
private

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

Definition at line 385 of file BaseInteraction.h.

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

BaseSpecies* BaseInteraction::species_
private

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

Definition at line 431 of file BaseInteraction.h.

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

Mdouble BaseInteraction::timeStamp_
private

Mdouble which store the last timeStamp the interaction was active.

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

Definition at line 416 of file BaseInteraction.h.

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

Vec3D BaseInteraction::torque_
private

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