https://mooseframework.inl.gov
RankTwoTensor.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 "MooseTypes.h"
14 #include "ADRankTwoTensorForward.h"
18 #include "MooseUtils.h"
19 #include "MathUtils.h"
20 
21 // Any requisite includes here
22 #include "libmesh/libmesh.h"
23 #include "libmesh/tensor_value.h"
24 #include "libmesh/vector_value.h"
25 #include "libmesh/int_range.h"
26 
27 #include "metaphysicl/raw_type.h"
28 
29 #include <petscsys.h>
30 #include <vector>
31 
32 // Forward declarations
33 class MooseEnum;
34 template <typename T>
35 class MooseArray;
37 template <typename>
39 namespace libMesh
40 {
41 template <typename>
42 class TypeVector;
43 template <typename>
44 class TypeTensor;
45 template <typename>
46 class TensorValue;
47 namespace TensorTools
48 {
49 template <>
51 {
53 };
54 }
55 }
56 
57 namespace MathUtils
58 {
59 template <typename T>
60 void mooseSetToZero(T & v);
61 
66 template <>
68 
73 template <>
75 }
76 
86 template <typename T>
88 {
89 public:
91 
95  static constexpr unsigned int N = Moose::dim;
96 
100  static constexpr unsigned int N2 = N * N;
101 
108  {
111  };
112 
119  {
125  };
126 
131  static void initRandom(unsigned int);
132 
138  [[nodiscard]] static MooseEnum fillMethodEnum();
139 
144 
146  void print(std::ostream & stm = Moose::out) const;
147 
149  void printReal(std::ostream & stm = Moose::out) const;
150 
152  void printADReal(unsigned int nDual, std::ostream & stm = Moose::out) const;
153 
155 
157 
171 
194 
212  const libMesh::TypeVector<T> & row2,
213  const libMesh::TypeVector<T> & row3);
214 
219  RankTwoTensorTempl(const std::vector<T> & input) { this->fillFromInputVector(input); };
220 
232  const T & S11, const T & S22, const T & S33, const T & S23, const T & S13, const T & S12);
233 
244  RankTwoTensorTempl(const T & S11,
245  const T & S21,
246  const T & S31,
247  const T & S12,
248  const T & S22,
249  const T & S32,
250  const T & S13,
251  const T & S23,
252  const T & S33);
253 
265  RankTwoTensorTempl(const RankTwoTensorTempl<T> & a) = default;
266 
271 
276 
280  template <typename T2>
282  : RankTwoTensorTempl<T>(a(0),
283  a(1),
284  a(2),
285  a(3) / MathUtils::sqrt2,
286  a(4) / MathUtils::sqrt2,
287  a(5) / MathUtils::sqrt2)
288  {
289  }
290 
295  template <typename T2>
297  {
298  }
300 
302 
319  [[nodiscard]] static RankTwoTensorTempl initializeSymmetric(const libMesh::TypeVector<T> & v0,
320  const libMesh::TypeVector<T> & v1,
321  const libMesh::TypeVector<T> & v2);
322 
336  [[nodiscard]] static RankTwoTensorTempl initializeFromRows(const libMesh::TypeVector<T> & row0,
337  const libMesh::TypeVector<T> & row1,
338  const libMesh::TypeVector<T> & row2);
339 
353  [[nodiscard]] static RankTwoTensorTempl
355  const libMesh::TypeVector<T> & col1,
356  const libMesh::TypeVector<T> & col2);
357 
368  [[nodiscard]] static RankTwoTensorTempl Identity() { return RankTwoTensorTempl(initIdentity); }
369 
384  [[nodiscard]] static RankTwoTensorTempl<T> timesTranspose(const RankTwoTensorTempl<T> &);
385 
400  [[nodiscard]] static RankTwoTensorTempl<T> transposeTimes(const RankTwoTensorTempl<T> &);
401 
416  [[nodiscard]] static RankTwoTensorTempl<T> plusTranspose(const RankTwoTensorTempl<T> &);
417 
431  [[nodiscard]] static RankTwoTensorTempl<T> outerProduct(const libMesh::TypeVector<T> &,
432  const libMesh::TypeVector<T> &);
433 
446  [[nodiscard]] static RankTwoTensorTempl<T> selfOuterProduct(const libMesh::TypeVector<T> &);
447 
455  [[nodiscard]] static RankTwoTensorTempl<T> genRandomTensor(T stddev, T mean);
456 
464  [[nodiscard]] static RankTwoTensorTempl<T> genRandomSymmTensor(T stddev, T mean);
465 
467 
469 
484  libMesh::VectorValue<T> column(const unsigned int i) const;
485 
487 
489 
509 
532 
551  template <typename Scalar>
553  RankTwoTensorTempl &>::type
554  operator=(const Scalar & libmesh_dbg_var(p))
555  {
556  libmesh_assert_equal_to(p, Scalar(0));
557  this->zero();
558  return *this;
559  }
560 
580 
600 
615  RankTwoTensorTempl<T> & operator*=(const T & a);
616 
631  RankTwoTensorTempl<T> & operator/=(const T & a);
632 
652 
700  void fillFromInputVector(const std::vector<T> & input, FillMethod fill_method = autodetect);
701 
748  void fillFromScalarVariable(const VariableValue & scalar_variable);
749 
754  void surfaceFillFromInputVector(const std::vector<T> & input);
755 
773 
792  void fillRow(unsigned int r, const libMesh::TypeVector<T> & v);
793 
812  void fillColumn(unsigned int c, const libMesh::TypeVector<T> & v);
813 
828  void setToIdentity();
829 
831 
845  void addIa(const T & a);
846 
867  void rotate(const RankTwoTensorTempl<T> & R);
868 
870 
872 
888 
910 
916 
932 
951  template <typename T2>
953  operator+(const libMesh::TypeTensor<T2> & a) const;
954 
973  template <typename T2>
975  operator-(const libMesh::TypeTensor<T2> & a) const;
976 
992 
1007  template <typename T2, typename std::enable_if<libMesh::ScalarTraits<T2>::value, int>::type = 0>
1009  operator*(const T2 & a) const;
1010 
1025  template <typename T2, typename std::enable_if<libMesh::ScalarTraits<T2>::value, int>::type = 0>
1027  operator/(const T2 & a) const;
1028 
1047  template <typename T2>
1049  operator*(const libMesh::TypeVector<T2> & a) const;
1050 
1069  template <typename T2>
1071  operator*(const libMesh::TypeTensor<T2> & a) const;
1072 
1090  T doubleContraction(const RankTwoTensorTempl<T> & a) const;
1091 
1125  template <int n, int o, int p, int q>
1127 
1155  template <int n, int o, int p, int q, int r, int s>
1157 
1162  {
1163  usingTensorIndices(i_, j_, k_, l_);
1164  return times<i_, j_, k_, l_>(b);
1165  }
1166 
1172 
1178 
1196  RankTwoTensorTempl<T> &) const;
1197 
1203 
1208  T trace() const;
1209 
1214  RankTwoTensorTempl<T> dtrace() const;
1215 
1220 
1226  T generalSecondInvariant() const;
1227 
1234  T secondInvariant() const;
1235 
1242 
1249 
1257  T sin3Lode(const T & r0, const T & r0_value) const;
1258 
1265  RankTwoTensorTempl<T> dsin3Lode(const T & r0) const;
1266 
1273  RankFourTensorTempl<T> d2sin3Lode(const T & r0) const;
1274 
1281  T thirdInvariant() const;
1282 
1288 
1294 
1299  RankTwoTensorTempl<T> ddet() const;
1300 
1302  T L2norm() const;
1303 
1308  void symmetricEigenvalues(std::vector<T> & eigvals) const;
1309 
1315  void symmetricEigenvaluesEigenvectors(std::vector<T> & eigvals,
1316  RankTwoTensorTempl<T> & eigvecs) const;
1317 
1329  void dsymmetricEigenvalues(std::vector<T> & eigvals,
1330  std::vector<RankTwoTensorTempl<T>> & deigvals) const;
1331 
1336  void d2symmetricEigenvalues(std::vector<RankFourTensorTempl<T>> & deriv) const;
1337 
1343 
1346 
1348 
1350 
1352  bool operator==(const RankTwoTensorTempl<T> & a) const;
1353 
1355  bool isSymmetric() const;
1356 
1358 
1359 protected:
1369  void syev(const char * calculation_type, std::vector<T> & eigvals, std::vector<T> & a) const;
1370 
1371 private:
1372  static constexpr Real identityCoords[N2] = {1, 0, 0, 0, 1, 0, 0, 0, 1};
1373 
1374  template <class T2>
1375  friend void dataStore(std::ostream &, RankTwoTensorTempl<T2> &, void *);
1376 
1378 
1379  template <class T2>
1380  friend void dataLoad(std::istream &, RankTwoTensorTempl<T2> &, void *);
1381  template <class T2>
1382  friend class RankFourTensorTempl;
1383  template <class T2>
1384  friend class RankThreeTensorTempl;
1385 };
1386 
1387 namespace MetaPhysicL
1388 {
1389 template <typename T>
1390 struct RawType<RankTwoTensorTempl<T>>
1391 {
1393 
1395  {
1396  value_type ret;
1399  ret(i, j) = raw_value(in(i, j));
1400 
1401  return ret;
1402  }
1403 };
1404 }
1405 
1406 template <typename T>
1407 template <typename T2>
1410 {
1412 }
1413 
1414 template <typename T>
1415 template <typename T2>
1418 {
1420 }
1421 
1422 template <typename T>
1423 template <typename T2, typename std::enable_if<libMesh::ScalarTraits<T2>::value, int>::type>
1426 {
1428 }
1429 
1430 template <typename T>
1431 template <typename T2>
1434 {
1436 }
1437 
1438 template <typename T>
1439 template <typename T2>
1442 {
1444 }
1445 
1446 template <typename T>
1447 template <typename T2, typename std::enable_if<libMesh::ScalarTraits<T2>::value, int>::type>
1450 {
1452 }
1453 
1454 template <typename T>
1457  RankTwoTensorTempl<T> & eigvec) const
1458 {
1459  if constexpr (MooseUtils::IsLikeReal<T>::value)
1460  {
1461  // Compute eigenvectors and eigenvalues of this tensor
1462  this->symmetricEigenvaluesEigenvectors(eigval, eigvec);
1463 
1464  // Separate out positive and negative eigen values
1465  std::array<T, N> epos;
1466  std::array<T, N> d;
1467  for (auto i : libMesh::make_range(N))
1468  {
1469  epos[i] = (std::abs(eigval[i]) + eigval[i]) / 2.0;
1470  d[i] = 0 < eigval[i] ? 1.0 : 0.0;
1471  }
1472 
1473  // projection tensor
1474  RankFourTensorTempl<T> proj_pos;
1475  RankFourTensorTempl<T> Gab, Gba;
1476 
1477  for (auto a : libMesh::make_range(N))
1478  {
1479  const auto Ma = RankTwoTensorTempl<T>::selfOuterProduct(eigvec.column(a));
1480  proj_pos += d[a] * Ma.outerProduct(Ma);
1481  }
1482 
1483  usingTensorIndices(i_, j_, k_, l_);
1484  for (const auto a : libMesh::make_range(N))
1485  for (const auto b : libMesh::make_range(a))
1486  {
1487  const auto Ma = RankTwoTensorTempl<T>::selfOuterProduct(eigvec.column(a));
1488  const auto Mb = RankTwoTensorTempl<T>::selfOuterProduct(eigvec.column(b));
1489 
1490  Gab = Ma.template times<i_, k_, j_, l_>(Mb) + Ma.template times<i_, l_, j_, k_>(Mb);
1491  Gba = Mb.template times<i_, k_, j_, l_>(Ma) + Mb.template times<i_, l_, j_, k_>(Ma);
1492 
1493  T theta_ab;
1494  if (!MooseUtils::absoluteFuzzyEqual(eigval[a], eigval[b]))
1495  theta_ab = 0.5 * (epos[a] - epos[b]) / (eigval[a] - eigval[b]);
1496  else
1497  theta_ab = 0.25 * (d[a] + d[b]);
1498 
1499  proj_pos += theta_ab * (Gab + Gba);
1500  }
1501  return proj_pos;
1502  }
1503  else
1504  mooseError("positiveProjectionEigenDecomposition is only available for ordered tensor "
1505  "component types");
1506 }
1507 
1508 template <typename T>
1509 T
1510 RankTwoTensorTempl<T>::sin3Lode(const T & r0, const T & r0_value) const
1511 {
1512  if constexpr (MooseUtils::IsLikeReal<T>::value)
1513  {
1514  T bar = secondInvariant();
1515  if (bar <= r0)
1516  // in this case the Lode angle is not defined
1517  return r0_value;
1518  else
1519  // the min and max here gaurd against precision-loss when bar is tiny but nonzero.
1520  return std::max(std::min(-1.5 * std::sqrt(3.0) * thirdInvariant() / std::pow(bar, 1.5), 1.0),
1521  -1.0);
1522  }
1523  else
1524  mooseError("sin3Lode is only available for ordered tensor component types");
1525 }
1526 
1527 template <typename T>
1530 {
1531  if constexpr (MooseUtils::IsLikeReal<T>::value)
1532  {
1533  T bar = secondInvariant();
1534  if (bar <= r0)
1535  return RankTwoTensorTempl<T>();
1536  else
1537  return -1.5 * std::sqrt(3.0) *
1538  (dthirdInvariant() / std::pow(bar, 1.5) -
1539  1.5 * dsecondInvariant() * thirdInvariant() / std::pow(bar, 2.5));
1540  }
1541  else
1542  mooseError("dsin3Lode is only available for ordered tensor component types");
1543 }
1544 
1545 template <typename T>
1548 {
1549  if constexpr (MooseUtils::IsLikeReal<T>::value)
1550  {
1551  T bar = secondInvariant();
1552  if (bar <= r0)
1553  return RankFourTensorTempl<T>();
1554 
1555  T J3 = thirdInvariant();
1556  RankTwoTensorTempl<T> dII = dsecondInvariant();
1557  RankTwoTensorTempl<T> dIII = dthirdInvariant();
1558  RankFourTensorTempl<T> deriv = d2thirdInvariant() / std::pow(bar, 1.5) -
1559  1.5 * d2secondInvariant() * J3 / std::pow(bar, 2.5);
1560 
1561  for (unsigned i = 0; i < N; ++i)
1562  for (unsigned j = 0; j < N; ++j)
1563  for (unsigned k = 0; k < N; ++k)
1564  for (unsigned l = 0; l < N; ++l)
1565  deriv(i, j, k, l) += (-1.5 * dII(i, j) * dIII(k, l) - 1.5 * dIII(i, j) * dII(k, l)) /
1566  std::pow(bar, 2.5) +
1567  1.5 * 2.5 * dII(i, j) * dII(k, l) * J3 / std::pow(bar, 3.5);
1568 
1569  deriv *= -1.5 * std::sqrt(3.0);
1570  return deriv;
1571  }
1572  else
1573  mooseError("d2sin3Lode is only available for ordered tensor component types");
1574 }
1575 
1576 template <typename T>
1577 template <int n, int o, int p, int q>
1580 {
1581  RankFourTensorTempl<T> result;
1582  std::size_t x[4];
1583  for (x[0] = 0; x[0] < N; ++x[0])
1584  for (x[1] = 0; x[1] < N; ++x[1])
1585  for (x[2] = 0; x[2] < N; ++x[2])
1586  for (x[3] = 0; x[3] < N; ++x[3])
1587  result(x[0], x[1], x[2], x[3]) = (*this)(x[n], x[o]) * b(x[p], x[q]);
1588 
1589  return result;
1590 }
1591 
1592 template <typename T>
1593 template <int n, int o, int p, int q, int r, int s>
1596 {
1597  RankFourTensorTempl<T> result;
1598  std::size_t x[5];
1599  for (x[0] = 0; x[0] < N; ++x[0])
1600  for (x[1] = 0; x[1] < N; ++x[1])
1601  for (x[2] = 0; x[2] < N; ++x[2])
1602  for (x[3] = 0; x[3] < N; ++x[3])
1603  for (x[4] = 0; x[4] < N; ++x[4])
1604  result(x[0], x[1], x[2], x[3]) += (*this)(x[n], x[o]) * b(x[p], x[q], x[r], x[s]);
1605 
1606  return result;
1607 }
RankFourTensorTempl< T > outerProduct(const RankTwoTensorTempl< T > &b) const
Return the outer product .
RankFourTensorTempl is designed to handle any N-dimensional fourth order tensor, C.
void fillRow(unsigned int r, const libMesh::TypeVector< T > &v)
Assign values to a specific row of the second order tensor.
MetaPhysicL::DualNumber< V, D, asd > abs(const MetaPhysicL::DualNumber< V, D, asd > &a)
Definition: EigenADReal.h:42
RankTwoTensorTempl< T > dsecondInvariant() const
Return the derivative of the main second invariant w.r.t.
RankTwoTensorTempl< T > inverse() const
Return the inverse of this second order tensor.
RankFourTensorTempl< T > d2secondInvariant() const
Return the second derivative of the main second invariant w.r.t.
RankTwoTensorTempl(const RankTwoTensorTempl< T2 > &a)
The conversion operator from RankTwoTensorTempl<T2> to RankTwoTensorTempl<T> where T2 is convertible ...
RankTwoTensorTempl()
Empty constructor; fills to zero.
bool operator==(const RankTwoTensorTempl< T > &a) const
Defines logical equality with another RankTwoTensorTempl<T>
void mooseSetToZero(T &v)
Helper function templates to set a variable to zero.
Definition: MathUtils.h:372
void printADReal(unsigned int nDual, std::ostream &stm=Moose::out) const
Print the Real part of the RankTwoTensorTempl<ADReal> along with its first nDual dual numbers...
T generalSecondInvariant() const
Return the principal second invariant of this second order tensor.
RankFourTensorTempl< T > positiveProjectionEigenDecomposition(std::vector< T > &, RankTwoTensorTempl< T > &) const
Return the positive projection tensor.
static RankTwoTensorTempl initializeSymmetric(const libMesh::TypeVector< T > &v0, const libMesh::TypeVector< T > &v1, const libMesh::TypeVector< T > &v2)
Named constructor for initializing symmetrically.
static void initRandom(unsigned int)
Initialize the random seed based on an unsigned integer.
void symmetricEigenvalues(std::vector< T > &eigvals) const
computes eigenvalues, assuming tens is symmetric, and places them in ascending order in eigvals ...
T sin3Lode(const T &r0, const T &r0_value) const
Sin(3*Lode_angle)
bool absoluteFuzzyEqual(const T &var1, const T2 &var2, const T3 &tol=libMesh::TOLERANCE *libMesh::TOLERANCE)
Function to check whether two variables are equal within an absolute tolerance.
Definition: MooseUtils.h:380
This class defines a Tensor that can change its shape.
libMesh::boostcopy::enable_if_c< libMesh::ScalarTraits< Scalar >::value, RankTwoTensorTempl & >::type operator=(const Scalar &libmesh_dbg_var(p))
Assignment-from-scalar operator.
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:302
void dsymmetricEigenvalues(std::vector< T > &eigvals, std::vector< RankTwoTensorTempl< T >> &deigvals) const
computes eigenvalues, and their symmetric derivatives wrt vals, assuming tens is symmetric ...
static RankTwoTensorTempl< T > genRandomTensor(T stddev, T mean)
Generate a random second order tensor with all 9 components treated as independent random variables f...
void print(std::ostream &stm=Moose::out) const
Print the rank two tensor.
RankTwoTensorTempl< T > & operator-=(const RankTwoTensorTempl< T > &a)
Subtract another second order tensor from this one.
static RankTwoTensorTempl< T > plusTranspose(const RankTwoTensorTempl< T > &)
Initialize a second order tensor with expression .
RankThreeTensorTempl< T > contraction(const RankThreeTensorTempl< T > &b) const
Return the single contraction of this second order tensor with a third order tensor ...
auto operator*(const Scalar &scalar) const -> typename boostcopy::enable_if_c< ScalarTraits< Scalar >::value, TypeTensor< decltype(T() *scalar)>>::type
RankTwoTensorTempl< typename libMesh::CompareTypes< T, T2 >::supertype > operator+(const libMesh::TypeTensor< T2 > &a) const
Return the sum of two second order tensors.
auto raw_value(const Eigen::Map< T > &in)
Definition: EigenADReal.h:73
void surfaceFillFromInputVector(const std::vector< T > &input)
sets _coords[0][0], _coords[0][1], _coords[1][0], _coords[1][1] to input, and the remainder to zero ...
void mooseSetToZero< ADRankTwoTensor >(ADRankTwoTensor &v)
Helper function template specialization to set an object to zero.
Definition: RankTwoTensor.C:26
static constexpr std::size_t dim
This is the dimension of all vector and tensor datastructures used in MOOSE.
Definition: Moose.h:153
RankTwoTensorTempl< T > & operator+=(const RankTwoTensorTempl< T > &a)
Add another second order tensor to this one.
T secondInvariant() const
Return the main second invariant of this second order tensor.
RankTwoTensorTempl< T > dtrace() const
Return the derivative of the trace w.r.t.
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...
static RankTwoTensorTempl Identity()
Initialize a second order identity tensor.
RankTwoTensorTempl< T > dthirdInvariant() const
Denote the _coords[i][j] by A_ij, then this returns d(thirdInvariant()/dA_ij.
boostcopy::enable_if_c< ScalarTraits< Scalar >::value, TypeTensor< typename CompareTypes< T, Scalar >::supertype > >::type operator/(const Scalar &) const
static constexpr unsigned int N
Tensor dimension, i.e.
Definition: RankTwoTensor.h:95
auto max(const L &left, const R &right)
void rotate(const RankTwoTensorTempl< T > &R)
Rotate the tensor in-place given a rotation tensor .
RankThreeTensor is designed to handle any N-dimensional third order tensor, r.
static constexpr unsigned int N2
The square of the tensor dimension.
static constexpr Real identityCoords[N2]
friend void dataLoad(std::istream &, RankTwoTensorTempl< T2 > &, void *)
T trace() const
A wrapper for tr()
void fillColumn(unsigned int c, const libMesh::TypeVector< T > &v)
Assign values to a specific column of the second order tensor.
friend void dataStore(std::ostream &, RankTwoTensorTempl< T2 > &, void *)
RankTwoTensorTempl< T > dsin3Lode(const T &r0) const
d(sin3Lode)/dA_ij If secondInvariant() <= r0 then return zero This is to gaurd against precision-loss...
TypeTensor< typename CompareTypes< T, T2 >::supertype > operator+(const TypeTensor< T2 > &) const
static RankTwoTensorTempl< T > selfOuterProduct(const libMesh::TypeVector< T > &)
Initialize a second order tensor as the outer product of a vector with itself, i.e.
static RankTwoTensorTempl initializeFromRows(const libMesh::TypeVector< T > &row0, const libMesh::TypeVector< T > &row1, const libMesh::TypeVector< T > &row2)
Named constructor for initializing from row vectors.
RankTwoTensorTempl< T > deviatoric() const
Return the deviatoric part of this tensor .
static MooseEnum fillMethodEnum()
Get the available FillMethod options.
T L2norm() const
Sqrt(_coords[i][j]*_coords[i][j])
void fillFromInputVector(const std::vector< T > &input, FillMethod fill_method=autodetect)
The smart mutator that determines how to fill the second order tensor based on the size of the input ...
void setToIdentity()
Set the tensor to identity.
Custom type trait that has a value of true for types that cam be use interchangeably with Real...
Definition: MooseUtils.h:1005
static value_type value(const RankTwoTensorTempl< T > &in)
TypeTensor< T > operator-() const
RankTwoTensorTempl< T > & operator/=(const T &a)
Divide this tensor by a scalar (component-wise)
Real deriv(unsigned n, unsigned alpha, unsigned beta, Real x)
RankFourTensorTempl< T > d2thirdInvariant() const
Denote the _coords[i][j] by A_ij, then this returns d^2(thirdInvariant)/dA_ij/dA_kl.
void addIa(const T &a)
Add identity times a to _coords.
RankTwoTensorTempl< T > rotateXyPlane(T a)
Rotate the tensor about the z-axis.
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.
void d2symmetricEigenvalues(std::vector< RankFourTensorTempl< T >> &deriv) const
Computes second derivatives of Eigenvalues of a rank two tensor.
static RankTwoTensorTempl< T > genRandomSymmTensor(T stddev, T mean)
Generate a random symmetric second order tensor with the 6 upper-triangular components treated as ind...
RankTwoTensorTempl< T > rotated(const RankTwoTensorTempl< T > &R) const
Return the rotated tensor given a rotation tensor .
RankTwoTensorTempl< typename libMesh::CompareTypes< T, T2 >::supertype > operator*(const T2 &a) const
Return this tensor multiplied by a scalar (component-wise)
T doubleContraction(const RankTwoTensorTempl< T > &a) const
Return the double contraction with another 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
RankTwoTensorTempl< T > square() const
Return .
RankFourTensorTempl< T > d2sin3Lode(const T &r0) const
d^2(sin3Lode)/dA_ij/dA_kl If secondInvariant() <= r0 then return zero This is to gaurd against precis...
RankTwoTensorTempl< T > & operator*=(const T &a)
Multiply this tensor by a scalar (component-wise)
T thirdInvariant() const
Denote the _coords[i][j] by A_ij, then S_ij = A_ij - de_ij*tr(A)/3 Then this returns det(S + S...
void printReal(std::ostream &stm=Moose::out) const
Print the Real part of the RankTwoTensorTempl<ADReal>
static RankTwoTensorTempl< T > timesTranspose(const RankTwoTensorTempl< T > &)
Initialize a second order tensor with expression .
OutputTools< Real >::VariableValue VariableValue
Definition: MooseTypes.h:314
static RankTwoTensorTempl< T > transposeTimes(const RankTwoTensorTempl< T > &)
Initialize a second order tensor with expression .
RankTwoTensorTempl< T > transpose() const
Return the tensor transposed.
void vectorOuterProduct(const libMesh::TypeVector< T > &, const libMesh::TypeVector< T > &)
Set the values of the second order tensor to be the outer product of two vectors, i...
RankTwoTensorTempl(const std::vector< T > &input)
Constructor that proxies the fillFromInputVector() method.
void fillRealTensor(libMesh::TensorValue< T > &)
Fill a libMesh::TensorValue<T> from this second order tensor.
forward declarations
RankTwoTensorTempl(const libMesh::TypeTensor< T > &a)
The conversion operator from a libMesh::TypeTensor
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
RankTwoTensorTempl< typename libMesh::CompareTypes< T, T2 >::supertype > operator/(const T2 &a) const
Return this tensor divided by a scalar (component-wise)
bool isSymmetric() const
Test for symmetry.
void symmetricEigenvaluesEigenvectors(std::vector< T > &eigvals, RankTwoTensorTempl< T > &eigvecs) const
computes eigenvalues and eigenvectors, assuming tens is symmetric, and places them in ascending order...
CTSub CT_OPERATOR_BINARY CTMul CTCompareLess CTCompareGreater CTCompareEqual _arg template * sqrt(_arg)) *_arg.template D< dtag >()) CT_SIMPLE_UNARY_FUNCTION(tanh
RankTwoTensorTempl< T > operator-() const
Return the negation of this tensor.
RankThreeTensorTempl< T > mixedProductJkI(const libMesh::VectorValue< T > &b) const
Return the tensor product of this second order tensor with a vector .
RankFourTensorTempl< T > times(const RankTwoTensorTempl< T > &b) const
Return the general tensor product of this second order tensor and another second order tensor defined...
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 _coords: (1) the eigenvalues (i...
static RankTwoTensorTempl< T > outerProduct(const libMesh::TypeVector< T > &, const libMesh::TypeVector< T > &)
Initialize a second order tensor as the outer product of two vectors, i.e.
IntRange< T > make_range(T beg, T end)
void getRUDecompositionRotation(RankTwoTensorTempl< T > &rot) const
Uses the petscblaslapack.h LAPACKsyev_ routine to perform RU decomposition and obtain the rotation te...
RankTwoTensorTempl< T > ddet() const
Denote the _coords[i][j] by A_ij, then this returns d(det)/dA_ij.
FillMethod
To fill up the 9 entries in the 2nd-order tensor, fillFromInputVector is called with one of the follo...
static RankTwoTensorTempl initializeFromColumns(const libMesh::TypeVector< T > &col0, const libMesh::TypeVector< T > &col1, const libMesh::TypeVector< T > &col2)
Named constructor for initializing from row vectors.
RankTwoTensorTempl< T > initialContraction(const RankFourTensorTempl< T > &b) const
returns this_ij * b_ijkl
void mooseSetToZero< RankTwoTensor >(RankTwoTensor &v)
Helper function template specialization to set an object to zero.
Definition: RankTwoTensor.C:19
RankTwoTensorTempl(const libMesh::TensorValue< T > &a)
The conversion operator from a libMesh::TensorValue
InitMethod
The initialization method.
RankTwoTensorTempl< T > & operator=(const RankTwoTensorTempl< T > &a)=default
Assignment operator.
auto min(const L &left, const R &right)
RankTwoTensorTempl(const SymmetricRankTwoTensorTempl< T2 > &a)
The conversion operator from a SymmetricRankTwoTensorTempl
void fillFromScalarVariable(const VariableValue &scalar_variable)
The smart mutator that determines how to fill the second order tensor based on the order of the scal...
MooseUnits pow(const MooseUnits &, int)
Definition: Units.C:537
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
MooseArray< Real > VariableValue
Definition: RankTwoTensor.h:35
RankTwoTensorTempl< typename RawType< T >::value_type > value_type