GranOO  3.0
A robust and versatile workbench to build 3D dynamic simulations based on the Discrete Element Method
HertzSpring.hpp
Go to the documentation of this file.
1 // This file is part of GranOO, a workbench for DEM simulation.
2 //
3 // Author(s) : - Damien Andre IRCER/UNILIM, Limoges France
4 // <damien.andre@unilim.fr>
5 // - Jean-luc Charles Arts et Metiers ParisTech, CNRS, I2M, Bordeaux France
6 // <jean-luc.charles@ensam.eu>
7 // - Jeremie Girardot Arts et Metiers ParisTech, CNRS, I2M, Bordeaux France
8 // <jeremie.girardot@ensam.eu>
9 // - Cedric Hubert LAMIH/UPHF, Valenciennes France
10 // <cedric.hubert@uphf.fr>
11 // - Ivan Iordanoff Arts et Metiers ParisTech, CNRS, I2M, Bordeaux France
12 // <ivan.iordanoff@ensam.eu>
13 //
14 // Copyright (C) 2008-2019 D. Andre, JL. Charles, J. Girardot, C. Hubert, I. Iordanoff
15 //
16 // This program is free software: you can redistribute it and/or modify
17 // it under the terms of the GNU General Public License as published by
18 // the Free Software Foundation, either version 3 of the License, or
19 // (at your option) any later version.
20 //
21 // This program is distributed in the hope that it will be useful,
22 // but WITHOUT ANY WARRANTY; without even the implied warranty of
23 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 // GNU General Public License for more details.
25 //
26 // You should have received a copy of the GNU General Public License
27 // along with this program. If not, see <http://www.gnu.org/licenses/>.
28 
29 #ifndef _libDEM_HertzSpring_hpp_
30 #define _libDEM_HertzSpring_hpp_
31 
32 #include <string>
33 #include <vector>
34 
35 #include "GranOO3/DEM/Bond.hpp"
36 #include "GranOO3/Core/SetOf.hpp"
37 #include "GranOO3/DEM/Element.hpp"
38 #include "GranOO3/Geom/Point.hpp"
39 
40 namespace GranOO3
41 {
42  namespace DEM
43  {
44  class HertzSpring : public Bond,
45  public Core::Register<HertzSpring>,
47 
48  GRANOO_CLASS(DEM::HertzSpring, Bond);
49 
50  public:
51  //CONSTRUCTORS & DESTRUCTORS
52  HertzSpring(Element& el1, Element& el2);
53  HertzSpring(Element& el1, Element& el2, double young_modulus, double poisson_ratio);
54  virtual ~HertzSpring();
55 
56  //USEFULL
57  void init();
58  void process();
59  virtual void update();
60  virtual void compute_load();
61  virtual double get_linear_stiffness() const;
62  virtual double get_angular_stiffness() const;
63  virtual double compute_critical_time_step() const;
64  virtual std::string info() const;
65 
66  //ACCESSORS
67  GRANOO_ACCESS (stiffness , double , _stiffness );
68  GRANOO_ACCESS (young_modulus , double , _young_modulus );
69  GRANOO_ACCESS_GET(poisson_ratio , double , _poisson_ratio );
70  GRANOO_ACCESS_GET(direction , Geom::Vector , _direction );
71  GRANOO_ACCESS_GET(force , Geom::Vector , _force );
72  GRANOO_ACCESS_GET(equivalent_radius, double , _equivalent_radius );
73  GRANOO_ACCESS_GET(contact_radius , double , _contact_radius );
74  GRANOO_ACCESS_GET(contact_surface , double , _contact_surface );
75 
76 
77  private:
78  HertzSpring() = delete;
79  HertzSpring(const HertzSpring&) = delete;
80  HertzSpring & operator=(const HertzSpring &) = delete;
81 
82  private:
83  // BOOST SERIALIZATION
85  template<class Archive> void serialize(Archive &, const unsigned int);
86 
87  private:
88  //Initial Parameter
91  //Parameter
95  double _stiffness;
98 
99 
100  };
101 
102  // BOOST SERIALIZATION
103  template<class Archive> void
104  HertzSpring::serialize(Archive &ar, const unsigned int version) {
105  ar & boost::serialization::base_object<Bond>(*this);
106  ar & _young_modulus;
107  ar & _poisson_ratio;
108  }
109  }
110 }
111 
112 
113 #include <boost/serialization/version.hpp>
115 
116 
117 // need placement new snippet because no default constructor exist
118 namespace boost
119 {
120  namespace serialization
121  {
122  template<class Archive>
123  inline void save_construct_data(Archive &ar, const GranOO3::DEM::HertzSpring *t, const unsigned int) {
124 
125  const GranOO3::DEM::Element *el1 = &t->get_element1();
126  const GranOO3::DEM::Element *el2 = &t->get_element2();
127  ar << el1;
128  ar << el2;
129  }
130 
131  template<class Archive>
132  inline void load_construct_data(Archive &ar, GranOO3::DEM::HertzSpring *t, const unsigned int) {
133 
134  GranOO3::DEM::Element* el1 = nullptr;
135  GranOO3::DEM::Element* el2 = nullptr;
136  ar >> el1;
137  ar >> el2;
138  ::new(t)GranOO3::DEM::HertzSpring(*el1,*el2);
139  }
140  }
141 } // namespace ...
142 
143 
144 namespace GranOO3 {
145  GRANOO_CLASS_DECLARE_TPL(DEM::HertzSpring);
146 }
147 
148 
149 #endif
150 
151 
BOOST_CLASS_VERSION(GranOO3::DEM::HertzSpring, 0) namespace boost
Definition: HertzSpring.hpp:114
Definition: SetOf.hpp:346
the base class for all bonds between discrete elements.
Definition: Bond.hpp:49
a base class that represents an element
Definition: Element.hpp:55
a bond model that represents an Hertzian contact (non linear contact)
Definition: HertzSpring.hpp:46
virtual void compute_load()
trigger the computing of the reaction force and torque
Definition: HertzSpring.cpp:107
double _equivalent_radius
the equivalent radius of the Hertz spring
Definition: HertzSpring.hpp:94
void init()
initialize the hertzspring
Definition: HertzSpring.cpp:67
Geom::Vector _direction
the current normal direction of the Hertz spring
Definition: HertzSpring.hpp:92
virtual double get_linear_stiffness() const
compute the linear stiffness of the bond
Definition: HertzSpring.cpp:114
Geom::Vector _force
the current normal force of the Hertz spring
Definition: HertzSpring.hpp:93
virtual double compute_critical_time_step() const
compute the critical time of the bond
Definition: HertzSpring.cpp:126
double _contact_surface
the contact surface of the Hertz spring
Definition: HertzSpring.hpp:97
void process()
compute the reaction force (no torque)
Definition: HertzSpring.cpp:86
virtual ~HertzSpring()
destructor
Definition: HertzSpring.cpp:63
virtual void update()
Definition: HertzSpring.cpp:75
double _stiffness
the equivalent stiffness of the Hertz spring
Definition: HertzSpring.hpp:95
HertzSpring(const HertzSpring &)=delete
virtual double get_angular_stiffness() const
similar as get_linear_stiffness() for rotation (zero for a Hertzian spring)
Definition: HertzSpring.cpp:120
HertzSpring & operator=(const HertzSpring &)=delete
double _young_modulus
the Young's modulus value of the bond in [Pa]
Definition: HertzSpring.hpp:89
double _contact_radius
the contact radius of the Hertz spring
Definition: HertzSpring.hpp:96
void serialize(Archive &, const unsigned int)
complete serializing of the bond in the *.gdd format
Definition: HertzSpring.hpp:104
friend class boost::serialization::access
Definition: HertzSpring.hpp:84
virtual std::string info() const
Display some useful info in the terminal
Definition: HertzSpring.cpp:139
double _poisson_ratio
the Poisson's ratio of the bond in [-]
Definition: HertzSpring.hpp:90
Definition: Vector.hpp:75
pure virtual class for modeling classes able to compute a critical time step
Definition: CriticalTimeStep.hpp:50
Definition: Common.hpp:198
void save_construct_data(Archive &ar, const GranOO3::Core::Pair< type > *t, const unsigned int)
Definition: Pair.hpp:207
void load_construct_data(Archive &ar, GranOO3::Core::Pair< type > *t, const unsigned int)
Definition: Pair.hpp:217
Definition: Pair.hpp:202
x y t t *t x y t t t x y t t t x *y t *t t x *y t *t t x y t t t x y t t t t(t+t)") define_sfop3(16
static char_cptr version
Definition: Exprtk.hpp:44221