www.mooseframework.org
SymmElasticityTensor.h
Go to the documentation of this file.
1 /****************************************************************/
2 /* MOOSE - Multiphysics Object Oriented Simulation Environment */
3 /* */
4 /* All contents are licensed under LGPL V2.1 */
5 /* See LICENSE for full restrictions */
6 /****************************************************************/
7 #ifndef SYMMELASTICITYTENSOR_H
8 #define SYMMELASTICITYTENSOR_H
9 
10 #include "SymmTensor.h"
11 
12 #include "MaterialProperty.h"
13 
14 #include "libmesh/vector_value.h"
15 
16 #include <vector>
17 
54 {
55 public:
62  SymmElasticityTensor(const bool constant = false);
63 
64  void constant(bool c) { _constant = c; }
65 
66  virtual ~SymmElasticityTensor() {}
67 
68  void copyValues(SymmElasticityTensor & rhs) const
69  {
70  for (unsigned i(0); i < 21; ++i)
71  {
72  rhs._val[i] = _val[i];
73  }
74  }
75 
80  void calculate(unsigned int qp);
81 
82  virtual void multiply(const SymmTensor & x, SymmTensor & b) const;
83  SymmTensor operator*(const SymmTensor & x) const;
84  SymmElasticityTensor operator*(Real x) const;
85 
86  virtual Real stiffness(const unsigned int i,
87  const unsigned int j,
88  const RealGradient & test,
89  const RealGradient & phi) const;
90 
92  {
93  SymmElasticityTensor t = *this;
94 
95  t += rhs;
96 
97  return t;
98  }
99 
101  {
102  for (unsigned i(0); i < 21; ++i)
103  {
104  _val[i] += rhs._val[i];
105  }
106  }
107 
109  {
110  for (unsigned i(0); i < 21; ++i)
111  {
112  _val[i] -= rhs._val[i];
113  }
114  }
115 
116  void operator*=(Real rhs)
117  {
118  for (unsigned i(0); i < 21; ++i)
119  {
120  _val[i] *= rhs;
121  }
122  }
123 
124  void operator/=(Real rhs)
125  {
126  for (unsigned i(0); i < 21; ++i)
127  {
128  _val[i] /= rhs;
129  }
130  }
131 
132  void zero()
133  {
134  for (unsigned i(0); i < 21; ++i)
135  {
136  _val[i] = 0;
137  }
138  }
139 
140  void convertFrom9x9(const ColumnMajorMatrix & cmm);
141  void convertFrom6x6(const ColumnMajorMatrix & cmm);
142 
143  ColumnMajorMatrix columnMajorMatrix9x9() const;
144  ColumnMajorMatrix columnMajorMatrix6x6() const;
145 
146  void form9x9Rotation(const ColumnMajorMatrix & R_3x3, ColumnMajorMatrix & R_9x9) const;
147  void rotateFromGlobalToLocal(const ColumnMajorMatrix & R);
148  void rotateFromLocalToGlobal(const ColumnMajorMatrix & R);
149 
150  virtual void adjustForCracking(const RealVectorValue & crack_flags);
151  virtual void adjustForCrackingWithShearRetention(const RealVectorValue & crack_flags);
152 
153  virtual SymmElasticityTensor calculateDerivative(unsigned int qp, unsigned int i);
154 
155  friend std::ostream & operator<<(std::ostream & stream, const SymmElasticityTensor & obj);
156 
157  void fillFromInputVector(std::vector<Real> input, bool all);
158 
159  Real sum_3x3() const;
160  RealGradient sum_3x1() const;
161 
162  /*
163  * @return the value of the tensor given the index supplied.
164  */
165  Real valueAtIndex(int i) const;
166 
167 protected:
171  bool _constant;
172 
177 
184  virtual void calculateEntries(unsigned int qp);
185 
186  Real _val[21]; // 6 in first row (column)
187  // 5 in second
188  // 4 in third
189  // 3 in fourth
190  // 2 in fifth
191  // 1 in sixth
192 
193  template <class T>
194  friend void dataStore(std::ostream &, T &, void *);
195 
196  template <class T>
197  friend void dataLoad(std::istream &, T &, void *);
198 };
199 
200 template <>
201 void dataStore(std::ostream &, SymmElasticityTensor &, void *);
202 
203 template <>
204 void dataLoad(std::istream &, SymmElasticityTensor &, void *);
205 
206 #endif // SYMMELASTICITYTENSOR_H
SymmElasticityTensor operator+(const SymmElasticityTensor &rhs) const
This class defines a basic set of capabilities any elasticity tensor should have. ...
virtual SymmElasticityTensor calculateDerivative(unsigned int qp, unsigned int i)
friend void dataLoad(std::istream &, T &, void *)
virtual void multiply(const SymmTensor &x, SymmTensor &b) const
RealGradient sum_3x1() const
Real valueAtIndex(int i) const
bool _constant
Whether or not the matrix is constant for all of time and space.
virtual Real stiffness(const unsigned int i, const unsigned int j, const RealGradient &test, const RealGradient &phi) const
virtual void adjustForCrackingWithShearRetention(const RealVectorValue &crack_flags)
virtual void calculateEntries(unsigned int qp)
Virtual (must be overriden by derived class).
virtual void adjustForCracking(const RealVectorValue &crack_flags)
SymmTensor operator*(const SymmTensor &x) const
void operator+=(const SymmElasticityTensor &rhs)
ColumnMajorMatrix columnMajorMatrix6x6() const
void fillFromInputVector(std::vector< Real > input, bool all)
friend void dataStore(std::ostream &, T &, void *)
void convertFrom9x9(const ColumnMajorMatrix &cmm)
SymmElasticityTensor(const bool constant=false)
Default constructor...
void calculate(unsigned int qp)
Public function that will be called whenever the values for this matrix need to be filled in...
void operator-=(const SymmElasticityTensor &rhs)
void rotateFromLocalToGlobal(const ColumnMajorMatrix &R)
void convertFrom6x6(const ColumnMajorMatrix &cmm)
void form9x9Rotation(const ColumnMajorMatrix &R_3x3, ColumnMajorMatrix &R_9x9) const
bool _values_computed
Whether or not the values have been computed once.
ColumnMajorMatrix columnMajorMatrix9x9() const
void rotateFromGlobalToLocal(const ColumnMajorMatrix &R)
friend std::ostream & operator<<(std::ostream &stream, const SymmElasticityTensor &obj)
void copyValues(SymmElasticityTensor &rhs) const