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  logger(ERROR, "Error in setSlidingDissipation");
112  }
113 }
114 
117 {
118  return slidingDissipation_;
119 }
120 
122 //mu has to be set to allow tangential forces (sets dispt=disp as default)
124 {
125  if (new_mu >= 0)
126  {
129  }
130  else
131  {
132  logger(ERROR, "Error in setSlidingFrictionCoefficient");
133  }
134 }
135 
138 {
140 }
141 
144 {
145  if (new_mu >= 0)
146  {
148  }
149  else
150  {
151  logger(ERROR, "Error in setSlidingFrictionCoefficientStatic");
152  }
153 }
154 
157 {
158  auto hertz = dynamic_cast<HertzianViscoelasticNormalSpecies*>(getBaseSpecies());
159  logger.assert_debug(hertz, "setPoissonRatio only works with HertzianViscoelastic*Species.");
160  shearModulus_ = hertz->getEffectiveElasticModulus() / 2 * (1 + poissonRatio);
161  logger(INFO, "Effective shear modulus set to %, based on effective elastic modulus % and Poisson's ratio %",
163  hertz->getEffectiveElasticModulus(), poissonRatio);
164 }
165 
167 //Mdouble MindlinSpecies::getPoissonRatio() const
168 //{
169 // auto hertz = dynamic_cast<HertzianViscoelasticNormalSpecies*>(getBaseSpecies());
170 // logger.assert_debug(hertz, "getPoissonRatio only works with HertzianViscoelastic*Species.");
171 // return 2. * shearModulus_ / hertz->getEffectiveElasticModulus() - 1;
172 //}
173 
176 {
177  logger.assert_debug(shearModulus > 0,
178  "setEffectiveShearModulus(%): value needs to be positive",shearModulus);
179  shearModulus_ = shearModulus;
180 }
181 
184 {
185  return shearModulus_;
186 }
187 
190 {
192 }
193 
201 {
202  return true;
203 }
204 
211 void MindlinSpecies::mix(MindlinSpecies* const SFrictional, MindlinSpecies* const TFrictional)
212 {
217 }
218 
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")
Definition of different loggers with certain modules. A user can define its own custom logger here...
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.