MercuryDPM  Beta
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
LinearPlasticViscoelasticNormalSpecies.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 
29 
30 class BaseParticle;
31 class BaseInteractable;
32 
34 {
35  loadingStiffness_ = 0.0;
37  cohesionStiffness_ = 0.0;
39  dissipation_ = 0.0;
40 #ifdef DEBUG_CONSTRUCTOR
41  std::cout<<"LinearPlasticViscoelasticNormalSpecies::LinearPlasticViscoelasticNormalSpecies() finished"<<std::endl;
42 #endif
43 }
44 
49 {
55 #ifdef DEBUG_CONSTRUCTOR
56  std::cout<<"LinearPlasticViscoelasticNormalSpecies::LinearPlasticViscoelasticNormalSpecies(const LinearPlasticViscoelasticNormalSpecies &p) finished"<<std::endl;
57 #endif
58 }
59 
61 {
62 #ifdef DEBUG_DESTRUCTOR
63  std::cout<<"LinearPlasticViscoelasticNormalSpecies::~LinearPlasticViscoelasticNormalSpecies() finished"<<std::endl;
64 #endif
65 }
66 
71 {
72  os << " loadingStiffness " << loadingStiffness_;
73  os << " maxUnloadingStiffness " << unloadingStiffnessMax_;
74  os << " cohesionStiffness " << cohesionStiffness_;
75  os << " maxPenetration " << penetrationDepthMax_;
76  os << " dissipation " << dissipation_;
77 }
78 
83 {
84  std::string dummy;
85  is >> dummy >> loadingStiffness_;
86  is >> dummy >> unloadingStiffnessMax_;
87  is >> dummy >> cohesionStiffness_;
88  is >> dummy >> penetrationDepthMax_;
89  is >> dummy >> dissipation_;
90 }
91 
96 {
97  return "LinearPlasticViscoelastic";
98 }
99 
106 {
112 }
113 
120 void LinearPlasticViscoelasticNormalSpecies::setPlasticParameters (Mdouble loadingStiffness, Mdouble unloadingStiffnessMax, Mdouble cohesionStiffness, Mdouble penetrationDepthMax)
121 {
122  if (loadingStiffness <= 0 || unloadingStiffnessMax < loadingStiffness || cohesionStiffness < 0 || penetrationDepthMax < 0 || penetrationDepthMax > 1)
123  {
124  std::cerr << "Error: arguments of setPlasticParameters do not make sense" << std::endl;
125  exit(-1);
126  }
127  setLoadingStiffness(loadingStiffness);
128  setUnloadingStiffnessMax(unloadingStiffnessMax);
129  setCohesionStiffness(cohesionStiffness);
130  setPenetrationDepthMax(penetrationDepthMax);
131 }
132 
137 {
138  return loadingStiffness_;
139 }
140 
145 {
146  return unloadingStiffnessMax_;
147 }
148 
153 {
154  return cohesionStiffness_;
155 }
156 
161 {
162  return penetrationDepthMax_;
163 }
164 
169 {
170  loadingStiffness_ = loadingStiffness;
171 }
172 
177 {
178  unloadingStiffnessMax_ = unloadingStiffnessMax;
179 }
180 
185 {
186  cohesionStiffness_ = cohesionStiffness;
187 }
188 
193 {
194  penetrationDepthMax_ = penetrationDepthMax;
195 }
196 
202 {
203  return 0.02 * constants::pi / std::sqrt(unloadingStiffnessMax_ / (.5 * mass) - mathsFunc::square(dissipation_ /mass));
204 }
205 
211 {
212  if (dissipation >= 0)
213  {
214  dissipation_ = dissipation;
215  }
216  else
217  {
218  std::cerr << "Error in setDissipation(" << dissipation << ")" << std::endl;
219  exit(-1);
220  }
221 }
222 
227 {
228  setLoadingStiffness(new_.k);
229  setDissipation(new_.disp);
230 }
231 
236 {
237  return dissipation_;
238 }
239 
247 {
248  dissipation_ = -mass / tc * std::log(eps);
251 }
void setCohesionStiffness(Mdouble cohesionStiffness)
Sets the cohesive stiffness of the linear plastic-viscoelastic normal force.
return type specifically for fuctions returning k and disp at once
Definition: Helpers.h:39
Mdouble getUnloadingStiffnessMax() const
Returns the maximum unloading stiffness of the linear plastic-viscoelastic normal force...
double Mdouble
MERCURY_DEPRECATED void setLoadingStiffnessAndDissipation(helpers::KAndDisp new_)
Allows the spring and dissipation constants to be changed simultaneously.
T square(T val)
squares a number
Definition: ExtendedMath.h:91
Mdouble cohesionStiffness_
the adhesive spring constant (k^c) for plastic deformations
Mdouble penetrationDepthMax_
the depth (relative to the normalized radius) at which k_2^max is used (phi_f)
void setPenetrationDepthMax(Mdouble penetrationDepthMax)
Sets the maximum penetration depth of the linear plastic-viscoelastic normal force.
Mdouble getCohesionStiffness() const
Returns the cohesive stiffness of the linear plastic-viscoelastic normal force.
Mdouble computeTimeStep(Mdouble mass)
Returns the optimal time step to resolve a collision of two particles of a given mass.
Mdouble disp
Definition: Helpers.h:43
Mdouble unloadingStiffnessMax_
the maximum elastic constant (k_2^max) for plastic deformations
const Mdouble pi
Definition: ExtendedMath.h:42
Mdouble average(Mdouble a, Mdouble b)
defines the average of two variables by the harmonic mean.
Definition: BaseSpecies.cc:85
void setCollisionTimeAndRestitutionCoefficient(Mdouble tc, Mdouble eps, Mdouble mass)
Set k, disp such that is matches a given tc and eps for a collision of two different masses...
Mdouble getDissipation() const
Allows the normal dissipation to be accessed.
void setLoadingStiffness(Mdouble loadingStiffness)
Sets the loading stiffness of the linear plastic-viscoelastic normal force.
void setDissipation(Mdouble dissipation)
Sets the linear dissipation coefficient of the linear plastic-viscoelastic normal force...
void mix(LinearPlasticViscoelasticNormalSpecies *const S, LinearPlasticViscoelasticNormalSpecies *const T)
creates default values for mixed species
Mdouble loadingStiffness_
(normal) spring constant (k_1)
void setPlasticParameters(Mdouble loadingStiffness, Mdouble unloadingStiffnessMax, Mdouble cohesionStiffness, Mdouble penetrationDepthMax)
Sets all parameters of the linear plastic-viscoelastic normal force at once.
Defines the basic properties that a interactable object can have.
LinearPlasticViscoelasticNormalSpecies contains the parameters used to describe a plastic-cohesive no...
std::string getBaseName() const
Used in Species::getName to obtain a unique name for each Species.
Mdouble getPenetrationDepthMax() const
Returns the maximum penetration depth of the linear plastic-viscoelastic normal force.
virtual ~LinearPlasticViscoelasticNormalSpecies()
The default destructor.
void setUnloadingStiffnessMax(Mdouble unloadingStiffnessMax)
Sets the maximum unloading stiffness of the linear plastic-viscoelastic normal force.
void write(std::ostream &os) const
Writes the species properties to an output stream.
void read(std::istream &is)
Reads the species properties from an input stream.
Mdouble getLoadingStiffness() const
Returns the loading stiffness of the linear plastic-viscoelastic normal force.