Plugins
mat_law_interface.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2014-2015: G-CSC, Goethe University Frankfurt
3  * Author: Raphael Prohl
4  *
5  * This file is part of UG4.
6  *
7  * UG4 is free software: you can redistribute it and/or modify it under the
8  * terms of the GNU Lesser General Public License version 3 (as published by the
9  * Free Software Foundation) with the following additional attribution
10  * requirements (according to LGPL/GPL v3 §7):
11  *
12  * (1) The following notice must be displayed in the Appropriate Legal Notices
13  * of covered and combined works: "Based on UG4 (www.ug4.org/license)".
14  *
15  * (2) The following notice must be displayed at a prominent place in the
16  * terminal output of covered works: "Based on UG4 (www.ug4.org/license)".
17  *
18  * (3) The following bibliography is recommended for citation and must be
19  * preserved in all covered files:
20  * "Reiter, S., Vogel, A., Heppner, I., Rupp, M., and Wittum, G. A massively
21  * parallel geometric multigrid solver on hierarchically distributed grids.
22  * Computing and visualization in science 16, 4 (2013), 151-164"
23  * "Vogel, A., Reiter, S., Rupp, M., Nägel, A., and Wittum, G. UG4 -- a novel
24  * flexible software system for simulating pde based models on high performance
25  * computers. Computing and visualization in science 16, 4 (2013), 165-179"
26  *
27  * This program is distributed in the hope that it will be useful,
28  * but WITHOUT ANY WARRANTY; without even the implied warranty of
29  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
30  * GNU Lesser General Public License for more details.
31  */
32 
33 #ifndef MAT_LAW_INTERFACE_H_
34 #define MAT_LAW_INTERFACE_H_
35 
36 namespace ug{
37 namespace SmallStrainMechanics{
38 
39 // NOTE: TDomain is necessary here, due to the attached ElemData, only!
40 // -> if an additional interface for materialLaws with internal Vars will be implemented
41 // remove TDomain!
42 template <typename TDomain>
44 {
45  public:
47  static const int dim = TDomain::dim;
48 
51 
52  public:
55 
57  virtual ~IMaterialLaw(){};
58 
59  public:
61  // methods for common material laws
63  virtual void init() = 0;
64 
65  // computes a stress tensor at an integration point ip
66  virtual void stressTensor(MathMatrix<dim,dim>& stressTens, const size_t ip,
67  const MathMatrix<dim,dim>& GradU) = 0;
68 
69  virtual void stressTensor(MathMatrix<dim,dim>& stressTens, const size_t ip,
70  const MathVector<dim>& x, const MathMatrix<dim,dim>& GradU) {
71  stressTensor(stressTens, ip, GradU);
72  }
73 
74  // computes the elasticity tensor at an integration point ip
76  elasticityTensor(const size_t ip, const MathMatrix<dim, dim>& GradU) = 0;
77 
79  elasticityTensor(const size_t ip, const MathVector<dim>& x, const MathMatrix<dim, dim>& GradU){
80  return elasticityTensor(ip, GradU);
81  }
82 
83  // computes the constant elasticity tensor
85  UG_THROW("Not implemented");
86  };
87 
88  virtual bool needs_to_add_jac_m(){return true;}
89 
91  // methods for material laws
92  // with internal variables
94  virtual void attach_internal_vars(typename TDomain::grid_type& grid){};
95  virtual void clear_attachments(typename TDomain::grid_type& grid){};
96 
97  virtual void init_internal_vars(TBaseElem* elem, const size_t numIP){};
98  virtual void internal_vars(TBaseElem* elem){};
99  virtual void update_internal_vars(const size_t ip, const MathMatrix<dim, dim>& GradU){};
100 
101  virtual void write_data_to_console(const number t){};
102 
103 
105  {
106  MathMatrix<dim, dim> inelastStrain; inelastStrain = 0;
107  SmartPtr<MathMatrix<dim, dim> > spInelasticStrain (new MathMatrix<dim, dim>(inelastStrain));
108  return spInelasticStrain;
109  }
110  virtual number hardening_parameter(const size_t ip){return 0.0;}
111  virtual number plastic_multiplier(const size_t ip, const MathMatrix<dim, dim>& GradU)
112  {return 0.0;}
113 
114  public:
115  inline bool is_initialized(){return m_bInit;}
116 
117  inline bool elastTensIsConstant(){return m_bConstElastTens;}
118 
119  template <typename TFEGeom>
120  void DisplacementGradient(MathMatrix<dim, dim>& GradU, const size_t ip,
121  const TFEGeom& geo, const LocalVector& u);
122 
123  public:
125 
126  protected:
128  bool m_bInit;
129 
132 
133 };
134 
135 }// end of namespace SmallStrainMechanics
136 }// end of namespace ug
137 
138 #include "mat_law_interface_impl.h"
139 
140 #endif /* MAT_LAW_INTERFACE_H_ */
Definition: mat_law_interface.h:44
static const int dim
World dimension.
Definition: mat_law_interface.h:47
virtual number plastic_multiplier(const size_t ip, const MathMatrix< dim, dim > &GradU)
Definition: mat_law_interface.h:111
virtual SmartPtr< MathTensor4< dim, dim, dim, dim > > elasticityTensor()
Definition: mat_law_interface.h:84
virtual SmartPtr< MathTensor4< dim, dim, dim, dim > > elasticityTensor(const size_t ip, const MathMatrix< dim, dim > &GradU)=0
virtual void init_internal_vars(TBaseElem *elem, const size_t numIP)
Definition: mat_law_interface.h:97
bool m_bInit
flag indicating, if material law has been initialized
Definition: mat_law_interface.h:128
virtual SmartPtr< MathMatrix< dim, dim > > inelastic_strain_tensor(const size_t ip)
Definition: mat_law_interface.h:104
void DisplacementGradient(MathMatrix< dim, dim > &GradU, const size_t ip, const TFEGeom &geo, const LocalVector &u)
Definition: mat_law_interface_impl.h:45
virtual void update_internal_vars(const size_t ip, const MathMatrix< dim, dim > &GradU)
Definition: mat_law_interface.h:99
virtual void write_data_to_console(const number t)
Definition: mat_law_interface.h:101
virtual void stressTensor(MathMatrix< dim, dim > &stressTens, const size_t ip, const MathMatrix< dim, dim > &GradU)=0
bool elastTensIsConstant()
Definition: mat_law_interface.h:117
virtual SmartPtr< MathTensor4< dim, dim, dim, dim > > elasticityTensor(const size_t ip, const MathVector< dim > &x, const MathMatrix< dim, dim > &GradU)
Definition: mat_law_interface.h:79
virtual void stressTensor(MathMatrix< dim, dim > &stressTens, const size_t ip, const MathVector< dim > &x, const MathMatrix< dim, dim > &GradU)
Definition: mat_law_interface.h:69
IMaterialLaw()
constructor
Definition: mat_law_interface.h:54
bool m_bConstElastTens
flag indicating, if elasticity tensor is constant
Definition: mat_law_interface.h:131
virtual void clear_attachments(typename TDomain::grid_type &grid)
Definition: mat_law_interface.h:95
virtual void internal_vars(TBaseElem *elem)
Definition: mat_law_interface.h:98
std::string m_materialConfiguration
Definition: mat_law_interface.h:124
domain_traits< TDomain::dim >::grid_base_object TBaseElem
base element type of associated domain
Definition: mat_law_interface.h:50
bool is_initialized()
Definition: mat_law_interface.h:115
virtual number hardening_parameter(const size_t ip)
Definition: mat_law_interface.h:110
virtual void attach_internal_vars(typename TDomain::grid_type &grid)
Definition: mat_law_interface.h:94
virtual bool needs_to_add_jac_m()
Definition: mat_law_interface.h:88
virtual ~IMaterialLaw()
destructor
Definition: mat_law_interface.h:57
SmartPtr< TGrid > grid()
static const int dim
TGrid grid_type
#define UG_THROW(msg)
double number