|
Contains information about the contact between two interactables, BaseInteraction::P_ and BaseInteraction::I_;. More...
#include <Interaction.h>
Public Member Functions | |
Interaction (BaseInteractable *P, BaseInteractable *I, unsigned timeStamp) | |
The default constructor. More... | |
Interaction () | |
Empty constructor. More... | |
Interaction (const Interaction &p) | |
The default copy constructor. More... | |
virtual | ~Interaction () |
The default destructor. More... | |
Interaction< NormalForceInteraction, FrictionForceInteraction, AdhesiveForceInteraction > * | copy () const final |
Creates a copy of this Interaction. More... | |
void | computeForce () final |
Computes the normal, tangential, and adhesive forces. More... | |
void | computeInteraction () |
Computes the interaction parameters based on the forces and torques. More... | |
void | read (std::istream &is) final |
Read Interaction properties from a file. More... | |
void | write (std::ostream &os) const final |
Writes Interaction properties to a file. More... | |
std::string | getName () const final |
Returns the name of the Interaction. More... | |
Mdouble | getElasticEnergy () const final |
Returns the elastic energy stored in the Interaction. More... | |
void | integrate (Mdouble timeStep) final |
Integrates the time-dependent parameters of the contact force. More... | |
void | reverseHistory () final |
Reverses the parameters of the contact force. More... | |
void | rotateHistory (Matrix3D &rotationMatrix) final |
When periodic particles are used, some interactions need certain history properties rotated (e.g. tangential springs). This is the function for that. More... | |
void | actionsAfterTimeStep () |
Mdouble | getElasticEnergyAtEquilibrium (Mdouble adhesiveForce) const |
returns the overlap at which the repulsive elastic force equals a given adhesive force; to be implemented in the normal force More... | |
void | getMPIInteraction (void *historyDataArray, unsigned int index) const final |
copies the history interactions into the data array More... | |
void | setMPIInteraction (void *historyDataArray, unsigned int index, const bool resetPointers) final |
void | getInteractionDetails (void *interactionDataArray, unsigned int index, unsigned int &identificationP, unsigned int &identificationI, bool &isWallInteraction, unsigned &timeStamp) |
void | createMPIType () final |
void * | createMPIInteractionDataArray (unsigned int numberOfInteractions) const final |
void | deleteMPIInteractionDataArray (void *dataArray) final |
Public Member Functions inherited from EmptyFrictionInteraction | |
EmptyFrictionInteraction (BaseInteractable *P, BaseInteractable *I, unsigned timeStamp) | |
Constructor. More... | |
EmptyFrictionInteraction () | |
EmptyFrictionInteraction (const EmptyFrictionInteraction &p) | |
Copy constructor. More... | |
~EmptyFrictionInteraction () override | |
Destructor. More... | |
void | computeFrictionForce () |
Computes nothing, it is an empty function. More... | |
void | computeFrictionInteraction () |
const EmptyFrictionSpecies * | getSpecies () const |
Returns a const pointer of type EmptyFrictionSpecies*. More... | |
std::string | getBaseName () const |
Returns interaction name/type. More... | |
Mdouble | getTangentialOverlap () const override |
Returns zero overlap. More... | |
const Vec3D | getTangentialForce () const override |
Returns zero tangential force. More... | |
Public Member Functions inherited from 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. 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... | |
void | writeToFStat (std::ostream &os, Mdouble time) const |
Writes forces data to the FStat file. 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... | |
InteractionHandler * | getHandler () const |
Gets a point to the interaction handlers to which this interaction belongs. More... | |
const Vec3D & | getForce () const |
Gets the current force (vector) between the two interacting objects. More... | |
const Vec3D & | getTorque () const |
Gets the current torque (vector) between the two interacting objects. More... | |
const Vec3D & | getNormal () const |
Gets the normal vector between the two interacting objects. More... | |
const Vec3D & | getContactPoint () 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 () |
BaseInteractable * | getP () |
Returns a pointer to first object involved in the interaction (normally a particle). More... | |
BaseInteractable * | getI () |
Returns a pointer to the second object involved in the interaction (often a wall or a particle). More... | |
const BaseInteractable * | getP () const |
Returns a constant pointer to the first object involved in the interaction. More... | |
const BaseInteractable * | getI () 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... | |
Mdouble | getDistance () const |
Returns an Mdouble which is the norm (length) of distance vector. More... | |
const Vec3D & | getRelativeVelocity () 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... | |
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 unsigned | getNumberOfFieldsVTK () const |
virtual std::string | getTypeVTK (unsigned i) const |
virtual std::string | getNameVTK (unsigned i) const |
virtual std::vector< Mdouble > | getFieldVTK (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 BaseSpecies * | getBaseSpecies () const |
Return a constant point to BaseSpecies of the interaction. More... | |
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 |
Public Member Functions inherited from EmptyAdhesiveInteraction | |
EmptyAdhesiveInteraction (BaseInteractable *P, BaseInteractable *I, unsigned timeStamp) | |
Constructor. More... | |
EmptyAdhesiveInteraction () | |
EmptyAdhesiveInteraction (const EmptyAdhesiveInteraction &p) | |
copy constructor. More... | |
~EmptyAdhesiveInteraction () override | |
Destructor. More... | |
void | computeAdhesionForce () |
Computes nothing as it is an Empty Adhesive interaction. More... | |
void | computeAdhesionInteraction () |
const EmptyAdhesiveSpecies * | getSpecies () const |
Returns a pointer to the adhesive force species EmptyAdhesiveSpecies. More... | |
std::string | getBaseName () const |
Returns the name of the interaction, see Interaction.h. More... | |
Additional Inherited Members | |
Public Types inherited from EmptyFrictionInteraction | |
typedef EmptyFrictionSpecies | SpeciesType |
An alias name for EmptyFrictionSpecies. More... | |
Public Types inherited from EmptyAdhesiveInteraction | |
typedef EmptyAdhesiveSpecies | SpeciesType |
An alias name for EmptyAdhesiveSpecies data type. More... | |
Protected Member Functions inherited from BaseInteraction | |
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... | |
void | writeInteraction (std::ostream &os, bool created) const |
Writes information about a interaction to the interaction file. More... | |
Contains information about the contact between two interactables, BaseInteraction::P_ and BaseInteraction::I_;.
An instance is created every time two BaseInteractables (particles or walls) get into contact with another, and gets deleted when the contact ends.
Next, the call process is described for this function for the case of two particles (it is very similar for a particle-wall contact.
Then, in each time step, every time that a contact is detected, DPMBase::computeInternalForces is called, which calls BaseParticle::getInteractionWith to create a new Interaction (setting the links to the interactables P_ and I_ and adds it to the InteractionHandler) or find an existing one. When a new Interaction is created, the Species determines what kind of Interaction it will be. DPMBase::computeInternalForces also sets the timeStamp_, normal_, overlap_, distance_, and contactPoint_ of the Interaction.
Then, computeForce is called, which sets the force_, which sets BaseInteraction::force_ and BaseInteraction::torque_ of the Interaction, and a few temporary values to communicate between the three different computeForce routines (see diamond inheritance below).
The force_ and torque_ is then used in DPMBase::integrateBeforeForceComputation and DPMBase::integrateAfterForceComputation to calcutate the new positions and velocities.
As there are many types of contact forces, the class is templated to allow for different force models. This is done in a diamond inheritance structure: First, three kinds of Interactions are created:
A full Interaction object is then derived by inheriting from all of the above:
Interaction< NormalForceInteraction, FrictionForceInteraction, AdhesiveForceInteraction >::Interaction | ( | BaseInteractable * | P, |
BaseInteractable * | I, | ||
unsigned | timeStamp | ||
) |
The default constructor.
Interaction< NormalForceInteraction, FrictionForceInteraction, AdhesiveForceInteraction >::Interaction |
Empty constructor.
Interaction< NormalForceInteraction, FrictionForceInteraction, AdhesiveForceInteraction >::Interaction | ( | const Interaction< NormalForceInteraction, FrictionForceInteraction, AdhesiveForceInteraction > & | p | ) |
The default copy constructor.
|
virtual |
|
virtual |
Reimplemented from BaseInteraction.
|
finalvirtual |
Computes the normal, tangential, and adhesive forces.
Computes the normal, tangential, and adhesive forces (in that order). The order is important, as the normal force computation also calculates some additional parameters required by the other force laws: relativeVelocity_, normalRelativeVelocity_, absoluteNormalForce_.
Reimplemented from BaseInteraction.
void Interaction< NormalForceInteraction, FrictionForceInteraction, AdhesiveForceInteraction >::computeInteraction | ( | ) |
Computes the interaction parameters based on the forces and torques.
|
finalvirtual |
Creates a copy of this Interaction.
Useful for polymorphism as it can be called from a BaseInteraction* pointer.
Implements BaseInteraction.
|
finalvirtual |
Reimplemented from BaseInteraction.
|
finalvirtual |
Reimplemented from BaseInteraction.
References MPIContainer::createMercuryMPIType(), MPIContainer::Instance(), and INTERACTION.
|
finalvirtual |
Reimplemented from BaseInteraction.
|
finalvirtual |
Returns the elastic energy stored in the Interaction.
Returns the elastic energy stored in the Interaction, adding up contributions from the normal, frictional and adhesive interaction The elastic (=potential) energy is defined as the energy gained by separating P_ and I_.
Reimplemented from EmptyAdhesiveInteraction.
|
virtual |
returns the overlap at which the repulsive elastic force equals a given adhesive force; to be implemented in the normal force
Reimplemented from BaseInteraction.
|
virtual |
Reimplemented from BaseInteraction.
References MPIInteraction< NormalForceInteraction, FrictionForceInteraction, AdhesiveForceInteraction >::I, MPIInteraction< NormalForceInteraction, FrictionForceInteraction, AdhesiveForceInteraction >::isWallInteraction, MPIInteraction< NormalForceInteraction, FrictionForceInteraction, AdhesiveForceInteraction >::P, and MPIInteraction< NormalForceInteraction, FrictionForceInteraction, AdhesiveForceInteraction >::timeStamp.
|
finalvirtual |
copies the history interactions into the data array
Reimplemented from BaseInteraction.
|
finalvirtual |
Returns the name of the Interaction.
Returns the name of the Interaction, which depends on the template parameters.
Reimplemented from BaseInteraction.
|
finalvirtual |
Integrates the time-dependent parameters of the contact force.
Called by ??? to integrate time-dependent parameters of the contact force, such as the SlidingFrictionInteraction::slidingSpring_
[in] | the | time step. |
Reimplemented from EmptyFrictionInteraction.
|
finalvirtual |
Read Interaction properties from a file.
Reads Interaction properties in human-readable form from a file, typically Files::restartFile.
[in] | is | the istream from which the data is read. |
Reimplemented from EmptyAdhesiveInteraction.
|
finalvirtual |
Reverses the parameters of the contact force.
Called by BaseInteraction::copySwitchPointer to reverse the
parameters of the contact force in the case that the interactables P_ and I_ are switched. This is needed to deal with periodic particles.
Reimplemented from BaseInteraction.
|
finalvirtual |
When periodic particles are used, some interactions need certain history properties rotated (e.g. tangential springs). This is the function for that.
Reimplemented from BaseInteraction.
|
finalvirtual |
Reimplemented from BaseInteraction.
|
finalvirtual |
Writes Interaction properties to a file.
Writes Interaction properties in human-readable form to a file, typically Files::restartFile.
[out] | os | the ostream to which the data is written. |
Reimplemented from EmptyAdhesiveInteraction.