MercuryDPM  Alpha
 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-2017, 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>
27 #include "MindlinSpecies.h"
29 #include "Species/BaseSpecies.h"
31 
32 class BaseParticle;
33 class BaseInteractable;
34 
36 {
40  //k_edit
41  //setting the shear modulus to have a default value of zero, in-keeping with the other parameters...
42  shearModulus_ = 0;
43  //...and the same for K_t0
44 #ifdef DEBUG_CONSTRUCTOR
45  std::cout<<"MindlinSpecies::MindlinSpecies() finished"<<std::endl;
46 #endif
47 }
48 
53 {
57  //k_edit
58  //setting the shear modulus to the value of 's', in-keeping with the other parameters...
60 #ifdef DEBUG_CONSTRUCTOR
61  std::cout<<"MindlinSpecies::MindlinSpecies(const MindlinSpecies &p) finished"<<std::endl;
62 #endif
63 }
64 
66 {
67 #ifdef DEBUG_DESTRUCTOR
68  std::cout<<"MindlinSpecies::~MindlinSpecies() finished"<<std::endl;
69 #endif
70 }
71 
76 void MindlinSpecies::write(std::ostream& os) const
77  {
78  //BaseSpecies::write(os);
79  os << " shearModulus " << shearModulus_;
80  os << " slidingDissipation " << slidingDissipation_;
81  os << " slidingFrictionCoefficient " << slidingFrictionCoefficient_;
82  os << " slidingFrictionCoefficientStatic " << slidingFrictionCoefficientStatic_;
83 }
84 
88 void MindlinSpecies::read(std::istream& is)
89 {
90  //BaseSpecies::read(is);
91  std::string dummy;
92  is >> dummy >> shearModulus_;
93  is >> dummy >> slidingDissipation_;
94  is >> dummy >> slidingFrictionCoefficient_;
95  is >> dummy >> slidingFrictionCoefficientStatic_;
96 }
97 
101 std::string MindlinSpecies::getBaseName() const
102 {
103  return "Mindlin";
104 }
105 
106 
107 
110 {
111  if (new_dispt >= 0)
112  slidingDissipation_ = new_dispt;
113  else
114  {
115  std::cerr << "Error in setSlidingDissipation" << std::endl;
116  exit(-1);
117  }
118 }
121 {
122  return slidingDissipation_;
123 }
124 
126 //mu has to be set to allow tangential forces (sets dispt=disp as default)
128 {
129  if (new_mu >= 0)
130  {
133  }
134  else
135  {
136  std::cerr << "Error in setSlidingFrictionCoefficient" << std::endl;
137  exit(-1);
138  }
139 }
140 
143 {
145 }
146 
149 {
150  if (new_mu >= 0)
151  {
153  }
154  else
155  {
156  std::cerr << "Error in setSlidingFrictionCoefficientStatic" << std::endl;
157  exit(-1);
158  }
159 }
160 //k_edit
161 //allows the shear modulus to be set / changed
163  //sanity check to ensure that a negative shear modulus cannot be set!
164  if (new_G >= 0)
165  {
166  shearModulus_ = new_G;
167  }
168  else
169  {
170  std::cerr << "Error in setShearModulus" << std::endl;
171  exit(-1);
172  }
173 }
174 
175 //k_edit
176 //allows the shear modulus of a given species to be accessed
178  return shearModulus_;
179 }
180 
183 {
185 }
186 
194 {
195  return true;
196 }
197 
205 void MindlinSpecies::mix(MindlinSpecies* const SFrictional, MindlinSpecies* const TFrictional)
206 {
210 }
211 
Mdouble getSlidingDissipation() const
Allows the tangential viscosity to be accessed.
Mdouble slidingDissipation_
tangential dissipation coefficient.
Mdouble getSlidingFrictionCoefficient() const
Allows the (dynamic) Coulomb friction coefficient to be accessed.
void write(std::ostream &os) const override
Writes the species properties to an output stream.
void read(std::istream &is) override
Reads the species properties from an input stream.
Mdouble getSlidingFrictionCoefficientStatic() const
Allows the static Coulomb friction coefficient to be accessed.
void setShearModulus(Mdouble new_G)
double Mdouble
void mix(MindlinSpecies *const S, MindlinSpecies *const T)
creates default values for mixed species
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.
Mdouble average(Mdouble a, Mdouble b)
defines the average of two variables by the harmonic mean.
Definition: BaseSpecies.cc:85
Mdouble slidingFrictionCoefficientStatic_
static Coulomb friction coefficient (by default set equal to mu)
virtual ~MindlinSpecies()
The default destructor.
Mdouble getShearModulus() const
void setSlidingDissipation(Mdouble new_dispt)
Allows the tangential viscosity to be changed.
Mdouble shearModulus_
Defines the basic properties that a interactable object can have.
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.