GranOO  3.0
A robust and versatile workbench to build 3D dynamic simulations based on the Discrete Element Method
Stress.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 
31 #ifndef _LibDEM_Prop_Stress_HPP
32 #define _LibDEM_Prop_Stress_HPP
33 
34 
35 
36 #include "GranOO3/Core/Prop.hpp"
37 #include "GranOO3/DEM/Element.hpp"
39 
40 
41 #define GRANOO_STESS_GET_CRITERION(I) \
42  double get_criterion ## I() const {if (_criterion_list.size() > I) return _criterion_list[I]; return 0.;}
43 
44 
45 namespace GranOO3
46 {
47  namespace DEM
48  {
49 
50  class Stress : public Core::Prop<Element>,
51  public Core::Register<Stress>
52  {
53 
54  GRANOO_CLASS (DEM::Stress, Core::Prop<Element>);
55 
56  public:
57  //CONSTRUCTORS & DESTRUCTORS
58  Stress();
59  virtual ~Stress();
60 
61  //USEFULL
62  virtual std::string info() const;
63 
64  //ACCESSORS
65  GRANOO_ACCESS(neighbour_level , unsigned int , _neighbour_level );
66  GRANOO_ACCESS(volume_fraction , double , _volume_fraction );
67  GRANOO_ACCESS(include_velocity, bool , _include_velocity );
68  GRANOO_ACCESS(stress_tensor , Geom::SymTensor, _stress_tensor );
69  GRANOO_ACCESS(criterion , double , _criterion );
70  GRANOO_ACCESS(periodic , bool , _periodic );
71  GRANOO_ACCESS_GET(principal_stress_1, double , _principal_stress_1 );
72  GRANOO_ACCESS_GET(principal_stress_2, double , _principal_stress_2 );
73  GRANOO_ACCESS_GET(principal_stress_3, double , _principal_stress_3 );
74  GRANOO_ACCESS_GET(principal_frame , Geom::Frame , _principal_frame );
75  GRANOO_ACCESS_GET(principal_stress , Geom::Vector, _principal_stress );
76 
77  double get_hydrostatic_stress() const;
78  double get_vonmises_stress() const;
79  double get_tresca_stress() const;
80 
81  void add_criterion(double value);
82  double& criterion(size_t i);
83 
84  GRANOO_STESS_GET_CRITERION(0);
85  GRANOO_STESS_GET_CRITERION(1);
86  GRANOO_STESS_GET_CRITERION(2);
87  GRANOO_STESS_GET_CRITERION(3);
88  GRANOO_STESS_GET_CRITERION(4);
89  GRANOO_STESS_GET_CRITERION(5);
90 
91  //METHOD
92  void compute_virial_stress();
93  void compute_virial_stress_for(Element* de, unsigned int level, std::set<Element*>& set);
94  void compute_lsq_stress();
96 
97  private:
98  //Serialization
100  template<class Archive> void serialize(Archive& ar, const unsigned int );
101 
102  private:
111  // failure criterion
112  double _criterion;
113  std::vector<double> _criterion_list;
114  // for virial stress computation
115  unsigned int _neighbour_level;
118  bool _periodic;
119  };
120 
121  template<class Archive> void
122  Stress::serialize(Archive& ar, const unsigned int version) {
123  ar & boost::serialization::base_object<Core::Prop<Element> >(*this);
124  ar & _neighbour_level;
125  ar & _volume_fraction;
126  ar & _stress_tensor;
127  ar & _principal_stress;
128  ar & _principal_stress_1;
129  ar & _principal_stress_2;
130  ar & _principal_stress_3;
131  ar & _criterion;
132  ar & _criterion_list;
133  }
134 
135  }
136 }
137 
138 
139 #include <boost/serialization/version.hpp>
141 
142 
143 namespace GranOO3
144 {
145  GRANOO_CLASS_DECLARE_TPL(DEM::Stress);
146 }
147 
148 
149 #endif
150 
BOOST_CLASS_VERSION(GranOO3::DEM::Stress, 0) namespace GranOO3
Definition: Stress.hpp:140
Definition: Prop.hpp:48
Definition: SetOf.hpp:346
a base class that represents an element
Definition: Element.hpp:55
a property for computing stress associated to DEM::Element
Definition: Stress.hpp:52
double _volume_fraction
the volume fraction for computing virial stress (virial stress computation needs the real volume).
Definition: Stress.hpp:116
double get_tresca_stress() const
get the Tresca stress
Definition: Stress.cpp:288
Geom::Frame _principal_frame
the local frame which are expressed the principal stresses (principal direction)
Definition: Stress.hpp:106
double & criterion(size_t i)
get the i_th criterion
Definition: Stress.cpp:97
void serialize(Archive &ar, const unsigned int)
complete serializing of the item in the *.gdd format
Definition: Stress.hpp:122
double _principal_stress_3
the value of the third (lower) principal stress
Definition: Stress.hpp:110
void compute_virial_stress()
compute the stress using the virial method
Definition: Stress.cpp:176
virtual std::string info() const
Display some useful info in the terminal
Definition: Stress.cpp:86
double _principal_stress_2
the value of the second (intermediate) principal stress
Definition: Stress.hpp:109
unsigned int _neighbour_level
the neighbor level (level of neighboring) for the computation of the virial stress.
Definition: Stress.hpp:115
void update_principal_stress()
update the principal stresses from the current value of the _stress_tensor attribute
Definition: Stress.cpp:263
std::vector< double > _criterion_list
the values of criteria (in case of many criteria are applied)
Definition: Stress.hpp:113
double _principal_stress_1
the value of the first (maximal) principal stress
Definition: Stress.hpp:108
bool _periodic
a flag for including priodic condition for the virial stress computation
Definition: Stress.hpp:118
Geom::Point _principal_point
this is just a trick for having a local frame ("useless as this")
Definition: Stress.hpp:104
virtual ~Stress()
destructor
Definition: Stress.cpp:82
void add_criterion(double value)
add a criterion, the criterion is often used for fracture but you can use it as you want
Definition: Stress.cpp:92
Stress()
constructor
void compute_lsq_stress()
compute the stress using a least square method (EXPERIMENTAL)
Definition: Stress.cpp:200
double get_vonmises_stress() const
get the von Mises stress
Definition: Stress.cpp:279
void compute_virial_stress_for(Element *de, unsigned int level, std::set< Element * > &set)
a util recursive method for computing virial stress
Definition: Stress.cpp:103
friend class boost::serialization::access
Definition: Stress.hpp:99
bool _include_velocity
a flag for including the velocity within the virial stress computation
Definition: Stress.hpp:117
Geom::Vector _principal_stress
a vector that stores the three principal stresses, note that the component are ordered like this X > ...
Definition: Stress.hpp:107
double get_hydrostatic_stress() const
get the hydrostatic stress
Definition: Stress.cpp:274
double _criterion
the value of the main criterion (in case of only one criterion is applied)
Definition: Stress.hpp:112
Geom::Quaternion _principal_quat
this quaternion that model the rotation matrix (from global frame) for retrieving the principal direc...
Definition: Stress.hpp:105
Geom::SymTensor _stress_tensor
the main stress tensor which is updated by the compute_virial_stress() and the compute_lsq_stress() m...
Definition: Stress.hpp:103
Definition: Frame.hpp:68
Definition: Point.hpp:62
Definition: Quaternion.hpp:54
Definition: SymTensor.hpp:68
Definition: Vector.hpp:75
Definition: Common.hpp:198
T value(details::expression_node< T > *n)
Definition: Exprtk.hpp:15070
static char_cptr version
Definition: Exprtk.hpp:44221