https://mooseframework.inl.gov
Loading...
Searching...
No Matches
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"
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
33class MooseEnum;
34template <typename T>
35class MooseArray;
37template <typename>
39namespace libMesh
40{
41template <typename>
42class TypeVector;
43template <typename>
44class TypeTensor;
45template <typename>
46class TensorValue;
47namespace TensorTools
48{
49template <>
54}
55}
56
57namespace MathUtils
58{
59template <typename T>
60void mooseSetToZero(T & v);
61
66template <>
68
73template <>
75}
76
86template <typename T>
88{
89public:
91
95 static constexpr unsigned int N = Moose::dim;
96
100 static constexpr unsigned int N2 = N * N;
101
112
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
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>
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
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>
552 typename std::enable_if<libMesh::ScalarTraits<Scalar>::value, RankTwoTensorTempl &>::type
553 operator=(const Scalar & libmesh_dbg_var(p))
554 {
555 libmesh_assert_equal_to(p, Scalar(0));
556 this->zero();
557 return *this;
558 }
559
579
599
614 RankTwoTensorTempl<T> & operator*=(const T & a);
615
630 RankTwoTensorTempl<T> & operator/=(const T & a);
631
651
699 void fillFromInputVector(const std::vector<T> & input, FillMethod fill_method = autodetect);
700
747 void fillFromScalarVariable(const VariableValue & scalar_variable);
748
753 void surfaceFillFromInputVector(const std::vector<T> & input);
754
772
791 void fillRow(unsigned int r, const libMesh::TypeVector<T> & v);
792
811 void fillColumn(unsigned int c, const libMesh::TypeVector<T> & v);
812
827 void setToIdentity();
828
830
844 void addIa(const T & a);
845
866 void rotate(const RankTwoTensorTempl<T> & R);
867
869
871
887
909
915
931
950 template <typename T2>
953
972 template <typename T2>
975
991
1006 template <typename T2, typename std::enable_if<libMesh::ScalarTraits<T2>::value, int>::type = 0>
1008 operator*(const T2 & a) const;
1009
1024 template <typename T2, typename std::enable_if<libMesh::ScalarTraits<T2>::value, int>::type = 0>
1026 operator/(const T2 & a) const;
1027
1046 template <typename T2>
1049
1068 template <typename T2>
1071
1089 T doubleContraction(const RankTwoTensorTempl<T> & a) const;
1090
1124 template <int n, int o, int p, int q>
1126
1154 template <int n, int o, int p, int q, int r, int s>
1156
1161 {
1162 usingTensorIndices(i_, j_, k_, l_);
1163 return times<i_, j_, k_, l_>(b);
1164 }
1165
1171
1177
1195 RankTwoTensorTempl<T> &) const;
1196
1202
1207 T trace() const;
1208
1214
1219
1225 T generalSecondInvariant() const;
1226
1233 T secondInvariant() const;
1234
1241
1248
1256 T sin3Lode(const T & r0, const T & r0_value) const;
1257
1265
1273
1280 T thirdInvariant() const;
1281
1287
1293
1299
1301 T L2norm() const;
1302
1307 void symmetricEigenvalues(std::vector<T> & eigvals) const;
1308
1314 void symmetricEigenvaluesEigenvectors(std::vector<T> & eigvals,
1315 RankTwoTensorTempl<T> & eigvecs) const;
1316
1328 void dsymmetricEigenvalues(std::vector<T> & eigvals,
1329 std::vector<RankTwoTensorTempl<T>> & deigvals) const;
1330
1335 void d2symmetricEigenvalues(std::vector<RankFourTensorTempl<T>> & deriv) const;
1336
1342
1345
1347
1349
1351 bool operator==(const RankTwoTensorTempl<T> & a) const;
1352
1354 bool isSymmetric() const;
1355
1357
1358protected:
1368 void syev(const char * calculation_type, std::vector<T> & eigvals, std::vector<T> & a) const;
1369
1370private:
1371 static constexpr Real identityCoords[N2] = {1, 0, 0, 0, 1, 0, 0, 0, 1};
1372
1373 template <class T2>
1374 friend void dataStore(std::ostream &, RankTwoTensorTempl<T2> &, void *);
1375
1377
1378 template <class T2>
1379 friend void dataLoad(std::istream &, RankTwoTensorTempl<T2> &, void *);
1380 template <class T2>
1382 template <class T2>
1384};
1385
1386namespace MetaPhysicL
1387{
1388template <typename T>
1389struct RawType<RankTwoTensorTempl<T>>
1390{
1392
1394 {
1395 value_type ret;
1398 ret(i, j) = raw_value(in(i, j));
1399
1400 return ret;
1401 }
1402};
1403}
1404
1405template <typename T>
1406template <typename T2>
1412
1413template <typename T>
1414template <typename T2>
1420
1421template <typename T>
1422template <typename T2, typename std::enable_if<libMesh::ScalarTraits<T2>::value, int>::type>
1425{
1427}
1428
1429template <typename T>
1430template <typename T2>
1436
1437template <typename T>
1438template <typename T2>
1444
1445template <typename T>
1446template <typename T2, typename std::enable_if<libMesh::ScalarTraits<T2>::value, int>::type>
1449{
1451}
1452
1453template <typename T>
1456 RankTwoTensorTempl<T> & eigvec) const
1457{
1458 using std::abs;
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] = (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
1508template <typename T>
1509T
1510RankTwoTensorTempl<T>::sin3Lode(const T & r0, const T & r0_value) const
1511{
1512 using std::pow, std::max, std::sqrt, std::min;
1513 if constexpr (MooseUtils::IsLikeReal<T>::value)
1514 {
1515 T bar = secondInvariant();
1516 if (bar <= r0)
1517 // in this case the Lode angle is not defined
1518 return r0_value;
1519 else
1520 // the min and max here gaurd against precision-loss when bar is tiny but nonzero.
1521 return max(min(-1.5 * sqrt(3.0) * thirdInvariant() / pow(bar, 1.5), 1.0), -1.0);
1522 }
1523 else
1524 mooseError("sin3Lode is only available for ordered tensor component types");
1525}
1526
1527template <typename T>
1530{
1531 using std::sqrt, std::pow;
1532 if constexpr (MooseUtils::IsLikeReal<T>::value)
1533 {
1534 T bar = secondInvariant();
1535 if (bar <= r0)
1536 return RankTwoTensorTempl<T>();
1537 else
1538 return -1.5 * sqrt(3.0) *
1539 (dthirdInvariant() / pow(bar, 1.5) -
1540 1.5 * dsecondInvariant() * thirdInvariant() / pow(bar, 2.5));
1541 }
1542 else
1543 mooseError("dsin3Lode is only available for ordered tensor component types");
1544}
1545
1546template <typename T>
1549{
1550 using std::pow, std::sqrt;
1551 if constexpr (MooseUtils::IsLikeReal<T>::value)
1552 {
1553 T bar = secondInvariant();
1554 if (bar <= r0)
1555 return RankFourTensorTempl<T>();
1556
1557 T J3 = thirdInvariant();
1558 RankTwoTensorTempl<T> dII = dsecondInvariant();
1559 RankTwoTensorTempl<T> dIII = dthirdInvariant();
1561 d2thirdInvariant() / pow(bar, 1.5) - 1.5 * d2secondInvariant() * J3 / pow(bar, 2.5);
1562
1563 for (unsigned i = 0; i < N; ++i)
1564 for (unsigned j = 0; j < N; ++j)
1565 for (unsigned k = 0; k < N; ++k)
1566 for (unsigned l = 0; l < N; ++l)
1567 deriv(i, j, k, l) +=
1568 (-1.5 * dII(i, j) * dIII(k, l) - 1.5 * dIII(i, j) * dII(k, l)) / pow(bar, 2.5) +
1569 1.5 * 2.5 * dII(i, j) * dII(k, l) * J3 / pow(bar, 3.5);
1570
1571 deriv *= -1.5 * sqrt(3.0);
1572 return deriv;
1573 }
1574 else
1575 mooseError("d2sin3Lode is only available for ordered tensor component types");
1576}
1577
1578template <typename T>
1579template <int n, int o, int p, int q>
1582{
1584 std::size_t x[4];
1585 for (x[0] = 0; x[0] < N; ++x[0])
1586 for (x[1] = 0; x[1] < N; ++x[1])
1587 for (x[2] = 0; x[2] < N; ++x[2])
1588 for (x[3] = 0; x[3] < N; ++x[3])
1589 result(x[0], x[1], x[2], x[3]) = (*this)(x[n], x[o]) * b(x[p], x[q]);
1590
1591 return result;
1592}
1593
1594template <typename T>
1595template <int n, int o, int p, int q, int r, int s>
1598{
1600 std::size_t x[5];
1601 for (x[0] = 0; x[0] < N; ++x[0])
1602 for (x[1] = 0; x[1] < N; ++x[1])
1603 for (x[2] = 0; x[2] < N; ++x[2])
1604 for (x[3] = 0; x[3] < N; ++x[3])
1605 for (x[4] = 0; x[4] < N; ++x[4])
1606 result(x[0], x[1], x[2], x[3]) += (*this)(x[n], x[o]) * b(x[p], x[q], x[r], x[s]);
1607
1608 return result;
1609}
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application.
Definition MooseError.h:311
OutputTools< Real >::VariableValue VariableValue
Definition MooseTypes.h:348
MooseArray< Real > VariableValue
This class defines a Tensor that can change its shape.
forward declarations
Definition MooseArray.h:18
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
Definition MooseEnum.h:55
RankFourTensorTempl is designed to handle any N-dimensional fourth order tensor, C.
RankThreeTensor is designed to handle any N-dimensional third order tensor, r.
RankTwoTensorTempl< T > dsin3Lode(const T &r0) const
d(sin3Lode)/dA_ij If secondInvariant() <= r0 then return zero This is to gaurd against precision-loss...
void setToIdentity()
Set the tensor to identity.
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(const std::vector< T > &input)
Constructor that proxies the fillFromInputVector() method.
static void initRandom(unsigned int)
Initialize the random seed based on an unsigned integer.
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.
void fillFromScalarVariable(const VariableValue &scalar_variable)
The smart mutator that determines how to fill the second order tensor based on the order of the scala...
T trace() const
A wrapper for tr()
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 > selfOuterProduct(const libMesh::TypeVector< T > &)
Initialize a second order tensor as the outer product of a vector with itself, i.e.
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 .
void addIa(const T &a)
Add identity times a to _coords.
static RankTwoTensorTempl< T > plusTranspose(const RankTwoTensorTempl< T > &)
Initialize a second order tensor with expression .
RankTwoTensorTempl(const libMesh::TensorValue< T > &a)
The conversion operator from a libMesh::TensorValue
RankThreeTensorTempl< T > contraction(const RankThreeTensorTempl< T > &b) const
Return the single contraction of this second order tensor with a third order tensor .
static MooseEnum fillMethodEnum()
Get the available FillMethod options.
RankTwoTensorTempl(const libMesh::TypeTensor< T > &a)
The conversion operator from a libMesh::TypeTensor
RankTwoTensorTempl< T > ddet() const
Denote the _coords[i][j] by A_ij, then this returns d(det)/dA_ij.
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.
RankTwoTensorTempl(const RankTwoTensorTempl< T2 > &a)
The conversion operator from RankTwoTensorTempl<T2> to RankTwoTensorTempl<T> where T2 is convertible ...
static constexpr unsigned int N
Tensor dimension, i.e.
RankFourTensorTempl< T > times(const RankTwoTensorTempl< T > &b) const
Return the general tensor product of this second order tensor and another second order tensor defined...
RankTwoTensorTempl(const SymmetricRankTwoTensorTempl< T2 > &a)
The conversion operator from a SymmetricRankTwoTensorTempl
T doubleContraction(const RankTwoTensorTempl< T > &a) const
Return the double contraction with another second order tensor .
void fillRow(unsigned int r, const libMesh::TypeVector< T > &v)
Assign values to a specific row of the second order tensor.
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...
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....
RankTwoTensorTempl< T > & operator=(const RankTwoTensorTempl< T > &a)=default
Assignment operator.
RankTwoTensorTempl< T > inverse() const
Return the inverse of this second order tensor.
bool isSymmetric() const
Test for symmetry.
void getRUDecompositionRotation(RankTwoTensorTempl< T > &rot) const
Uses the petscblaslapack.h LAPACKsyev_ routine to perform RU decomposition and obtain the rotation te...
friend void dataLoad(std::istream &, RankTwoTensorTempl< T2 > &, void *)
void printReal(std::ostream &stm=Moose::out) const
Print the Real part of the RankTwoTensorTempl<ADReal>
RankFourTensorTempl< T > outerProduct(const RankTwoTensorTempl< T > &b) const
Return the outer product .
void rotate(const RankTwoTensorTempl< T > &R)
Rotate the tensor in-place given a rotation tensor .
friend void dataStore(std::ostream &, RankTwoTensorTempl< T2 > &, void *)
RankTwoTensorTempl< T > transpose() const
Return the tensor transposed.
void print(std::ostream &stm=Moose::out) const
Print the rank two tensor.
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.
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 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....
T secondInvariant() const
Return the main second invariant of this second order tensor.
InitMethod
The initialization method.
RankTwoTensorTempl< typename libMesh::CompareTypes< T, T2 >::supertype > operator+(const libMesh::TypeTensor< T2 > &a) const
Return the sum of two second order tensors.
RankTwoTensorTempl< T > dthirdInvariant() const
Denote the _coords[i][j] by A_ij, then this returns d(thirdInvariant()/dA_ij.
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...
static RankTwoTensorTempl< T > transposeTimes(const RankTwoTensorTempl< T > &)
Initialize a second order tensor with expression .
RankTwoTensorTempl< T > & operator*=(const T &a)
Multiply this tensor by a scalar (component-wise)
libMesh::VectorValue< T > column(const unsigned int i) const
Get the i-th column of the second order tensor.
RankFourTensorTempl< T > times(const RankFourTensorTempl< T > &b) const
Return the single contraction of this second order tensor with a fourth order tensor defined as whe...
RankTwoTensorTempl< T > & operator/=(const T &a)
Divide this tensor by a scalar (component-wise)
FillMethod
To fill up the 9 entries in the 2nd-order tensor, fillFromInputVector is called with one of the follo...
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
std::enable_if< libMesh::ScalarTraits< Scalar >::value, RankTwoTensorTempl & >::type operator=(const Scalar &libmesh_dbg_var(p))
Assignment-from-scalar operator.
T sin3Lode(const T &r0, const T &r0_value) const
Sin(3*Lode_angle)
RankTwoTensorTempl(const RankTwoTensorTempl< T > &a)=default
The copy constructor.
bool operator==(const RankTwoTensorTempl< T > &a) const
Defines logical equality with another RankTwoTensorTempl<T>
RankTwoTensorTempl< typename libMesh::CompareTypes< T, T2 >::supertype > operator/(const T2 &a) const
Return this tensor divided by a scalar (component-wise)
static RankTwoTensorTempl< T > genRandomTensor(T stddev, T mean)
Generate a random second order tensor with all 9 components treated as independent random variables f...
libMesh::TypeVector< typename libMesh::CompareTypes< T, T2 >::supertype > operator*(const libMesh::TypeVector< T2 > &a) const
Return this tensor multiplied by a vector.
RankTwoTensorTempl< T > & operator-=(const RankTwoTensorTempl< T > &a)
Subtract another second order tensor from this one.
void fillRealTensor(libMesh::TensorValue< T > &)
Fill a libMesh::TensorValue<T> from this second order tensor.
RankFourTensorTempl< T > d2thirdInvariant() const
Denote the _coords[i][j] by A_ij, then this returns d^2(thirdInvariant)/dA_ij/dA_kl.
void symmetricEigenvalues(std::vector< T > &eigvals) const
computes eigenvalues, assuming tens is symmetric, and places them in ascending order in eigvals
RankTwoTensorTempl< T > dsecondInvariant() const
Return the derivative of the main second invariant w.r.t.
void fillColumn(unsigned int c, const libMesh::TypeVector< T > &v)
Assign values to a specific column of the second order tensor.
RankTwoTensorTempl< T > rotateXyPlane(T a)
Rotate the tensor about the z-axis.
static constexpr Real identityCoords[N2]
T L2norm() const
Sqrt(_coords[i][j]*_coords[i][j])
RankTwoTensorTempl< T > dtrace() const
Return the derivative of the trace w.r.t.
RankTwoTensorTempl< T > deviatoric() const
Return the deviatoric part of this tensor .
RankTwoTensorTempl< T > & operator+=(const RankTwoTensorTempl< T > &a)
Add another second order tensor to this one.
RankFourTensorTempl< T > d2secondInvariant() const
Return the second derivative of the main second invariant w.r.t.
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 > initialContraction(const RankFourTensorTempl< T > &b) const
returns this_ij * b_ijkl
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< typename libMesh::CompareTypes< T, T2 >::supertype > operator*(const libMesh::TypeTensor< T2 > &a) const
Multiplication with another second order tensor.
static constexpr unsigned int N2
The square of the tensor dimension.
static RankTwoTensorTempl initializeSymmetric(const libMesh::TypeVector< T > &v0, const libMesh::TypeVector< T > &v1, const libMesh::TypeVector< T > &v2)
Named constructor for initializing symmetrically.
RankTwoTensorTempl< typename libMesh::CompareTypes< T, T2 >::supertype > operator*(const T2 &a) const
Return this tensor multiplied by a scalar (component-wise)
RankTwoTensorTempl< T > rotated(const RankTwoTensorTempl< T > &R) const
Return the rotated tensor given a rotation tensor .
static RankTwoTensorTempl< T > timesTranspose(const RankTwoTensorTempl< T > &)
Initialize a second order tensor with expression .
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.
RankTwoTensorTempl()
Empty constructor; fills to zero.
RankTwoTensorTempl< T > square() const
Return .
RankTwoTensorTempl< typename libMesh::CompareTypes< T, T2 >::supertype > operator-(const libMesh::TypeTensor< T2 > &a) const
Return the subtraction of two second order tensors.
static RankTwoTensorTempl Identity()
Initialize a second order identity tensor.
SymmetricRankTwoTensorTempl is designed to handle the Stress or Strain Tensor for an anisotropic mate...
T _coords[LIBMESH_DIM *LIBMESH_DIM]
void mooseSetToZero(T &v)
Helper function templates to set a variable to zero.
Definition MathUtils.h:373
void mooseSetToZero< ADRankTwoTensor >(ADRankTwoTensor &v)
Helper function template specialization to set an object to zero.
void mooseSetToZero< RankTwoTensor >(RankTwoTensor &v)
Helper function template specialization to set an object to zero.
We need to instantiate the following CompareTypes to tell the compiler that ADReal is a subtype of Ch...
auto raw_value(const Eigen::Map< T > &in)
static constexpr std::size_t dim
This is the dimension of all vector and tensor datastructures used in MOOSE.
Definition Moose.h:165
The following methods are specializations for using the libMesh::Parallel::packed_range_* routines fo...
IntRange< T > make_range(T beg, T end)
MooseUnits pow(const MooseUnits &, int)
Definition Units.C:537
RankTwoTensorTempl< typename RawType< T >::value_type > value_type
static value_type value(const RankTwoTensorTempl< T > &in)