https://mooseframework.inl.gov
HillConstants.C
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 #include "HillConstants.h"
11 
12 registerMooseObject("SolidMechanicsApp", HillConstants);
13 registerMooseObject("SolidMechanicsApp", ADHillConstants);
14 
15 template <bool is_ad>
18 {
20  params.addClassDescription("Build and rotate the Hill Tensor. It can be used with other Hill "
21  "plasticity and creep materials.");
22  params.addParam<std::string>("base_name",
23  "Optional parameter that allows the user to define "
24  "multiple mechanics material systems on the same "
25  "block, i.e. for multiple phases");
26  params.addRequiredRangeCheckedParam<std::vector<Real>>("hill_constants",
27  "hill_constants_size = 6",
28  "Hill material constants in order: F, "
29  "G, H, L, M, N");
30  params.addParam<RealVectorValue>(
31  "rotation_angles",
32  "Provide the rotation angles for the transformation matrix. "
33  "This should be a vector that provides "
34  "the rotation angles about z-, x-, and z-axis, respectively in degrees.");
35  params.addParam<std::vector<FunctionName>>(
36  "function_names",
37  {},
38  "A set of functions that describe the evolution of anisotropy with temperature");
39  params.addParam<bool>(
40  "use_large_rotation",
41  true,
42  "Whether to rotate the Hill tensor (anisotropic parameters) to account for large kinematic "
43  "rotations. It's recommended to set it to true if large displacements are to be expected.");
44  params.addParam<bool>("use_automatic_differentiation",
45  false,
46  "Whether thermal contact depends on automatic differentiation materials.");
47  params.addCoupledVar("temperature", "Coupled temperature");
48  return params;
49 }
50 
51 template <bool is_ad>
53  : Material(parameters),
54  _base_name(isParamValid("base_name") ? getParam<std::string>("base_name") + "_" : ""),
55  _use_large_rotation(getParam<bool>("use_large_rotation")),
56  _rotation_total_hill(_use_large_rotation ? &declareGenericProperty<RankTwoTensor, is_ad>(
57  _base_name + "rotation_total_hill")
58  : nullptr),
59  _rotation_total_hill_old(_use_large_rotation
60  ? &this->template getMaterialPropertyOldByName<RankTwoTensor>(
61  _base_name + "rotation_total_hill")
62  : nullptr),
63  _rotation_increment(_use_large_rotation ? &getGenericMaterialProperty<RankTwoTensor, is_ad>(
64  "rotation_increment")
65  : nullptr),
66  _hill_constants_input(getParam<std::vector<Real>>("hill_constants")),
67  _hill_tensor(6, 6),
68  _hill_constant_material(declareProperty<std::vector<Real>>(_base_name + "hill_constants")),
69  _hill_tensor_material(_use_large_rotation
70  ? &declareProperty<DenseMatrix<Real>>(_base_name + "hill_tensor")
71  : nullptr),
72  _zxz_angles(isParamValid("rotation_angles") ? getParam<RealVectorValue>("rotation_angles")
73  : RealVectorValue(0.0, 0.0, 0.0)),
74  _transformation_tensor(6, 6),
75  _has_temp(isParamValid("temperature")),
76  _temperature(_has_temp ? coupledValue("temperature") : _zero),
77  _function_names(getParam<std::vector<FunctionName>>("function_names")),
78  _num_functions(_function_names.size()),
79  _functions(_num_functions),
80  _rigid_body_rotation_tensor(_zxz_angles)
81 {
82  // Transform to radians, used throughout the class.
83  for (unsigned i = 0; i < 3; i++)
84  _zxz_angles(i) *= libMesh::pi / 180.0;
85 
86  if (_has_temp && _num_functions != 6)
87  paramError("function_names",
88  "Six functions need to be provided to determine the evolution of Hill's "
89  "coefficients F, G, H, L, M, and N, when temperature dependency is selected.");
90 
91  for (unsigned int i = 0; i < _num_functions; i++)
92  {
94  if (_functions[i] == nullptr)
95  paramError("function_names", "Function names provided cannot retrieve a function.");
96  }
97 
100 }
101 
102 template <bool is_ad>
103 void
105 {
106  if (_use_large_rotation)
107  {
108  RankTwoTensor identity_rotation(RankTwoTensor::initIdentity);
109  (*_rotation_total_hill)[_qp] = identity_rotation;
110  }
111 }
112 
113 template <bool is_ad>
114 void
116 {
117  // Account for finite strain rotation influence on anisotropic coefficients
118  if (_use_large_rotation)
119  {
120  (*_rotation_total_hill)[_qp] = (*_rotation_increment)[_qp] * (*_rotation_total_hill_old)[_qp];
121 
122  // Make sure to provide the original coefficients to the orientation transformation
123  _hill_constant_material[_qp].resize(6);
124  _hill_constant_material[_qp] = _hill_constants_input;
125  }
126 
127  // Account for temperature dependency
128  if (_has_temp)
129  {
130  _hill_constant_material[_qp].resize(6);
131 
132  for (unsigned int i = 0; i < 6; i++)
133  _hill_constant_material[_qp][i] = _functions[i]->value(_temperature[_qp]);
134  }
135 
136  // We need to update the coefficients whether we use temperature dependency or large rotation
137  // kinematics (or both)
138  if (_has_temp || _use_large_rotation)
139  rotateHillConstants(_hill_constant_material[_qp]);
140 
141  // Update material coefficients whether or not they are temperature-dependent
142  if (_use_large_rotation)
143  (*_hill_tensor_material)[_qp] = _hill_tensor;
144 
145  // To be used only for simple cases (axis-aligned, small deformation)
146  if (!_use_large_rotation)
147  {
148  _hill_constant_material[_qp].resize(6);
149  _hill_constant_material[_qp][0] = -_hill_tensor(1, 2); // F
150  _hill_constant_material[_qp][1] = -_hill_tensor(0, 2); // G
151  _hill_constant_material[_qp][2] = -_hill_tensor(0, 1); // H
152  _hill_constant_material[_qp][3] = _hill_tensor(4, 4) / 2.0; // L
153  _hill_constant_material[_qp][4] = _hill_tensor(5, 5) / 2.0; // M
154  _hill_constant_material[_qp][5] = _hill_tensor(3, 3) / 2.0; // N
155  }
156 }
157 
158 template <bool is_ad>
159 void
160 HillConstantsTempl<is_ad>::rotateHillConstants(const std::vector<Real> & hill_constants_input)
161 {
162  // Rotation due to rigid body motion and large deformation
163  RankTwoTensor total_rotation_matrix;
164 
165  if (_use_large_rotation)
166  total_rotation_matrix =
167  MetaPhysicL::raw_value((*_rotation_total_hill)[_qp]) * _rigid_body_rotation_tensor;
168  else
169  total_rotation_matrix = _rigid_body_rotation_tensor;
170 
171  const RankTwoTensor & trm = total_rotation_matrix;
172 
173  const Real & F = hill_constants_input[0];
174  const Real & G = hill_constants_input[1];
175  const Real & H = hill_constants_input[2];
176  const Real & L = hill_constants_input[3];
177  const Real & M = hill_constants_input[4];
178  const Real & N = hill_constants_input[5];
179 
180  _hill_tensor.zero();
181 
182  _hill_tensor(0, 0) = G + H;
183  _hill_tensor(1, 1) = F + H;
184  _hill_tensor(2, 2) = F + G;
185  _hill_tensor(0, 1) = _hill_tensor(1, 0) = -H;
186  _hill_tensor(0, 2) = _hill_tensor(2, 0) = -G;
187  _hill_tensor(1, 2) = _hill_tensor(2, 1) = -F;
188 
189  _hill_tensor(3, 3) = 2.0 * N;
190  _hill_tensor(4, 4) = 2.0 * L;
191  _hill_tensor(5, 5) = 2.0 * M;
192 
193  // Transformed the Hill tensor given the total rotation matrix
194  // MEHRABADI, MORTEZA M.; COWIN, STEPHEN C. (1990). EIGENTENSORS OF LINEAR ANISOTROPIC ELASTIC
195  // MATERIALS. The Quarterly Journal of Mechanics and Applied Mathematics, 43(1), 15-41.
196  // doi:10.1093/qjmam/43.1.15
197  DenseMatrix<Real> transformation_matrix_n(6, 6);
198  const static std::array<std::size_t, 3> a = {{1, 0, 0}};
199  const static std::array<std::size_t, 3> b = {{2, 2, 1}};
200  for (std::size_t i = 0; i < 3; ++i)
201  for (std::size_t j = 0; j < 3; ++j)
202  {
203  transformation_matrix_n(i, j) = trm(i, j) * trm(i, j);
204  transformation_matrix_n(i + 3, j) = 2.0 * trm((i + 1) % 3, j) * trm((i + 2) % 3, j);
205  transformation_matrix_n(j, i + 3) = trm(j, (i + 1) % 3) * trm(j, (i + 2) % 3);
206  transformation_matrix_n(i + 3, j + 3) =
207  trm(a[i], a[j]) * trm(b[i], b[j]) + trm(a[i], b[j]) * trm(b[i], a[j]);
208  }
209 
210  _hill_tensor.left_multiply(transformation_matrix_n);
211  _hill_tensor.right_multiply_transpose(transformation_matrix_n);
212 }
213 
214 template class HillConstantsTempl<false>;
215 template class HillConstantsTempl<true>;
const std::vector< FunctionName > _function_names
Function names.
Definition: HillConstants.h:72
void addRequiredRangeCheckedParam(const std::string &name, const std::string &parsed_function, const std::string &doc_string)
virtual void initQpStatefulProperties() override
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
auto raw_value(const Eigen::Map< T > &in)
registerMooseObject("SolidMechanicsApp", HillConstants)
static const std::string F
Definition: NS.h:165
static const std::string G
Definition: NS.h:166
const bool _has_temp
Flag to determine if temperature is supplied by the user.
Definition: HillConstants.h:66
Real value(unsigned n, unsigned alpha, unsigned beta, Real x)
static InputParameters validParams()
virtual void rotateHillConstants(const std::vector< Real > &hill_constants_input)
HillConstantsTempl(const InputParameters &parameters)
Definition: HillConstants.C:52
void paramError(const std::string &param, Args... args) const
void addCoupledVar(const std::string &name, const std::string &doc_string)
RealVectorValue _zxz_angles
Euler angles for transformation of hill tensor.
Definition: HillConstants.h:60
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
const Function & getFunctionByName(const FunctionName &name) const
int N
virtual void computeQpProperties() override
void addClassDescription(const std::string &doc_string)
static const std::complex< double > j(0, 1)
Complex number "j" (also known as "i")
const std::vector< Real > _hill_constants_input
Hill constants for orthotropic inelasticity.
Definition: HillConstants.h:50
std::vector< const Function * > _functions
The functions describing the temperature dependence.
Definition: HillConstants.h:78
const unsigned int _num_functions
Number of function names.
Definition: HillConstants.h:75
const Real pi
static InputParameters validParams()
Definition: HillConstants.C:17
const bool _use_large_rotation
Flag to determine whether to rotate Hill&#39;s tensor with large strain kinematics.
Definition: HillConstants.h:39
This class defines a Hill tensor material object with a given base name.
Definition: HillConstants.h:21