27 stm << std::setw(15) << a(i, j).value() <<
' ';
41 stm << std::setw(15) << a(i, j).value() <<
" {";
43 stm << std::setw(5) << a(i, j).derivatives()[k] <<
' ';
53 std::vector<Real> & eigvals,
54 std::vector<Real> & a)
const 61 PetscBLASInt lwork = 66 * nd;
63 std::vector<PetscScalar> work(lwork);
74 LAPACKsyev_(calculation_type,
"U", &nd, &a[0], &nd, &eigvals[0], &work[0], &lwork, &
info);
78 "In computing the eigenvalues and eigenvectors for the symmetric rank-2 tensor (",
80 "), the PETSC LAPACK syev routine returned error code ",
89 syev(
"N", eigvals, a);
98 syev(
"V", eigvals, a);
102 eigvecs(j, i) = a[i *
N + j];
110 typedef Eigen::Matrix<ADReal, N, N> RankTwoMatrix;
113 for (
unsigned int j = i; j <
N; ++j)
115 auto & v =
self(j, i);
121 Eigen::SelfAdjointEigenSolver<RankTwoMatrix> es;
124 const auto & lambda = es.eigenvalues();
127 eigvals[i] = lambda(i);
129 const auto & v = es.eigenvectors();
132 eigvecs(i, j) = v(i, j);
141 PetscScalar cmat[
N][
N], work[10];
145 PetscBLASInt nd =
N, lwork = 10,
info;
151 cmat[i][j] = c(i, j);
153 LAPACKsyev_(
"V",
"U", &nd, &cmat[0][0], &nd, w, work, &lwork, &
info);
157 "In computing the eigenvalues and eigenvectors of a symmetric rank-2 tensor, the " 158 "PETSC LAPACK syev routine returned error code ",
168 evec(i, j) = cmat[i][j];
RankTwoTensorTempl< T > inverse() const
Return the inverse of this second order tensor.
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...
void symmetricEigenvalues(std::vector< T > &eigvals) const
computes eigenvalues, assuming tens is symmetric, and places them in ascending order in eigvals ...
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.
void print(std::ostream &stm=Moose::out) const
Print the rank two tensor.
static constexpr unsigned int N
Tensor dimension, i.e.
std::string stringify(const T &t)
conversion to string
void printReal(std::ostream &stm=Moose::out) const
Print the Real part of the RankTwoTensorTempl<ADReal>
RankTwoTensorTempl< T > transpose() const
Return the tensor transposed.
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 is designed to handle the Stress or Strain Tensor for a fully anisotropic material...
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...
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...
const T & operator()(const unsigned int i, const unsigned int j) const