MercuryDPM  Alpha
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Interaction< NormalForceInteraction, FrictionForceInteraction, AdhesiveForceInteraction > Class Template Reference

Contains information about the contact between two interactables, BaseInteraction::P_ and BaseInteraction::I_;. More...

#include <Interaction.h>

+ Inheritance diagram for Interaction< NormalForceInteraction, FrictionForceInteraction, AdhesiveForceInteraction >:

Public Member Functions

 Interaction (BaseInteractable *P, BaseInteractable *I, Mdouble timeStamp)
 The default 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 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
 
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...
 

Detailed Description

template<class NormalForceInteraction, class FrictionForceInteraction = EmptyFrictionInteraction, class AdhesiveForceInteraction = EmptyAdhesiveInteraction>
class Interaction< NormalForceInteraction, FrictionForceInteraction, AdhesiveForceInteraction >

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:

dot_inline_dotgraph_1.png

Definition at line 107 of file Interaction.h.

Constructor & Destructor Documentation

template<class NormalForceInteraction , class FrictionForceInteraction , class AdhesiveForceInteraction >
Interaction< NormalForceInteraction, FrictionForceInteraction, AdhesiveForceInteraction >::Interaction ( BaseInteractable P,
BaseInteractable I,
Mdouble  timeStamp 
)

The default constructor.

Definition at line 155 of file Interaction.h.

156 : BaseInteraction(P, I, timeStamp), NormalForceInteraction(P, I, timeStamp), FrictionForceInteraction(P, I, timeStamp), AdhesiveForceInteraction(P, I, timeStamp)
157 {
158 #ifdef DEBUG_CONSTRUCTOR
159  std::cout<<"Interaction::Interaction() finished"<<std::endl;
160 #endif
161 }
Stores information about interactions between two interactable objects; often particles but could be ...
template<class NormalForceInteraction , class FrictionForceInteraction , class AdhesiveForceInteraction >
Interaction< NormalForceInteraction, FrictionForceInteraction, AdhesiveForceInteraction >::Interaction ( const Interaction< NormalForceInteraction, FrictionForceInteraction, AdhesiveForceInteraction > &  p)

The default copy constructor.

Definition at line 164 of file Interaction.h.

166 {
167 #ifdef DEBUG_CONSTRUCTOR
168  std::cout<<"Interaction::Interaction(const Interaction &p finished"<<std::endl;
169 #endif
170 }
Stores information about interactions between two interactable objects; often particles but could be ...
template<class NormalForceInteraction , class FrictionForceInteraction , class AdhesiveForceInteraction >
Interaction< NormalForceInteraction, FrictionForceInteraction, AdhesiveForceInteraction >::~Interaction ( )
virtual

The default destructor.

Definition at line 173 of file Interaction.h.

174 {
175 #ifdef DEBUG_DESTRUCTOR
176  std::cout<<"Interaction::~Interaction() finished"<<std::endl;
177 #endif
178 }

Member Function Documentation

template<class NormalForceInteraction , class FrictionForceInteraction , class AdhesiveForceInteraction >
void Interaction< NormalForceInteraction, FrictionForceInteraction, AdhesiveForceInteraction >::actionsAfterTimeStep ( )

Definition at line 284 of file Interaction.h.

285 {
286  AdhesiveForceInteraction::actionsAfterTimeStep();
287 }
template<class NormalForceInteraction , class FrictionForceInteraction , class AdhesiveForceInteraction >
void Interaction< NormalForceInteraction, FrictionForceInteraction, AdhesiveForceInteraction >::computeForce ( )
final

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

Definition at line 264 of file Interaction.h.

265 {
266  NormalForceInteraction::computeNormalForce();
267  FrictionForceInteraction::computeFrictionForce();
268  AdhesiveForceInteraction::computeAdhesionForce();
269 }
template<class NormalForceInteraction , class FrictionForceInteraction , class AdhesiveForceInteraction >
Interaction< NormalForceInteraction, FrictionForceInteraction, AdhesiveForceInteraction > * Interaction< NormalForceInteraction, FrictionForceInteraction, AdhesiveForceInteraction >::copy ( ) const
final

Creates a copy of this Interaction.

Useful for polymorphism as it can be called from a BaseInteraction* pointer.

Definition at line 184 of file Interaction.h.

185 {
186  return new Interaction(*this);
187 }
Interaction(BaseInteractable *P, BaseInteractable *I, Mdouble timeStamp)
The default constructor.
Definition: Interaction.h:155
template<class NormalForceInteraction , class FrictionForceInteraction , class AdhesiveForceInteraction >
Mdouble Interaction< NormalForceInteraction, FrictionForceInteraction, AdhesiveForceInteraction >::getElasticEnergy ( ) const
final

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

Returns
the computed elastic energy.

Definition at line 278 of file Interaction.h.

279 {
280  return NormalForceInteraction::getElasticEnergy() + FrictionForceInteraction::getElasticEnergy() + AdhesiveForceInteraction::getElasticEnergy();
281 }
template<class NormalForceInteraction , class FrictionForceInteraction , class AdhesiveForceInteraction >
Mdouble Interaction< NormalForceInteraction, FrictionForceInteraction, AdhesiveForceInteraction >::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

Definition at line 293 of file Interaction.h.

294 {
295  return NormalForceInteraction::getElasticEnergyAtEquilibrium(adhesiveForce);
296 };
template<class NormalForceInteraction , class FrictionForceInteraction , class AdhesiveForceInteraction >
std::string Interaction< NormalForceInteraction, FrictionForceInteraction, AdhesiveForceInteraction >::getName ( ) const
final

Returns the name of the Interaction.

Returns the name of the Interaction, which depends on the template parameters.

Returns
the string to which the name is written.

Definition at line 239 of file Interaction.h.

240 {
241  return NormalForceInteraction::getBaseName() + FrictionForceInteraction::getBaseName() + AdhesiveForceInteraction::getBaseName() + "Interaction";
242 }
template<class NormalForceInteraction , class FrictionForceInteraction , class AdhesiveForceInteraction >
void Interaction< NormalForceInteraction, FrictionForceInteraction, AdhesiveForceInteraction >::integrate ( Mdouble  timeStep)
final

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_

Parameters
[in]thetime step.

Definition at line 250 of file Interaction.h.

251 {
252  FrictionForceInteraction::integrate(timeStep);
253 }
template<class NormalForceInteraction , class FrictionForceInteraction , class AdhesiveForceInteraction >
void Interaction< NormalForceInteraction, FrictionForceInteraction, AdhesiveForceInteraction >::read ( std::istream &  is)
final

Read Interaction properties from a file.

Reads Interaction properties in human-readable form from a file, typically Files::restartFile.

Parameters
[in]isthe istream from which the data is read.

Definition at line 206 of file Interaction.h.

207 {
208  NormalForceInteraction::read(is);
209  FrictionForceInteraction::read(is);
210  AdhesiveForceInteraction::read(is);
211 }
template<class NormalForceInteraction , class FrictionForceInteraction , class AdhesiveForceInteraction >
void Interaction< NormalForceInteraction, FrictionForceInteraction, AdhesiveForceInteraction >::reverseHistory ( )
final

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.

Definition at line 219 of file Interaction.h.

220 {
221  NormalForceInteraction::reverseHistory();
222  FrictionForceInteraction::reverseHistory();
223  AdhesiveForceInteraction::reverseHistory();
224 }
template<class NormalForceInteraction , class FrictionForceInteraction , class AdhesiveForceInteraction >
void Interaction< NormalForceInteraction, FrictionForceInteraction, AdhesiveForceInteraction >::rotateHistory ( Matrix3D rotationMatrix)
final

Definition at line 227 of file Interaction.h.

228 {
229  NormalForceInteraction::rotateHistory(rotationMatrix);
230  FrictionForceInteraction::rotateHistory(rotationMatrix);
231  AdhesiveForceInteraction::rotateHistory(rotationMatrix);
232 }
template<class NormalForceInteraction , class FrictionForceInteraction , class AdhesiveForceInteraction >
void Interaction< NormalForceInteraction, FrictionForceInteraction, AdhesiveForceInteraction >::write ( std::ostream &  os) const
final

Writes Interaction properties to a file.

Writes Interaction properties in human-readable form to a file, typically Files::restartFile.

Parameters
[out]osthe ostream to which the data is written.

Definition at line 194 of file Interaction.h.

195 {
196  NormalForceInteraction::write(os);
197  FrictionForceInteraction::write(os);
198  AdhesiveForceInteraction::write(os);
199 }

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