www.mooseframework.org
RankTwoTensor.h
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://www.mooseframework.org
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 }
48 
49 namespace MathUtils
50 {
51 template <typename T>
52 void mooseSetToZero(T & v);
53 
58 template <>
60 
65 template <>
67 }
68 
78 template <typename T>
80 {
81 public:
83 
87  static constexpr unsigned int N = Moose::dim;
88 
92  static constexpr unsigned int N2 = N * N;
93 
100  {
103  };
104 
111  {
117  };
118 
123  static void initRandom(unsigned int);
124 
130  [[nodiscard]] static MooseEnum fillMethodEnum();
131 
136 
138  void print(std::ostream & stm = Moose::out) const;
139 
141  void printReal(std::ostream & stm = Moose::out) const;
142 
144  void printDualReal(unsigned int nDual, std::ostream & stm = Moose::out) const;
145 
147 
149 
163 
186 
204  const libMesh::TypeVector<T> & row2,
205  const libMesh::TypeVector<T> & row3);
206 
211  RankTwoTensorTempl(const std::vector<T> & input) { this->fillFromInputVector(input); };
212 
224  const T & S11, const T & S22, const T & S33, const T & S23, const T & S13, const T & S12);
225 
236  RankTwoTensorTempl(const T & S11,
237  const T & S21,
238  const T & S31,
239  const T & S12,
240  const T & S22,
241  const T & S32,
242  const T & S13,
243  const T & S23,
244  const T & S33);
245 
257  RankTwoTensorTempl(const RankTwoTensorTempl<T> & a) = default;
258 
263 
268 
272  template <typename T2>
274  : RankTwoTensorTempl<T>(a(0),
275  a(1),
276  a(2),
277  a(3) / MathUtils::sqrt2,
278  a(4) / MathUtils::sqrt2,
279  a(5) / MathUtils::sqrt2)
280  {
281  }
282 
287  template <typename T2>
289  {
290  }
292 
294 
311  [[nodiscard]] static RankTwoTensorTempl initializeSymmetric(const libMesh::TypeVector<T> & v0,
312  const libMesh::TypeVector<T> & v1,
313  const libMesh::TypeVector<T> & v2);
314 
328  [[nodiscard]] static RankTwoTensorTempl initializeFromRows(const libMesh::TypeVector<T> & row0,
329  const libMesh::TypeVector<T> & row1,
330  const libMesh::TypeVector<T> & row2);
331 
345  [[nodiscard]] static RankTwoTensorTempl
347  const libMesh::TypeVector<T> & col1,
348  const libMesh::TypeVector<T> & col2);
349 
360  [[nodiscard]] static RankTwoTensorTempl Identity() { return RankTwoTensorTempl(initIdentity); }
361 
376  [[nodiscard]] static RankTwoTensorTempl<T> timesTranspose(const RankTwoTensorTempl<T> &);
377 
392  [[nodiscard]] static RankTwoTensorTempl<T> transposeTimes(const RankTwoTensorTempl<T> &);
393 
408  [[nodiscard]] static RankTwoTensorTempl<T> plusTranspose(const RankTwoTensorTempl<T> &);
409 
423  [[nodiscard]] static RankTwoTensorTempl<T> outerProduct(const libMesh::TypeVector<T> &,
424  const libMesh::TypeVector<T> &);
425 
438  [[nodiscard]] static RankTwoTensorTempl<T> selfOuterProduct(const libMesh::TypeVector<T> &);
439 
447  [[nodiscard]] static RankTwoTensorTempl<T> genRandomTensor(T stddev, T mean);
448 
456  [[nodiscard]] static RankTwoTensorTempl<T> genRandomSymmTensor(T stddev, T mean);
457 
459 
461 
476  VectorValue<T> column(const unsigned int i) const;
477 
479 
481 
501 
524 
543  template <typename Scalar>
544  typename boostcopy::enable_if_c<ScalarTraits<Scalar>::value, RankTwoTensorTempl &>::type
545  operator=(const Scalar & libmesh_dbg_var(p))
546  {
547  libmesh_assert_equal_to(p, Scalar(0));
548  this->zero();
549  return *this;
550  }
551 
571 
591 
606  RankTwoTensorTempl<T> & operator*=(const T & a);
607 
622  RankTwoTensorTempl<T> & operator/=(const T & a);
623 
643 
691  void fillFromInputVector(const std::vector<T> & input, FillMethod fill_method = autodetect);
692 
739  void fillFromScalarVariable(const VariableValue & scalar_variable);
740 
745  void surfaceFillFromInputVector(const std::vector<T> & input);
746 
764 
783  void fillRow(unsigned int r, const libMesh::TypeVector<T> & v);
784 
803  void fillColumn(unsigned int c, const libMesh::TypeVector<T> & v);
804 
819  void setToIdentity();
820 
822 
836  void addIa(const T & a);
837 
858  void rotate(const RankTwoTensorTempl<T> & R);
859 
861 
863 
879 
901 
907 
923 
942  template <typename T2>
944  operator+(const libMesh::TypeTensor<T2> & a) const;
945 
964  template <typename T2>
966  operator-(const libMesh::TypeTensor<T2> & a) const;
967 
983 
998  template <typename T2, typename std::enable_if<ScalarTraits<T2>::value, int>::type = 0>
1000 
1015  template <typename T2, typename std::enable_if<ScalarTraits<T2>::value, int>::type = 0>
1017 
1036  template <typename T2>
1038  operator*(const libMesh::TypeVector<T2> & a) const;
1039 
1058  template <typename T2>
1060  operator*(const libMesh::TypeTensor<T2> & a) const;
1061 
1079  T doubleContraction(const RankTwoTensorTempl<T> & a) const;
1080 
1114  template <int n, int o, int p, int q>
1116 
1144  template <int n, int o, int p, int q, int r, int s>
1146 
1151  {
1152  usingTensorIndices(i_, j_, k_, l_);
1153  return times<i_, j_, k_, l_>(b);
1154  }
1155 
1161 
1166  RankThreeTensorTempl<T> mixedProductJkI(const VectorValue<T> & b) const;
1167 
1185  RankTwoTensorTempl<T> &) const;
1186 
1192 
1197  T trace() const;
1198 
1203  RankTwoTensorTempl<T> dtrace() const;
1204 
1209 
1215  T generalSecondInvariant() const;
1216 
1223  T secondInvariant() const;
1224 
1231 
1238 
1246  T sin3Lode(const T & r0, const T & r0_value) const;
1247 
1254  RankTwoTensorTempl<T> dsin3Lode(const T & r0) const;
1255 
1262  RankFourTensorTempl<T> d2sin3Lode(const T & r0) const;
1263 
1270  T thirdInvariant() const;
1271 
1277 
1283 
1288  RankTwoTensorTempl<T> ddet() const;
1289 
1291  T L2norm() const;
1292 
1297  void symmetricEigenvalues(std::vector<T> & eigvals) const;
1298 
1304  void symmetricEigenvaluesEigenvectors(std::vector<T> & eigvals,
1305  RankTwoTensorTempl<T> & eigvecs) const;
1306 
1318  void dsymmetricEigenvalues(std::vector<T> & eigvals,
1319  std::vector<RankTwoTensorTempl<T>> & deigvals) const;
1320 
1325  void d2symmetricEigenvalues(std::vector<RankFourTensorTempl<T>> & deriv) const;
1326 
1332 
1335 
1337 
1339 
1341  bool operator==(const RankTwoTensorTempl<T> & a) const;
1342 
1344  bool isSymmetric() const;
1345 
1347 
1348 protected:
1358  void syev(const char * calculation_type, std::vector<T> & eigvals, std::vector<T> & a) const;
1359 
1360 private:
1361  static constexpr Real identityCoords[N2] = {1, 0, 0, 0, 1, 0, 0, 0, 1};
1362 
1363  template <class T2>
1364  friend void dataStore(std::ostream &, RankTwoTensorTempl<T2> &, void *);
1365 
1367 
1368  template <class T2>
1369  friend void dataLoad(std::istream &, RankTwoTensorTempl<T2> &, void *);
1370  template <class T2>
1371  friend class RankFourTensorTempl;
1372  template <class T2>
1373  friend class RankThreeTensorTempl;
1374 };
1375 
1376 namespace MetaPhysicL
1377 {
1378 template <typename T>
1379 struct RawType<RankTwoTensorTempl<T>>
1380 {
1382 
1384  {
1385  value_type ret;
1386  for (auto i : make_range(RankTwoTensorTempl<T>::N))
1387  for (auto j : make_range(RankTwoTensorTempl<T>::N))
1388  ret(i, j) = raw_value(in(i, j));
1389 
1390  return ret;
1391  }
1392 };
1393 }
1394 
1395 template <typename T>
1396 template <typename T2>
1399 {
1401 }
1402 
1403 template <typename T>
1404 template <typename T2>
1407 {
1409 }
1410 
1411 template <typename T>
1412 template <typename T2, typename std::enable_if<ScalarTraits<T2>::value, int>::type>
1415 {
1417 }
1418 
1419 template <typename T>
1420 template <typename T2>
1423 {
1425 }
1426 
1427 template <typename T>
1428 template <typename T2>
1431 {
1433 }
1434 
1435 template <typename T>
1436 template <typename T2, typename std::enable_if<ScalarTraits<T2>::value, int>::type>
1439 {
1441 }
1442 
1443 template <typename T>
1446  RankTwoTensorTempl<T> & eigvec) const
1447 {
1448  if constexpr (MooseUtils::IsLikeReal<T>::value)
1449  {
1450  // Compute eigenvectors and eigenvalues of this tensor
1451  this->symmetricEigenvaluesEigenvectors(eigval, eigvec);
1452 
1453  // Separate out positive and negative eigen values
1454  std::array<T, N> epos;
1455  std::array<T, N> d;
1456  for (auto i : make_range(N))
1457  {
1458  epos[i] = (std::abs(eigval[i]) + eigval[i]) / 2.0;
1459  d[i] = 0 < eigval[i] ? 1.0 : 0.0;
1460  }
1461 
1462  // projection tensor
1463  RankFourTensorTempl<T> proj_pos;
1464  RankFourTensorTempl<T> Gab, Gba;
1465 
1466  for (auto a : make_range(N))
1467  {
1468  const auto Ma = RankTwoTensorTempl<T>::selfOuterProduct(eigvec.column(a));
1469  proj_pos += d[a] * Ma.outerProduct(Ma);
1470  }
1471 
1472  usingTensorIndices(i_, j_, k_, l_);
1473  for (const auto a : make_range(N))
1474  for (const auto b : make_range(a))
1475  {
1476  const auto Ma = RankTwoTensorTempl<T>::selfOuterProduct(eigvec.column(a));
1477  const auto Mb = RankTwoTensorTempl<T>::selfOuterProduct(eigvec.column(b));
1478 
1479  Gab = Ma.template times<i_, k_, j_, l_>(Mb) + Ma.template times<i_, l_, j_, k_>(Mb);
1480  Gba = Mb.template times<i_, k_, j_, l_>(Ma) + Mb.template times<i_, l_, j_, k_>(Ma);
1481 
1482  T theta_ab;
1483  if (!MooseUtils::absoluteFuzzyEqual(eigval[a], eigval[b]))
1484  theta_ab = 0.5 * (epos[a] - epos[b]) / (eigval[a] - eigval[b]);
1485  else
1486  theta_ab = 0.25 * (d[a] + d[b]);
1487 
1488  proj_pos += theta_ab * (Gab + Gba);
1489  }
1490  return proj_pos;
1491  }
1492  else
1493  mooseError("positiveProjectionEigenDecomposition is only available for ordered tensor "
1494  "component types");
1495 }
1496 
1497 template <typename T>
1498 T
1499 RankTwoTensorTempl<T>::sin3Lode(const T & r0, const T & r0_value) const
1500 {
1501  if constexpr (MooseUtils::IsLikeReal<T>::value)
1502  {
1503  T bar = secondInvariant();
1504  if (bar <= r0)
1505  // in this case the Lode angle is not defined
1506  return r0_value;
1507  else
1508  // the min and max here gaurd against precision-loss when bar is tiny but nonzero.
1509  return std::max(std::min(-1.5 * std::sqrt(3.0) * thirdInvariant() / std::pow(bar, 1.5), 1.0),
1510  -1.0);
1511  }
1512  else
1513  mooseError("sin3Lode is only available for ordered tensor component types");
1514 }
1515 
1516 template <typename T>
1519 {
1520  if constexpr (MooseUtils::IsLikeReal<T>::value)
1521  {
1522  T bar = secondInvariant();
1523  if (bar <= r0)
1524  return RankTwoTensorTempl<T>();
1525  else
1526  return -1.5 * std::sqrt(3.0) *
1527  (dthirdInvariant() / std::pow(bar, 1.5) -
1528  1.5 * dsecondInvariant() * thirdInvariant() / std::pow(bar, 2.5));
1529  }
1530  else
1531  mooseError("dsin3Lode is only available for ordered tensor component types");
1532 }
1533 
1534 template <typename T>
1537 {
1538  if constexpr (MooseUtils::IsLikeReal<T>::value)
1539  {
1540  T bar = secondInvariant();
1541  if (bar <= r0)
1542  return RankFourTensorTempl<T>();
1543 
1544  T J3 = thirdInvariant();
1545  RankTwoTensorTempl<T> dII = dsecondInvariant();
1546  RankTwoTensorTempl<T> dIII = dthirdInvariant();
1547  RankFourTensorTempl<T> deriv = d2thirdInvariant() / std::pow(bar, 1.5) -
1548  1.5 * d2secondInvariant() * J3 / std::pow(bar, 2.5);
1549 
1550  for (unsigned i = 0; i < N; ++i)
1551  for (unsigned j = 0; j < N; ++j)
1552  for (unsigned k = 0; k < N; ++k)
1553  for (unsigned l = 0; l < N; ++l)
1554  deriv(i, j, k, l) += (-1.5 * dII(i, j) * dIII(k, l) - 1.5 * dIII(i, j) * dII(k, l)) /
1555  std::pow(bar, 2.5) +
1556  1.5 * 2.5 * dII(i, j) * dII(k, l) * J3 / std::pow(bar, 3.5);
1557 
1558  deriv *= -1.5 * std::sqrt(3.0);
1559  return deriv;
1560  }
1561  else
1562  mooseError("d2sin3Lode is only available for ordered tensor component types");
1563 }
1564 
1565 template <typename T>
1566 template <int n, int o, int p, int q>
1569 {
1570  RankFourTensorTempl<T> result;
1571  std::size_t x[4];
1572  for (x[0] = 0; x[0] < N; ++x[0])
1573  for (x[1] = 0; x[1] < N; ++x[1])
1574  for (x[2] = 0; x[2] < N; ++x[2])
1575  for (x[3] = 0; x[3] < N; ++x[3])
1576  result(x[0], x[1], x[2], x[3]) = (*this)(x[n], x[o]) * b(x[p], x[q]);
1577 
1578  return result;
1579 }
1580 
1581 template <typename T>
1582 template <int n, int o, int p, int q, int r, int s>
1585 {
1586  RankFourTensorTempl<T> result;
1587  std::size_t x[5];
1588  for (x[0] = 0; x[0] < N; ++x[0])
1589  for (x[1] = 0; x[1] < N; ++x[1])
1590  for (x[2] = 0; x[2] < N; ++x[2])
1591  for (x[3] = 0; x[3] < N; ++x[3])
1592  for (x[4] = 0; x[4] < N; ++x[4])
1593  result(x[0], x[1], x[2], x[3]) += (*this)(x[n], x[o]) * b(x[p], x[q], x[r], x[s]);
1594 
1595  return result;
1596 }
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.
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:368
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:346
This class defines a Tensor that can change its shape.
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:299
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 > mixedProductJkI(const VectorValue< T > &b) const
Return the tensor product of this second order tensor with a vector .
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
VectorValue< T > column(const unsigned int i) const
Get the i-th column of the second order tensor.
auto raw_value(const Eigen::Map< T > &in)
Definition: ADReal.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:27
static constexpr std::size_t dim
This is the dimension of all vector and tensor datastructures used in MOOSE.
Definition: Moose.h:148
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...
ADRealEigenVector< T, D, asd > sqrt(const ADRealEigenVector< T, D, asd > &)
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:87
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.
Definition: RankTwoTensor.h:92
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 *)
ADRealEigenVector< T, D, asd > abs(const ADRealEigenVector< T, D, asd > &)
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 interchangably with Real...
Definition: MooseUtils.h:997
static value_type value(const RankTwoTensorTempl< T > &in)
TypeTensor< T > operator-() const
RankTwoTensorTempl< typename CompareTypes< T, T2 >::supertype > operator*(const T2 &a) const
Return this tensor multiplied by a scalar (component-wise)
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...
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 .
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:31
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...
boostcopy::enable_if_c< ScalarTraits< Scalar >::value, RankTwoTensorTempl & >::type operator=(const Scalar &libmesh_dbg_var(p))
Assignment-from-scalar operator.
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:302
RankTwoTensorTempl< typename CompareTypes< T, T2 >::supertype > operator+(const libMesh::TypeTensor< T2 > &a) const
Return the sum of two second order tensors.
static RankTwoTensorTempl< T > transposeTimes(const RankTwoTensorTempl< T > &)
Initialize a second order tensor with expression .
RankTwoTensorTempl< T > transpose() const
Return the tensor transposed.
RankTwoTensorTempl< T > & operator=(const RankTwoTensorTempl< T > &a)
Assignment operator.
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
Definition: MooseArray.h:17
RankTwoTensorTempl(const libMesh::TypeTensor< T > &a)
The conversion operator from a libMesh::TypeTensor
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
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...
RankTwoTensorTempl< T > operator-() const
Return the negation of this tensor.
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...
void printDualReal(unsigned int nDual, std::ostream &stm=Moose::out) const
Print the Real part of the RankTwoTensorTempl<ADReal> along with its first nDual dual numbers...
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:20
RankTwoTensorTempl(const libMesh::TensorValue< T > &a)
The conversion operator from a libMesh::TensorValue
InitMethod
The initialization method.
Definition: RankTwoTensor.h:99
RankTwoTensorTempl< typename CompareTypes< T, T2 >::supertype > operator/(const T2 &a) const
Return this tensor divided by a scalar (component-wise)
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:24
MooseArray< Real > VariableValue
Definition: RankTwoTensor.h:35
RankTwoTensorTempl< typename RawType< T >::value_type > value_type