GranOO  3.0
A robust and versatile workbench to build 3D dynamic simulations based on the Discrete Element Method
KratosFlatBond.hpp
Go to the documentation of this file.
1 // This file is part of GranOO, a workbench for DEM simulation.
2 //
3 // Author(s) : - Jean-luc CHARLES I2M-DuMAS/ENSAM Talence France
4 // <jean-luc.charles@ensam.eu>
5 // - Damien ANDRE SPCTS/ENS Ceramique industrielle, Limoges France
6 // <damien.andre@unilim.fr>
7 // - Jeremie GIRARDOT I2M-DuMAS/ENSAM Talence France
8 // <jeremie.girardot@ensam.eu>
9 // - Cedric Hubert LAMIH/UVHC Valenciennes France
10 // <cedric.hubert@univ-valenciennes.fr>
11 // - Ivan IORDANOFF I2M-DuMAS-MPI/ENSAM Talence France
12 // <ivan.iordanoff@ensam.eu>
13 //
14 // Copyright (C) 2008-2016 JL. CHARLES, D. ANDRE, I. IORDANOFF, J. GIRARDOT
15 //
16 //
17 //
18 //
19 //
20 // This program is free software: you can redistribute it and/or modify
21 // it under the terms of the GNU General Public License as published by
22 // the Free Software Foundation, either version 3 of the License, or
23 // (at your option) any later version.
24 //
25 // This program is distributed in the hope that it will be useful,
26 // but WITHOUT ANY WARRANTY; without even the implied warranty of
27 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
28 // GNU General Public License for more details.
29 //
30 // You should have received a copy of the GNU General Public License
31 // along with this program. If not, see <http://www.gnu.org/licenses/>.
32 
33 
34 #ifndef _libDEM_KratosFlatBond_hpp_
35 #define _libDEM_KratosFlatBond_hpp_
36 
37 #ifdef KRATOS
38 
39 #include <string>
40 #include <vector>
41 
42 
43 
44 #include "GranOO3/DEM/Bond.hpp"
45 #include "GranOO3/Core/SetOf.hpp"
46 #include "GranOO3/DEM/Element.hpp"
49 #include "GranOO3/Geom/Point.hpp"
50 
52 // KRATOS HEADER //
54 #include "custom_constitutive/hyper_elastic_isotropic_ogden_1d.h"
55 #include "custom_constitutive/hyper_elastic_isotropic_henky_1d.h"
56 #include "custom_constitutive/truss_plasticity_constitutive_law.h"
57 #include "custom_constitutive/elastic_isotropic_plane_stress_uncoupled_shear.h"
58 #include "custom_constitutive/hyper_elastic_isotropic_kirchhoff_3d.h"
59 #include "custom_constitutive/hyper_elastic_isotropic_kirchhoff_plane_stress_2d.h"
60 #include "custom_constitutive/hyper_elastic_isotropic_kirchhoff_plane_strain_2d.h"
61 #include "custom_constitutive/hyper_elastic_isotropic_neo_hookean_3d.h"
62 #include "custom_constitutive/hyper_elastic_isotropic_neo_hookean_plane_strain_2d.h"
63 #include "custom_constitutive/linear_elastic_orthotropic_2D_law.h"
64 #include "custom_constitutive/small_strain_j2_plasticity_3d.h"
65 #include "custom_constitutive/small_strain_j2_plasticity_plane_strain_2d.h"
66 #include "custom_constitutive/small_strain_isotropic_damage_3d.h"
67 #include "custom_constitutive/small_strain_isotropic_damage_implex_3d.h"
68 #include "custom_constitutive/small_strain_isotropic_damage_traction_only_3d.h"
69 #include "custom_constitutive/small_strain_isotropic_damage_traction_only_implex_3d.h"
70 #include "custom_constitutive/wrinkling_linear_2d_law.h"
71 #include "custom_constitutive/multi_linear_elastic_1d_law.h"
72 #include "custom_constitutive/multi_linear_isotropic_plane_stress_2d.h"
73 // Plastic, damage laws and viscosities
74 #include "custom_constitutive/small_strain_isotropic_damage_plane_strain_2d.h"
75 #include "custom_constitutive/small_strain_isotropic_plasticity_factory.h"
76 #include "custom_constitutive/small_strain_kinematic_plasticity_factory.h"
77 #include "custom_constitutive/finite_strain_isotropic_plasticity_factory.h"
78 #include "custom_constitutive/small_strain_isotropic_damage_factory.h"
79 #include "custom_constitutive/viscous_generalized_maxwell.h"
80 #include "custom_constitutive/viscous_generalized_kelvin.h"
81 #include "custom_constitutive/generic_small_strain_viscoplasticity_3d.h"
82 #include "custom_constitutive/generic_small_strain_isotropic_plasticity.h"
83 #include "custom_constitutive/generic_finite_strain_isotropic_plasticity.h"
84 #include "custom_constitutive/generic_finite_strain_kinematic_plasticity.h"
85 #include "custom_constitutive/generic_small_strain_isotropic_damage.h"
86 #include "custom_constitutive/generic_small_strain_d_plus_d_minus_damage.h"
87 #include "custom_constitutive/generic_small_strain_kinematic_plasticity.h"
88 #include "custom_constitutive/generic_small_strain_high_cycle_fatigue_law.h"
89 #include "custom_constitutive/plasticity_isotropic_kinematic_j2.h"
90 #include "custom_constitutive/plane_stress_d_plus_d_minus_damage_masonry_2d.h"
91 #include "custom_constitutive/d_plus_d_minus_damage_masonry_3d.h"
92 #include "custom_constitutive/generic_small_strain_plastic_damage_model.h"
93 #include "custom_constitutive/generic_small_strain_orthotropic_damage.h"
94 #include "custom_constitutive/serial_parallel_rule_of_mixtures_law.h"
95 // Integrators
96 #include "custom_constitutive/constitutive_laws_integrators/generic_constitutive_law_integrator_damage.h"
97 #include "custom_constitutive/constitutive_laws_integrators/generic_constitutive_law_integrator_plasticity.h"
98 #include "custom_constitutive/constitutive_laws_integrators/generic_constitutive_law_integrator_kinematic_plasticity.h"
99 #include "custom_constitutive/constitutive_laws_integrators/d+d-constitutive_law_integrators/generic_compression_constitutive_law_integrator.h"
100 #include "custom_constitutive/constitutive_laws_integrators/d+d-constitutive_law_integrators/generic_tension_constitutive_law_integrator.h"
101 // Yield surfaces
102 #include "custom_constitutive/yield_surfaces/generic_yield_surface.h"
103 #include "custom_constitutive/yield_surfaces/von_mises_yield_surface.h"
104 #include "custom_constitutive/yield_surfaces/modified_mohr_coulomb_yield_surface.h"
105 #include "custom_constitutive/yield_surfaces/mohr_coulomb_yield_surface.h"
106 #include "custom_constitutive/yield_surfaces/rankine_yield_surface.h"
107 #include "custom_constitutive/yield_surfaces/simo_ju_yield_surface.h"
108 #include "custom_constitutive/yield_surfaces/drucker_prager_yield_surface.h"
109 #include "custom_constitutive/yield_surfaces/tresca_yield_surface.h"
110 // Plastic potentials
111 #include "custom_constitutive/plastic_potentials/generic_plastic_potential.h"
112 #include "custom_constitutive/plastic_potentials/von_mises_plastic_potential.h"
113 #include "custom_constitutive/plastic_potentials/tresca_plastic_potential.h"
114 #include "custom_constitutive/plastic_potentials/modified_mohr_coulomb_plastic_potential.h"
115 #include "custom_constitutive/plastic_potentials/mohr_coulomb_plastic_potential.h"
116 #include "custom_constitutive/plastic_potentials/drucker_prager_plastic_potential.h"
117 #include "custom_constitutive/plastic_potentials/rankine_plastic_potential.h"
118 // Geometries
119 #include "geometries/line_3d_2.h"
120 
121 #include "custom_constitutive/generic_anisotropic_3d_law.h"
122 
123 
125 // END OF KRATOS HEADER //
127 
128 namespace GranOO3
129 {
130  namespace DEM
131  {
132 
133 
134  class KratosFlatBond : public Bond,
135  public Core::Register<KratosFlatBond>,
136  public Physic::CriticalTimeStep
137  {
138 
139  GRANOO_CLASS(DEM::KratosFlatBond, Bond);
140 
141  enum Type{DAMAGE, PLASTIC, ORTHOTROPIC};
142 
143  public :
144 
145  using Node = Kratos::Node<3>;
146  using ConstElGeom = Kratos::Line3D2<Node>;
147  using ConstLawParam = Kratos::ConstitutiveLaw::Parameters;
148 
149  // Damage
150  using ConstLawDamage = Kratos::GenericSmallStrainIsotropicDamage<Kratos::GenericConstitutiveLawIntegratorDamage<Kratos::RankineYieldSurface<Kratos::MohrCoulombPlasticPotential<6>>>>;
151  // Plasticity
152  using ConstLawPlastic = Kratos::GenericSmallStrainIsotropicPlasticity <Kratos::GenericConstitutiveLawIntegratorPlasticity<Kratos::VonMisesYieldSurface<Kratos::VonMisesPlasticPotential<6>>>>;
153  // Orthotropic
154  using ConstLawOrtho = Kratos::GenericAnisotropic3DLaw;
155 
156 
157  public:
158  //CONSTRUCTORS & DESTRUCTORS
159  KratosFlatBond(Element& el1, Element& el2, Type type, bool build_voronoi_bond = true);
160  KratosFlatBond(Element& el1, Element& el2, bool build_voronoi_bond = true);
161  virtual ~KratosFlatBond();
162 
163  //USEFULL
164  void update_strain_tensor();
165  void compute_load_from_stress_tensor();
166  void compute_stress_from_kratos_constituve_law();
167  virtual void compute_load();
168  double get_linear_stiffness() const;
169  double get_angular_stiffness() const;
170  virtual double compute_critical_time_step() const;
171  virtual std::string info() const;
172 
173  //ACCESSORS
174  GRANOO_ACCESS(young_modulus , double , _mat[Kratos::YOUNG_MODULUS ] );
175  GRANOO_ACCESS(poisson_ratio , double , _mat[Kratos::POISSON_RATIO ] );
176  GRANOO_ACCESS(yield_stress , double , _mat[Kratos::YIELD_STRESS ] );
177  GRANOO_ACCESS(fracture_energy , double , _mat[Kratos::FRACTURE_ENERGY] );
178  GRANOO_ACCESS(damage , double , _damage );
179  GRANOO_ACCESS(plastic_dissipation , double , _plastic_dissipation );
180  GRANOO_ACCESS(damage_threshold , double , _damage_threshold );
181  GRANOO_ACCESS(current_stress_vector , Geom::Vector , _current_stress_vector );
182  GRANOO_ACCESS( local_strain_tensor , Geom::SymTensor, _local_strain_tensor );
183  GRANOO_ACCESS(global_strain_tensor , Geom::SymTensor, _global_strain_tensor );
184  GRANOO_ACCESS( local_stress_tensor , Geom::SymTensor, _local_stress_tensor );
185  GRANOO_ACCESS(global_stress_tensor , Geom::SymTensor, _global_stress_tensor );
186  GRANOO_ACCESS(global_stress_tensor_test , Geom::SymTensor, _global_stress_tensor_test );
187  GRANOO_ACCESS(global_stress_tensor_diff , Geom::SymTensor, _global_stress_tensor_diff );
188  GRANOO_ACCESS(type , Type , _type );
189 
190  void set_ortho_elastic_constant(Kratos::Vector& v){_mat_ortho[Kratos::ORTHOTROPIC_ELASTIC_CONSTANTS] = v;}
191 
192  void set_characteristic_length(double l0);
193  void auto_compute_characteristic_length();
194  void set_linear_softening();
195  void set_exponential_softening();
196 
197 
198 
199  private:
200  KratosFlatBond() = delete;
201  KratosFlatBond(const KratosFlatBond&) = delete;
202  KratosFlatBond & operator=(const KratosFlatBond &) = delete;
203 
204  private:
205  //BOOST SERIALIZATION
206  friend class boost::serialization::access;
207  template<class Archive> void serialize(Archive&, const unsigned int);
208 
209  private:
210  VoronoiBond* _voronoi_bond;
211  double _damage;
212  double _plastic_dissipation;
213  double _damage_threshold;
214  Geom::Point _FC1;
215  Geom::Point _FC2;
216  Geom::Vector _current_stress_vector;
217  Geom::SymTensor _local_strain_tensor;
218  Geom::SymTensor _global_strain_tensor;
219  Geom::SymTensor _local_stress_tensor;
220  Geom::SymTensor _global_stress_tensor;
221  Geom::SymTensor _global_stress_tensor_test;
222  Geom::SymTensor _global_stress_tensor_diff;
223  Type _type;
224  ConstLawDamage _damage_law;
225  ConstLawPlastic _plastic_law;
226  ConstLawOrtho& _orthotropic_law; //DIRTY HACK
227  ConstLawParam _param;
228  Node* _n1; //DIRTY HACK
229  Node* _n2; //DIRTY HACK
230  ConstElGeom _geom;
231  Kratos::Vector _strain_vector;
232  Kratos::Vector _stress_vector;
233  Kratos::Matrix _const_matrix;
234  Kratos::Matrix _def_gradient_matrix;
235  Kratos::Properties _mat;
236  Kratos::Properties& _mat_ortho; //DIRTY HACK
237 
238  };
239 
240  //BOOST SERIALIZATION
241  template<class Archive> void
242  KratosFlatBond::serialize(Archive & ar, const unsigned int version) {
243  ar & boost::serialization::base_object<Bond>(*this);
244  ar & _mat[Kratos::YOUNG_MODULUS ];
245  ar & _mat[Kratos::POISSON_RATIO ];
246  ar & _mat[Kratos::YIELD_STRESS ];
247  ar & _mat[Kratos::FRACTURE_ENERGY];
248  ar & _damage;
249  ar & _plastic_dissipation;
250  ar & _local_strain_tensor;
251  ar & _global_strain_tensor;
252  ar & _local_stress_tensor;
253  ar & _global_stress_tensor;
254  ar & _global_stress_tensor_test;
255  ar & _global_stress_tensor_diff;
256  ar & _FC1;
257  ar & _FC2;
258  }
259 
260  }
261 }
262 
263 
264 
265 
266 
267 
268 
269 
270 
271 
272 
273 
274 #include <boost/serialization/version.hpp>
275 BOOST_CLASS_VERSION(GranOO3::DEM::KratosFlatBond, 0)
276 
277 
278 // need placement new snippet because no default constructor exist
279 namespace boost
280 {
281  namespace serialization
282  {
283 
284  template<class Archive>
285  inline void save_construct_data(Archive & ar,
286  const GranOO3::DEM::KratosFlatBond * t,
287  const unsigned int) {
288  const GranOO3::DEM::Element* de1 = &t->get_element1();
289  const GranOO3::DEM::Element* de2 = &t->get_element2();
290  const GranOO3::DEM::KratosFlatBond::Type type = t->get_type();
291  ar << de1;
292  ar << de2;
293  ar << type;
294  }
295 
296 
297  template<class Archive>
298  inline void load_construct_data(Archive & ar,
299  GranOO3::DEM::KratosFlatBond * t,
300  const unsigned int) {
301  GranOO3::DEM::Element* de1 = nullptr;
302  GranOO3::DEM::Element* de2 = nullptr;
303  GranOO3::DEM::KratosFlatBond::Type type;
304  ar >> de1;
305  ar >> de2;
306  ar >> type;
307  ::new(t)GranOO3::DEM::KratosFlatBond(*de1,*de2, type, false);
308  }
309  }
310 }
311 
312 
313 namespace GranOO3{
314  GRANOO_CLASS_DECLARE_TPL(DEM::KratosFlatBond);
315 }
316 
317 #endif // END OF KRATOS
318 
319 #endif
320 
321 
BOOST_CLASS_VERSION(GranOO3::Core::Base, 1) namespace GranOO3
Definition: Base.hpp:277
a base class that represents an element
Definition: Element.hpp:55
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