www.mooseframework.org
RankTwoScalarTools.C
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 #include "RankTwoScalarTools.h"
11 
12 namespace RankTwoScalarTools
13 {
14 
18 {
19  return MooseEnum("VonMisesStress EffectiveStrain Hydrostatic L2norm MaxPrincipal "
20  "MidPrincipal MinPrincipal VolumetricStrain FirstInvariant SecondInvariant "
21  "ThirdInvariant AxialStress HoopStress RadialStress TriaxialityStress "
22  "Direction MaxShear StressIntensity");
23 }
24 
27 {
28  return MooseEnum("VonMisesStress EffectiveStrain Hydrostatic L2norm VolumetricStrain "
29  "FirstInvariant SecondInvariant "
30  "ThirdInvariant TriaxialityStress MaxShear StressIntensity EffectiveStrain");
31 }
32 
35 {
36  return MooseEnum("AxialStress HoopStress RadialStress");
37 }
38 
41 {
42  return MooseEnum("HoopStress RadialStress");
43 }
44 
45 void
46 normalPositionVector(const Point & point1,
47  const Point & point2,
48  const Point & curr_point,
49  Point & normalPosition)
50 {
51  // Find the nearest point on the axis of rotation (defined by point2 - point1)
52  // to the current position, e.g. the normal to the axis of rotation at the
53  // current position
54  Point axis_rotation = point2 - point1;
55  Point positionWRTpoint1 = point1 - curr_point;
56  Real projection = (axis_rotation * positionWRTpoint1) / axis_rotation.norm_sq();
57  Point normal = point1 - projection * axis_rotation;
58 
59  // Calculate the direction normal to the plane formed by the axis of rotation
60  // and the normal to the axis of rotation from the current position.
61  normalPosition = curr_point - normal;
62  normalPosition /= normalPosition.norm();
63 }
64 
65 void
66 setRotationMatrix(const RealVectorValue & outwardnormal,
67  const RealVectorValue & axialVector,
68  RankTwoTensor & rotationMatrix,
69  const bool transpose)
70 {
71  RealVectorValue radial_vector(outwardnormal);
72  RealVectorValue azimuthal_vector(0, 0, 0);
73  RealVectorValue polar_vector(axialVector);
74 
75  Real rv_norm = radial_vector.norm();
76  if (rv_norm)
77  radial_vector /= rv_norm;
78  else
79  mooseError("The outward normal vector cannot be a zero vector");
80 
81  azimuthal_vector = polar_vector.cross(radial_vector);
82  azimuthal_vector /= azimuthal_vector.norm();
83 
84  if (!transpose)
85  {
86  // Considering that Moose uses convention [T'] = [Q][T][Q_transpose], the
87  // basis vectors of old coordinate system should be arranged column wise
88  // to construct the rotation matrix Q.
89 
90  rotationMatrix.fillColumn(0, radial_vector);
91  rotationMatrix.fillColumn(1, azimuthal_vector);
92  rotationMatrix.fillColumn(2, polar_vector);
93  }
94  else
95  {
96  rotationMatrix.fillRow(0, radial_vector);
97  rotationMatrix.fillRow(1, azimuthal_vector);
98  rotationMatrix.fillRow(2, polar_vector);
99  }
100 }
101 }
void fillRow(unsigned int r, const libMesh::TypeVector< Real > &v)
MooseEnum invariantOptions()
auto norm() const -> decltype(std::norm(Real()))
void mooseError(Args &&... args)
MooseEnum scalarOptions()
This enum is left for legacy calls.
void fillColumn(unsigned int c, const libMesh::TypeVector< Real > &v)
MooseEnum sphericalOptions()
TypeVector< typename CompareTypes< Real, T2 >::supertype > cross(const TypeVector< T2 > &v) const
void setRotationMatrix(const RealVectorValue &outwardnormal, const RealVectorValue &axialVector, RankTwoTensor &rotationMatrix, const bool transpose)
MooseEnum cylindricalOptions()
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
void normalPositionVector(const Point &point1, const Point &point2, const Point &curr_point, Point &normalPosition)