MercuryDPM  Alpha
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
HertzianSinterInteraction.cc
Go to the documentation of this file.
1 //Copyright (c) 2013-2014, The MercuryDPM Developers Team. All rights reserved.
2 //For the list of developers, see <http://www.MercuryDPM.org/Team>.
3 //
4 //Redistribution and use in source and binary forms, with or without
5 //modification, are permitted provided that the following conditions are met:
6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above copyright
9 // notice, this list of conditions and the following disclaimer in the
10 // documentation and/or other materials provided with the distribution.
11 // * Neither the name MercuryDPM nor the
12 // names of its contributors may be used to endorse or promote products
13 // derived from this software without specific prior written permission.
14 //
15 //THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
16 //ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17 //WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18 //DISCLAIMED. IN NO EVENT SHALL THE MERCURYDPM DEVELOPERS TEAM BE LIABLE FOR ANY
19 //DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20 //(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21 //LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
22 //ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 //(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24 //SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 
26 
28 #include "InteractionHandler.h"
29 #include "Particles/BaseParticle.h"
30 #include "DPMBase.h"
32 #include "Math/ExtendedMath.h"
33 #include <iomanip>
34 #include <fstream>
35 #include <cmath> // std::max
42  : BaseInteraction(P, I, timeStamp)
43 {
44  maxOverlap_=0;
45 #ifdef DEBUG_CONSTRUCTOR
46  std::cout<<"HertzianSinterInteraction::HertzianSinterInteraction() finished"<<std::endl;
47 #endif
48 }
53  : BaseInteraction(p)
54 {
56 #ifdef DEBUG_CONSTRUCTOR
57  std::cout<<"HertzianSinterInteraction::HertzianSinterInteraction(const HertzianSinterInteraction &p finished"<<std::endl;
58 #endif
59 }
64 {
65 #ifdef DEBUG_DESTRUCTOR
66  std::cout<<"HertzianSinterInteraction::~HertzianSinterInteraction() finished"<<std::endl;
67 #endif
68 }
69 
74 void HertzianSinterInteraction::write(std::ostream& os) const
75 {
77  os << " maxOverlap " << maxOverlap_;
78 }
83 void HertzianSinterInteraction::read(std::istream& is)
84 {
86  std::string dummy;
87  is >> dummy >> maxOverlap_;
88 }
93 {
94  return "HertzianSinter";
95 }
100 {
101  // Compute the relative velocity vector of particle P w.r.t. I
102  setRelativeVelocity(getP()->getVelocityAtContact(getContactPoint()) - getI()->getVelocityAtContact(getContactPoint()));
103  // Compute the projection of vrel onto the normal (can be negative)
105 
106  if (getOverlap() > 0) //if contact forces
107  {
108  const HertzianSinterNormalSpecies* species = getSpecies();
109  Mdouble effectiveDiameter = 2.0*getEffectiveRadius();
110 
111  //calculate the overlap above which the max. unloading stiffness becomes active (the 'fluid branch')
112  static Mdouble maxFactor = 1
113  -mathsFunc::square(cbrt((species->getLoadingModulus()+species->getCohesionModulus())/species->getUnloadingModulusMax()));
114  Mdouble deltaStar = species->getPenetrationDepthMax() * effectiveDiameter/maxFactor;
115 
116  //increase max overlap if necessary
117  if (getOverlap()>getMaxOverlap()) {
119  std::cout << "," << getHandler()->getDPMBase()->getTime();
120  }
121  //limit max overlap if necessary
122  if (getMaxOverlap()>deltaStar)
123  setMaxOverlap(deltaStar);
124 
125  //calculate the unloading modulus
126  Mdouble loadingCohesionModulus = species->getLoadingModulus()+species->getCohesionModulus();
127  Mdouble unloadingModulus = loadingCohesionModulus
128  + (species->getUnloadingModulusMax() - loadingCohesionModulus) * (getMaxOverlap() / deltaStar);
129 
130  //calculate the overlap where the force is minimal
131  Mdouble factor = 1-mathsFunc::square(cbrt(loadingCohesionModulus/unloadingModulus));
132  Mdouble minOverlap = factor*maxOverlap_;
133 
134  //add dissipative force
135  Mdouble normalForce = -species->getDissipation() * getNormalRelativeVelocity();
136 
137  //compute elastic force
138  if (getOverlap() < minOverlap) {
139  //decrease max overlap if in cohesive range
140  std::cout << "." << getHandler()->getDPMBase()->getTime();
141  setMaxOverlap(getOverlap()/factor);
142  } else {
143  Mdouble contactRadius = sqrt(2.0*effectiveDiameter * (getOverlap()-minOverlap));
144  normalForce += 4./3.*unloadingModulus * contactRadius *(getOverlap()-minOverlap);
145  }
146 
147  setAbsoluteNormalForce(std::abs(normalForce)); //used for the friction force calculations;
148 
149  Mdouble contactRadius = sqrt(2.0*effectiveDiameter * getOverlap());
150  normalForce -= 4./3.*species->getCohesionModulus() * contactRadius *getOverlap();
151 
152  setForce(getNormal() * normalForce);
153  setTorque(Vec3D(0.0, 0.0, 0.0));
154 
155  //now add the sintering model 'modified Frenkel' of the Pokula paper
156  //plasticOverlap_+=species->getSinterRate()*(deltaStar-plasticOverlap_)*getHandler()->getDPMBase()->getTimeStep();
157  //x/a=sqrt(2*a*del)/a
158  Mdouble x = 1e-10+sqrt(2.0*maxOverlap_/effectiveDiameter);
159  //Mdouble x2 = x*x;
160  Mdouble dx = 0.5/x;//+ x*(-0.5 + x2* (0.15625 + x2*(-0.0208333 +x2*(-0.00325521 +x2*(0.000189887 +x2*0.0000542535)))));
161  Mdouble doverlap = x*dx*effectiveDiameter;
162  //doverlap = 0.5/(factor*factor*plasticOverlap_);
163  maxOverlap_ += species->getSinterRate()*doverlap*getHandler()->getDPMBase()->getTimeStep();
164  }
165  else
166  {
168  setForce(Vec3D(0.0, 0.0, 0.0));
169  setTorque(Vec3D(0.0, 0.0, 0.0));
170  }
171 }
176 {
178 }
183 {
184  if (getOverlap() > 0)
185  return 0.5 * (getSpecies()->getLoadingModulus() * mathsFunc::square(getOverlap()));
186  else
187  return 0.0;
189 }
194 {
195  return dynamic_cast<const HertzianSinterNormalSpecies*>(getBaseSpecies());
196 }
201 {
202  return maxOverlap_;
203 }
208 {
209  maxOverlap_ = maxOverlap;
210 }
215 {
216  const HertzianSinterNormalSpecies* species = getSpecies();
217  Mdouble effectiveDiameter = 2.0*getEffectiveRadius();
218  Mdouble deltaMaxFluid = species->getPenetrationDepthMax() * effectiveDiameter / (1.0-species->getLoadingModulus()/species->getUnloadingModulusMax());
219  if (getOverlap() > deltaMaxFluid)
220  return species->getUnloadingModulusMax();
221  else
222  return species->getLoadingModulus() + (species->getUnloadingModulusMax() - species->getLoadingModulus()) * getMaxOverlap()/deltaMaxFluid;
223 }
224 
const HertzianSinterNormalSpecies * getSpecies() const
Mdouble getEffectiveRadius() const
Returns a Mdouble to the effective radius of the interaction. (Not corrected for the overlap) ...
Mdouble getLoadingModulus() const
Returns the loading stiffness of the linear plastic-viscoelastic normal force.
InteractionHandler * getHandler() const
Gets a point to the interaction handlers to which this interaction belongs.
virtual std::string getBaseName() const
Returns the name of the interaction.
Mdouble getDissipation() const
Allows the normal dissipation to be accessed.
const Vec3D & getRelativeVelocity() const
Returns a constant reference to a vector of relative velocity.
double Mdouble
void setRelativeVelocity(Vec3D relativeVelocity)
set the relative velocity of the current of the interactions.
virtual void read(std::istream &is)
Interaction read function, which accepts an std::istream as input.
void setForce(Vec3D force)
set total force (this is used by the normal force, tangential forces are added use addForce) ...
static Mdouble dot(const Vec3D &a, const Vec3D &b)
Calculates the dot product of two Vec3D: .
Definition: Vector.cc:167
void setNormalRelativeVelocity(Mdouble normalRelativeVelocit)
set the normal component of the relative velocity.
T square(T val)
squares a number
Definition: ExtendedMath.h:91
Stores information about interactions between two interactable objects; often particles but could be ...
Mdouble getSinterRate() const
Allows the normal dissipation to be accessed.
virtual ~HertzianSinterInteraction()
Destructor.
const Vec3D & getContactPoint() const
Gets constant reference to contact point (vector).
Mdouble getNormalRelativeVelocity() const
Returns a double which is the norm (length) of the relative velocity vector.
Mdouble getElasticEnergy() const
Computes and returns the amount of elastic energy stored in the spring.
const BaseSpecies * getBaseSpecies() const
Return a constant point to BaseSpecies of the interaction.
virtual void write(std::ostream &os) const
Interaction write function, which accepts an std::ostream as input.
Mdouble getCohesionModulus() const
Returns the cohesive stiffness of the linear plastic-viscoelastic normal force.
void computeNormalForce()
Calls computeSinterForce().
const Vec3D & getNormal() const
Gets the normal vector between the two interacting objects.
void setTorque(Vec3D torque)
set the total force (this is used by the normal force, tangential torques are added use addTorque) ...
HertzianSinterNormalSpecies contains the parameters used to describe a plastic-cohesive normal force ...
Computes normal forces in case of a linear plastic visco-elastic interaction.
void computeSinterForce()
Creates a copy of an object of this class. (Deep copy)
Mdouble getOverlap() const
Returns a Mdouble with the current overlap between the two interacting objects.
void setAbsoluteNormalForce(Mdouble absoluteNormalForce)
the absolute values of the norm (length) of the normal force
BaseInteractable * getI()
virtual void read(std::istream &is)
Interaction read function, which accepts an std::istream as input.
Defines the basic properties that a interactable object can have.
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
Mdouble getTimeStep() const
Allows the time step dt to be accessed.
Definition: DPMBase.cc:465
virtual void write(std::ostream &os) const
Interaction print function, which accepts an std::ostream as input.
Mdouble getTime() const
Access function for the time.
Definition: DPMBase.cc:169
HertzianSinterInteraction(BaseInteractable *P, BaseInteractable *I, Mdouble timeStamp)
Constructor.
Mdouble getUnloadingModulusMax() const
Returns the maximum unloading stiffness of the linear plastic-viscoelastic normal force...
Mdouble getPenetrationDepthMax() const
Returns the maximum penetration depth of the linear plastic-viscoelastic normal force.