MercuryDPM  Beta
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
LinearViscoelasticNormalSpecies Class Reference

LinearViscoelasticNormalSpecies contains the parameters used to describe a linear elastic-dissipative normal force. More...

#include <LinearViscoelasticNormalSpecies.h>

+ Inheritance diagram for LinearViscoelasticNormalSpecies:

Public Types

typedef
LinearViscoelasticInteraction 
InteractionType
 The correct Interaction type for this FrictionForceSpecies. More...
 

Public Member Functions

 LinearViscoelasticNormalSpecies ()
 The default constructor. More...
 
 LinearViscoelasticNormalSpecies (const LinearViscoelasticNormalSpecies &p)
 The default copy constructor. More...
 
virtual ~LinearViscoelasticNormalSpecies ()
 The default destructor. More...
 
void read (std::istream &is)
 Reads the species properties from an input stream. More...
 
void write (std::ostream &os) const
 Writes the species properties to an output stream. More...
 
std::string getBaseName () const
 Used in Species::getName to obtain a unique name for each Species. More...
 
Mdouble getMaximumVelocity (Mdouble radius, Mdouble mass)
 Calculates the maximum velocity allowed for a collision of two copies of P (for higher velocities particles could pass through each other) More...
 
void setStiffnessAndRestitutionCoefficient (Mdouble k_, Mdouble eps, Mdouble mass)
 Sets k, disp such that it matches a given tc and eps for a collision of two copies of P. More...
 
void setCollisionTimeAndRestitutionCoefficient (Mdouble tc, Mdouble eps, Mdouble mass)
 Sets k, disp such that it matches a given tc and eps for a collision of two copies of equal mass m. More...
 
void setCollisionTimeAndRestitutionCoefficient (Mdouble collisionTime, Mdouble restitutionCoefficient, Mdouble mass1, Mdouble mass2)
 Set k, disp such that is matches a given tc and eps for a collision of two different masses. More...
 
Mdouble getCollisionTime (Mdouble mass)
 Calculates collision time for two copies of a particle of given disp, k, mass. More...
 
Mdouble getRestitutionCoefficient (Mdouble mass)
 Calculates restitution coefficient for two copies of given disp, k, mass. More...
 
void mix (LinearViscoelasticNormalSpecies *const SBase, LinearViscoelasticNormalSpecies *const TBase)
 creates default values for mixed species More...
 
void setStiffness (Mdouble new_k)
 Allows the spring constant to be changed. More...
 
Mdouble getStiffness () const
 Allows the spring constant to be accessed. More...
 
void setDissipation (Mdouble dissipation)
 Allows the normal dissipation to be changed. More...
 
Mdouble getDissipation () const
 Allows the normal dissipation to be accessed. More...
 
MERCURY_DEPRECATED void setStiffnessAndDissipation (helpers::KAndDisp new_)
 Allows the spring and dissipation constants to be changed simultaneously. More...
 
- Public Member Functions inherited from BaseSpecies
 BaseSpecies ()
 The default constructor. More...
 
 BaseSpecies (const BaseSpecies &p)
 The copy constructor. More...
 
virtual ~BaseSpecies ()
 The default destructor. More...
 
virtual BaseSpeciescopy () const =0
 Creates a deep copy of the object from which it is called. More...
 
void setHandler (SpeciesHandler *handler)
 Sets the pointer to the handler to which this species belongs. More...
 
SpeciesHandlergetHandler () const
 Returns the pointer to the handler to which this species belongs. More...
 
Mdouble average (Mdouble a, Mdouble b)
 defines the average of two variables by the harmonic mean. More...
 
virtual void mixAll (BaseSpecies *const S, BaseSpecies *const T)=0
 creates default values for mixed species More...
 
virtual Mdouble getInteractionDistance () const =0
 returns the largest separation distance at which adhesive short-range forces can occur. More...
 
virtual bool getUseAngularDOFs () const =0
 Returns true if torques (i.e. angular degrees of freedom) have to be calculated. More...
 
virtual BaseInteractiongetNewInteraction (BaseInteractable *P, BaseInteractable *I, Mdouble timeStamp)=0
 returns new Interaction object. 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 std::string getName () const =0
 A purely virtual function. 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...
 

Private Attributes

Mdouble stiffness_
 (normal) spring constant More...
 
Mdouble dissipation_
 (normal) viscosity More...
 

Detailed Description

LinearViscoelasticNormalSpecies contains the parameters used to describe a linear elastic-dissipative normal force.

See LinearViscoelasticNormalInteraction::computeForce for a description of the force law.

Definition at line 36 of file LinearViscoelasticNormalSpecies.h.

Member Typedef Documentation

Constructor & Destructor Documentation

LinearViscoelasticNormalSpecies::LinearViscoelasticNormalSpecies ( )

The default constructor.

Definition at line 34 of file LinearViscoelasticNormalSpecies.cc.

References dissipation_, and stiffness_.

35 {
36  stiffness_ = 0;
37  dissipation_ = 0;
38 #ifdef DEBUG_CONSTRUCTOR
39  std::cout<<"LinearViscoelasticNormalSpecies::LinearViscoelasticNormalSpecies() finished"<<std::endl;
40 #endif
41 }
Mdouble stiffness_
(normal) spring constant
LinearViscoelasticNormalSpecies::LinearViscoelasticNormalSpecies ( const LinearViscoelasticNormalSpecies p)

The default copy constructor.

Parameters
[in]thespecies that is copied

Definition at line 46 of file LinearViscoelasticNormalSpecies.cc.

References dissipation_, and stiffness_.

47 {
50 #ifdef DEBUG_CONSTRUCTOR
51  std::cout<<"LinearViscoelasticNormalSpecies::LinearViscoelasticNormalSpecies(const LinearViscoelasticNormalSpecies &p) finished"<<std::endl;
52 #endif
53 }
Mdouble stiffness_
(normal) spring constant
LinearViscoelasticNormalSpecies::~LinearViscoelasticNormalSpecies ( )
virtual

The default destructor.

Definition at line 55 of file LinearViscoelasticNormalSpecies.cc.

56 {
57 #ifdef DEBUG_DESTRUCTOR
58  std::cout<<"LinearViscoelasticNormalSpecies::~LinearViscoelasticNormalSpecies() finished"<<std::endl;
59 #endif
60 }

Member Function Documentation

std::string LinearViscoelasticNormalSpecies::getBaseName ( ) const

Used in Species::getName to obtain a unique name for each Species.

Returns
a string containing the name of the species (minus the word "Species")

Definition at line 84 of file LinearViscoelasticNormalSpecies.cc.

85 {
86  return "LinearViscoelastic";
87 }
Mdouble LinearViscoelasticNormalSpecies::getCollisionTime ( Mdouble  mass)

Calculates collision time for two copies of a particle of given disp, k, mass.

Definition at line 135 of file LinearViscoelasticNormalSpecies.cc.

References dissipation_, constants::pi, mathsFunc::square(), and stiffness_.

Referenced by getRestitutionCoefficient().

136 {
137  if (mass <= 0)
138  {
139  std::cerr << "Error in getCollisionTime(" << mass << ") mass is not set or has an unexpected value, (getCollisionTime(" << mass << "))" << std::endl;
140  exit(-1);
141  }
142  if (stiffness_ <= 0)
143  {
144  std::cerr << "Error in getCollisionTime(" << mass << ") stiffness=" << stiffness_ << " is not set or has an unexpected value, (getCollisionTime(" << mass << "), with stiffness=" << stiffness_ << ")" << std::endl;
145  exit(-1);
146  }
147  if (dissipation_ < 0)
148  {
149  std::cerr << "Error in getCollisionTime(" << mass << ") dissipation=" << dissipation_ << " is not set or has an unexpected value, (getCollisionTime(" << mass << "), with dissipation=" << dissipation_ << ")" << std::endl;
150  exit(-1);
151  }
152  Mdouble tosqrt = stiffness_ / (.5 * mass) - mathsFunc::square(dissipation_ / mass);
153  if (tosqrt <= 0)
154  {
155  std::cerr << "Error in getCollisionTime(" << mass << ") values for mass, stiffness and dissipation would lead to an overdamped system, (getCollisionTime(" << mass << "), with stiffness=" << stiffness_ << " and dissipation=" << dissipation_ << ")" << std::endl;
156  exit(-1);
157  }
158  return constants::pi / std::sqrt(tosqrt);
159 }
Mdouble stiffness_
(normal) spring constant
double Mdouble
T square(T val)
squares a number
Definition: ExtendedMath.h:91
const Mdouble pi
Definition: ExtendedMath.h:42
Mdouble LinearViscoelasticNormalSpecies::getDissipation ( ) const

Allows the normal dissipation to be accessed.

Definition at line 129 of file LinearViscoelasticNormalSpecies.cc.

References dissipation_.

Referenced by LinearViscoelasticInteraction::computeNormalForce(), and mix().

130 {
131  return dissipation_;
132 }
Mdouble LinearViscoelasticNormalSpecies::getMaximumVelocity ( Mdouble  radius,
Mdouble  mass 
)

Calculates the maximum velocity allowed for a collision of two copies of P (for higher velocities particles could pass through each other)

Definition at line 168 of file LinearViscoelasticNormalSpecies.cc.

References stiffness_.

169 {
170  return radius * std::sqrt(stiffness_ / (.5 * mass));
171 }
Mdouble stiffness_
(normal) spring constant
Mdouble LinearViscoelasticNormalSpecies::getRestitutionCoefficient ( Mdouble  mass)

Calculates restitution coefficient for two copies of given disp, k, mass.

Definition at line 162 of file LinearViscoelasticNormalSpecies.cc.

References dissipation_, and getCollisionTime().

163 {
164  return std::exp(-dissipation_ / mass * getCollisionTime(mass));
165 }
Mdouble getCollisionTime(Mdouble mass)
Calculates collision time for two copies of a particle of given disp, k, mass.
void LinearViscoelasticNormalSpecies::mix ( LinearViscoelasticNormalSpecies *const  S,
LinearViscoelasticNormalSpecies *const  T 
)

creates default values for mixed species

For all parameters we assume that the harmonic mean of the parameters of the original two species is a sensible default.

Parameters
[in]S,Tthe two species whose properties are mixed to create the new species

Definition at line 214 of file LinearViscoelasticNormalSpecies.cc.

References BaseSpecies::average(), dissipation_, getDissipation(), getStiffness(), and stiffness_.

215 {
218 }
Mdouble stiffness_
(normal) spring constant
Mdouble getStiffness() const
Allows the spring constant to be accessed.
Mdouble getDissipation() const
Allows the normal dissipation to be accessed.
Mdouble average(Mdouble a, Mdouble b)
defines the average of two variables by the harmonic mean.
Definition: BaseSpecies.cc:85
void LinearViscoelasticNormalSpecies::read ( std::istream &  is)
virtual

Reads the species properties from an input stream.

Parameters
[in]inputstream (typically the restart file)

Implements BaseObject.

Definition at line 74 of file LinearViscoelasticNormalSpecies.cc.

References dissipation_, and stiffness_.

75 {
76  std::string dummy;
77  is >> dummy >> stiffness_
78  >> dummy >> dissipation_;
79 }
Mdouble stiffness_
(normal) spring constant
void LinearViscoelasticNormalSpecies::setCollisionTimeAndRestitutionCoefficient ( Mdouble  tc,
Mdouble  eps,
Mdouble  mass 
)

Sets k, disp such that it matches a given tc and eps for a collision of two copies of equal mass m.

Sets k, disp such that it matches a given tc and eps for a collision of two copies of equal mass m

Parameters
[in]tccollision time
[in]epsrestitution coefficient
[in]masseffective particle mass, \(\frac{2}{1/m1+1/m2}\)

Definition at line 191 of file LinearViscoelasticNormalSpecies.cc.

References dissipation_, constants::pi, mathsFunc::square(), and stiffness_.

Referenced by SlidingFrictionSpecies::setCollisionTimeAndNormalAndTangentialRestitutionCoefficient(), SlidingFrictionSpecies::setCollisionTimeAndNormalAndTangentialRestitutionCoefficientNoDispt(), and setCollisionTimeAndRestitutionCoefficient().

192 {
193  dissipation_ = -mass / tc * std::log(eps);
195 }
Mdouble stiffness_
(normal) spring constant
T square(T val)
squares a number
Definition: ExtendedMath.h:91
const Mdouble pi
Definition: ExtendedMath.h:42
void LinearViscoelasticNormalSpecies::setCollisionTimeAndRestitutionCoefficient ( Mdouble  collisionTime,
Mdouble  restitutionCoefficient,
Mdouble  mass1,
Mdouble  mass2 
)

Set k, disp such that is matches a given tc and eps for a collision of two different masses.

Recall the resitution constant is a function of k, disp and the mass of each particle in the collision See also setCollisionTimeAndRestitutionCoefficient(Mdouble tc, Mdouble eps, Mdouble mass)

Set k, disp such that is matches a given tc and eps for a collision of two different masses. Recall the resitution constant is a function of k, disp and the mass of each particle in the collision See also setCollisionTimeAndRestitutionCoefficient(Mdouble tc, Mdouble eps, Mdouble mass)

Parameters
[in]collisiontime

Definition at line 203 of file LinearViscoelasticNormalSpecies.cc.

References setCollisionTimeAndRestitutionCoefficient().

204 {
205  Mdouble reduced_mass = mass1 * mass2 / (mass1 + mass2);
206  setCollisionTimeAndRestitutionCoefficient(collisionTime, restitutionCoefficient, 2.0 * reduced_mass);
207 }
void setCollisionTimeAndRestitutionCoefficient(Mdouble tc, Mdouble eps, Mdouble mass)
Sets k, disp such that it matches a given tc and eps for a collision of two copies of equal mass m...
double Mdouble
void LinearViscoelasticNormalSpecies::setDissipation ( Mdouble  dissipation)

Allows the normal dissipation to be changed.

Definition at line 115 of file LinearViscoelasticNormalSpecies.cc.

References dissipation_.

Referenced by setStiffnessAndDissipation().

116 {
117  if (dissipation >= 0)
118  {
119  dissipation_ = dissipation;
120  }
121  else
122  {
123  std::cerr << "Error in setDissipation(" << dissipation << ")" << std::endl;
124  exit(-1);
125  }
126 }
void LinearViscoelasticNormalSpecies::setStiffness ( Mdouble  new_k)

Allows the spring constant to be changed.

Definition at line 90 of file LinearViscoelasticNormalSpecies.cc.

References stiffness_.

Referenced by setStiffnessAndDissipation().

91 {
92  if (new_k >= 0)
93  stiffness_ = new_k;
94  else
95  {
96  std::cerr << "Error in set_k" << std::endl;
97  exit(-1);
98  }
99 }
Mdouble stiffness_
(normal) spring constant
void LinearViscoelasticNormalSpecies::setStiffnessAndDissipation ( helpers::KAndDisp  new_)

Allows the spring and dissipation constants to be changed simultaneously.

Definition at line 108 of file LinearViscoelasticNormalSpecies.cc.

References helpers::KAndDisp::disp, helpers::KAndDisp::k, setDissipation(), and setStiffness().

109 {
110  setStiffness(new_.k);
111  setDissipation(new_.disp);
112 }
void setDissipation(Mdouble dissipation)
Allows the normal dissipation to be changed.
void setStiffness(Mdouble new_k)
Allows the spring constant to be changed.
Mdouble disp
Definition: Helpers.h:43
void LinearViscoelasticNormalSpecies::setStiffnessAndRestitutionCoefficient ( Mdouble  stiffness,
Mdouble  eps,
Mdouble  mass 
)

Sets k, disp such that it matches a given tc and eps for a collision of two copies of P.

Sets k, disp such that it matches a given tc and eps for a collision of two copies of P

Parameters
[in]stiffnessstiffness
[in]epsrestitution coefficient
[in]masseffective particle mass, \(\frac{2}{1/m1+1/m2}\)

Definition at line 179 of file LinearViscoelasticNormalSpecies.cc.

References dissipation_, constants::sqr_pi, mathsFunc::square(), and stiffness_.

180 {
181  stiffness_ = stiffness;
182  dissipation_ = -std::sqrt(2.0 * mass * stiffness_ / (constants::sqr_pi + mathsFunc::square(log(eps)))) * log(eps);
183 }
Mdouble stiffness_
(normal) spring constant
T square(T val)
squares a number
Definition: ExtendedMath.h:91
const Mdouble sqr_pi
Definition: ExtendedMath.h:44
void LinearViscoelasticNormalSpecies::write ( std::ostream &  os) const
virtual

Writes the species properties to an output stream.

Parameters
[out]outputstream (typically the restart file)

Implements BaseObject.

Definition at line 65 of file LinearViscoelasticNormalSpecies.cc.

References dissipation_, and stiffness_.

66 {
67  os << " stiffness " << stiffness_
68  << " dissipation " << dissipation_;
69 }
Mdouble stiffness_
(normal) spring constant

Member Data Documentation


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