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 boostcopy = libMesh::boostcopy;
47 
48 namespace MathUtils
49 {
50 template <typename T>
51 void mooseSetToZero(T & v);
52 
57 template <>
59 
64 template <>
66 }
67 
74 template <typename T>
76 {
77 public:
79  typedef T value_type;
80 
82  static constexpr unsigned int Ndim = Moose::dim;
83  static constexpr unsigned int N = Ndim + (Ndim * (Ndim - 1)) / 2;
85 
86  // Full tensor indices in the Mandel/Voigt representation
87  static constexpr unsigned int full_index[6][2] = {{0, 0}, {1, 1}, {2, 2}, {1, 2}, {0, 2}, {0, 1}};
88 
89  // Reverse tensor indices in the Mandel/Voigt representation
90  static constexpr unsigned int reverse_index[3][3] = {{0, 5, 4}, {5, 1, 3}, {4, 3, 2}};
91 
93  static constexpr Real mandelFactor(unsigned int i) { return i < Ndim ? 1.0 : MathUtils::sqrt2; }
94 
95  // Select initialization
97  {
100  };
101 
104 
107 
114  {
119  };
120 
122  SymmetricRankTwoTensorTempl(const std::vector<T> & input) { this->fillFromInputVector(input); };
123 
126  const T & S11, const T & S22, const T & S33, const T & S23, const T & S13, const T & S12);
127 
128  // explicit cast to a full tensor
129  explicit operator RankTwoTensorTempl<T>();
130 
131 private:
133  SymmetricRankTwoTensorTempl(const T & S11,
134  const T & S21,
135  const T & S31,
136  const T & S12,
137  const T & S22,
138  const T & S32,
139  const T & S13,
140  const T & S23,
141  const T & S33);
142 
143  // internal use named constructor that does not apply the sqrt(2) factors
145  const T & S11, const T & S22, const T & S33, const T & S23, const T & S13, const T & S12);
146 
147 public:
149  explicit SymmetricRankTwoTensorTempl(const TensorValue<T> & a);
150 
152  explicit SymmetricRankTwoTensorTempl(const TypeTensor<T> & a);
153 
155  template <typename T2>
157  {
158  for (const auto i : make_range(N))
159  _vals[i] = a(i);
160  }
161 
162  // Named constructors
164  {
166  }
167 
170  initializeSymmetric(const TypeVector<T> & v0, const TypeVector<T> & v1, const TypeVector<T> & v2);
171 
173  static MooseEnum fillMethodEnum();
174 
176  void fillFromInputVector(const std::vector<T> & input, FillMethod fill_method = autodetect);
177 
182  void fillFromScalarVariable(const VariableValue & scalar_variable);
183 
185  inline T & operator()(unsigned int i) { return _vals[i]; }
186 
191  inline T operator()(unsigned int i) const { return _vals[i]; }
192 
196  inline T operator()(unsigned int i, unsigned int j) const
197  {
198  const auto a = reverse_index[i][j];
199  return _vals[a] / mandelFactor(a);
200  }
201 
203  libMesh::VectorValue<T> row(const unsigned int n) const;
204 
206  libMesh::VectorValue<T> column(const unsigned int n) const { return row(n); }
207 
210  [[nodiscard]] static SymmetricRankTwoTensorTempl<T>
212 
215  [[nodiscard]] static SymmetricRankTwoTensorTempl<T>
217 
220  [[nodiscard]] static SymmetricRankTwoTensorTempl<T>
222 
225 
227  T tr() const { return _vals[0] + _vals[1] + _vals[2]; }
228 
230  void zero();
231 
237  void rotate(const TypeTensor<T> & R);
238 
244 
246  template <typename T2>
248 
252  template <typename Scalar>
255  operator=(const Scalar & libmesh_dbg_var(p))
256  {
257  libmesh_assert_equal_to(p, Scalar(0));
258  this->zero();
259  return *this;
260  }
261 
264 
266  template <typename T2>
269 
272 
274  template <typename T2>
277 
280 
283 
285  template <typename T2>
286  auto operator*(const T2 & a) const ->
287  typename std::enable_if<libMesh::ScalarTraits<T2>::value,
289 
292 
294  template <typename T2>
295  auto operator/(const T2 & a) const ->
296  typename std::enable_if<libMesh::ScalarTraits<T2>::value,
297  SymmetricRankTwoTensorTempl<decltype(T() / T2())>>::type;
298 
300  template <typename T2>
301  TypeVector<typename libMesh::CompareTypes<T, T2>::supertype>
302  operator*(const TypeVector<T2> & a) const;
303 
305  template <typename T2>
306  bool operator==(const SymmetricRankTwoTensorTempl<T2> & a) const;
307 
309  bool isSymmetric() const { return true; }
310 
312  template <typename T2>
313  bool operator!=(const SymmetricRankTwoTensorTempl<T2> & a) const;
314 
317 
320 
323 
327 
330 
332  T trace() const;
333 
336 
342 
346  T generalSecondInvariant() const;
347 
354  T secondInvariant() const;
355 
361 
367 
374  T sin3Lode(const T & r0, const T & r0_value) const;
375 
382  SymmetricRankTwoTensorTempl<T> dsin3Lode(const T & r0) const;
383 
390  T thirdInvariant() const;
391 
397 
403 
404  // determinant of the tensor
405  T det() const;
406 
412 
414  void print(std::ostream & stm = Moose::out) const;
415 
417  void printReal(std::ostream & stm = Moose::out) const;
418 
420  void printADReal(unsigned int nDual, std::ostream & stm = Moose::out) const;
421 
422  friend std::ostream & operator<<(std::ostream & os, const SymmetricRankTwoTensorTempl<T> & t)
423  {
424  t.print(os);
425  return os;
426  }
427 
429  void addIa(const T & a);
430 
432  T L2norm() const;
433 
438  void surfaceFillFromInputVector(const std::vector<T> & input);
439 
444  void symmetricEigenvalues(std::vector<T> & eigvals) const;
445 
451  void symmetricEigenvaluesEigenvectors(std::vector<T> & eigvals,
452  RankTwoTensorTempl<T> & eigvecs) const;
453 
457  static void initRandom(unsigned int);
458 
464  [[nodiscard]] static SymmetricRankTwoTensorTempl<T> genRandomSymmTensor(T, T);
465 
467  [[nodiscard]] static SymmetricRankTwoTensorTempl<T> selfOuterProduct(const TypeVector<T> &);
468 
472 
474  void setToIdentity();
475 
476 protected:
486  void syev(const char * calculation_type, std::vector<T> & eigvals, std::vector<T> & a) const;
487 
488 private:
489  static constexpr std::array<Real, N> identityCoords = {{1, 1, 1, 0, 0, 0}};
490 
491  // tensor components
492  std::array<T, N> _vals;
493 
494  template <class T2>
495  friend void dataStore(std::ostream &, SymmetricRankTwoTensorTempl<T2> &, void *);
496 
497  template <class T2>
498  friend void dataLoad(std::istream &, SymmetricRankTwoTensorTempl<T2> &, void *);
499  template <class T2>
501 };
502 
503 namespace MetaPhysicL
504 {
505 template <typename T>
506 struct RawType<SymmetricRankTwoTensorTempl<T>>
507 {
509 
511  {
512  value_type ret;
513  for (unsigned int i = 0; i < SymmetricRankTwoTensorTempl<T>::N; ++i)
514  ret(i) = raw_value(in(i));
515 
516  return ret;
517  }
518 };
519 }
520 
521 template <typename T>
522 template <typename T2>
523 auto
525  typename std::enable_if<libMesh::ScalarTraits<T2>::value,
527 {
529  for (const auto i : make_range(N))
530  result._vals[i] = _vals[i] * a;
531  return result;
532 }
533 
534 template <typename T>
535 template <typename T2>
536 auto
538  typename std::enable_if<libMesh::ScalarTraits<T2>::value,
539  SymmetricRankTwoTensorTempl<decltype(T() / T2())>>::type
540 {
541  SymmetricRankTwoTensorTempl<decltype(T() / T2())> result;
542  for (const auto i : make_range(N))
543  result._vals[i] = _vals[i] / a;
544  return result;
545 }
546 
548 template <typename T>
549 template <typename T2>
550 TypeVector<typename libMesh::CompareTypes<T, T2>::supertype>
551 SymmetricRankTwoTensorTempl<T>::operator*(const TypeVector<T2> & a) const
552 {
553  TypeVector<typename libMesh::CompareTypes<T, T2>::supertype> ret;
554  ret(0) = a(0) * _vals[0] + a(1) * _vals[5] + a(2) * _vals[4];
555  ret(1) = a(0) * _vals[5] + a(1) * _vals[1] + a(2) * _vals[3];
556  ret(2) = a(0) * _vals[4] + a(1) * _vals[3] + a(2) * _vals[2];
557 }
558 
559 template <typename T>
560 template <typename T2>
561 bool
563 {
564  for (std::size_t i = 0; i < N; ++i)
565  if (_vals[i] != a._vals[i])
566  return false;
567  return true;
568 }
569 
570 template <typename T>
571 template <typename T2>
572 bool
574 {
575  for (std::size_t i = 0; i < N; ++i)
576  if (_vals[i] != a._vals[i])
577  return true;
578  return false;
579 }
580 
581 template <typename T>
584  std::vector<T> & eigval, RankTwoTensorTempl<T> & eigvec) const
585 {
586  // The calculate of projection tensor follows
587  // C. Miehe and M. Lambrecht, Commun. Numer. Meth. Engng 2001; 17:337~353
588 
589  // Compute eigenvectors and eigenvalues of this tensor
591  {
592  this->symmetricEigenvaluesEigenvectors(eigval, eigvec);
593 
594  // Separate out positive and negative eigen values
595  std::array<T, N> epos;
596  std::array<T, N> d;
597  for (unsigned int i = 0; i < N; ++i)
598  {
599  epos[i] = (std::abs(eigval[i]) + eigval[i]) / 2.0;
600  d[i] = 0 < eigval[i] ? 1.0 : 0.0;
601  }
602 
603  // projection tensor
605 
606  for (unsigned int a = 0; a < Ndim; ++a)
607  {
608  const auto Ma = SymmetricRankTwoTensorTempl<T>::selfOuterProduct(eigvec.column(a));
609  proj_pos += d[a] * Ma.outerProduct(Ma);
610  }
611 
612  for (const auto a : make_range(Ndim))
613  for (const auto b : make_range(a))
614  {
615  const auto Ma = SymmetricRankTwoTensorTempl<T>::selfOuterProduct(eigvec.column(a));
616  const auto Mb = SymmetricRankTwoTensorTempl<T>::selfOuterProduct(eigvec.column(b));
617 
619  for (const auto aa : make_range(N))
620  for (const auto bb : make_range(N))
621  {
622  const auto i = SymmetricRankFourTensorTempl<T>::full_index[aa][bb][0];
623  const auto j = SymmetricRankFourTensorTempl<T>::full_index[aa][bb][1];
624  const auto k = SymmetricRankFourTensorTempl<T>::full_index[aa][bb][2];
625  const auto l = SymmetricRankFourTensorTempl<T>::full_index[aa][bb][3];
626 
627  Gabba(aa, bb) = (Ma(i, k) * Mb(j, l) + Ma(i, l) * Mb(j, k) + Ma(j, l) * Mb(i, k) +
628  Ma(j, k) * Mb(i, l)) *
630  }
631 
632  T theta_ab;
633  if (!MooseUtils::relativeFuzzyEqual(eigval[a], eigval[b]))
634  theta_ab = 0.5 * (epos[a] - epos[b]) / (eigval[a] - eigval[b]);
635  else
636  theta_ab = 0.25 * (d[a] + d[b]);
637 
638  proj_pos += theta_ab * Gabba;
639  }
640  return proj_pos;
641  }
642  else
643  mooseError("positiveProjectionEigenDecomposition is only available for ordered tensor "
644  "component types");
645 }
646 
647 template <typename T>
648 T
649 SymmetricRankTwoTensorTempl<T>::sin3Lode(const T & r0, const T & r0_value) const
650 {
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 std::max(std::min(thirdInvariant() * -1.5 * std::sqrt(3.0) / std::pow(bar, 1.5), 1.0),
660  -1.0);
661  }
662  else
663  mooseError("sin3Lode is only available for ordered tensor component types");
664 }
665 
666 template <typename T>
669 {
671  {
672  T bar = secondInvariant();
673  if (bar <= r0)
675  else
676  return -1.5 * std::sqrt(3.0) *
677  (dthirdInvariant() / std::pow(bar, 1.5) -
678  1.5 * dsecondInvariant() * thirdInvariant() / std::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:42
void mooseSetToZero(T &v)
Helper function templates to set a variable to zero.
Definition: MathUtils.h:372
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:302
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:73
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:153
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:33
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.
Custom type trait that has a value of true for types that cam be use interchangeably with Real...
Definition: MooseUtils.h:1005
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])
SymmetricRankTwoTensorTempl is designed to handle the Stress or Strain Tensor for an anisotropic mate...
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:33
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:314
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...
boostcopy::enable_if_c< libMesh::ScalarTraits< Scalar >::value, SymmetricRankTwoTensorTempl & >::type operator=(const Scalar &libmesh_dbg_var(p))
Assignment-from-scalar operator.
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.
bool relativeFuzzyEqual(const T &var1, const T2 &var2, const T3 &tol=libMesh::TOLERANCE *libMesh::TOLERANCE)
Function to check whether two variables are equal within a relative tolerance.
Definition: MooseUtils.h:492
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