MercuryDPM  Trunk
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
HertzianSinterNormalSpecies.cc
Go to the documentation of this file.
1 //Copyright (c) 2013-2020, 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 
29 #include "BaseHandler.h"
31 //#include <cassert>
32 
33 class BaseParticle;
34 
35 class BaseInteractable;
36 
38  : BaseNormalForce()
39 {
40  loadingModulus_ = 0.0;
42  cohesionModulus_ = 0.0;
44  dissipation_ = 0.0;
45  sinterRate_ = 0.0;
46 #ifdef DEBUG_CONSTRUCTOR
47  std::cout<<"HertzianSinterNormalSpecies::HertzianSinterNormalSpecies() finished"<<std::endl;
48 #endif
49 }
50 
55  : BaseNormalForce(p)
56 {
63 #ifdef DEBUG_CONSTRUCTOR
64  std::cout<<"HertzianSinterNormalSpecies::HertzianSinterNormalSpecies(const HertzianSinterNormalSpecies &p) finished"<<std::endl;
65 #endif
66 }
67 
69 {
70 #ifdef DEBUG_DESTRUCTOR
71  std::cout<<"HertzianSinterNormalSpecies::~HertzianSinterNormalSpecies() finished"<<std::endl;
72 #endif
73 }
74 
78 void HertzianSinterNormalSpecies::write(std::ostream& os) const
79 {
80  os << " loadingModulus " << loadingModulus_;
81  os << " maxUnloadingModulus " << unloadingModulusMax_;
82  os << " cohesionModulus " << cohesionModulus_;
83  os << " maxPenetration " << penetrationDepthMax_;
84  os << " dissipation " << dissipation_;
85  os << " sinterRate " << sinterRate_;
86 }
87 
91 void HertzianSinterNormalSpecies::read(std::istream& is)
92 {
93  std::string dummy;
94  is >> dummy >> loadingModulus_;
95  is >> dummy >> unloadingModulusMax_;
96  is >> dummy >> cohesionModulus_;
97  is >> dummy >> penetrationDepthMax_;
98  is >> dummy >> dissipation_;
99  is >> dummy >> sinterRate_;
100 }
101 
106 {
107  return "HertzianSinter";
108 }
109 
116 {
123 }
124 
131 void HertzianSinterNormalSpecies::setPlasticParameters(Mdouble loadingModulus, Mdouble unloadingModulusMax,
132  Mdouble cohesionModulus, Mdouble penetrationDepthMax)
133 {
134  if (loadingModulus <= 0 || unloadingModulusMax <= 1.000001 * (loadingModulus + cohesionModulus) ||
135  cohesionModulus < 0 || penetrationDepthMax < 0)
136  {
137  std::cerr << "Error: arguments of setPlasticParameters do not make sense" << std::endl;
138  exit(-1);
139  }
140  setLoadingModulus(loadingModulus);
141  setUnloadingModulusMax(unloadingModulusMax);
142  setCohesionModulus(cohesionModulus);
143  setPenetrationDepthMax(penetrationDepthMax);
144 }
145 
150 {
151  return loadingModulus_;
152 }
153 
158 {
159  return unloadingModulusMax_;
160 }
161 
166 {
167  return cohesionModulus_;
168 }
169 
174 {
175  return penetrationDepthMax_;
176 }
177 
182 {
183  loadingModulus_ = loadingModulus;
184 }
185 
190 {
191  unloadingModulusMax_ = unloadingModulusMax;
192 }
193 
198 {
199  cohesionModulus_ = cohesionModulus;
200 }
201 
206 {
207  penetrationDepthMax_ = penetrationDepthMax;
208 }
209 
215 {
216 // if (stiffnessMax / (.5 * mass) < mathsFunc::square(dissipation_ /mass)) {
217 // std::cerr << "Dissipation too high; max. allowed " << sqrt(2.0 * stiffnessMax * mass) << std::endl;
218 // return 0.02 * constants::pi / std::sqrt(2.0*stiffnessMax / mass);
219 // } else {
220  std::cerr << "Warning: Dissipation is not taken into account when computing the time step" << std::endl;
221  ParticleSpecies* p = dynamic_cast<ParticleSpecies*>(getBaseSpecies());
222  logger.assert(p,"Empty particle handler");
223  Mdouble radius = cbrt(mass * 3. / (4. * constants::pi * p->getDensity()));
224  return 0.02 * constants::pi / std::sqrt(2.0 * getUnloadingModulusMax() * getPenetrationDepthMax() * radius / mass);
225 }
226 
232 {
233  if (dissipation >= 0)
234  {
235  dissipation_ = dissipation;
236  }
237  else
238  {
239  std::cerr << "Error in setDissipation(" << dissipation << ")" << std::endl;
240  exit(-1);
241  }
242 }
243 
249 {
250  if (sinterRate >= 0)
251  {
252  sinterRate_ = sinterRate;
253  }
254  else
255  {
256  std::cerr << "Error in setSinterRate(" << sinterRate << ")" << std::endl;
257  exit(-1);
258  }
259 }
260 
265 {
266  return dissipation_;
267 }
268 
273 {
274  return sinterRate_;
275 }
HertzianSinterNormalSpecies()
The default constructor.
Mdouble getLoadingModulus() const
Returns the loading stiffness of the linear plastic-viscoelastic normal force.
BaseSpecies * getBaseSpecies() const
Definition: BaseForce.h:35
~HertzianSinterNormalSpecies()
The default destructor.
Mdouble computeTimeStep(Mdouble mass)
Returns the optimal time step to resolve a collision of two particles of a given mass.
Logger< MERCURY_LOGLEVEL > logger("MercuryKernel")
Mdouble dissipation_
linear dissipation coefficient
double Mdouble
Definition: GeneralDefine.h:34
void write(std::ostream &os) const
Writes the species properties to an output stream.
Mdouble unloadingModulusMax_
the maximum elastic constant (k_2^max) for plastic deformations
Mdouble getDissipation() const
Allows the normal dissipation to be accessed.
void setPenetrationDepthMax(Mdouble penetrationDepthMax)
Sets the maximum penetration depth of the linear plastic-viscoelastic normal force.
Mdouble getSinterRate() const
Allows the normal dissipation to be accessed.
std::string getBaseName() const
Used in Species::getName to obtain a unique name for each Species.
const Mdouble pi
Definition: ExtendedMath.h:45
Mdouble getCohesionModulus() const
Returns the cohesive stiffness of the linear plastic-viscoelastic normal force.
static Mdouble average(Mdouble a, Mdouble b)
Returns the harmonic mean of two variables.
Definition: BaseSpecies.cc:110
void mix(HertzianSinterNormalSpecies *S, HertzianSinterNormalSpecies *T)
creates default values for mixed species
void setSinterRate(Mdouble sinterRate)
Sets the linear dissipation coefficient of the linear plastic-viscoelastic normal force...
HertzianSinterNormalSpecies contains the parameters used to describe a plastic-cohesive normal force ...
void setCohesionModulus(Mdouble cohesionModulus)
Sets the cohesive stiffness of the linear plastic-viscoelastic normal force.
void read(std::istream &is)
Reads the species properties from an input stream.
void setLoadingModulus(Mdouble loadingModulus)
Sets the loading stiffness of the linear plastic-viscoelastic normal force.
Mdouble cohesionModulus_
the adhesive spring constant (k^c) for plastic deformations
Defines the basic properties that a interactable object can have.
Mdouble getDensity() const
Allows density_ to be accessed.
void setDissipation(Mdouble dissipation)
Sets the linear dissipation coefficient of the linear plastic-viscoelastic normal force...
Mdouble loadingModulus_
(normal) spring constant (k_1)
void setPlasticParameters(Mdouble loadingModulus, Mdouble unloadingModulusMax, Mdouble cohesionModulus, Mdouble penetrationDepthMax)
Sets all parameters of the linear plastic-viscoelastic normal force at once.
Mdouble getUnloadingModulusMax() const
Returns the maximum unloading stiffness of the linear plastic-viscoelastic normal force...
void setUnloadingModulusMax(Mdouble unloadingModulusMax)
Sets 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.
Mdouble penetrationDepthMax_
the depth (relative to the normalized radius) at which k_2^max is used (phi_f)