MercuryDPM  Beta
 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
 

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 148 of file Interaction.h.

149 : BaseInteraction(P, I, timeStamp), NormalForceInteraction(P, I, timeStamp), FrictionForceInteraction(P, I, timeStamp), AdhesiveForceInteraction(P, I, timeStamp)
150 {
151 #ifdef DEBUG_CONSTRUCTOR
152  std::cout<<"Interaction::Interaction() finished"<<std::endl;
153 #endif
154 }
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 157 of file Interaction.h.

159 {
160 #ifdef DEBUG_CONSTRUCTOR
161  std::cout<<"Interaction::Interaction(const Interaction &p finished"<<std::endl;
162 #endif
163 }
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 166 of file Interaction.h.

167 {
168 #ifdef DEBUG_DESTRUCTOR
169  std::cout<<"Interaction::~Interaction() finished"<<std::endl;
170 #endif
171 }

Member Function Documentation

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 257 of file Interaction.h.

258 {
259  NormalForceInteraction::computeNormalForce();
260  FrictionForceInteraction::computeFrictionForce();
261  AdhesiveForceInteraction::computeAdhesionForce();
262 }
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 177 of file Interaction.h.

178 {
179  return new Interaction(*this);
180 }
Interaction(BaseInteractable *P, BaseInteractable *I, Mdouble timeStamp)
The default constructor.
Definition: Interaction.h:148
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 271 of file Interaction.h.

272 {
273  return NormalForceInteraction::getElasticEnergy() + FrictionForceInteraction::getElasticEnergy() + AdhesiveForceInteraction::getElasticEnergy();
274 }
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 232 of file Interaction.h.

233 {
234  return NormalForceInteraction::getBaseName() + FrictionForceInteraction::getBaseName() + AdhesiveForceInteraction::getBaseName() + "Interaction";
235 }
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 243 of file Interaction.h.

244 {
245  FrictionForceInteraction::integrate(timeStep);
246 }
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 199 of file Interaction.h.

200 {
201  NormalForceInteraction::read(is);
202  FrictionForceInteraction::read(is);
203  AdhesiveForceInteraction::read(is);
204 }
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 212 of file Interaction.h.

213 {
214  NormalForceInteraction::reverseHistory();
215  FrictionForceInteraction::reverseHistory();
216  AdhesiveForceInteraction::reverseHistory();
217 }
template<class NormalForceInteraction , class FrictionForceInteraction , class AdhesiveForceInteraction >
void Interaction< NormalForceInteraction, FrictionForceInteraction, AdhesiveForceInteraction >::rotateHistory ( Matrix3D rotationMatrix)
final

Definition at line 220 of file Interaction.h.

221 {
222  NormalForceInteraction::rotateHistory(rotationMatrix);
223  FrictionForceInteraction::rotateHistory(rotationMatrix);
224  AdhesiveForceInteraction::rotateHistory(rotationMatrix);
225 }
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 187 of file Interaction.h.

188 {
189  NormalForceInteraction::write(os);
190  FrictionForceInteraction::write(os);
191  AdhesiveForceInteraction::write(os);
192 }

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