www.mooseframework.org
MaterialTensorCalculator.C
Go to the documentation of this file.
1 /****************************************************************/
2 /* MOOSE - Multiphysics Object Oriented Simulation Environment */
3 /* */
4 /* All contents are licensed under LGPL V2.1 */
5 /* See LICENSE for full restrictions */
6 /****************************************************************/
7 
10 
11 template <>
12 InputParameters
14 {
15  InputParameters params = emptyInputParameters();
16  MooseEnum quantities("VonMises=1 EffectiveStrain Hydrostatic Direction Hoop Radial Axial "
17  "MaxPrincipal MedPrincipal MinPrincipal FirstInvariant SecondInvariant "
18  "ThirdInvariant TriAxiality VolumetricStrain");
19 
20  params.addParam<int>(
21  "index", -1, "The index into the tensor, from 0 to 5 (xx, yy, zz, xy, yz, zx).");
22  params.addParam<MooseEnum>(
23  "quantity", quantities, "A scalar quantity to compute: " + quantities.getRawNames());
24 
25  params.addParam<RealVectorValue>(
26  "point1",
27  RealVectorValue(0, 0, 0),
28  "Start point for axis used to calculate some material tensor quantities");
29  params.addParam<RealVectorValue>(
30  "point2",
31  RealVectorValue(0, 1, 0),
32  "End point for axis used to calculate some material tensor quantities");
33  params.addParam<RealVectorValue>("direction", RealVectorValue(1, 0, 0), "Direction vector");
34  return params;
35 }
36 
37 MaterialTensorCalculator::MaterialTensorCalculator(const InputParameters & parameters)
38  : _index(parameters.get<int>("index")),
39  _quantity_moose_enum(parameters.get<MooseEnum>("quantity")),
40  _p1(parameters.get<RealVectorValue>("point1")),
41  _p2(parameters.get<RealVectorValue>("point2")),
42  _direction(parameters.get<RealVectorValue>("direction") /
43  parameters.get<RealVectorValue>("direction").norm())
44 {
45  const std::string & name = parameters.get<std::string>("_object_name");
46 
47  if (_quantity_moose_enum.isValid())
48  {
49  if (_index > 0)
50  mooseError("Cannot define an index and a quantity in " + name);
51  else
53  }
54  else
55  {
56  if (_index < 0)
57  mooseError("Neither an index nor a quantity listed for " + name);
58  else
59  _quantity = COMPONENT; // default
60  }
61 
62  if (_index > -1 && _index > 5)
63  {
64  mooseError("The material tensor index must be >= 0 and <= 5 OR < 0 (off).");
65  }
66 }
67 
68 Real
70  const Point & curr_point,
71  RealVectorValue & direction)
72 {
73  direction.zero();
74  Real value = 0.0;
75 
76  switch (_quantity)
77  {
78  case 0:
79  value = MaterialTensorCalculatorTools::component(tensor, _index, direction);
80  break;
81 
82  case 1:
84  break;
85 
86  case 2:
88  break;
89 
90  case 3:
92  break;
93 
94  case 4:
96  break;
97 
98  case 5:
99  value = MaterialTensorCalculatorTools::hoopStress(tensor, _p1, _p2, curr_point, direction);
100  break;
101 
102  case 6:
103  value = MaterialTensorCalculatorTools::radialStress(tensor, _p1, _p2, curr_point, direction);
104  break;
105 
106  case 7:
107  value = MaterialTensorCalculatorTools::axialStress(tensor, _p1, _p2, direction);
108  break;
109 
110  case 8:
111  value = MaterialTensorCalculatorTools::maxPrincipal(tensor, direction);
112  break;
113 
114  case 9:
115  value = MaterialTensorCalculatorTools::midPrincipal(tensor, direction);
116  break;
117 
118  case 10:
119  value = MaterialTensorCalculatorTools::minPrincipal(tensor, direction);
120  break;
121 
122  case 11:
124  break;
125 
126  case 12:
128  break;
129 
130  case 13:
132  break;
133 
134  case 14:
136  break;
137 
138  case 15:
140  break;
141 
142  default:
143  mooseError("Unknown quantity in MaterialTensorAux: " +
144  _quantity_moose_enum.operator std::string());
145  }
146  return value;
147 }
Real minPrincipal(const SymmTensor &symm_tensor, RealVectorValue &direction)
Real midPrincipal(const SymmTensor &symm_tensor, RealVectorValue &direction)
Real getTensorQuantity(const SymmTensor &tensor, const Point &curr_point, RealVectorValue &direction)
Real volumetricStrain(const SymmTensor &symm_strain)
Real hydrostatic(const SymmTensor &symm_tensor)
Real hoopStress(const SymmTensor &symm_stress, const Point &point1, const Point &point2, const Point &curr_point, RealVectorValue &direction)
Real maxPrincipal(const SymmTensor &symm_tensor, RealVectorValue &direction)
Real component(const SymmTensor &symm_tensor, unsigned int index)
Real effectiveStrain(const SymmTensor &symm_strain)
InputParameters validParams< MaterialTensorCalculator >()
Real radialStress(const SymmTensor &symm_stress, const Point &point1, const Point &point2, const Point &curr_point, RealVectorValue &direction)
Real triaxialityStress(const SymmTensor &symm_stress)
Real secondInvariant(const SymmTensor &symm_tensor)
Real vonMisesStress(const SymmTensor &symm_stress)
Real firstInvariant(const SymmTensor &symm_tensor)
Real thirdInvariant(const SymmTensor &symm_tensor)
Real axialStress(const SymmTensor &symm_stress, const Point &point1, const Point &point2, RealVectorValue &direction)
Real directionValueTensor(const SymmTensor &symm_tensor, const RealVectorValue &input_direction)
MaterialTensorCalculator(const InputParameters &parameters)