MercuryDPM  Alpha
 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-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 #include "BaseHandler.h"
31 #include <assert.h>
32 class BaseParticle;
33 class BaseInteractable;
34 
36 {
37  loadingModulus_ = 0.0;
39  cohesionModulus_ = 0.0;
41  dissipation_ = 0.0;
42  sinterRate_ = 0.0;
43 #ifdef DEBUG_CONSTRUCTOR
44  std::cout<<"HertzianSinterNormalSpecies::HertzianSinterNormalSpecies() finished"<<std::endl;
45 #endif
46 }
47 
52 {
59 #ifdef DEBUG_CONSTRUCTOR
60  std::cout<<"HertzianSinterNormalSpecies::HertzianSinterNormalSpecies(const HertzianSinterNormalSpecies &p) finished"<<std::endl;
61 #endif
62 }
63 
65 {
66 #ifdef DEBUG_DESTRUCTOR
67  std::cout<<"HertzianSinterNormalSpecies::~HertzianSinterNormalSpecies() finished"<<std::endl;
68 #endif
69 }
70 
74 void HertzianSinterNormalSpecies::write(std::ostream& os) const
75 {
76  os << " loadingModulus " << loadingModulus_;
77  os << " maxUnloadingModulus " << unloadingModulusMax_;
78  os << " cohesionModulus " << cohesionModulus_;
79  os << " maxPenetration " << penetrationDepthMax_;
80  os << " dissipation " << dissipation_;
81  os << " sinterRate " << sinterRate_;
82 }
83 
87 void HertzianSinterNormalSpecies::read(std::istream& is)
88 {
89  std::string dummy;
90  is >> dummy >> loadingModulus_;
91  is >> dummy >> unloadingModulusMax_;
92  is >> dummy >> cohesionModulus_;
93  is >> dummy >> penetrationDepthMax_;
94  is >> dummy >> dissipation_;
95  is >> dummy >> sinterRate_;
96 }
97 
102 {
103  return "HertzianSinter";
104 }
105 
112 {
119 }
120 
127 void HertzianSinterNormalSpecies::setPlasticParameters (Mdouble loadingModulus, Mdouble unloadingModulusMax, Mdouble cohesionModulus, Mdouble penetrationDepthMax)
128 {
129  if (loadingModulus <= 0 || unloadingModulusMax <= 1.000001*(loadingModulus+cohesionModulus) || cohesionModulus < 0 || penetrationDepthMax < 0)
130  {
131  std::cerr << "Error: arguments of setPlasticParameters do not make sense" << std::endl;
132  exit(-1);
133  }
134  setLoadingModulus(loadingModulus);
135  setUnloadingModulusMax(unloadingModulusMax);
136  setCohesionModulus(cohesionModulus);
137  setPenetrationDepthMax(penetrationDepthMax);
138 }
139 
144 {
145  return loadingModulus_;
146 }
147 
152 {
153  return unloadingModulusMax_;
154 }
155 
160 {
161  return cohesionModulus_;
162 }
163 
168 {
169  return penetrationDepthMax_;
170 }
171 
176 {
177  loadingModulus_ = loadingModulus;
178 }
179 
184 {
185  unloadingModulusMax_ = unloadingModulusMax;
186 }
187 
192 {
193  cohesionModulus_ = cohesionModulus;
194 }
195 
200 {
201  penetrationDepthMax_ = penetrationDepthMax;
202 }
203 
209 {
210 // if (stiffnessMax / (.5 * mass) < mathsFunc::square(dissipation_ /mass)) {
211 // std::cerr << "Dissipation too high; max. allowed " << sqrt(2.0 * stiffnessMax * mass) << std::endl;
212 // return 0.02 * constants::pi / std::sqrt(2.0*stiffnessMax / mass);
213 // } else {
214  std::cerr << "Warning: Dissipation is not taken into account when computing the time step" << std::endl;
215  ParticleSpecies* p=dynamic_cast<ParticleSpecies*>(this);
216  assert(p);
217  Mdouble radius = cbrt(mass*3./(4.*constants::pi*p->getDensity()));
218  return 0.02 * constants::pi / std::sqrt(2.0*getUnloadingModulusMax()*getPenetrationDepthMax()*radius / mass);
219 }
220 
226 {
227  if (dissipation >= 0)
228  {
229  dissipation_ = dissipation;
230  }
231  else
232  {
233  std::cerr << "Error in setDissipation(" << dissipation << ")" << std::endl;
234  exit(-1);
235  }
236 }
237 
243 {
244  if (sinterRate >= 0)
245  {
246  sinterRate_ = sinterRate;
247  }
248  else
249  {
250  std::cerr << "Error in setSinterRate(" << sinterRate << ")" << std::endl;
251  exit(-1);
252  }
253 }
254 
259 {
260  return dissipation_;
261 }
262 
267 {
268  return sinterRate_;
269 }
HertzianSinterNormalSpecies()
The default constructor.
Mdouble getLoadingModulus() const
Returns the loading stiffness of the linear plastic-viscoelastic normal force.
virtual ~HertzianSinterNormalSpecies()
The default destructor.
Mdouble computeTimeStep(Mdouble mass)
Returns the optimal time step to resolve a collision of two particles of a given mass.
Mdouble dissipation_
linear dissipation coefficient
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 mix(HertzianSinterNormalSpecies *const S, HertzianSinterNormalSpecies *const T)
creates default values for mixed species
double Mdouble
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:42
Mdouble getCohesionModulus() const
Returns the cohesive stiffness of the linear plastic-viscoelastic normal force.
Mdouble average(Mdouble a, Mdouble b)
defines the average of two variables by the harmonic mean.
Definition: BaseSpecies.cc:85
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.
#define assert(e,...)
Definition: Logger.h:584
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)