MercuryDPM  Trunk
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
MindlinSpecies.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 #include <cmath>
28 #include "MindlinSpecies.h"
30 #include "Species/BaseSpecies.h"
32 
33 class BaseParticle;
34 
35 class BaseInteractable;
36 
38 {
42  shearModulus_ = 0;
43 #ifdef DEBUG_CONSTRUCTOR
44  std::cout<<"MindlinSpecies::MindlinSpecies() finished"<<std::endl;
45 #endif
46 }
47 
52 {
57 #ifdef DEBUG_CONSTRUCTOR
58  std::cout<<"MindlinSpecies::MindlinSpecies(const MindlinSpecies &p) finished"<<std::endl;
59 #endif
60 }
61 
63 {
64 #ifdef DEBUG_DESTRUCTOR
65  std::cout<<"MindlinSpecies::~MindlinSpecies() finished"<<std::endl;
66 #endif
67 }
68 
73 void MindlinSpecies::write(std::ostream& os) const
74 {
75  //BaseSpecies::write(os);
76  os << " slidingDissipation " << slidingDissipation_;
77  os << " slidingFrictionCoefficient " << slidingFrictionCoefficient_;
78  os << " slidingFrictionCoefficientStatic " << slidingFrictionCoefficientStatic_;
79  os << " shearModulus " << shearModulus_;
80 }
81 
85 void MindlinSpecies::read(std::istream& is)
86 {
87  //BaseSpecies::read(is);
88  std::string dummy;
89  is >> dummy >> slidingDissipation_;
90  is >> dummy >> slidingFrictionCoefficient_;
91  is >> dummy >> slidingFrictionCoefficientStatic_;
92  is >> dummy >> shearModulus_;
93 }
94 
98 std::string MindlinSpecies::getBaseName() const
99 {
100  return "Mindlin";
101 }
102 
103 
106 {
107  if (new_dispt >= 0)
108  slidingDissipation_ = new_dispt;
109  else
110  {
111  std::cerr << "Error in setSlidingDissipation" << std::endl;
112  exit(-1);
113  }
114 }
115 
118 {
119  return slidingDissipation_;
120 }
121 
123 //mu has to be set to allow tangential forces (sets dispt=disp as default)
125 {
126  if (new_mu >= 0)
127  {
130  }
131  else
132  {
133  std::cerr << "Error in setSlidingFrictionCoefficient" << std::endl;
134  exit(-1);
135  }
136 }
137 
140 {
142 }
143 
146 {
147  if (new_mu >= 0)
148  {
150  }
151  else
152  {
153  std::cerr << "Error in setSlidingFrictionCoefficientStatic" << std::endl;
154  exit(-1);
155  }
156 }
157 
160 {
161  auto hertz = dynamic_cast<HertzianViscoelasticNormalSpecies*>(getBaseSpecies());
162  logger.assert(hertz, "setPoissonRatio only works with HertzianViscoelastic*Species.");
163  shearModulus_ = hertz->getEffectiveElasticModulus() / 2 * (1 + poissonRatio);
164  logger(INFO, "Effective shear modulus set to %, based on effective elastic modulus % and Poisson's ratio %",
166  hertz->getEffectiveElasticModulus(), poissonRatio);
167 }
168 
170 //Mdouble MindlinSpecies::getPoissonRatio() const
171 //{
172 // auto hertz = dynamic_cast<HertzianViscoelasticNormalSpecies*>(getBaseSpecies());
173 // logger.assert(hertz, "getPoissonRatio only works with HertzianViscoelastic*Species.");
174 // return 2. * shearModulus_ / hertz->getEffectiveElasticModulus() - 1;
175 //}
176 
179 {
180  logger.assert(shearModulus > 0,
181  "setEffectiveShearModulus(%): value needs to be positive",shearModulus);
182  shearModulus_ = shearModulus;
183 }
184 
187 {
188  return shearModulus_;
189 }
190 
193 {
195 }
196 
204 {
205  return true;
206 }
207 
214 void MindlinSpecies::mix(MindlinSpecies* const SFrictional, MindlinSpecies* const TFrictional)
215 {
220 }
221 
Mdouble getSlidingDissipation() const
Allows the tangential viscosity to be accessed.
Mdouble slidingDissipation_
tangential dissipation coefficient.
void write(std::ostream &os) const
Writes the species properties to an output stream.
Mdouble getSlidingFrictionCoefficient() const
Allows the (dynamic) Coulomb friction coefficient to be accessed.
void mix(MindlinSpecies *S, MindlinSpecies *T)
creates default values for mixed species
Mdouble getEffectiveShearModulus() const
Allows the shear modulus to be accessed.
BaseSpecies * getBaseSpecies() const
Definition: BaseForce.h:35
Logger< MERCURY_LOGLEVEL > logger("MercuryKernel")
double Mdouble
Definition: GeneralDefine.h:34
void read(std::istream &is)
Reads the species properties from an input stream.
Mdouble getSlidingFrictionCoefficientStatic() const
Allows the static Coulomb friction coefficient to be accessed.
MERCURY_DEPRECATED void setPoissonRatio(Mdouble poissonRatio)
Allows the poisson ratio to be changed.
MindlinSpecies contains the parameters used to describe sliding friction.
Mdouble slidingFrictionCoefficient_
(dynamic) Coulomb friction coefficient
void setSlidingFrictionCoefficient(Mdouble new_mu)
Allows the (dynamic) Coulomb friction coefficient to be changed; also sets mu_s by default...
virtual std::string getBaseName() const
Used in Species::getName to obtain a unique name for each Species.
static Mdouble average(Mdouble a, Mdouble b)
Returns the harmonic mean of two variables.
Definition: BaseSpecies.cc:110
Mdouble slidingFrictionCoefficientStatic_
static Coulomb friction coefficient (by default set equal to mu)
~MindlinSpecies()
The default destructor.
void setSlidingDissipation(Mdouble new_dispt)
Allows the tangential viscosity to be changed.
void setEffectiveShearModulus(Mdouble shearModulus)
allows the shear modulus to be changed
Mdouble shearModulus_
tangential spring constant
Defines the basic properties that a interactable object can have.
HertzianViscoelasticNormalSpecies contains the parameters used to describe a Hertzian normal force (T...
void setSlidingFrictionCoefficientStatic(Mdouble new_mu)
Allows the static Coulomb friction coefficient to be changed.
MindlinSpecies()
The default constructor.
bool getUseAngularDOFs() const override
Returns true if torques have to be calculated.