https://mooseframework.inl.gov
SymmetricRankTwoTensor.h
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://mooseframework.inl.gov
3 //*
4 //* All rights reserved, see COPYRIGHT for full restrictions
5 //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6 //*
7 //* Licensed under LGPL 2.1, please see LICENSE for details
8 //* https://www.gnu.org/licenses/lgpl-2.1.html
9 
10 #pragma once
11 
12 #include "Moose.h"
13 #include "ADRankTwoTensorForward.h"
16 #include "MooseUtils.h"
17 #include "MathUtils.h"
18 
19 #include "libmesh/libmesh.h"
20 #include "libmesh/tensor_value.h"
21 
22 #include "metaphysicl/raw_type.h"
23 
24 #include <petscsys.h>
25 #include <vector>
26 
27 // Forward declarations
28 class MooseEnum;
29 template <typename T>
30 class MooseArray;
32 template <typename>
34 namespace libMesh
35 {
36 template <typename>
37 class VectorValue;
38 template <typename>
39 class TypeVector;
40 template <typename>
41 class TypeTensor;
42 template <typename>
43 class TensorValue;
44 }
45 
46 namespace MathUtils
47 {
48 template <typename T>
49 void mooseSetToZero(T & v);
50 
55 template <>
57 
62 template <>
64 }
65 
72 template <typename T>
74 {
75 public:
77  typedef T value_type;
78 
80  static constexpr unsigned int Ndim = Moose::dim;
81  static constexpr unsigned int N = Ndim + (Ndim * (Ndim - 1)) / 2;
83 
84  // Full tensor indices in the Mandel/Voigt representation
85  static constexpr unsigned int full_index[6][2] = {{0, 0}, {1, 1}, {2, 2}, {1, 2}, {0, 2}, {0, 1}};
86 
87  // Reverse tensor indices in the Mandel/Voigt representation
88  static constexpr unsigned int reverse_index[3][3] = {{0, 5, 4}, {5, 1, 3}, {4, 3, 2}};
89 
91  static constexpr Real mandelFactor(unsigned int i) { return i < Ndim ? 1.0 : MathUtils::sqrt2; }
92 
93  // Select initialization
95  {
98  };
99 
102 
105 
112  {
117  };
118 
120  SymmetricRankTwoTensorTempl(const std::vector<T> & input) { this->fillFromInputVector(input); };
121 
124  const T & S11, const T & S22, const T & S33, const T & S23, const T & S13, const T & S12);
125 
126  // explicit cast to a full tensor
127  explicit operator RankTwoTensorTempl<T>();
128 
129 private:
131  SymmetricRankTwoTensorTempl(const T & S11,
132  const T & S21,
133  const T & S31,
134  const T & S12,
135  const T & S22,
136  const T & S32,
137  const T & S13,
138  const T & S23,
139  const T & S33);
140 
141  // internal use named constructor that does not apply the sqrt(2) factors
143  const T & S11, const T & S22, const T & S33, const T & S23, const T & S13, const T & S12);
144 
145 public:
147  explicit SymmetricRankTwoTensorTempl(const TensorValue<T> & a);
148 
150  explicit SymmetricRankTwoTensorTempl(const TypeTensor<T> & a);
151 
153  template <typename T2>
155  {
156  for (const auto i : make_range(N))
157  _vals[i] = a(i);
158  }
159 
160  // Named constructors
162  {
164  }
165 
168  initializeSymmetric(const TypeVector<T> & v0, const TypeVector<T> & v1, const TypeVector<T> & v2);
169 
171  static MooseEnum fillMethodEnum();
172 
174  void fillFromInputVector(const std::vector<T> & input, FillMethod fill_method = autodetect);
175 
180  void fillFromScalarVariable(const VariableValue & scalar_variable);
181 
183  inline T & operator()(unsigned int i) { return _vals[i]; }
184 
189  inline T operator()(unsigned int i) const { return _vals[i]; }
190 
194  inline T operator()(unsigned int i, unsigned int j) const
195  {
196  const auto a = reverse_index[i][j];
197  return _vals[a] / mandelFactor(a);
198  }
199 
201  libMesh::VectorValue<T> row(const unsigned int n) const;
202 
204  libMesh::VectorValue<T> column(const unsigned int n) const { return row(n); }
205 
208  [[nodiscard]] static SymmetricRankTwoTensorTempl<T>
210 
213  [[nodiscard]] static SymmetricRankTwoTensorTempl<T>
215 
218  [[nodiscard]] static SymmetricRankTwoTensorTempl<T>
220 
223 
225  T tr() const { return _vals[0] + _vals[1] + _vals[2]; }
226 
228  void zero();
229 
235  void rotate(const TypeTensor<T> & R);
236 
242 
244  template <typename T2>
246 
250  template <typename Scalar>
251  typename std::enable_if<libMesh::ScalarTraits<Scalar>::value, SymmetricRankTwoTensorTempl &>::type
252  operator=(const Scalar & libmesh_dbg_var(p))
253  {
254  libmesh_assert_equal_to(p, Scalar(0));
255  this->zero();
256  return *this;
257  }
258 
261 
263  template <typename T2>
266 
269 
271  template <typename T2>
274 
277 
280 
282  template <typename T2>
283  auto operator*(const T2 & a) const ->
284  typename std::enable_if<libMesh::ScalarTraits<T2>::value,
286 
289 
291  template <typename T2>
292  auto operator/(const T2 & a) const ->
293  typename std::enable_if<libMesh::ScalarTraits<T2>::value,
294  SymmetricRankTwoTensorTempl<decltype(T() / T2())>>::type;
295 
297  template <typename T2>
298  TypeVector<typename libMesh::CompareTypes<T, T2>::supertype>
299  operator*(const TypeVector<T2> & a) const;
300 
302  template <typename T2>
303  bool operator==(const SymmetricRankTwoTensorTempl<T2> & a) const;
304 
306  bool isSymmetric() const { return true; }
307 
309  template <typename T2>
310  bool operator!=(const SymmetricRankTwoTensorTempl<T2> & a) const;
311 
314 
317 
320 
324 
327 
329  T trace() const;
330 
333 
339 
343  T generalSecondInvariant() const;
344 
351  T secondInvariant() const;
352 
358 
364 
371  T sin3Lode(const T & r0, const T & r0_value) const;
372 
379  SymmetricRankTwoTensorTempl<T> dsin3Lode(const T & r0) const;
380 
387  T thirdInvariant() const;
388 
394 
400 
401  // determinant of the tensor
402  T det() const;
403 
409 
411  void print(std::ostream & stm = Moose::out) const;
412 
414  void printReal(std::ostream & stm = Moose::out) const;
415 
417  void printADReal(unsigned int nDual, std::ostream & stm = Moose::out) const;
418 
419  friend std::ostream & operator<<(std::ostream & os, const SymmetricRankTwoTensorTempl<T> & t)
420  {
421  t.print(os);
422  return os;
423  }
424 
426  void addIa(const T & a);
427 
429  T L2norm() const;
430 
435  void surfaceFillFromInputVector(const std::vector<T> & input);
436 
441  void symmetricEigenvalues(std::vector<T> & eigvals) const;
442 
448  void symmetricEigenvaluesEigenvectors(std::vector<T> & eigvals,
449  RankTwoTensorTempl<T> & eigvecs) const;
450 
454  static void initRandom(unsigned int);
455 
461  [[nodiscard]] static SymmetricRankTwoTensorTempl<T> genRandomSymmTensor(T, T);
462 
464  [[nodiscard]] static SymmetricRankTwoTensorTempl<T> selfOuterProduct(const TypeVector<T> &);
465 
469 
471  void setToIdentity();
472 
473 protected:
483  void syev(const char * calculation_type, std::vector<T> & eigvals, std::vector<T> & a) const;
484 
485 private:
486  static constexpr std::array<Real, N> identityCoords = {{1, 1, 1, 0, 0, 0}};
487 
488  // tensor components
489  std::array<T, N> _vals;
490 
491  template <class T2>
492  friend void dataStore(std::ostream &, SymmetricRankTwoTensorTempl<T2> &, void *);
493 
494  template <class T2>
495  friend void dataLoad(std::istream &, SymmetricRankTwoTensorTempl<T2> &, void *);
496  template <class T2>
498 };
499 
500 namespace MetaPhysicL
501 {
502 template <typename T>
503 struct RawType<SymmetricRankTwoTensorTempl<T>>
504 {
506 
508  {
509  value_type ret;
510  for (unsigned int i = 0; i < SymmetricRankTwoTensorTempl<T>::N; ++i)
511  ret(i) = raw_value(in(i));
512 
513  return ret;
514  }
515 };
516 }
517 
518 template <typename T>
519 template <typename T2>
520 auto
522  typename std::enable_if<libMesh::ScalarTraits<T2>::value,
524 {
526  for (const auto i : make_range(N))
527  result._vals[i] = _vals[i] * a;
528  return result;
529 }
530 
531 template <typename T>
532 template <typename T2>
533 auto
535  typename std::enable_if<libMesh::ScalarTraits<T2>::value,
536  SymmetricRankTwoTensorTempl<decltype(T() / T2())>>::type
537 {
538  SymmetricRankTwoTensorTempl<decltype(T() / T2())> result;
539  for (const auto i : make_range(N))
540  result._vals[i] = _vals[i] / a;
541  return result;
542 }
543 
545 template <typename T>
546 template <typename T2>
547 TypeVector<typename libMesh::CompareTypes<T, T2>::supertype>
548 SymmetricRankTwoTensorTempl<T>::operator*(const TypeVector<T2> & a) const
549 {
550  TypeVector<typename libMesh::CompareTypes<T, T2>::supertype> ret;
551  ret(0) = a(0) * _vals[0] + a(1) * _vals[5] + a(2) * _vals[4];
552  ret(1) = a(0) * _vals[5] + a(1) * _vals[1] + a(2) * _vals[3];
553  ret(2) = a(0) * _vals[4] + a(1) * _vals[3] + a(2) * _vals[2];
554 }
555 
556 template <typename T>
557 template <typename T2>
558 bool
560 {
561  for (std::size_t i = 0; i < N; ++i)
562  if (_vals[i] != a._vals[i])
563  return false;
564  return true;
565 }
566 
567 template <typename T>
568 template <typename T2>
569 bool
571 {
572  for (std::size_t i = 0; i < N; ++i)
573  if (_vals[i] != a._vals[i])
574  return true;
575  return false;
576 }
577 
578 template <typename T>
581  std::vector<T> & eigval, RankTwoTensorTempl<T> & eigvec) const
582 {
583  using std::abs;
584 
585  // The calculate of projection tensor follows
586  // C. Miehe and M. Lambrecht, Commun. Numer. Meth. Engng 2001; 17:337~353
587 
588  // Compute eigenvectors and eigenvalues of this tensor
589  if (MooseUtils::IsLikeReal<T>::value)
590  {
591  this->symmetricEigenvaluesEigenvectors(eigval, eigvec);
592 
593  // Separate out positive and negative eigen values
594  std::array<T, N> epos;
595  std::array<T, N> d;
596  for (unsigned int i = 0; i < Ndim; ++i)
597  {
598  epos[i] = (abs(eigval[i]) + eigval[i]) / 2.0;
599  d[i] = 0 < eigval[i] ? 1.0 : 0.0;
600  }
601 
602  // projection tensor
604 
605  for (unsigned int a = 0; a < Ndim; ++a)
606  {
607  const auto Ma = SymmetricRankTwoTensorTempl<T>::selfOuterProduct(eigvec.column(a));
608  proj_pos += d[a] * Ma.outerProduct(Ma);
609  }
610 
611  for (const auto a : make_range(Ndim))
612  for (const auto b : make_range(a))
613  {
614  const auto Ma = SymmetricRankTwoTensorTempl<T>::selfOuterProduct(eigvec.column(a));
615  const auto Mb = SymmetricRankTwoTensorTempl<T>::selfOuterProduct(eigvec.column(b));
616 
618  for (const auto aa : make_range(N))
619  for (const auto bb : make_range(N))
620  {
621  const auto i = SymmetricRankFourTensorTempl<T>::full_index[aa][bb][0];
622  const auto j = SymmetricRankFourTensorTempl<T>::full_index[aa][bb][1];
623  const auto k = SymmetricRankFourTensorTempl<T>::full_index[aa][bb][2];
624  const auto l = SymmetricRankFourTensorTempl<T>::full_index[aa][bb][3];
625 
626  Gabba(aa, bb) = (Ma(i, k) * Mb(j, l) + Ma(i, l) * Mb(j, k) + Ma(j, l) * Mb(i, k) +
627  Ma(j, k) * Mb(i, l)) *
629  }
630 
631  T theta_ab;
632  if (!MooseUtils::relativeFuzzyEqual(eigval[a], eigval[b]))
633  theta_ab = 0.5 * (epos[a] - epos[b]) / (eigval[a] - eigval[b]);
634  else
635  theta_ab = 0.25 * (d[a] + d[b]);
636 
637  proj_pos += theta_ab * Gabba;
638  }
639  return proj_pos;
640  }
641  else
642  mooseError("positiveProjectionEigenDecomposition is only available for ordered tensor "
643  "component types");
644 }
645 
646 template <typename T>
647 T
648 SymmetricRankTwoTensorTempl<T>::sin3Lode(const T & r0, const T & r0_value) const
649 {
651  if (MooseUtils::IsLikeReal<T>::value)
652  {
653  T bar = secondInvariant();
654  if (bar <= r0)
655  // in this case the Lode angle is not defined
656  return r0_value;
657  else
658  // the min and max here gaurd against precision-loss when bar is tiny but nonzero.
659  return max(min(thirdInvariant() * -1.5 * sqrt(3.0) / pow(bar, 1.5), 1.0), -1.0);
660  }
661  else
662  mooseError("sin3Lode is only available for ordered tensor component types");
663 }
664 
665 template <typename T>
668 {
669  using std::sqrt, std::pow;
670  if (MooseUtils::IsLikeReal<T>::value)
671  {
672  T bar = secondInvariant();
673  if (bar <= r0)
675  else
676  return -1.5 * sqrt(3.0) *
677  (dthirdInvariant() / pow(bar, 1.5) -
678  1.5 * dsecondInvariant() * thirdInvariant() / pow(bar, 2.5));
679  }
680  else
681  mooseError("dsin3Lode is only available for ordered tensor component types");
682 }
683 
684 template <typename T>
685 template <typename T2>
688 {
689  for (const auto i : make_range(N))
690  (*this)(i) = a(i);
691  return *this;
692 }
693 
694 // non-member operators
695 
696 template <typename T, typename Scalar>
697 inline typename std::enable_if_t<
700 operator*(const Scalar & factor, const SymmetricRankTwoTensorTempl<T> & t)
701 {
702  return t * factor;
703 }
SymmetricRankTwoTensorTempl< T > dsecondInvariant() const
Denote the _vals[i][j] by A_ij, then this returns d(secondInvariant)/dA_ij.
MetaPhysicL::DualNumber< V, D, asd > abs(const MetaPhysicL::DualNumber< V, D, asd > &a)
Definition: EigenADReal.h:50
void mooseSetToZero(T &v)
Helper function templates to set a variable to zero.
Definition: MathUtils.h:377
void fillFromScalarVariable(const VariableValue &scalar_variable)
fillFromScalarVariable takes FIRST/THIRD/SIXTH order scalar variable to fill in the Rank-2 tensor...
static SymmetricRankTwoTensorTempl< T > timesTranspose(const RankTwoTensorTempl< T > &)
return the matrix multiplied with its transpose A*A^T (guaranteed symmetric)
SymmetricRankTwoTensorTempl(const std::vector< T > &input)
Constructor that proxies the fillFromInputVector method.
static constexpr unsigned int reverse_index[3][3]
friend void dataLoad(std::istream &, SymmetricRankTwoTensorTempl< T2 > &, void *)
SymmetricRankTwoTensorTempl< T > & operator*=(const T &a)
performs _vals *= a
static constexpr std::array< Real, N > identityCoords
This class defines a Tensor that can change its shape.
FillMethod
To fill up the 6 entries in the 2nd-order tensor, fillFromInputVector is called with one of the follo...
T sin3Lode(const T &r0, const T &r0_value) const
Sin(3*Lode_angle) If secondInvariant() <= r0 then return r0_value This is to gaurd against precision-...
T thirdInvariant() const
Denote the _vals[i][j] by A_ij, then S_ij = A_ij - de_ij*tr(A)/3 Then this returns det(S + S...
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:311
void addIa(const T &a)
Add identity times a to _vals.
void printReal(std::ostream &stm=Moose::out) const
Print the Real part of the ADReal rank two tensor.
T generalSecondInvariant() const
Calculates the second invariant (I2) of a tensor.
SymmetricRankTwoTensorTempl< typename libMesh::CompareTypes< T, T2 >::supertype > operator+(const SymmetricRankTwoTensorTempl< T2 > &a) const
returns _vals + a
SymmetricRankFourTensorTempl< T > d2thirdInvariant() const
Denote the _vals[i][j] by A_ij, then this returns d^2(thirdInvariant)/dA_ij/dA_kl.
libMesh::VectorValue< T > column(const unsigned int n) const
get the specified column of the tensor
auto operator*(const T2 &a) const -> typename std::enable_if< libMesh::ScalarTraits< T2 >::value, SymmetricRankTwoTensorTempl< decltype(T() *T2())>>::type
returns _vals*a
void rotate(const TypeTensor< T > &R)
rotates the tensor data given a rank two tensor rotation tensor _vals[i][j] = R_ij * R_jl * _vals[k][...
static void initRandom(unsigned int)
This function initializes random seed based on a user-defined number.
auto raw_value(const Eigen::Map< T > &in)
Definition: EigenADReal.h:100
static SymmetricRankTwoTensorTempl identity()
static SymmetricRankTwoTensorTempl< T > transposeTimes(const RankTwoTensorTempl< T > &)
return the matrix multiplied with its transpose A^T*A (guaranteed symmetric)
static constexpr std::size_t dim
This is the dimension of all vector and tensor datastructures used in MOOSE.
Definition: Moose.h:163
T trace() const
returns the trace of the tensor, ie _vals[i][i] (sum i = 0, 1, 2)
void symmetricEigenvaluesEigenvectors(std::vector< T > &eigvals, RankTwoTensorTempl< T > &eigvecs) const
computes eigenvalues and eigenvectors, assuming tens is symmetric, and places them in ascending order...
T & operator()(unsigned int i)
Gets the raw value for the index specified. Takes index = 0,1,2,3,4,5.
SymmetricRankFourTensorTempl< T > positiveProjectionEigenDecomposition(std::vector< T > &, RankTwoTensorTempl< T > &) const
return positive projection tensor of eigen-decomposition
We need to instantiate the following CompareTypes to tell the compiler that ADReal is a subtype of Ch...
The following methods are specializations for using the libMesh::Parallel::packed_range_* routines fo...
std::basic_ostream< charT, traits > * os
Definition: InfixIterator.h:34
T value_type
For generic programming.
SymmetricRankTwoTensorTempl< T > ddet() const
Denote the _vals[i][j] by A_ij, then this returns d(det)/dA_ij.
bool operator==(const SymmetricRankTwoTensorTempl< T2 > &a) const
Defines logical equality with another SymmetricRankTwoTensorTempl<T2>
SymmetricRankFourTensorTempl< T > d2secondInvariant() const
Denote the _vals[i][j] by A_ij, then this returns d^2(secondInvariant)/dA_ij/dA_kl.
std::enable_if_t< libMesh::ScalarTraits< Scalar >::value, SymmetricRankTwoTensorTempl< typename libMesh::CompareTypes< T, Scalar >::supertype > > operator*(const Scalar &factor, const SymmetricRankTwoTensorTempl< T > &t)
auto max(const L &left, const R &right)
SymmetricRankTwoTensorTempl(const SymmetricRankTwoTensorTempl< T2 > &a)
Construct from other template.
MooseArray< Real > VariableValue
static constexpr unsigned int Ndim
tensor dimension and Mandel vector length
SymmetricRankTwoTensorTempl< T > initialContraction(const SymmetricRankFourTensorTempl< T > &b) const
returns this_ij * b_ijkl
void fillFromInputVector(const std::vector< T > &input, FillMethod fill_method=autodetect)
fillFromInputVector takes 1, 3, or 6 inputs to fill in the symmmetric Rank-2 tensor.
void print(std::ostream &stm=Moose::out) const
Print the rank two tensor.
T pow(const T &x)
T secondInvariant() const
Denote the _vals[i][j] by A_ij, then S_ij = A_ij - de_ij*tr(A)/3 Then this returns (S_ij + S_ji)*(S_i...
T tr() const
Returns the trace.
SymmetricRankTwoTensorTempl< T > square() const
Returns the matrix squared.
SymmetricRankTwoTensorTempl()
Default constructor; fills to zero.
T L2norm() const
Sqrt(_vals[i][j]*_vals[i][j])
libMesh::VectorValue< T > column(const unsigned int i) const
Get the i-th column of the second order tensor.
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
Definition: MooseEnum.h:54
std::enable_if< libMesh::ScalarTraits< Scalar >::value, SymmetricRankTwoTensorTempl & >::type operator=(const Scalar &libmesh_dbg_var(p))
Assignment-from-scalar operator.
SymmetricRankTwoTensorTempl< T > deviatoric() const
returns A_ij - de_ij*tr(A)/3, where A are the _vals
T doubleContraction(const SymmetricRankTwoTensorTempl< T > &a) const
returns _vals_ij * a_ij (sum on i, j)
SymmetricRankTwoTensorTempl< T > & operator/=(const T &a)
performs _vals /= a
SymmetricRankTwoTensorTempl< T > dthirdInvariant() const
Denote the _vals[i][j] by A_ij, then this returns d(thirdInvariant()/dA_ij.
void setToIdentity()
set the tensor to the identity matrix
OutputTools< Real >::VariableValue VariableValue
Definition: MooseTypes.h:343
SymmetricRankTwoTensorTempl< T > & operator=(const SymmetricRankTwoTensorTempl< T2 > &a)
sets _vals to a, and returns _vals
forward declarations
static SymmetricRankTwoTensorTempl< T > selfOuterProduct(const TypeVector< T > &)
SymmetricRankTwoTensorTempl<T> from outer product of a vector with itself.
void symmetricEigenvalues(std::vector< T > &eigvals) const
computes eigenvalues, assuming tens is symmetric, and places them in ascending order in eigvals ...
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
bool isSymmetric() const
Test for symmetry. Surprisingly this is always true.
SymmetricRankTwoTensorTempl< T > dsin3Lode(const T &r0) const
d(sin3Lode)/dA_ij If secondInvariant() <= r0 then return zero This is to gaurd against precision-loss...
T operator()(unsigned int i) const
Gets the raw value for the index specified.
SymmetricRankTwoTensorTempl< T > & operator-=(const SymmetricRankTwoTensorTempl< T > &a)
sets _vals -= a and returns vals
static SymmetricRankTwoTensorTempl< T > genRandomSymmTensor(T, T)
This function generates a random symmetric rank two tensor.
CTSub CT_OPERATOR_BINARY CTMul CTCompareLess CTCompareGreater CTCompareEqual _arg template * sqrt(_arg)) *_arg.template D< dtag >()) CT_SIMPLE_UNARY_FUNCTION(tanh
static SymmetricRankTwoTensorTempl< T > plusTranspose(const RankTwoTensorTempl< T > &)
return the matrix plus its transpose A-A^T (guaranteed symmetric)
RankTwoTensorTempl is designed to handle the Stress or Strain Tensor for a fully anisotropic material...
Definition: RankTwoTensor.h:87
SymmetricRankTwoTensorTempl< typename RawType< T >::value_type > value_type
SymmetricRankTwoTensorTempl< T > dtrace() const
Denote the _vals[i][j] by A_ij, then this returns d(trace)/dA_ij.
static MooseEnum fillMethodEnum()
Static method for use in validParams for getting the "fill_method".
friend void dataStore(std::ostream &, SymmetricRankTwoTensorTempl< T2 > &, void *)
static SymmetricRankTwoTensorTempl initializeSymmetric(const TypeVector< T > &v0, const TypeVector< T > &v1, const TypeVector< T > &v2)
named constructor for initializing symmetrically
SymmetricRankFourTensorTempl is designed to handle an N-dimensional fourth order tensor with minor sy...
IntRange< T > make_range(T beg, T end)
void mooseSetToZero< SymmetricRankTwoTensor >(SymmetricRankTwoTensor &v)
Helper function template specialization to set an object to zero.
bool operator!=(const SymmetricRankTwoTensorTempl< T2 > &a) const
Defines logical inequality with another SymmetricRankTwoTensorTempl<T2>
void syev(const char *calculation_type, std::vector< T > &eigvals, std::vector< T > &a) const
Uses the petscblaslapack.h LAPACKsyev_ routine to find, for symmetric _vals: (1) the eigenvalues (if ...
SymmetricRankFourTensorTempl< T > outerProduct(const SymmetricRankTwoTensorTempl< T > &a) const
returns C_ijkl = a_ij * b_kl
void mooseSetToZero< ADSymmetricRankTwoTensor >(ADSymmetricRankTwoTensor &v)
Helper function template specialization to set an object to zero.
static constexpr Real mandelFactor(unsigned int i)
returns the 1 or sqrt(2) prefactor in the Mandel notation for the index i ranging from 0-5...
SymmetricRankTwoTensorTempl< T > & operator+=(const SymmetricRankTwoTensorTempl< T > &a)
adds a to _vals
auto operator/(const T2 &a) const -> typename std::enable_if< libMesh::ScalarTraits< T2 >::value, SymmetricRankTwoTensorTempl< decltype(T()/T2())>>::type
returns _vals/a
libMesh::VectorValue< T > row(const unsigned int n) const
get the specified row of the tensor
static value_type value(const SymmetricRankTwoTensorTempl< T > &in)
static constexpr unsigned int full_index[6][2]
void surfaceFillFromInputVector(const std::vector< T > &input)
sets _vals[0][0], _vals[0][1], _vals[1][0], _vals[1][1] to input, and the remainder to zero ...
static constexpr unsigned int N
auto min(const L &left, const R &right)
static SymmetricRankTwoTensorTempl fromRawComponents(const T &S11, const T &S22, const T &S33, const T &S23, const T &S13, const T &S12)
MooseUnits pow(const MooseUnits &, int)
Definition: Units.C:537
SymmetricRankTwoTensorTempl< T > transpose() const
Returns a matrix that is the transpose of the matrix this was called on.
static constexpr Real sqrt2
std::sqrt is not constexpr, so we add sqrt(2) as a constant (used in Mandel notation) ...
Definition: MathUtils.h:25
void printADReal(unsigned int nDual, std::ostream &stm=Moose::out) const
Print the Real part of the ADReal rank two tensor along with its first nDual dual numbers...
SymmetricRankTwoTensorTempl< T > operator-() const
returns -_vals
T operator()(unsigned int i, unsigned int j) const
Gets the value for the index specified.
void zero()
Set all components to zero.
SymmetricRankTwoTensorTempl< T > inverse() const
retuns the inverse of the tensor