15 #include "libmesh/point.h" 69 return r2tensor(i,
j);
89 return r2tensor(i,
j);
111 template <
typename T>
122 template <
typename T>
126 return r2tensor.
trace() / 3.0;
132 template <
typename T>
162 template <
typename T>
166 return std::exp(strain(0, 0)) * std::exp(strain(1, 1)) * std::exp(strain(2, 2)) - 1.0;
173 template <
typename T>
177 return r2tensor.
trace();
187 template <
typename T>
192 for (
unsigned int i = 0; i < 2; ++i)
193 for (
unsigned int j = i + 1;
j < 3; ++
j)
195 val += r2tensor(i, i) * r2tensor(
j,
j);
196 val -= (r2tensor(i,
j) * r2tensor(i,
j) + r2tensor(
j, i) * r2tensor(
j, i)) * 0.5;
206 template <
typename T>
211 val = r2tensor(0, 0) * r2tensor(1, 1) * r2tensor(2, 2) -
212 r2tensor(0, 0) * r2tensor(1, 2) * r2tensor(2, 1) +
213 r2tensor(0, 1) * r2tensor(1, 2) * r2tensor(2, 0) -
214 r2tensor(0, 1) * r2tensor(1, 0) * r2tensor(2, 2) +
215 r2tensor(0, 2) * r2tensor(1, 0) * r2tensor(2, 1) -
216 r2tensor(0, 2) * r2tensor(1, 1) * r2tensor(2, 0);
229 template <
typename T>
235 std::vector<T> eigenval(LIBMESH_DIM);
239 T val = eigenval[index];
240 eigenvec = eigvecs.
column(index);
251 template <
typename T>
264 template <
typename T>
277 template <
typename T>
292 template <
typename T>
295 const Point & point1,
296 const Point & point2,
299 Point
axis = point2 - point1;
303 T axial_stress =
axis * (stress *
axis);
320 const Point & point2,
321 const Point & curr_point,
322 Point & normalPosition);
334 template <
typename T>
337 const Point & point1,
338 const Point & point2,
339 const Point & curr_point,
346 Point axis_rotation = point2 - point1;
347 Point yp = axis_rotation / axis_rotation.norm();
348 Point zp = xp.cross(yp);
351 T hoop_stress = zp * (stress * zp);
367 template <
typename T>
370 const Point & point1,
371 const Point & point2,
372 const Point & curr_point,
380 T radial_stress = radial_norm * (stress * radial_norm);
382 direction = radial_norm;
384 return radial_stress;
395 template <
typename T>
399 const Point & curr_point,
402 Point radial = curr_point -
center;
403 radial /= radial.norm();
406 T radial_stress = radial * (stress * radial);
410 return radial_stress;
420 template <
typename T>
424 const Point & curr_point,
427 Point radial = curr_point -
center;
428 Real r = radial.norm();
440 Real x = curr_point(0) - (radial(1) + radial(2)) * r / radial(0);
441 tangential = Point(
x, curr_point(1) + r, curr_point(2) + r) - curr_point;
445 Real y = curr_point(1) - (radial(0) + radial(2)) * r / radial(1);
446 tangential = Point(curr_point(0) + r,
y, curr_point(2) + r) - curr_point;
450 Real z = curr_point(2) - (radial(0) + radial(1)) * r / radial(2);
451 tangential = Point(curr_point(0) + r, curr_point(1) + r, z) - curr_point;
454 mooseError(
"In Hoop stress calculation for spherical geometry, the current (quadracture) point " 455 "is likely to be at the center. ");
457 tangential /= tangential.norm();
461 for (
unsigned int i = 0; i < 3; ++i)
462 for (
unsigned int j = 0;
j < 3; ++
j)
463 hoop_stress += tangential(
j) * stress(
j, i) * tangential(i);
465 direction = tangential;
474 template <
typename T>
478 T tensor_value_in_direction = direction * (r2tensor * direction);
480 return tensor_value_in_direction;
486 template <
typename T>
497 template <
typename T>
507 template <
typename T>
525 template <
typename T>
529 const Point & point1,
530 const Point & point2,
531 const Point & curr_point,
539 mooseError(
"To compute an effective inelastic strain use " 540 "RankTwoScalarTools::effectiveStrain()");
560 return axialStress(tensor, point1, point2, direction);
562 return hoopStress(tensor, point1, point2, curr_point, direction);
564 return radialStress(tensor, point1, point2, curr_point, direction);
574 mooseError(
"RankTwoScalarTools Error: invalid scalar type");
578 template <
typename T>
582 const Point & point1,
583 const Point & point2,
584 const Point & curr_point,
590 return axialStress(tensor, point1, point2, direction);
592 return hoopStress(tensor, point1, point2, curr_point, direction);
594 return radialStress(tensor, point1, point2, curr_point, direction);
596 mooseError(
"RankTwoCylindricalComponent Error: scalar type invalid");
600 template <
typename T>
605 const Point & curr_point,
615 mooseError(
"RankTwoSphericalComponent Error: scalar type invalid");
619 template <
typename T>
634 mooseError(
"RankTwoInvariant Error: valid invariant");
638 template <
typename T>
645 template <
typename T>
654 mooseError(
"To compute an effective inelastic strain use " 655 "RankTwoScalarTools::effectiveStrain()");
675 mooseError(
"RankTwoCartesianComponent Error: Pass valid invariant - " +
683 const bool transpose);
685 template <
bool is_ad>
690 voigt_vector(0) = tensor(0, 0);
691 voigt_vector(1) = tensor(1, 1);
692 voigt_vector(2) = tensor(2, 2);
693 voigt_vector(3) = tensor(0, 1);
694 voigt_vector(4) = tensor(1, 2);
695 voigt_vector(5) = tensor(0, 2);
698 template <
bool is_ad>
703 tensor(0, 0) = voigt_vector(0);
704 tensor(1, 1) = voigt_vector(1);
705 tensor(2, 2) = voigt_vector(2);
706 tensor(0, 1) = tensor(1, 0) = voigt_vector(3);
707 tensor(1, 2) = tensor(2, 1) = voigt_vector(4);
708 tensor(0, 2) = tensor(2, 0) = voigt_vector(5);
bool absoluteFuzzyEqual(const T &var1, const T2 &var2, const T3 &tol=libMesh::TOLERANCE *libMesh::TOLERANCE)
void mooseError(Args &&... args)
VectorValue< T > column(const unsigned int i) const
const std::vector< double > y
ADRealEigenVector< T, D, asd > sqrt(const ADRealEigenVector< T, D, asd > &)
static const std::string axis
RankTwoTensorTempl< T > deviatoric() const
const std::vector< double > x
T doubleContraction(const RankTwoTensorTempl< T > &a) const
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
void symmetricEigenvaluesEigenvectors(std::vector< T > &eigvals, RankTwoTensorTempl< T > &eigvecs) const
typename std::conditional< is_ad, DenseVector< ADReal >, DenseVector< Real > >::type GenericDenseVector
typename Moose::GenericType< RankTwoTensor, is_ad > GenericRankTwoTensor
static const std::complex< double > j(0, 1)
Complex number "j" (also known as "i")
static const std::string center