GranOO  3.0
A robust and versatile workbench to build 3D dynamic simulations based on the Discrete Element Method
Beam.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 
30 #ifndef _libDEM_Beam_hpp_
31 #define _libDEM_Beam_hpp_
32 
33 #include <string>
34 #include <vector>
35 
36 
37 
38 
39 #include "GranOO3/DEM/Bond.hpp"
40 #include "GranOO3/DEM/Element.hpp"
41 #include "GranOO3/Core/SetOf.hpp"
42 
43 
44 #include "GranOO3/Geom/Point.hpp"
45 
46 namespace GranOO3
47 {
48  namespace DEM
49  {
50 
51 
52  class Beam : public Bond, public Core::Register< Beam >, public Physic::CriticalTimeStep
53  {
54 
55  GRANOO_CLASS(DEM::Beam, Bond);
56 
57  private:
58  static unsigned int _broken_beam_number;
59 
60  public:
61  static unsigned int get_broken_beam_number();
62 
63  public:
64  //CONSTRUCTORS & DESTRUCTORS
65  Beam(Element& el1, Element& el2);
66  Beam(Element& el1, Element& el2, double young_mod, double radius, double poisson_ratio, double max_stress = 0.);
67  Beam(Element& el1, Element& el2, double young_mod, double damping, double radius, double poisson_ratio, double max_stress);
68  virtual ~Beam();
69 
70  //USEFULL
71  virtual void compute_load();
72  virtual double get_linear_stiffness() const;
73  virtual double get_angular_stiffness() const;
74  virtual double compute_critical_time_step() const;
75  void update_coeff_value();
76  virtual void draw();
77  virtual std::string info() const;
78 
79  //ACCESSORS
80  GRANOO_ACCESS(young_modulus, double, _young_modulus);
81  GRANOO_ACCESS(radius , double, _radius);
82  GRANOO_ACCESS(poisson_ratio, double, _poisson_ratio);
83  GRANOO_ACCESS(max_stress , double, _max_stress);
84 
85  GRANOO_ACCESS_GET_COPY(section, double, M_PI*pow(_radius,2));
86  GRANOO_ACCESS_GET_COPY(inertia, double, M_PI*pow(_radius*2.,4)/64.);
87  GRANOO_ACCESS_GET_COPY(tensile_stiffness, double, _young_modulus*get_section()/_relaxed_length);
88  GRANOO_ACCESS_GET_COPY(bending_stiffness, double, 2.*_young_modulus*get_inertia()/_relaxed_length);
89 
90  GRANOO_ACCESS_GET(current_stress, double, _current_stress );
91  GRANOO_ACCESS_GET(current_tensile_stress, double, _current_tensile_stress);
92  GRANOO_ACCESS_GET(current_bending_stress, double, _current_bending_stress );
93  GRANOO_ACCESS_GET(current_torsion_stress, double, _current_torsion_stress );
94  GRANOO_ACCESS_GET(current_normal_stress, double, _current_normal_stress );
95 
96  private:
97  Beam() = delete;
98  Beam(const Beam& frame) = delete;
99  Beam & operator=(const Beam &) = delete;
100 
101  private:
102  //SERIALIZATION
104  template<class Archive> void save(Archive&, const unsigned int ) const;
105  template<class Archive> void load(Archive&, const unsigned int);
107 
108  protected:
109  //Parameter
111  double _radius;
113  double _max_stress;
114 
120 
121  // We store here coefficient values to speedup the computation
122  // Note that this value must be updated if the setting of the beam
123  // are changed (radius, relaxed length and so on...)
125 
126  };
127 
128 
129  template<class Archive> void
130  Beam::save(Archive& ar, const unsigned int v) const {
131  ar << boost::serialization::base_object<Bond>(*this);
132  ar << _young_modulus;
133  ar << _radius;
134  ar << _poisson_ratio;
135  ar << _max_stress;
136  ar << _current_stress;
141  }
142 
143  template<class Archive> void
144  Beam::load(Archive& ar, const unsigned int v) {
145  ar >> boost::serialization::base_object<Bond>(*this);
146  ar >> _young_modulus;
147  ar >> _radius;
148  ar >> _poisson_ratio;
149  ar >> _max_stress;
150  ar >> _current_stress;
156  }
157 
158  inline void
160 #ifndef SERVER
161  Bond::draw();
162 #endif
163  }
164 
165  }
166 }
167 
168 
169 #include <boost/serialization/version.hpp>
171 
172 // need placement new snippet because no default constructor exist
173 namespace boost
174 {
175  namespace serialization
176  {
177 
178  template<class Archive>
179  void save_construct_data(Archive & ar,
180  const GranOO3::DEM::Beam * t,
181  const unsigned int) {
182  const GranOO3::DEM::Element* de1 = &t->get_element1();
183  const GranOO3::DEM::Element* de2 = &t->get_element2();
184  ar << de1;
185  ar << de2;
186  }
187 
188  template<class Archive>
189  void load_construct_data(Archive & ar,
191  const unsigned int) {
192  GranOO3::DEM::Element* de1 = nullptr;
193  GranOO3::DEM::Element* de2 = nullptr;
194  ar >> de1;
195  ar >> de2;
196  ::new(t)GranOO3::DEM::Beam(*de1,*de2);
197  }
198 
199  }
200 } // namespace ...
201 
202 namespace GranOO3
203 {
204  GRANOO_CLASS_DECLARE_TPL(DEM::Beam);
205 }
206 
207 
208 #endif
209 
210 
BOOST_CLASS_VERSION(GranOO3::DEM::Beam, 0) namespace boost
Definition: Beam.hpp:170
Definition: SetOf.hpp:346
a bond beam that works in tension, compression, bending and torsion
Definition: Beam.hpp:53
double _S
for storing some intermediate values to speed-up the computation (normal surface)
Definition: Beam.hpp:124
static unsigned int _broken_beam_number
Definition: Beam.hpp:58
virtual void compute_load()
compute the reaction force and torque of the beam
Definition: Beam.cpp:99
void update_coeff_value()
Definition: Beam.cpp:87
virtual std::string info() const
Display some useful info in the terminal
Definition: Beam.cpp:227
double _max_stress
the maximal tensile stress of the beam in [Pa]
Definition: Beam.hpp:113
double _current_stress
the current maximal stress (including normal, bending and torsion stresses) in [Pa]
Definition: Beam.hpp:115
Beam(const Beam &frame)=delete
void save(Archive &, const unsigned int) const
complete serializing of the bond in the *.gdd format
Definition: Beam.hpp:130
double _Io
for storing some intermediate values to speed-up the computation (quadratic polar inertia)
Definition: Beam.hpp:124
static unsigned int get_broken_beam_number()
Definition: Beam.cpp:52
Beam & operator=(const Beam &)=delete
virtual double compute_critical_time_step() const
compute the critical time of the bond
Definition: Beam.cpp:201
double _factor_Tt
for storing some intermediate values to speed-up the computation
Definition: Beam.hpp:124
double _young_modulus
the Young's modulus value of the beam in [Pa]
Definition: Beam.hpp:110
virtual double get_angular_stiffness() const
similar as get_linear_stiffness() for rotation
Definition: Beam.cpp:195
double _current_tensile_stress
the current tensile stress into the beam
Definition: Beam.hpp:116
double _current_normal_stress
the current maximal normal stress into the beam (sum of tensile and bending stresses)
Definition: Beam.hpp:119
double _poisson_ratio
the Poisson's ratio of the beam in [-]
Definition: Beam.hpp:112
virtual ~Beam()
Definition: Beam.cpp:83
virtual double get_linear_stiffness() const
compute the linear stiffness of the bond
Definition: Beam.cpp:190
double _factor_Fb
for storing some intermediate values to speed-up the computation
Definition: Beam.hpp:124
double _K
for storing some intermediate values to speed-up the computation (normal stiffness)
Definition: Beam.hpp:124
double _radius
the radius of the beam in [m]
Definition: Beam.hpp:111
double _factor_Tb
for storing some intermediate values to speed-up the computation
Definition: Beam.hpp:124
friend class boost::serialization::access
Definition: Beam.hpp:103
double _G
for storing some intermediate values to speed-up the computation (Coulomb's modulus)
Definition: Beam.hpp:124
void load(Archive &, const unsigned int)
complete serializing of the bond in the *.gdd format
Definition: Beam.hpp:144
double _Ig
for storing some intermediate values to speed-up the computation (quadratic inertia)
Definition: Beam.hpp:124
double _current_torsion_stress
the current maximal torsion stress into the beam
Definition: Beam.hpp:118
double _current_bending_stress
the current maximal bending stress into the beam
Definition: Beam.hpp:117
virtual void draw()
OpenGL draw of the bond
Definition: Beam.hpp:159
the base class for all bonds between discrete elements.
Definition: Bond.hpp:49
virtual void draw()
OpenGL draw of the bond
Definition: Bond.cpp:428
double _relaxed_length
the relaxed length of the bond.
Definition: Bond.hpp:209
a base class that represents an element
Definition: Element.hpp:55
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
T pow(const T v0, const T v1)
Definition: Exprtk.hpp:1491
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